pub trait Mutate<AccountId>: Inspect<AccountId> {
// Required methods
fn set_freeze(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult;
fn extend_freeze(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult;
fn thaw(id: &Self::Id, who: &AccountId) -> DispatchResult;
// Provided methods
fn set_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
fortitude: Fortitude,
) -> DispatchResult { ... }
fn ensure_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
fortitude: Fortitude,
) -> DispatchResult { ... }
fn decrease_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult { ... }
fn increase_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult { ... }
}Expand description
Trait for introducing, altering and removing freezes for an account for its funds never go below a set minimum.
Required Methods§
Sourcefn set_freeze(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult
fn set_freeze( id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> DispatchResult
Prevent actions which would reduce the balance of the account of who below the given
amount and identify this restriction though the given id. Unlike extend_freeze, any
outstanding freeze in place for who under the id are dropped.
If amount is zero, it is equivalent to using thaw.
Note that amount can be greater than the total balance, if desired.
Sourcefn extend_freeze(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult
fn extend_freeze( id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> DispatchResult
Prevent the balance of the account of who from being reduced below the given amount and
identify this restriction though the given id. Unlike set_freeze, this does not
counteract any pre-existing freezes in place for who under the id. Also unlike
set_freeze, in the case that amount is zero, this is no-op and never fails.
Note that more funds can be frozen than the total balance, if desired.
Sourcefn thaw(id: &Self::Id, who: &AccountId) -> DispatchResult
fn thaw(id: &Self::Id, who: &AccountId) -> DispatchResult
Remove an existing freeze.
Provided Methods§
Sourcefn set_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
fortitude: Fortitude,
) -> DispatchResult
fn set_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, fortitude: Fortitude, ) -> DispatchResult
Attempt to alter the amount frozen under the given id to amount.
Fail if the account of who has fewer freezable funds than amount, unless fortitude is
Fortitude::Force.
Sourcefn ensure_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
fortitude: Fortitude,
) -> DispatchResult
fn ensure_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, fortitude: Fortitude, ) -> DispatchResult
Attempt to set the amount frozen under the given id to amount, iff this would increase
the amount frozen under id. Do nothing otherwise.
Fail if the account of who has fewer freezable funds than amount, unless fortitude is
Fortitude::Force.
Sourcefn decrease_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult
fn decrease_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> DispatchResult
Decrease the amount which is being frozen for a particular freeze, failing in the case of underflow.
Sourcefn increase_frozen(
id: &Self::Id,
who: &AccountId,
amount: Self::Balance,
) -> DispatchResult
fn increase_frozen( id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> DispatchResult
Increase the amount which is being frozen for a particular freeze, failing in the case that too little balance is available for being frozen.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.