referrerpolicy=no-referrer-when-downgrade
pub trait MutateFreeze<AccountId>: Inspect<AccountId> {
    // Required methods
    fn set_freeze(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
        amount: Self::Balance,
    ) -> Result<(), DispatchError>;
    fn extend_freeze(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
        amount: Self::Balance,
    ) -> Result<(), DispatchError>;
    fn thaw(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
    ) -> Result<(), DispatchError>;

    // Provided methods
    fn set_frozen(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
        amount: Self::Balance,
        fortitude: Fortitude,
    ) -> Result<(), DispatchError> { ... }
    fn ensure_frozen(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
        amount: Self::Balance,
        fortitude: Fortitude,
    ) -> Result<(), DispatchError> { ... }
    fn decrease_frozen(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
        amount: Self::Balance,
    ) -> Result<(), DispatchError> { ... }
    fn increase_frozen(
        asset: Self::AssetId,
        id: &Self::Id,
        who: &AccountId,
        amount: Self::Balance,
    ) -> Result<(), DispatchError> { ... }
}
Expand description

Trait for introducing, altering and removing locks to freeze an account’s funds so they never go below a set minimum.

Required Methods§

fn set_freeze( asset: Self::AssetId, id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>

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.

fn extend_freeze( asset: Self::AssetId, id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>

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 locked than the total balance, if desired.

fn thaw( asset: Self::AssetId, id: &Self::Id, who: &AccountId, ) -> Result<(), DispatchError>

Remove an existing lock.

Provided Methods§

fn set_frozen( asset: Self::AssetId, id: &Self::Id, who: &AccountId, amount: Self::Balance, fortitude: Fortitude, ) -> Result<(), DispatchError>

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.

fn ensure_frozen( asset: Self::AssetId, id: &Self::Id, who: &AccountId, amount: Self::Balance, fortitude: Fortitude, ) -> Result<(), DispatchError>

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.

fn decrease_frozen( asset: Self::AssetId, id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>

Decrease the amount which is being frozen for a particular lock, failing in the case of underflow.

fn increase_frozen( asset: Self::AssetId, id: &Self::Id, who: &AccountId, amount: Self::Balance, ) -> Result<(), DispatchError>

Increase the amount which is being frozen for a particular lock, failing in the case that too little balance is available for being frozen.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<Left, Right, Criterion, AssetKind, AccountId> Mutate<AccountId> for polkadot_sdk_frame::traits::tokens::fungible::UnionOf<Left, Right, Criterion, AssetKind, AccountId>
where Left: Mutate<AccountId>, Right: Mutate<AccountId, Balance = <Left as Inspect<AccountId>>::Balance, Id = <Left as Inspect<AccountId>>::Id>, Criterion: Convert<AssetKind, Either<(), <Right as Inspect<AccountId>>::AssetId>>, AssetKind: AssetId,

§

impl<Left, Right, Criterion, AssetKind, AccountId> Mutate<AccountId> for polkadot_sdk_frame::traits::tokens::fungibles::UnionOf<Left, Right, Criterion, AssetKind, AccountId>
where Left: Mutate<AccountId>, Right: Mutate<AccountId, Balance = <Left as Inspect<AccountId>>::Balance, Id = <Left as Inspect<AccountId>>::Id>, Criterion: Convert<AssetKind, Either<<Left as Inspect<AccountId>>::AssetId, <Right as Inspect<AccountId>>::AssetId>>, AssetKind: AssetId,