Trait orml_traits::currency::BasicCurrency[][src]

pub trait BasicCurrency<AccountId> {
    type Balance: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default;
    fn minimum_balance() -> Self::Balance;
fn total_issuance() -> Self::Balance;
fn total_balance(who: &AccountId) -> Self::Balance;
fn free_balance(who: &AccountId) -> Self::Balance;
fn ensure_can_withdraw(
        who: &AccountId,
        amount: Self::Balance
    ) -> DispatchResult;
fn transfer(
        from: &AccountId,
        to: &AccountId,
        amount: Self::Balance
    ) -> DispatchResult;
fn deposit(who: &AccountId, amount: Self::Balance) -> DispatchResult;
fn withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult;
fn can_slash(who: &AccountId, value: Self::Balance) -> bool;
fn slash(who: &AccountId, amount: Self::Balance) -> Self::Balance; }

Abstraction over a fungible (single) currency system.

Associated Types

type Balance: AtLeast32BitUnsigned + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default[src]

The balance of an account.

Loading content...

Required methods

fn minimum_balance() -> Self::Balance[src]

Existential deposit.

fn total_issuance() -> Self::Balance[src]

The total amount of issuance.

fn total_balance(who: &AccountId) -> Self::Balance[src]

The combined balance of who.

fn free_balance(who: &AccountId) -> Self::Balance[src]

The free balance of who.

fn ensure_can_withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult[src]

A dry-run of withdraw. Returns Ok iff the account is able to make a withdrawal of the given amount.

fn transfer(
    from: &AccountId,
    to: &AccountId,
    amount: Self::Balance
) -> DispatchResult
[src]

Transfer some amount from one account to another.

fn deposit(who: &AccountId, amount: Self::Balance) -> DispatchResult[src]

Add amount to the balance of who and increase total issuance.

fn withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult[src]

Remove amount from the balance of who and reduce total issuance.

fn can_slash(who: &AccountId, value: Self::Balance) -> bool[src]

Same result as slash(who, value) (but without the side-effects) assuming there are no balance changes in the meantime and only the reserved balance is not taken into account.

fn slash(who: &AccountId, amount: Self::Balance) -> Self::Balance[src]

Deduct the balance of who by up to amount.

As much funds up to amount will be deducted as possible. If this is less than amount,then a non-zero value will be returned.

Loading content...

Implementors

Loading content...