Skip to content

XAssetsBridge


Calls


back_foreign

Add assets which can back add_back_foreign chain Note: for admin

  • asset_id:

Attributes

Name Type
asset_id AssetId
remove bool

Python

call = substrate.compose_call(
    'XAssetsBridge', 'back_foreign', {'asset_id': 'u32', 'remove': 'bool'}
)

claim_account

Claim account mapping between Substrate accounts and EVM accounts. Ensure eth_address has not been mapped. Note: for general users

  • eth_address: The address to bind to the caller's account
  • eth_signature: A signature generated by the address to prove ownership

Attributes

Name Type
eth_address H160
eth_signature EcdsaSignature

Python

call = substrate.compose_call(
    'XAssetsBridge', 'claim_account', {
    'eth_address': '[u8; 20]',
    'eth_signature': '[u8; 65]',
}
)

deposit

Deposit substrate assets into evm erc20 contracts. Note: for general users

  • asset_id: The asset id
  • amount: Deposit amount

Attributes

Name Type
asset_id AssetId
amount BalanceOf<T>

Python

call = substrate.compose_call(
    'XAssetsBridge', 'deposit', {'amount': 'u128', 'asset_id': 'u32'}
)

deposit_pcx_to_evm

Deposit PCX from wasm to evm Note: for user

Attributes

Name Type
amount BalanceOf<T>
eth_address H160

Python

call = substrate.compose_call(
    'XAssetsBridge', 'deposit_pcx_to_evm', {
    'amount': 'u128',
    'eth_address': '[u8; 20]',
}
)

dissolve

Dissolve substrate accounts and EVM accounts. Note: for general users

Attributes

No attributes

Python

call = substrate.compose_call(
    'XAssetsBridge', 'dissolve', {}
)

force_unregister

Force unregister substrate assets and erc20 contracts Note: for admin

Attributes

Name Type
asset_id AssetId

Python

call = substrate.compose_call(
    'XAssetsBridge', 'force_unregister', {'asset_id': 'u32'}
)

pause

Pause assets bridge deposit and withdraw Note: for admin

  • asset_id: None will pause all, Some(id) will pause the specified asset

Attributes

Name Type
asset_id Option<AssetId>

Python

call = substrate.compose_call(
    'XAssetsBridge', 'pause', {'asset_id': (None, 'u32')}
)

register

Register substrate assets and erc20 contracts Note: for admin

  • asset_id: The asset id
  • erc20: The erc20 contract address

Attributes

Name Type
asset_id AssetId
erc20 H160

Python

call = substrate.compose_call(
    'XAssetsBridge', 'register', {
    'asset_id': 'u32',
    'erc20': '[u8; 20]',
}
)

set_admin

Set this pallet admin key Note: for super admin

Attributes

Name Type
new_admin <T::Lookup as StaticLookup>::Source

Python

call = substrate.compose_call(
    'XAssetsBridge', 'set_admin', {
    'new_admin': {
        'Address20': '[u8; 20]',
        'Address32': '[u8; 32]',
        'Id': 'AccountId',
        'Index': 'u32',
        'Raw': 'Bytes',
    },
}
)

swap_xbtc_to_btc

Swap XBTC(assets moudle) to BTC(btc ledger module) by 1:1 Note: for user who hold XBTC

Attributes

Name Type
amount u128
eth_address H160

Python

call = substrate.compose_call(
    'XAssetsBridge', 'swap_xbtc_to_btc', {
    'amount': 'u128',
    'eth_address': '[u8; 20]',
}
)

teleport

Teleport native currency between substrate account and evm address Ensure eth_address has been mapped Note: for general users

  • amount: Teleport amount
  • action: (1) Direct(H160): direct transfer into unchecked evm address (2) FromSubToEth: transfer from substrate account to mapped evm address (3) FromEthToSub: transfer from mapped evm address to substrate account
  • companion with relay: (4) BackForeign(asset_id): transfer assets back foreign chain

Attributes

Name Type
amount BalanceOf<T>
action ActionType

Python

call = substrate.compose_call(
    'XAssetsBridge', 'teleport', {
    'action': {
        'BackForeign': 'u32',
        'Direct': '[u8; 20]',
        'FromEthToSub': None,
        'FromSubToEth': None,
    },
    'amount': 'u128',
}
)

transfer_btc_to_evm

Transfer BTC(btc ledger module) from substrate account to evm address Note: for user who hold BTC

Attributes

Name Type
amount u128
eth_address H160

Python

call = substrate.compose_call(
    'XAssetsBridge', 'transfer_btc_to_evm', {
    'amount': 'u128',
    'eth_address': '[u8; 20]',
}
)

unpause

Unpause assets bridge deposit and withdraw Note: for admin

  • asset_id: None will unpause all, Some(id) will unpause the specified asset

Attributes

Name Type
asset_id Option<AssetId>

Python

