Skip to content

Commit

Permalink
natspec fixes + remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlinaric committed Jul 9, 2024
1 parent 45b4d31 commit 144bcbb
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions contracts/handlers/NativeTokenHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ contract NativeTokenHandler is IHandler, ERCHandlerHelpers {
error InvalidSender(address sender);

/**
@notice A deposit is initiated by making a deposit in the Bridge contract.
@notice A deposit is initiated by making a deposit to the NativeTokenAdapter which constructs the required
deposit data and propagates it to the Bridge contract.
@param resourceID ResourceID used to find address of token to be used for deposit.
@param depositor Address of account making the deposit in the Bridge contract.
@param data Consists of {amount} padded to 32 bytes.
@notice Data passed into the function should be constructed as follows:
amount uint256 bytes 0 - 32
destinationRecipientAddress length uint256 bytes 32 - 64
destinationRecipientAddress bytes bytes 64 - END
@dev Depending if the corresponding {tokenAddress} for the parsed {resourceID} is
marked true in {_tokenContractAddressToTokenProperties[tokenAddress].isBurnable}, deposited tokens will be burned, if not, they will be locked.
@return an empty data.
@return deposit amount internal representation.
*/
function deposit(
bytes32 resourceID,
Expand All @@ -55,18 +54,16 @@ contract NativeTokenHandler is IHandler, ERCHandlerHelpers {
if(depositor != _nativeTokenAdapterAddress) revert InvalidSender(depositor);

address tokenAddress = _resourceIDToTokenContractAddress[resourceID];
if (!_tokenContractAddressToTokenProperties[tokenAddress].isWhitelisted) revert ContractAddressNotWhitelisted(tokenAddress);

return abi.encodePacked(convertToInternalBalance(tokenAddress, amount));
}

/**
@notice Proposal execution should be initiated when a proposal is finalized in the Bridge contract.
@notice Proposal execution should be initiated when a proposal is finalized in the Bridge contract.
@notice Proposal execution should be initiated when a proposal is finalized in the Bridge contract
by a relayer on the deposit's destination chain.
@param resourceID ResourceID to be used when making deposits.
@param data Consists of {resourceID}, {amount}, {lenDestinationRecipientAddress},
and {destinationRecipientAddress} all padded to 32 bytes.
@param data Consists of {amount}, {lenDestinationRecipientAddress}
and {destinationRecipientAddress}.
@notice Data passed into the function should be constructed as follows:
amount uint256 bytes 0 - 32
destinationRecipientAddress length uint256 bytes 32 - 64 // not used
Expand All @@ -93,7 +90,6 @@ contract NativeTokenHandler is IHandler, ERCHandlerHelpers {
amount uint bytes 64 - 96
*/
function withdraw(bytes memory data) external override onlyBridge {
address tokenAddress;
address recipient;
uint amount;

Expand All @@ -112,7 +108,7 @@ contract NativeTokenHandler is IHandler, ERCHandlerHelpers {
Sets decimals value for contractAddress if value is provided in args.
@param resourceID ResourceID to be used when making deposits.
@param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
@param args Additional data to be passed to specified handler.
@param args Additional data passed to the handler - this should be 1 byte containing number of decimals places.
*/
function setResource(bytes32 resourceID, address contractAddress, bytes calldata args) external onlyBridge {
_setResource(resourceID, contractAddress);
Expand Down

0 comments on commit 144bcbb

Please sign in to comment.