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
Name | Type | Description |
---|---|---|
bridgeAddress | address | Contract 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.
Name | Type | Description |
---|---|---|
resourceID | bytes32 | ResourceID used to find address of token to be used for deposit. |
depositer | address | Address of account making the deposit in the Bridge contract. |
data | bytes | Consists of {tokenID} padded to 32 bytes. |
Name | Type | Description |
---|---|---|
metaData | bytes | : 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
Name | Type | Description |
---|---|---|
resourceID | bytes32 | |
data | bytes | Consists 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
Name | Type | Description |
---|---|---|
data | bytes | Consists of {tokenAddress}, {recipient}, and {tokenID} all padded to 32 bytes. |