Skip to content

ChainBridge


Calls


acknowledge_proposal

See [Pallet::acknowledge_proposal].

Attributes

Name Type
nonce u64
src_id u8
r_id [u8; 32]
call Box<<T as Config>::Proposal>

Python

call = substrate.compose_call(
    'ChainBridge', 'acknowledge_proposal', {
    'call': 'Call',
    'nonce': 'u64',
    'r_id': '[u8; 32]',
    'src_id': 'u8',
}
)

add_relayer

See [Pallet::add_relayer].

Attributes

Name Type
v T::AccountId

Python

call = substrate.compose_call(
    'ChainBridge', 'add_relayer', {'v': 'AccountId'}
)

eval_vote_state

See [Pallet::eval_vote_state].

Attributes

Name Type
nonce u64
src_id u8
prop Box<<T as Config>::Proposal>

Python

call = substrate.compose_call(
    'ChainBridge', 'eval_vote_state', {
    'nonce': 'u64',
    'prop': 'Call',
    'src_id': 'u8',
}
)

reject_proposal

See [Pallet::reject_proposal].

Attributes

Name Type
nonce u64
src_id u8
r_id [u8; 32]
call Box<<T as Config>::Proposal>

Python

call = substrate.compose_call(
    'ChainBridge', 'reject_proposal', {
    'call': 'Call',
    'nonce': 'u64',
    'r_id': '[u8; 32]',
    'src_id': 'u8',
}
)

remove_relayer

See [Pallet::remove_relayer].

Attributes

Name Type
v T::AccountId

Python

call = substrate.compose_call(
    'ChainBridge', 'remove_relayer', {'v': 'AccountId'}
)

remove_resource

See [Pallet::remove_resource].

Attributes

Name Type
id [u8; 32]

Python

call = substrate.compose_call(
    'ChainBridge', 'remove_resource', {'id': '[u8; 32]'}
)

set_resource

See [Pallet::set_resource].

Attributes

Name Type
id [u8; 32]
method Vec<u8>

Python

call = substrate.compose_call(
    'ChainBridge', 'set_resource', {'id': '[u8; 32]', 'method': 'Bytes'}
)

set_threshold

See [Pallet::set_threshold].

Attributes

Name Type
threshold u32

Python

call = substrate.compose_call(
    'ChainBridge', 'set_threshold', {'threshold': 'u32'}
)

whitelist_chain

See [Pallet::whitelist_chain].

Attributes

Name Type
id u8

Python

call = substrate.compose_call(
    'ChainBridge', 'whitelist_chain', {'id': 'u8'}
)

Events


ChainWhitelisted

Chain now available for transfers (chain_id)

Attributes

Name Type Composition
None u8 u8

FungibleTransfer

FunglibleTransfer is for relaying fungibles (dest_id, nonce, resource_id, amount, recipient, metadata)

Attributes

Name Type Composition
None u8 u8
None u64 u64
None ResourceId [u8; 32]
None U256 scale_info::117
None Vec<u8> Bytes

GenericTransfer

GenericTransfer is for a generic data payload (dest_id, nonce, resource_id, metadata)

Attributes

Name Type Composition
None u8 u8
None u64 u64
None ResourceId [u8; 32]
None Vec<u8> Bytes

NonFungibleTransfer

NonFungibleTransfer is for relaying NFTS (dest_id, nonce, resource_id, token_id, recipient, metadata)

Attributes

Name Type Composition
None u8 u8
None u64 u64
None ResourceId [u8; 32]
None Vec<u8> Bytes
None Vec<u8> Bytes
None Vec<u8> Bytes

ProposalApproved

Voting successful for a proposal

Attributes

Name Type Composition
None u8 u8
None u64 u64

ProposalFailed

Execution of call failed

Attributes

Name Type Composition
None u8 u8
None u64 u64

ProposalRejected

Voting rejected a proposal

Attributes

Name Type Composition
None u8 u8
None u64 u64

ProposalSucceeded

Execution of call succeeded

Attributes

Name Type Composition
None u8 u8
None u64 u64

