Trait frame_support::traits::LockableCurrency[][src]

pub trait LockableCurrency<AccountId>: Currency<AccountId> {
    type Moment;
    type MaxLocks: Get<u32>;
    fn set_lock(
        id: LockIdentifier,
        who: &AccountId,
        amount: Self::Balance,
        reasons: WithdrawReasons
    );
fn extend_lock(
        id: LockIdentifier,
        who: &AccountId,
        amount: Self::Balance,
        reasons: WithdrawReasons
    );
fn remove_lock(id: LockIdentifier, who: &AccountId); }

A currency whose accounts can have liquidity restrictions.

Associated Types

type Moment[src]

The quantity used to denote time; usually just a BlockNumber.

type MaxLocks: Get<u32>[src]

The maximum number of locks a user should have on their account.

Loading content...

Required methods

fn set_lock(
    id: LockIdentifier,
    who: &AccountId,
    amount: Self::Balance,
    reasons: WithdrawReasons
)
[src]

Create a new balance lock on account who.

If the new lock is valid (i.e. not already expired), it will push the struct to the Locks vec in storage. Note that you can lock more funds than a user has.

If the lock id already exists, this will update it.

fn extend_lock(
    id: LockIdentifier,
    who: &AccountId,
    amount: Self::Balance,
    reasons: WithdrawReasons
)
[src]

Changes a balance lock (selected by id) so that it becomes less liquid in all parameters or creates a new one if it does not exist.

Calling extend_lock on an existing lock id differs from set_lock in that it applies the most severe constraints of the two, while set_lock replaces the lock with the new parameters. As in, extend_lock will set:

  • maximum amount
  • bitwise mask of all reasons

fn remove_lock(id: LockIdentifier, who: &AccountId)[src]

Remove an existing lock.

Loading content...

Implementors

Loading content...