call = substrate.compose_call(
    'XAssetsBridge', 'unpause', {'asset_id': (None, 'u32')}
)

withdraw

Withdraw from evm erc20 contracts into substrate assets Note: for general users

  • asset_id: The asset id
  • amount: Withdraw amount

Attributes

Name Type
asset_id AssetId
amount BalanceOf<T>

Python

call = substrate.compose_call(
    'XAssetsBridge', 'withdraw', {'amount': 'u128', 'asset_id': 'u32'}
)

Events


BackForeign

Attributes

Name Type Composition
None AssetId u32
None bool bool

ClaimAccount

(account_id, evm_address)

Attributes

Name Type Composition
None T::AccountId AccountId
None H160 [u8; 20]

DepositExecuted

(asset_id, account_id, evm_address, amount, erc20_contract)

Attributes

Name Type Composition
None AssetId u32
None T::AccountId AccountId
None H160 [u8; 20]
None BalanceOf<T> u128
None H160 [u8; 20]

Dissolve

(account_id)

Attributes

Name Type Composition
None T::AccountId AccountId

ForceUnRegister

(asset_id, erc20_contract)

Attributes

Name Type Composition
None AssetId u32
None H160 [u8; 20]

Paused

(asset_id)

Attributes

Name Type Composition
None AssetId u32

PausedAll

Attributes

No attributes


Register

(asset_id, erc20_contract)

Attributes

Name Type Composition
None AssetId u32
None H160 [u8; 20]

SetAdmin

(account_id)

Attributes

Name Type Composition
None T::AccountId AccountId

Teleport

(account_id, amount, action)

Attributes

Name Type Composition
None T::AccountId AccountId
None BalanceOf<T> u128
None ActionType {'Direct': '[u8; 20]', 'FromSubToEth': None, 'FromEthToSub': None, 'BackForeign': 'u32'}

UnPaused

Attributes

Name Type Composition
None AssetId u32

UnPausedAll

Attributes

No attributes


WithdrawExecuted

(asset_id, account_id, evm_address, amount, erc20_contract)

Attributes

Name Type Composition
None AssetId u32
None T::AccountId AccountId
None H160 [u8; 20]
None BalanceOf<T> u128
None H160 [u8; 20]

Storage functions


Admin

The pallet admin key.

Python

result = substrate.query(
    'XAssetsBridge', 'Admin', []
)

Return value

'AccountId'

AssetIds

The Asset Ids for Erc20 Contract Addresses

AssetIds: map H160 => Option<AssetId>

Python

result = substrate.query(
    'XAssetsBridge', 'AssetIds', ['[u8; 20]']
)

Return value

'u32'

BackForeign

The Assets can back foreign chain

AssetIds: Vec<AssetId>

Python

result = substrate.query(
    'XAssetsBridge', 'BackForeign', []
)

Return value

['u32']

Emergencies

The Assets in emergency

Python

result = substrate.query(
    'XAssetsBridge', 'Emergencies', []
)

Return value

['u32']

Erc20s

The Erc20 Contract Addresses for Asset Ids

Erc20s: map AssetId => Option<H160>

Python

result = substrate.query(
    'XAssetsBridge', 'Erc20s', ['u32']
)

Return value

'[u8; 20]'

EvmAccounts

The Evm Addresses for Substrate Accounts

EvmAccounts: map AccountId => Option<H160>

Python

result = substrate.query(
    'XAssetsBridge', 'EvmAccounts', ['AccountId']
)

Return value

'[u8; 20]'

SubAccounts

The Substrate Account for Evm Addresses

SubAccounts: map H160 => Option<AccountId>

Python

result = substrate.query(
    'XAssetsBridge', 'SubAccounts', ['[u8; 20]']
)

Return value

'AccountId'

Constants


ClaimBond

How much should be locked up in order to claim account.

Value

100000000

Python

constant = substrate.get_constant('XAssetsBridge', 'ClaimBond')

EvmCaller

The assets-bridge's inner evm caller.

Value

'0x1111111111111111111111111111111111111111'

Python

constant = substrate.get_constant('XAssetsBridge', 'EvmCaller')

Errors


AccountIdHasMapped

AccountId has mapped


AccountIdHasNotMapped

AccountId has not mapped


AssetIdHasMapped

AssetId has mapped


AssetIdHasNotMapped

AssetId has not mapped


BadSignature

Bad signature


BanBackForeign

Ban back to foreign


ContractAddressHasMapped

Erc20 contract address has mapped


ContractAddressHasNotMapped

Erc20 contract address has not mapped


Deprecated

Deprecated


EthAddressHasMapped

Eth address has mapped


EthAddressHasNotMapped

Eth address has not mapped


ExecutedFailed

Failed Erc20 contract call


InEmergency

Ban deposit and withdraw when in emergency


InvalidSignature

Invalid signature


RequireAdmin

Require admin authority


ZeroBalance

Zero balance