RelayerAdded

Relayer added to set

Attributes

Name Type Composition
None T::AccountId AccountId

RelayerRemoved

Relayer removed from set

Attributes

Name Type Composition
None T::AccountId AccountId

RelayerThresholdChanged

Vote threshold has changed (new_threshold)

Attributes

Name Type Composition
None u32 u32

VoteAgainst

Vot submitted against proposal

Attributes

Name Type Composition
None u8 u8
None u64 u64
None T::AccountId AccountId

VoteFor

Vote submitted in favour of proposal

Attributes

Name Type Composition
None u8 u8
None u64 u64
None T::AccountId AccountId

Storage functions


BridgeEvents

All whitelisted chains and their respective transaction counts

Python

result = substrate.query(
    'ChainBridge', 'BridgeEvents', []
)

Return value

[
    {
        'FungibleTransfer': (
            'u8',
            'u64',
            '[u8; 32]',
            'scale_info::117',
            'Bytes',
        ),
        'GenericTransfer': ('u8', 'u64', '[u8; 32]', 'Bytes'),
        'NonFungibleTransfer': (
            'u8',
            'u64',
            '[u8; 32]',
            'Bytes',
            'Bytes',
            'Bytes',
        ),
    },
]

ChainNonces

All whitelisted chains and their respective transaction counts

Python

result = substrate.query(
    'ChainBridge', 'ChainNonces', ['u8']
)

Return value

(None, 'u64')

RelayerCount

Python

result = substrate.query(
    'ChainBridge', 'RelayerCount', []
)

Return value

'u32'

RelayerThreshold

Number of votes required for a proposal to execute

Python

result = substrate.query(
    'ChainBridge', 'RelayerThreshold', []
)

Return value

'u32'

Relayers

Tracks current relayer set

Python

result = substrate.query(
    'ChainBridge', 'Relayers', ['AccountId']
)

Return value

()

Resources

Utilized by the bridge software to map resource IDs to actual methods

Python

result = substrate.query(
    'ChainBridge', 'Resources', ['[u8; 32]']
)

Return value

'Bytes'

Votes

All known proposals. The key is the hash of the call and the deposit ID, to ensure it's unique.

Python

result = substrate.query(
    'ChainBridge', 'Votes', ['u8', ('u64', 'Call')]
)

Return value

{
    'expiry': 'u32',
    'status': ('Initiated', 'Approved', 'Rejected'),
    'votes_against': ['AccountId'],
    'votes_for': ['AccountId'],
}

Constants


BridgeChainId

The identifier for this chain. This must be unique and must not collide with existing IDs within a set of bridged chains.

Value

3

Python

constant = substrate.get_constant('ChainBridge', 'BridgeChainId')

PalletId

Constant configuration parameter to store the module identifier for the pallet.

The module identifier may be of the form PalletId(*b&quot;chnbrdge&quot;) and set using the parameter_types

Value

'0x6372636c61696d73'

Python

constant = substrate.get_constant('ChainBridge', 'PalletId')

ProposalLifetime

Value

50400

Python

constant = substrate.get_constant('ChainBridge', 'ProposalLifetime')

Errors


ChainAlreadyWhitelisted

Chain has already been enabled


ChainNotWhitelisted

Interactions with this chain is not permitted


InvalidChainId

Provided chain Id is not valid


InvalidThreshold

Relayer threshold cannot be 0


MustBeRelayer

Protected operation, must be performed by relayer


ProposalAlreadyComplete

Proposal has either failed or succeeded


ProposalAlreadyExists

A proposal with these parameters has already been submitted


ProposalDoesNotExist

No proposal with the ID was found


ProposalExpired

Lifetime of proposal has been exceeded


ProposalNotComplete

Cannot complete proposal, needs more votes


RelayerAlreadyExists

Relayer already in set


RelayerAlreadyVoted

Relayer has already submitted some vote for this proposal


RelayerInvalid

Provided accountId is not a relayer


ResourceDoesNotExist

Resource ID provided isn&#x27;t mapped to anything


ThresholdNotSet

Relayer threshold not set