Skip to content

Commit

Permalink
Remove the serverURL after it's unset
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcontrart committed Jan 14, 2024
1 parent 2723013 commit 81b4ade
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions source/registry/contracts/Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ contract Registry {
if (bytes(stakerServerURLs[msg.sender]).length == 0)
revert NoServerURLSet();

string memory _url = stakerServerURLs[msg.sender];

EnumerableSet.Bytes32Set storage supportedProtocolList = protocolsByStaker[
msg.sender
];
uint256 _protocolListLength = supportedProtocolList.length();

bytes4[] memory _protocolList = new bytes4[](_protocolListLength);

for (uint256 i = _protocolListLength; i > 0; ) {
Expand All @@ -98,6 +101,7 @@ contract Registry {
msg.sender
];
uint256 _tokenListLength = supportedTokenList.length();

address[] memory _tokenList = new address[](_tokenListLength);

for (uint256 i = _tokenListLength; i > 0; ) {
Expand All @@ -108,19 +112,16 @@ contract Registry {
stakersByToken[_token].remove(msg.sender);
}

delete stakerServerURLs[msg.sender];

uint256 _transferAmount = stakingCost +
(supportCost * _protocolListLength) +
(supportCost * _tokenListLength);
if (_transferAmount > 0) {
stakingToken.safeTransfer(msg.sender, _transferAmount);
}

emit UnsetServer(
msg.sender,
stakerServerURLs[msg.sender],
_protocolList,
_tokenList
);
emit UnsetServer(msg.sender, _url, _protocolList, _tokenList);
}

/**
Expand Down

0 comments on commit 81b4ade

Please sign in to comment.