Skip to main content

Reference

info()

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

Return current erc20 bridge id.

Returns:

indexnametypedescription
0idUUIDerc20 bridge id

issue(user,amount)

Issue amount erc20 token to user.

Params:

nametypedescription
userTEXTwallet address
amountUINT256uint256 amount

transfer(to, amount)

Transfer amount erc20 token to to;

Params:

nametypedescription
toTEXTwallet address
amountUINT256transfer amount

lock(amount)

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

Params:

nametypedescription
amountUINT256amount

lock_admin(user, amount)

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

Params:

nametypedescription
userTEXTuser wallet address
amountUINT256amount

unlock(amount)

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

Params:

nametypedescription
userTEXTuser wallet address
amountUINT256amount

bridge(amount)

Bridge amount erc20 token to erc20 bridge.

Params:

nametypedescription
amountUINT256amount

balance(user)

Return the erc20 token balance of user.

Params:

nametypedescription
userTEXTuser wallet address

Returns:

indexnametypedescription
0balanceUINT256user's balance

decimals()

Return the erc20 token's decimals.

Returns:

indexnametypedescription
0decimalsINTerc20 token decimals

scale_down(amount)

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)

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

Return current active epochs.

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, limit)

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)

Return all rewards of an epoch.

Params:

nametypedescription
epoch_idUUIDepoch id

Returns:

indexnametypedescription
0recipientTEXTrecipient wallet address
1amountUINT256recipient's token amount

vote_epoch

Vote to approve an epoch, with signatures.

Params:

nametypedescription
epoch_idUUIDepoch id
nonceINTsafe nonce
signatureBYTEAsignature of current vote

list_wallet_rewards(wallet, with_pending)

Return all rewards issused 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

NOTE: REWARD is kind of awkward here

Create GnosisSafe and Escrow contract

Kwil will provide a smart contract that you can use to create both Safe and Escrow contract.

For now, contact us and we'll create this for you.