Solidity API
NativeTokenHandler
This contract is intended to be used with the Bridge contract.
constructor
constructor(address bridgeAddress) public
Name | Type | Description |
---|---|---|
bridgeAddress | address | Contract address of previously deployed Bridge. |
deposit
function deposit(bytes32 resourceID, address, bytes data) external payable returns (bytes)
A deposit is initiatied by making a deposit in the Bridge contract.
Requirements:
- {tokenAddress} must be 0x01.
- {tokenAddress} must be allowed.
- {msg.value} must be equal to {amount}.
- {amount} must be greater than 0.
- Recipient address in data hex string must not be zero address.
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
Depending if the corresponding {tokenAddress} for the parsed {resourceID} is marked true in {_burnList}, deposited tokens will be burned, if not, they will be locked.
Name | Type | Description |
---|---|---|
resourceID | bytes32 | ResourceID used to find address of token to be used for deposit. |
address | ||
data | bytes | Consists of {amount} padded to 32 bytes. |
Name | Type | Description |
---|---|---|
[0] | bytes | an empty data. |
executeProposal
function executeProposal(bytes32 resourceID, bytes data) external
Proposal execution should be initiated when a proposal is finalized in the Bridge contract. by a relayer on the deposit's destination chain.
Requirements:
- {tokenAddress} must be 0x01.
- {tokenAddress} must be allowed.
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
Name | Type | Description |
---|---|---|
resourceID | bytes32 | |
data | bytes | Consists of {resourceID}, {amount}, {lenDestinationRecipientAddress}, and {destinationRecipientAddress} all padded to 32 bytes. |
safeTransferETH
function safeTransferETH(address to, uint256 value) internal
withdraw
function withdraw(bytes data) external
Used to manually release ERC20 tokens from ERC20Safe.
Requirements:
- {tokenAddress} must be 0x01.
Data passed into the function should be constructed as follows: tokenAddress address bytes 0 - 32 recipient address bytes 32 - 64 amount uint bytes 64 - 96
Name | Type | Description |
---|---|---|
data | bytes | Consists of {tokenAddress}, {recipient}, and {amount} all padded to 32 bytes. |
_settle
function _settle(address tokenAddress, uint16, struct KeyValuePair[] entries) internal virtual
Requirements:
- {tokenAddress} must be 0x01.
- {tokenAddress} must be allowed.