Trait governance_os_support::traits::LockableCurrencies[][src]

pub trait LockableCurrencies<AccountId>: Currencies<AccountId> {
    fn locked_balance(
        currency_id: Self::CurrencyId,
        who: &AccountId
    ) -> Self::Balance;
fn set_lock(
        currency_id: Self::CurrencyId,
        lock_id: LockIdentifier,
        who: &AccountId,
        amount: Self::Balance
    ) -> DispatchResult;
fn extend_lock(
        currency_id: Self::CurrencyId,
        lock_id: LockIdentifier,
        who: &AccountId,
        amount: Self::Balance
    ) -> DispatchResult;
fn remove_lock(
        currency_id: Self::CurrencyId,
        lock_id: LockIdentifier,
        who: &AccountId
    ) -> DispatchResult; }

An extension of the Currencies trait to allow the runtime to lock funds from the token holders. Locks should be combinable. Creating a lock shall increment any existing reference count, deleting one should decrement it.

Required methods

fn locked_balance(
    currency_id: Self::CurrencyId,
    who: &AccountId
) -> Self::Balance
[src]

Return the total amount of coins locked for the given account.

fn set_lock(
    currency_id: Self::CurrencyId,
    lock_id: LockIdentifier,
    who: &AccountId,
    amount: Self::Balance
) -> DispatchResult
[src]

Create a new lock on the balance of who. You can lock more coins than the total balance of a user.

NOTE: this should overwrite any existing lock with the same id.

fn extend_lock(
    currency_id: Self::CurrencyId,
    lock_id: LockIdentifier,
    who: &AccountId,
    amount: Self::Balance
) -> DispatchResult
[src]

Extend an existing lock for who and currency_id. If the lock already exists it will take the maximum value between amount and the existing one.

fn remove_lock(
    currency_id: Self::CurrencyId,
    lock_id: LockIdentifier,
    who: &AccountId
) -> DispatchResult
[src]

Remove an existing lock.

Loading content...

Implementors

Loading content...