Trait frame_support::traits::tokens::fungible::MutateHold
source · [−]pub trait MutateHold<AccountId>: InspectHold<AccountId> + Transfer<AccountId> {
fn hold(who: &AccountId, amount: Self::Balance) -> DispatchResult;
fn release(
who: &AccountId,
amount: Self::Balance,
best_effort: bool
) -> Result<Self::Balance, DispatchError>;
fn transfer_held(
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
best_effort: bool,
on_held: bool
) -> Result<Self::Balance, DispatchError>;
}
Expand description
Trait for mutating a fungible asset which can be reserved.
Required methods
fn hold(who: &AccountId, amount: Self::Balance) -> DispatchResult
fn hold(who: &AccountId, amount: Self::Balance) -> DispatchResult
Hold some funds in an account.
Release up to amount
held funds in an account.
The actual amount released is returned with Ok
.
If best_effort
is true
, then the amount actually unreserved and returned as the inner
value of Ok
may be smaller than the amount
passed.
fn transfer_held(
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
best_effort: bool,
on_held: bool
) -> Result<Self::Balance, DispatchError>
fn transfer_held(
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
best_effort: bool,
on_held: 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.