Skip to main content

Reference

This page lists all built-in actions provided by tbe erc20-bridge extension.

See more about the access modifiers

info() PUBLIC VIEW

Return current erc20 bridge info.

Returns:

indexnametypedescription
0chainTEXTchain name
1escrowTEXTerc20 escrow contract address
2epoch_periodTEXTthe epoch duration
3erc20TEXTerc20 token address
4decimalsINTerc20 token decimals
5balanceUINT256total unspent balance
6syncedBOOLwhether this info is synced
7synced_atINTblock height when this info is synced
8enabledBOOLwhether this extension is enabled

id() PUBLIC VIEW

Return current erc20 bridge id.

Returns:

indexnametypedescription
0idUUIDerc20 bridge id

issue(user,amount) SYSTEM

Issue amount erc20 token to user.

Params:

nametypedescription
userTEXTwallet address
amountUINT256uint256 amount

transfer(to, amount) PUBLIC

Transfer amount erc20 token to to.

Params:

nametypedescription
toTEXTwallet address
amountUINT256transfer amount

lock(amount) PUBLIC

Lock(or deposit) amount erc20 token to erc20 bridge.

Params:

nametypedescription
amountUINT256amount

lock_admin(user, amount) SYSTEM

Lock(or deposit) amount erc20 token to erc20 bridge, to user.

Params:

nametypedescription
userTEXTuser wallet address
amountUINT256amount

unlock(amount) SYSTEM

Unlock(or withdraw) amount erc20 token from erc20 bridge.

Params:

nametypedescription
userTEXTuser wallet address
amountUINT256amount

bridge(amount) PUBLIC

Bridge amount erc20 token to erc20 bridge.

Params:

nametypedescription
amountUINT256amount

balance(user) PUBLIC VIEW

Return the erc20 token balance of user.

Params:

nametypedescription
userTEXTuser wallet address

Returns:

indexnametypedescription
0balanceUINT256user's balance

decimals() PUBLIC VIEW

Return the erc20 token's decimals.

Returns:

indexnametypedescription
0decimalsINTerc20 token decimals

scale_down(amount) PUBLIC VIEW

Accepts an uint256 amount and returns correspond user-friendly value.

Params:

nametypedescription
amountTEXTscale down to UINT256, according to erc20 token decimals

Returns:

indexnametypedescription
0scaledUINT256.

scale_up(amount) PUBLIC VIEW

Accepts an user friendly amount and return its correspond uint256 value.

Params:

nametypedescription
amountTEXTscale down to UINT256, according to erc20 token decimals

Returns:

indexnametypedescription
0scaledUINT256.

get_active_epochs() PUBLIC VIEW

Return current active epochs, always returns 2 epochs(expect the very first epoch):

  • finalized epoch, epoch is finalized but yet confirmed on EVM chains;
  • collecting epoch, epoch is currently collecting all issuance;

Returns:

indexnametypedescription
0idUUIDepoch id
1start_heightINTepoch start block height
2start_timestampINTepoch start timestamp
3end_heightINTepoch end block height
4reward_rootBYTEAmerkle tree root of current epoch rewards
5reward_amountUINT256total amount of token in this epoch
6end_block_hashBYTEAepoch end block hash
7confirmedBOOLwhether confirmed on target EVM chains
8voters[]TEXTvoter address
9vote_nonces[]INTsafe nonce of current vote
10voter_signatures[]BYTEAsignature of current vote

list_epochs(after_block, limit) PUBLIC VIEW

Return requested epochs based on given range.

Params:

nametypedescription
afterINTlist epochs after(not include) block height
limitINTreturn size

Returns:

indexnametypedescription
0idUUIDepoch id
1start_heightINTepoch start block height
2start_timestampINTepoch start timestamp
3end_heightINTepoch end block height
4reward_rootBYTEAmerkle tree root of current epoch rewards
5reward_amountUINT256total amount of token in this epoch
6end_block_hashBYTEAepoch end block hash
7confirmedBOOLwhether confirmed on target EVM chains
8voters[]TEXTvoter address
9vote_nonces[]INTsafe nonce of current vote
10voter_signatures[]BYTEAsignature of current vote

get_epoch_rewards(epoch_id) PUBLIC VIEW

Return all rewards of an epoch.

Params:

nametypedescription
epoch_idUUIDepoch id

Returns:

indexnametypedescription
0recipientTEXTrecipient wallet address
1amountUINT256recipient's token amount

vote_epoch(epoch_id, nonce, signature) PUBLIC

Vote to approve an epoch, with signatures.

Params:

nametypedescription
epoch_idUUIDepoch id
nonceINTsafe nonce
signatureBYTEAsignature of current vote

list_wallet_rewards(wallet, with_pending) PUBLIC VIEW

Return all rewards issued to wallet. If with_pending is true, return not confirmed rewards as well.

Params:

nametypedescription
walletTEXTwallet address
with_pendingBOOLinclude the rewards that's pending

Returns:

indexnametypedescription
0chainTEXTchain name of the erc20 token
1chain_idTEXTchain id of the erc20 token
2contractTEXTescrow contract to claim erc20 token
3created_atINTblock height when this REWARD is created
4param_recipeintTEXTthe recipient argument to claim REWARD
5param_amountUINT256the amount argument to claim REWARD
6param_block_hashBYTEAthe block_hash argument to claim REWARD
7param_rootBYTEAthe block_hash arguemnt to claim REWARD
8param_proofs[]BYTEAthe proofs arguemnt to claim REWARD