OrbitChain
Search…
Ethereum IBC protocol

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
1
// deposit ETH
2
function deposit(address toAddr, address extraToAddr) payable public
3
// deposit ERC20 TOKEN
4
function depositToken(address token, address toAddr, uint amount, address extraToAddr) public
Copied!
If your transaction succeed,
1
event Deposit(address tokenAddr, address addr, address toAddr, uint amount, uint depositId, address extraToAddr);
Copied!
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
1
// EthpeggingContract
2
event DepositValidated(address mainAddr, address tokenAddr, address addr, address toAddr, uint amount, uint depositId, address extraToAddr)
3
// BalanceContract
4
event BalanceChange(address indexed user, bytes32 indexed tokenId, uint balance);
Copied!

Withdrawal

Send a withdrawal transaction to OrbitChain BalanceContract
1
function withdrawBySignature(bytes32[] memory bytes32s, uint[] memory uints, address fromAddr, bytes memory destination, bytes memory comment, uint8 v) public
2
function withdraw(bytes32 tokenId, bytes memory destination, uint amount, bytes memory comment) public
Copied!
Then, Ethereum IBC operator and Validator begin to proceed this withdrawal
When withdrawal is completed in Ethereum, Withdrawal event occur
1
event Withdraw(address tokenAddr, address addr, address toAddr, uint amount, bytes32 whash, uint withdrawId, bytes comment);
Copied!

Contract Methods

addToken

Only owner address can execute this function.
Smart Contract
1
function addToken(address _tokenAddr) public onlyOwner;
Copied!
Parameter
Type
Description
tokenAddress
address
Token address to append

removeToken

Only owner address can execute this function.
Smart Contract
1
function removeToken(address _tokenAddr) public onlyOwner;
Copied!
Parameter
Type
Description
tokenAddress
address
Token address to remove

relayDepositToken

Smart Contract
1
function relayDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr) public;
Copied!
Parameter
Type
Description
mainAddr
address
Ethereum reserve contract address on main network
fromAddr
address
Address of sender
toAddr
address
Receiver address on OrbitChain
token
address
Address of token
amount
uint256
Amount of token
depositId
uint256
Identifier of deposit
extraToAddr
address
Extra receiver address on OrbitChain

validateDepositToken

Smart Contract
1
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;
Copied!
You should hash following parameters to sign or validate deposit request.
1
sha256(mainAddr, fromAddr, toAddr, token, amount, depositId, extraToAddr);
Copied!
Parameter
Type
Description
mainAddr
address
Ethereum reserve contract address on main network
fromAddr
address
Address of sender
toAddr
address
Receiver address on OrbitChain
token
address
Address of token
amount
uint256
Amount of token
depositId
uint256
Identifier of deposit
extraToAddr
address
Extra receiver address on OrbitChain
validator
address
Address of signer/validator
v
uint8
v of signature
r
bytes32
r of signature
s
bytes32
s of signature

checkValidateDepositToken

Smart Contract
1
function checkValidateDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr) public;
Copied!
Parameter
Type
Description
mainAddr
address
Ethereum reserve contract address on main network
fromAddr
address
Address of sender
toAddr
address
Receiver address on OrbitChain
token
address
Address of token
amount
uint256
Amount of token
depositId
uint256
Identifier of deposit
extraToAddr
address
Extra receiver address on OrbitChain

withdraw

Only BalanceContract can execute this function.
Smart Contract
1
function withdraw(uint withdrawId, address user, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public;
Copied!
Parameter
Type
Description
withdrawId
uint256
Identifier of BalanceContract withdrawal
user
address
Sender address on OrbitChain
tokenSummary
bytes32
Token summary
destination
bytes
Address of withdrawal destination
uint256
amount
Amount of withdrawal
bytes
comment
Extra data

withdraw

Only BalanceContract can execute this function.
Smart Contract
1
function withdraw(uint withdrawId, address user, address extraUser, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public;
Copied!
Parameter
Type
Description
withdrawId
uint256
Identifier of BalanceContract withdrawal
user
address
Sender address on OrbitChain
extraUser
address
Extra sender address on OrbitChain (for Giveback)
tokenSummary
bytes32
Token summary
destination
bytes
Address of withdrawal destination
uint256
amount
Amount of withdrawal
bytes
comment
Extra data

relayWithdraw

Smart Contract
1
function relayWithdraw(uint withdrawId) public;
Copied!
Parameter
Type
Description
withdrawId
uint256
Withdraw ID

validateWithdraw

Smart Contract
1
function validateWithdraw(uint withdrawId, address validator, uint8 v, bytes32 r, bytes32 s) public;
Copied!
Parameter
Type
Description
withdrawId
uint256
Withdraw ID
validator
address
Address of signer/validator

checkValidateWithdraw

Smart Contract
1
function validateWithdraw(uint withdrawId) public;
Copied!
Parameter
Type
Description
withdrawId
uint256
Withdraw ID

_

Smart Contract
1
Copied!
Parameter
Type
Description