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

// 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.

Smart Contract
function addToken(address _tokenAddr) public onlyOwner;

Parameter

Type

Description

tokenAddress

address

Token address to append

removeToken

Only owner address can execute this function.

Smart Contract
function removeToken(address _tokenAddr) public onlyOwner;

Parameter

Type

Description

tokenAddress

address

Token address to remove

relayDepositToken

Smart Contract
function relayDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr) public;

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
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);

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
function checkValidateDepositToken(address mainAddr, address fromAddr, address toAddr, address token, uint amount, uint depositId, address extraToAddr) public;

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
function withdraw(uint withdrawId, address user, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public;

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
function withdraw(uint withdrawId, address user, address extraUser, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public;

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
function relayWithdraw(uint withdrawId) public;

Parameter

Type

Description

withdrawId

uint256

Withdraw ID

validateWithdraw

Smart Contract
function validateWithdraw(uint withdrawId, address validator, uint8 v, bytes32 r, bytes32 s) public;

Parameter

Type

Description

withdrawId

uint256

Withdraw ID

validator

address

Address of signer/validator

checkValidateWithdraw

Smart Contract
function validateWithdraw(uint withdrawId) public;

Parameter

Type

Description

withdrawId

uint256

Withdraw ID

_

Smart Contract

Parameter

Type

Description

Last updated