referrerpolicy=no-referrer-when-downgrade

Trait frame_support::traits::tokens::fungibles::hold::Mutate

source ·
pub trait Mutate<AccountId>: Inspect<AccountId> + Unbalanced<AccountId> + Unbalanced<AccountId> {
    // Provided methods
    fn hold(
        asset: Self::AssetId,
        reason: &Self::Reason,
        who: &AccountId,
        amount: Self::Balance,
    ) -> DispatchResult { ... }
    fn release(
        asset: Self::AssetId,
        reason: &Self::Reason,
        who: &AccountId,
        amount: Self::Balance,
        precision: Precision,
    ) -> Result<Self::Balance, DispatchError> { ... }
    fn burn_held(
        asset: Self::AssetId,
        reason: &Self::Reason,
        who: &AccountId,
        amount: Self::Balance,
        precision: Precision,
        force: Fortitude,
    ) -> Result<Self::Balance, DispatchError> { ... }
    fn burn_all_held(
        asset: Self::AssetId,
        reason: &Self::Reason,
        who: &AccountId,
        precision: Precision,
        force: Fortitude,
    ) -> Result<Self::Balance, DispatchError> { ... }
    fn transfer_on_hold(
        asset: Self::AssetId,
        reason: &Self::Reason,
        source: &AccountId,
        dest: &AccountId,
        amount: Self::Balance,
        precision: Precision,
        mode: Restriction,
        force: Fortitude,
    ) -> Result<Self::Balance, DispatchError> { ... }
    fn transfer_and_hold(
        asset: Self::AssetId,
        reason: &Self::Reason,
        source: &AccountId,
        dest: &AccountId,
        amount: Self::Balance,
        precision: Precision,
        expendability: Preservation,
        force: Fortitude,
    ) -> Result<Self::Balance, DispatchError> { ... }
    fn done_hold(
        _asset: Self::AssetId,
        _reason: &Self::Reason,
        _who: &AccountId,
        _amount: Self::Balance,
    ) { ... }
    fn done_release(
        _asset: Self::AssetId,
        _reason: &Self::Reason,
        _who: &AccountId,
        _amount: Self::Balance,
    ) { ... }
    fn done_burn_held(
        _asset: Self::AssetId,
        _reason: &Self::Reason,
        _who: &AccountId,
        _amount: Self::Balance,
    ) { ... }
    fn done_transfer_on_hold(
        _asset: Self::AssetId,
        _reason: &Self::Reason,
        _source: &AccountId,
        _dest: &AccountId,
        _amount: Self::Balance,
    ) { ... }
    fn done_transfer_and_hold(
        _asset: Self::AssetId,
        _reason: &Self::Reason,
        _source: &AccountId,
        _dest: &AccountId,
        _transferred: Self::Balance,
    ) { ... }
}
Expand description

Trait for mutating a fungible asset which can be placed on hold.

Provided Methods§

source

fn hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, ) -> DispatchResult

Hold some funds in an account. If a hold for reason is already in place, then this will increase it.

source

fn release( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, ) -> Result<Self::Balance, DispatchError>

Release up to amount held funds in an account.

The actual amount released is returned with Ok.

If precision is BestEffort, then the amount actually unreserved and returned as the inner value of Ok may be smaller than the amount passed.

source

fn burn_held( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, force: Fortitude, ) -> Result<Self::Balance, DispatchError>

Attempt to decrease the asset balance of who which is held for the given reason by amount.

If precision is true, then as much as possible is reduced, up to amount, and the amount of tokens reduced is returned. Otherwise, if the total amount can be reduced, then it is and the amount returned, and if not, then nothing changes and Err is returned.

If force is Force, then locks/freezes will be ignored. This should only be used when conducting slashing or other activity which materially disadvantages the account holder since it could provide a means of circumventing freezes.

source

fn burn_all_held( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, precision: Precision, force: Fortitude, ) -> Result<Self::Balance, DispatchError>

Attempt to decrease the asset balance of who which is held for the given reason to zero.

If precision is BestEffort, then as much as possible is reduced, up to amount, and the amount of tokens reduced is returned. Otherwise, if the total amount can be reduced, then it is and the amount returned, and if not, then nothing changes and Err is returned.

If force is Force, then locks/freezes will be ignored. This should only be used when conducting slashing or other activity which materially disadvantages the account holder since it could provide a means of circumventing freezes.

source

fn transfer_on_hold( asset: Self::AssetId, reason: &Self::Reason, source: &AccountId, dest: &AccountId, amount: Self::Balance, precision: Precision, mode: Restriction, force: Fortitude, ) -> Result<Self::Balance, DispatchError>

Transfer held funds into a destination account.

If mode is OnHold, then the destination account must already exist and the assets transferred will still be on hold in the destination account. If not, then the destination account need not already exist, but must be creatable.

If precision is BestEffort, then an amount less than amount may be transferred without error.

If force is Force, then other fund-locking mechanisms may be disregarded. It should be left as Regular in most circumstances, but when you want the same power as a slash, it may be Force.

The actual amount transferred is returned, or Err in the case of error and nothing is changed.

source

fn transfer_and_hold( asset: Self::AssetId, reason: &Self::Reason, source: &AccountId, dest: &AccountId, amount: Self::Balance, precision: Precision, expendability: Preservation, force: Fortitude, ) -> Result<Self::Balance, DispatchError>

Transfer some amount of free balance from source to become owned by dest but on hold for reason. for reason.

If precision is BestEffort, then an amount less than amount may be transferred without error.

source must obey the requirements of keep_alive.

If force is Force, then other fund-locking mechanisms may be disregarded. It should be left as Regular in most circumstances, but when you want the same power as a slash, it may be Force.

The amount placed on hold is returned or Err in the case of error and nothing is changed.

WARNING: This may return an error after a partial storage mutation. It should be used only inside a transactional storage context and an Err result must imply a storage rollback.

source

fn done_hold( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance, )

source

fn done_release( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance, )

source

fn done_burn_held( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance, )

source

fn done_transfer_on_hold( _asset: Self::AssetId, _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance, )

source

fn done_transfer_and_hold( _asset: Self::AssetId, _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _transferred: Self::Balance, )

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Left: MutateHold<AccountId>, Right: MutateHold<AccountId, Balance = Left::Balance, Reason = Left::Reason>, Criterion: Convert<AssetKind, Either<(), Right::AssetId>>, AssetKind: AssetId, AccountId> Mutate<AccountId> for frame_support::traits::tokens::fungible::UnionOf<Left, Right, Criterion, AssetKind, AccountId>

source§

impl<Left: MutateHold<AccountId>, Right: MutateHold<AccountId, Balance = Left::Balance, Reason = Left::Reason>, Criterion: Convert<AssetKind, Either<Left::AssetId, Right::AssetId>>, AssetKind: AssetId, AccountId> Mutate<AccountId> for frame_support::traits::tokens::fungibles::UnionOf<Left, Right, Criterion, AssetKind, AccountId>