DepositBoxERC20

depositERC20 depositERC20(string schainName, address erc20OnMainnet, address to, uint256 amount) external

Allows msg.sender to send ERC20 token from mainnet to schain

Requirements:

  • Schain name must not be Mainnet.

  • Receiver account on schain cannot be null.

  • Schain that receives tokens should not be killed.

  • Receiver contract should be defined.

  • msg.sender should approve their tokens for DepositBoxERC20 address.

postMessage postMessage(bytes32 schainHash, address sender, bytes data) → address external

Allows MessageProxyForMainnet contract to execute transferring ERC20 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.

  • Amount of tokens on DepositBoxERC20 should be equal or more than transferred amount.

gasPayer gasPayer(bytes32 schainHash, address sender, bytes data) → address external

addERC20TokenByOwner addERC20TokenByOwner(string schainName, address erc20OnMainnet) external

Allows Schain owner to add an ERC20 token to DepositBoxERC20.

Emits an ERC20TokenAdded event.

Requirements:

  • Schain should not be killed.

  • Only owner of the schain able to run function.

getFunds getFunds(string schainName, address erc20OnMainnet, address receiver, uint256 amount) 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:

  • Amount of tokens on schain should be equal or more than transferred amount.

getSchainToERC20 getSchainToERC20(string schainName, address erc20OnMainnet) → bool external

Should return true if token was added by Schain owner or added automatically after sending to schain if whitelist was turned off.

initialize initialize(contract IContractManager contractManagerOfSkaleManagerValue, contract Linker linkerValue, contract MessageProxyForMainnet messageProxyValue) public

Creates a new DepositBoxERC20 contract.

ERC20TokenAdded ERC20TokenAdded(string schainName, address contractOnMainnet) event

Emitted when token is mapped in DepositBoxERC20.

ERC20TokenReady ERC20TokenReady(address contractOnMainnet, uint256 amount) event

Emitted when token is received by DepositBox and is ready to be cloned or transferred on SKALE chain.