pub trait Inspect<AccountId> {
    type AssetId: AssetId;
    type Balance: Balance;

    // Required methods
    fn total_issuance(asset: Self::AssetId) -> Self::Balance;
    fn minimum_balance(asset: Self::AssetId) -> Self::Balance;
    fn balance(asset: Self::AssetId, who: &AccountId) -> Self::Balance;
    fn reducible_balance(
        asset: Self::AssetId,
        who: &AccountId,
        keep_alive: bool
    ) -> Self::Balance;
    fn can_deposit(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance,
        mint: bool
    ) -> DepositConsequence;
    fn can_withdraw(
        asset: Self::AssetId,
        who: &AccountId,
        amount: Self::Balance
    ) -> WithdrawConsequence<Self::Balance>;
    fn asset_exists(asset: Self::AssetId) -> bool;

    // Provided method
    fn active_issuance(asset: Self::AssetId) -> Self::Balance { ... }
}
Expand description

Trait for providing balance-inspection access to a set of named fungible assets.

Required Associated Types§

source

type AssetId: AssetId

Means of identifying one asset class from another.

source

type Balance: Balance

Scalar type for representing balance of an account.

Required Methods§

source

fn total_issuance(asset: Self::AssetId) -> Self::Balance

The total amount of issuance in the system.

source

fn minimum_balance(asset: Self::AssetId) -> Self::Balance

The minimum balance any single account may have.

source

fn balance(asset: Self::AssetId, who: &AccountId) -> Self::Balance

Get the asset balance of who.

source

fn reducible_balance( asset: Self::AssetId, who: &AccountId, keep_alive: bool ) -> Self::Balance

Get the maximum amount of asset that who can withdraw/transfer successfully.

source

fn can_deposit( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, mint: bool ) -> DepositConsequence

Returns true if the asset balance of who may be increased by amount.

  • asset: The asset that should be deposited.
  • who: The account of which the balance should be increased by amount.
  • amount: How much should the balance be increased?
  • mint: Will amount be minted to deposit it into account?
source

fn can_withdraw( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> WithdrawConsequence<Self::Balance>

Returns Failed if the asset balance of who may not be decreased by amount, otherwise the consequence.

source

fn asset_exists(asset: Self::AssetId) -> bool

Returns true if an asset exists.

Provided Methods§

source

fn active_issuance(asset: Self::AssetId) -> Self::Balance

The total amount of issuance in the system excluding those which are controlled by the system.

Implementors§