DepositBoxERC721
Runs on mainnet, accepts messages from schain, stores deposits of ERC721.
depositERC721 depositERC721(string schainName, address erc721OnMainnet, uint256 tokenId)
external
Allows msg.sender
to send ERC721 token from mainnet to schain.
Requirements:
-
Receiver contract should be defined.
-
msg.sender
should approve their token for DepositBoxERC721 address.
postMessage postMessage(bytes32 schainHash, address sender, bytes data)
external
Allows MessageProxyForMainnet contract to execute transferring ERC721 token from schain to mainnet.
Requirements:
-
Schain from which the tokens came should not be killed.
-
Sender contract should be defined and schain name cannot be
Mainnet
. -
DepositBoxERC721 contract should own token.
addERC721TokenByOwner addERC721TokenByOwner(string schainName, address erc721OnMainnet)
external
Allows Schain owner to add an ERC721 token to DepositBoxERC721.
Emits an ERC721TokenAdded
event.
Requirements:
-
Schain should not be killed.
-
Only owner of the schain able to run function.
getFunds getFunds(string schainName, address erc721OnMainnet, address receiver, uint256 tokenId)
external
Allows Schain owner to return each user their tokens. The Schain owner decides which tokens to send to which address, since the contract on mainnet does not store information about which tokens belong to whom.
Requirements:
-
DepositBoxERC721 contract should own such token.
-
msg.sender should be an owner of schain
-
IMA transfers Mainnet <→ schain should be killed
gasPayer gasPayer(bytes32 schainHash, address sender, bytes data) → address
external
Returns receiver of message.
Requirements:
-
Sender contract should be defined and schain name cannot be
Mainnet
.
getSchainToAllERC721Length getSchainToAllERC721Length(string schainName) → uint256
external
Should return length of a set of all mapped tokens which were added by Schain owner or added automatically after sending to schain if whitelist was turned off.
getSchainToAllERC721 getSchainToAllERC721(string schainName, uint256 from, uint256 to) → address[] tokensInRange
external
Should return an array of range of tokens were added by Schain owner or added automatically after sending to schain if whitelist was turned off.
initialize initialize(contract IContractManager contractManagerOfSkaleManagerValue, contract ILinker linkerValue, contract IMessageProxyForMainnet messageProxyValue)
public
Creates a new DepositBoxERC721 contract.
getSchainToERC721 getSchainToERC721(string schainName, address erc721OnMainnet) → bool
public
Should return true if token was added by Schain owner or automatically added after sending to schain if whitelist was turned off.
_removeTransferredAmount _removeTransferredAmount(address erc721Token, uint256 tokenId)
internal
Removes the ids of tokens that was transferred from schain.
_receiveERC721 _receiveERC721(string schainName, address erc721OnMainnet, address to, uint256 tokenId) → bytes data
internal
Allows DepositBoxERC721 to receive ERC721 tokens.
Emits an ERC721TokenReady
event.
Requirements:
-
Whitelist should be turned off for auto adding tokens to DepositBoxERC721.
_addERC721ForSchain _addERC721ForSchain(string schainName, address erc721OnMainnet)
internal
Adds an ERC721 token to DepositBoxERC721.
Emits an ERC721TokenAdded
event.
Requirements:
-
Given address should be contract.
_getTokenInfo _getTokenInfo(contract IERC721MetadataUpgradeable erc721) → struct Messages.Erc721TokenInfo
internal
Returns info about ERC721 token such as token name, symbol.
ERC721TokenAdded ERC721TokenAdded(string schainName, address contractOnMainnet)
event
Emitted when token is mapped in DepositBoxERC721.
ERC721TokenReady ERC721TokenReady(address contractOnMainnet, uint256 tokenId)
event
Emitted when token is received by DepositBox and is ready to be cloned or transferred on SKALE chain.