Deposit
If you want to send ERC20 token to the Orbit IBC contract, you should check that the token is registered
decimal(address tokenAddr)
Send a deposit transaction to the Orbit IBC contract on the Ethereum MAINNET/ROPSTEN
// deposit ETH
function deposit(address toAddr, address extraToAddr) payable public
// deposit ERC20 TOKEN
function depositToken(address token, address toAddr, uint amount, address extraToAddr) public
If your transaction succeed,
event Deposit(address tokenAddr, address addr, address toAddr, uint amount, uint depositId, address extraToAddr);
Deposit event occur in your transaction
Then, Ethereum IBC operator and Validator begin to proceed this deposit
When deposit is completed in the Orbit chain, DepositValidated and BalanceChange event occur
// EthpeggingContract
event DepositValidated(address mainAddr, address tokenAddr, address addr, address toAddr, uint amount, uint depositId, address extraToAddr)
// BalanceContract
event BalanceChange(address indexed user, bytes32 indexed tokenId, uint balance);
Withdrawal
Send a withdrawal transaction to OrbitChain BalanceContract
function withdrawBySignature(bytes32[] memory bytes32s, uint[] memory uints, address fromAddr, bytes memory destination, bytes memory comment, uint8 v) public
function withdraw(bytes32 tokenId, bytes memory destination, uint amount, bytes memory comment) public
Then, Ethereum IBC operator and Validator begin to proceed this withdrawal
When withdrawal is completed in Ethereum, Withdrawal event occur
event Withdraw(address tokenAddr, address addr, address toAddr, uint amount, bytes32 whash, uint withdrawId, bytes comment);
Contract Methods
addToken
Only owner address can execute this function.
function addToken(address _tokenAddr) public onlyOwner;
removeToken
Only owner address can execute this function.
function removeToken(address _tokenAddr) public onlyOwner;
relayDepositToken
function relayDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr) public;
validateDepositToken
function validateDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr, address validator, uint8 v, bytes32 r, bytes32 s) public;
You should hash following parameters to sign or validate deposit request.
sha256(mainAddr, fromAddr, toAddr, token, amount, depositId, extraToAddr);
checkValidateDepositToken
function checkValidateDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr) public;
withdraw
Only BalanceContract can execute this function.
function withdraw(uint withdrawId, address user, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public;
withdraw
Only BalanceContract can execute this function.
function withdraw(uint withdrawId, address user, address extraUser, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public;
relayWithdraw
function relayWithdraw(uint withdrawId) public;
validateWithdraw
function validateWithdraw(uint withdrawId, address validator, uint8 v, bytes32 r, bytes32 s) public;
checkValidateWithdraw
function validateWithdraw(uint withdrawId) public;
_