A bridge from substrate assets(wasm) into ERC20 tokens(evm).
Substrate & EVM address on PSC
In AssetsBridge
- substrate assets
->
erc20 tokens:deposit
- substrate assets
<-
erc20 tokens:withdraw
- native currency(wasm)
<->
eth(evm):teleport
- for user:
claim_account
: bond substrate account and evm address, will reserve some currency.dissolve
: unbond substrate account and evm address, will unreserve some currency.deposit
: move substrate assets into erc20 tokens.withdraw
: move back substrate assets from erc20 tokens.teleport
: transfer native currency between substrate account and evm address.
- for admin:
register
: bond substrate assets and erc20 contract address.pause
: pausedeposit
,withdraw
andteleport(BackForeign)
when in emergency.unpause
: unpause thepaused
state.
- for sudo:
set_admin
: set new the admin ofAssetsBridge
.force_unregister
: force unbond substrate assets and erc20 contract address.
In the production environment, the admin of assets-bridge must audits whether the erc20 contract
implements IAssetsBridge
interface and whether it has the AssetsBridgeAdmin
modifier.
- (1) bond
Assets(wasm)
andTokens(evm)
: admin callregister
. - (2) bond
Account(wasm)
andAddress(evm)
: user callclaim_account
. - (3) move assets(wasm and evm):
deposit
: burn from wasm and mint into evm.withdraw
: burn from evm and mint into wasm.teleport
: transfer in wasm.
- (4) maintenance:
- for
sudo
:set_admin
,force_unregister
. - for
admin
:pause
,unpause
. - for
user
:dissolve
.
- for
"evm:" + substrate_pubkey_hex_without_0x
example:
substrate account: 5USGSZK3raH3LD4uxvNTa23HN5VULnYrkXonRktyizTJUYg9
it's pubkey(hex): 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
the sign data: "evm:d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
-
Foreign assets
(on other chain) ->PSC assets
flow:- (1)
user
needtransfer
to the account which under the control ofassets-bridge admin
onforeign chain
- (2)
mint
touser
byassets-bridge admin
onPSC
- (1)
-
PSC assets
->Foreign assets
(on other chain) flow:- (1)
user
needteleport
withBackForeign(asset_id)
onPSC
. - (2) the account which under the control of
assets-bridge admin
onforeign chain
transfer
touser
- (1)
-
maintenance
byadmin
:back_foreign
add or removeasset_id
which can back foreign chain.
For safety, AssetsBridge now only allows dependent AssetsBridge assets(wasm) and AssetsBridge tokens(evm).