pub trait SettlementChain: Send + Sync {
Show 13 methods // Required methods fn get_chain_name<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn check_connection<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_last_block<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<SettlementChainBlock, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_contract_sequence<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u128, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_relayer_account_info<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(HexSerializedVec, Decimal), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_light_client_header<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<BlockHeader, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_treasury_fungible_token_balance<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<Decimal, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_treasury_non_fungible_token_balance<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<Vec<HexSerializedVec>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn update_treasury_light_client<'life0, 'async_trait>( &'life0 self, header: BlockHeader, proof: FinalizationProof ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn execute<'life0, 'async_trait>( &'life0 self, transaction: Transaction, block_height: u64, proof: MerkleProof ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn eoa_get_sequence<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<u128, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn eoa_get_fungible_token_balance<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec, token_address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<Decimal, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn eoa_transfer_fungible_token<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec, sender_private_key: HexSerializedVec, token_address: HexSerializedVec, receiver_address: HexSerializedVec, amount: Decimal ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

An abstraction of a settlement chain with its treasury deployed on it.

One trivial implementation of this trait would carry the API endpoint of the full node and the relayer account used to submit message delivering transactions.

Required Methods§

source

fn get_chain_name<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the name of the chain.

source

fn check_connection<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Checks whether the chain is healthy and the full node is running.

source

fn get_last_block<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<SettlementChainBlock, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Gets the latest finalized block on the chain.

source

fn get_contract_sequence<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u128, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the current sequence of the treasury contract.

source

fn get_relayer_account_info<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(HexSerializedVec, Decimal), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the address and the current balance (which is used to pay the gas fee) of the relayer account in this chain.

The relayer account has no special authority; it is simply used to pay the gas fee for the transaction. (i.e., there is no need for the contract to check the transaction submitter).

source

fn get_light_client_header<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<BlockHeader, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the latest header that the light client has verified.

source

fn get_treasury_fungible_token_balance<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<Decimal, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the current balance of a particular fungible token in the treasury contract.

source

fn get_treasury_non_fungible_token_balance<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<Vec<HexSerializedVec>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the current balance of a particular non-fungible token collection in the treasury contract, identified as their token indices.

source

fn update_treasury_light_client<'life0, 'async_trait>( &'life0 self, header: BlockHeader, proof: FinalizationProof ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Updates the light client state in the treasury by providing the next, valid block header and its proof.

This is one of the message delivery methods; a transaction that carries the given data will be submitted to the chain.

source

fn execute<'life0, 'async_trait>( &'life0 self, transaction: Transaction, block_height: u64, proof: MerkleProof ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Delivers an execution transaction to the settlement chain with the commitment proof.

  • transaction: The transaction to deliver.
  • block_height: The height of the block that the transaction is included in.
source

fn eoa_get_sequence<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<u128, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the current sequence number of the given externally owned account.

source

fn eoa_get_fungible_token_balance<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec, token_address: HexSerializedVec ) -> Pin<Box<dyn Future<Output = Result<Decimal, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns the current balance of a particular fungible token in the given externally owned account.

source

fn eoa_transfer_fungible_token<'life0, 'async_trait>( &'life0 self, address: HexSerializedVec, sender_private_key: HexSerializedVec, token_address: HexSerializedVec, receiver_address: HexSerializedVec, amount: Decimal ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Submits a transaction to transfer a fungible token from the given externally owned account to the given receiver address.

Implementors§