ibc_app_transfer::context

Trait TokenTransferValidationContext

Source
pub trait TokenTransferValidationContext {
    type AccountId: TryFrom<Signer>;

    // Required methods
    fn get_port(&self) -> Result<PortId, HostError>;
    fn can_send_coins(&self) -> Result<(), HostError>;
    fn can_receive_coins(&self) -> Result<(), HostError>;
    fn escrow_coins_validate(
        &self,
        from_account: &Self::AccountId,
        port_id: &PortId,
        channel_id: &ChannelId,
        coin: &PrefixedCoin,
        memo: &Memo,
    ) -> Result<(), HostError>;
    fn unescrow_coins_validate(
        &self,
        to_account: &Self::AccountId,
        port_id: &PortId,
        channel_id: &ChannelId,
        coin: &PrefixedCoin,
    ) -> Result<(), HostError>;
    fn mint_coins_validate(
        &self,
        account: &Self::AccountId,
        coin: &PrefixedCoin,
    ) -> Result<(), HostError>;
    fn burn_coins_validate(
        &self,
        account: &Self::AccountId,
        coin: &PrefixedCoin,
        memo: &Memo,
    ) -> Result<(), HostError>;

    // Provided method
    fn denom_hash_string(&self, _denom: &PrefixedDenom) -> Option<String> { ... }
}
Expand description

Methods required in token transfer validation, to be implemented by the host

Required Associated Types§

Required Methods§

Source

fn get_port(&self) -> Result<PortId, HostError>

get_port returns the portID for the transfer module.

Source

fn can_send_coins(&self) -> Result<(), HostError>

Returns Ok() if the host chain supports sending coins.

Source

fn can_receive_coins(&self) -> Result<(), HostError>

Returns Ok() if the host chain supports receiving coins.

Source

fn escrow_coins_validate( &self, from_account: &Self::AccountId, port_id: &PortId, channel_id: &ChannelId, coin: &PrefixedCoin, memo: &Memo, ) -> Result<(), HostError>

Validates that the tokens can be escrowed successfully.

memo field allows incorporating additional contextual details in the escrow validation.

Source

fn unescrow_coins_validate( &self, to_account: &Self::AccountId, port_id: &PortId, channel_id: &ChannelId, coin: &PrefixedCoin, ) -> Result<(), HostError>

Validates that the tokens can be unescrowed successfully.

Source

fn mint_coins_validate( &self, account: &Self::AccountId, coin: &PrefixedCoin, ) -> Result<(), HostError>

Validates the receiver account and the coin input

Source

fn burn_coins_validate( &self, account: &Self::AccountId, coin: &PrefixedCoin, memo: &Memo, ) -> Result<(), HostError>

Validates the sender account and the coin input before burning.

memo field allows incorporating additional contextual details in the burn validation.

Provided Methods§

Source

fn denom_hash_string(&self, _denom: &PrefixedDenom) -> Option<String>

Returns a hash of the prefixed denom. Implement only if the host chain supports hashed denominations.

Implementors§