Skip to main content

Solidity API

ERC20Handler

This contract is intended to be used with the Bridge contract.

constructor

constructor(address bridgeAddress) public
NameTypeDescription
bridgeAddressaddressContract address of previously deployed Bridge.

deposit

function deposit(bytes32 resourceID, address depositer, bytes data) external payable returns (bytes)

A deposit is initiatied by making a deposit in the Bridge contract.

Data passed into the function should be constructed as follows: amount uint256 bytes 0 - 32

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.

NameTypeDescription
resourceIDbytes32ResourceID used to find address of token to be used for deposit.
depositeraddressAddress of account making the deposit in the Bridge contract.
databytesConsists of {amount} padded to 32 bytes.
NameTypeDescription
[0]bytesan 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.

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

NameTypeDescription
resourceIDbytes32
databytesConsists of {resourceID}, {amount}, {lenDestinationRecipientAddress}, and {destinationRecipientAddress} all padded to 32 bytes.

withdraw

function withdraw(bytes data) external

Used to manually release ERC20 tokens from ERC20Safe.

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

NameTypeDescription
databytesConsists of {tokenAddress}, {recipient}, and {amount} all padded to 32 bytes.