Trait frame_support::traits::tokens::fungibles::MutateHold
source · pub trait MutateHold<AccountId>: InspectHold<AccountId> + Transfer<AccountId> {
// Required methods
fn hold(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance
) -> DispatchResult;
fn release(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance,
best_effort: bool
) -> Result<Self::Balance, DispatchError>;
fn transfer_held(
asset: Self::AssetId,
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
best_effort: bool,
on_hold: bool
) -> Result<Self::Balance, DispatchError>;
}
Expand description
Trait for mutating a set of named fungible assets which can be placed on hold.
Required Methods§
sourcefn hold(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance
) -> DispatchResult
fn hold( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> DispatchResult
Hold some funds in an account.
sourcefn release(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance,
best_effort: bool
) -> Result<Self::Balance, DispatchError>
fn release( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, best_effort: bool ) -> Result<Self::Balance, DispatchError>
Release some funds in an account from being on hold.
If best_effort
is true
, then the amount actually released and returned as the inner
value of Ok
may be smaller than the amount
passed.
sourcefn transfer_held(
asset: Self::AssetId,
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
best_effort: bool,
on_hold: bool
) -> Result<Self::Balance, DispatchError>
fn transfer_held( asset: Self::AssetId, source: &AccountId, dest: &AccountId, amount: Self::Balance, best_effort: bool, on_hold: bool ) -> Result<Self::Balance, DispatchError>
Transfer held funds into a destination account.
If on_hold
is true
, 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 best_effort
is true
, then an amount less than amount
may be transferred without
error.
The actual amount transferred is returned, or Err
in the case of error and nothing is
changed.