Skip to main content

Solidity API

ERC721Handler

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

_INTERFACE_ERC721_METADATA

bytes4 _INTERFACE_ERC721_METADATA

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 metaData)

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

Requirements:

  • It must be called by only bridge.
  • {tokenAddress} must be whiltelisted.

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

If the corresponding {tokenAddress} for the parsed {resourceID} supports {_INTERFACE_ERC721_METADATA}, then {metaData} will be set according to the {tokenURI} method in the token contract.

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 {tokenID} padded to 32 bytes.
NameTypeDescription
metaDatabytes: the deposited token metadata acquired by calling a {tokenURI} method in the token contract.

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:

  • It must be called by only bridge.
  • {tokenAddress} must be whiltelisted.

Data passed into the function should be constructed as follows: tokenID uint256 bytes 0 - 32 destinationRecipientAddress length uint256 bytes 32 - 64 destinationRecipientAddress bytes bytes 64 - (64 + len(destinationRecipientAddress)) metadata length uint256 bytes (64 + len(destinationRecipientAddress)) - (64 + len(destinationRecipientAddress) + 32) metadata bytes bytes (64 + len(destinationRecipientAddress) + 32) - END

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

withdraw

function withdraw(bytes data) external

Used to manually release ERC721 tokens from ERC721Safe.

Requirements:

  • It must be called by only bridge.

Data passed into the function should be constructed as follows: tokenAddress address bytes 0 - 32 recipient address bytes 32 - 64 tokenID uint bytes 64 - 96

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