Struct orml_currencies::BasicCurrencyAdapter
source · pub struct BasicCurrencyAdapter<T, Currency, Amount, Moment>(/* private fields */);
Expand description
Adapt other currency traits implementation to BasicCurrency
.
Trait Implementations§
source§impl<T, AccountId, Currency, Amount, Moment> BasicCurrency<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletCurrency<AccountId>,
T: Config,
impl<T, AccountId, Currency, Amount, Moment> BasicCurrency<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletCurrency<AccountId>,
T: Config,
source§fn minimum_balance() -> Self::Balance
fn minimum_balance() -> Self::Balance
Existential deposit.
source§fn total_issuance() -> Self::Balance
fn total_issuance() -> Self::Balance
The total amount of issuance.
source§fn total_balance(who: &AccountId) -> Self::Balance
fn total_balance(who: &AccountId) -> Self::Balance
The combined balance of
who
.source§fn free_balance(who: &AccountId) -> Self::Balance
fn free_balance(who: &AccountId) -> Self::Balance
The free balance of
who
.source§fn ensure_can_withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult
fn ensure_can_withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult
A dry-run of
withdraw
. Returns Ok
iff the account is able to make a
withdrawal of the given amount.source§fn transfer(
from: &AccountId,
to: &AccountId,
amount: Self::Balance
) -> DispatchResult
fn transfer( from: &AccountId, to: &AccountId, amount: Self::Balance ) -> DispatchResult
Transfer some amount from one account to another.
source§fn deposit(who: &AccountId, amount: Self::Balance) -> DispatchResult
fn deposit(who: &AccountId, amount: Self::Balance) -> DispatchResult
Add
amount
to the balance of who
and increase total issuance.source§fn withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult
fn withdraw(who: &AccountId, amount: Self::Balance) -> DispatchResult
Remove
amount
from the balance of who
and reduce total issuance.source§impl<T, AccountId, Currency, Amount, Moment> BasicCurrencyExtended<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Amount: Signed + TryInto<<Currency as PalletCurrency<AccountId>>::Balance> + TryFrom<<Currency as PalletCurrency<AccountId>>::Balance> + SimpleArithmetic + Codec + Copy + MaybeSerializeDeserialize + Debug + Default + MaxEncodedLen,
Currency: PalletCurrency<AccountId>,
T: Config,
impl<T, AccountId, Currency, Amount, Moment> BasicCurrencyExtended<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Amount: Signed + TryInto<<Currency as PalletCurrency<AccountId>>::Balance> + TryFrom<<Currency as PalletCurrency<AccountId>>::Balance> + SimpleArithmetic + Codec + Copy + MaybeSerializeDeserialize + Debug + Default + MaxEncodedLen,
Currency: PalletCurrency<AccountId>,
T: Config,
source§fn update_balance(who: &AccountId, by_amount: Self::Amount) -> DispatchResult
fn update_balance(who: &AccountId, by_amount: Self::Amount) -> DispatchResult
Add or remove abs(
by_amount
) from the balance of who
. If positive
by_amount
, do add, else do remove.source§impl<T, AccountId, Currency, Amount, Moment> BasicLockableCurrency<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletLockableCurrency<AccountId>,
T: Config,
impl<T, AccountId, Currency, Amount, Moment> BasicLockableCurrency<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletLockableCurrency<AccountId>,
T: Config,
source§fn set_lock(
lock_id: LockIdentifier,
who: &AccountId,
amount: Self::Balance
) -> DispatchResult
fn set_lock( lock_id: LockIdentifier, who: &AccountId, amount: Self::Balance ) -> DispatchResult
Create a new balance lock on account
who
. Read moresource§fn extend_lock(
lock_id: LockIdentifier,
who: &AccountId,
amount: Self::Balance
) -> DispatchResult
fn extend_lock( lock_id: LockIdentifier, who: &AccountId, amount: Self::Balance ) -> DispatchResult
Changes a balance lock (selected by
lock_id
) so that it becomes less
liquid in all parameters or creates a new one if it does not exist. Read moresource§fn remove_lock(lock_id: LockIdentifier, who: &AccountId) -> DispatchResult
fn remove_lock(lock_id: LockIdentifier, who: &AccountId) -> DispatchResult
Remove an existing lock.
source§impl<T, AccountId, Currency, Amount, Moment> BasicReservableCurrency<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletReservableCurrency<AccountId>,
T: Config,
impl<T, AccountId, Currency, Amount, Moment> BasicReservableCurrency<AccountId> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletReservableCurrency<AccountId>,
T: Config,
source§fn can_reserve(who: &AccountId, value: Self::Balance) -> bool
fn can_reserve(who: &AccountId, value: Self::Balance) -> bool
Same result as
reserve(who, value)
(but without the side-effects)
assuming there are no balance changes in the meantime.source§fn slash_reserved(who: &AccountId, value: Self::Balance) -> Self::Balance
fn slash_reserved(who: &AccountId, value: Self::Balance) -> Self::Balance
source§fn reserved_balance(who: &AccountId) -> Self::Balance
fn reserved_balance(who: &AccountId) -> Self::Balance
The amount of the balance of a given account that is externally
reserved; this can still get slashed, but gets slashed last of all. Read more
source§fn reserve(who: &AccountId, value: Self::Balance) -> DispatchResult
fn reserve(who: &AccountId, value: Self::Balance) -> DispatchResult
Moves
value
from balance to reserved balance. Read moresource§fn unreserve(who: &AccountId, value: Self::Balance) -> Self::Balance
fn unreserve(who: &AccountId, value: Self::Balance) -> Self::Balance
Moves up to
value
from reserved balance to free balance. This function
cannot fail. Read moresource§fn repatriate_reserved(
slashed: &AccountId,
beneficiary: &AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved( slashed: &AccountId, beneficiary: &AccountId, value: Self::Balance, status: BalanceStatus ) -> Result<Self::Balance, DispatchError>
Moves up to
value
from reserved balance of account slashed
to
balance of account beneficiary
. beneficiary
must exist for this to
succeed. If it does not, Err
will be returned. Funds will be placed in
either the free
balance or the reserved
balance, depending on the
status
. Read moresource§impl<T, AccountId, Currency, Amount, Moment, ReserveIdentifier> NamedBasicReservableCurrency<AccountId, ReserveIdentifier> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletNamedReservableCurrency<AccountId, ReserveIdentifier = ReserveIdentifier>,
T: Config,
impl<T, AccountId, Currency, Amount, Moment, ReserveIdentifier> NamedBasicReservableCurrency<AccountId, ReserveIdentifier> for BasicCurrencyAdapter<T, Currency, Amount, Moment>where
Currency: PalletNamedReservableCurrency<AccountId, ReserveIdentifier = ReserveIdentifier>,
T: Config,
source§fn slash_reserved_named(
id: &ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Self::Balance
fn slash_reserved_named( id: &ReserveIdentifier, who: &AccountId, value: Self::Balance ) -> Self::Balance
source§fn reserved_balance_named(
id: &ReserveIdentifier,
who: &AccountId
) -> Self::Balance
fn reserved_balance_named( id: &ReserveIdentifier, who: &AccountId ) -> Self::Balance
The amount of the balance of a given account that is externally
reserved; this can still get slashed, but gets slashed last of all. Read more
source§fn reserve_named(
id: &ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> DispatchResult
fn reserve_named( id: &ReserveIdentifier, who: &AccountId, value: Self::Balance ) -> DispatchResult
Moves
value
from balance to reserved balance. Read moresource§fn unreserve_named(
id: &ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Self::Balance
fn unreserve_named( id: &ReserveIdentifier, who: &AccountId, value: Self::Balance ) -> Self::Balance
Moves up to
value
from reserved balance to free balance. This function
cannot fail. Read moresource§fn repatriate_reserved_named(
id: &ReserveIdentifier,
slashed: &AccountId,
beneficiary: &AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved_named( id: &ReserveIdentifier, slashed: &AccountId, beneficiary: &AccountId, value: Self::Balance, status: BalanceStatus ) -> Result<Self::Balance, DispatchError>
Moves up to
value
from reserved balance of account slashed
to
balance of account beneficiary
. beneficiary
must exist for this to
succeed. If it does not, Err
will be returned. Funds will be placed in
either the free
balance or the reserved
balance, depending on the
status
. Read moresource§fn ensure_reserved_named(
id: &ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Result<(), DispatchError>
fn ensure_reserved_named( id: &ReserveIdentifier, who: &AccountId, value: Self::Balance ) -> Result<(), DispatchError>
Ensure the reserved balance is equal to
value
. Read moresource§fn unreserve_all_named(id: &ReserveIdentifier, who: &AccountId) -> Self::Balance
fn unreserve_all_named(id: &ReserveIdentifier, who: &AccountId) -> Self::Balance
Unreserve all the named reserved balances, returning unreserved amount. Read more
source§fn slash_all_reserved_named(
id: &ReserveIdentifier,
who: &AccountId
) -> Self::Balance
fn slash_all_reserved_named( id: &ReserveIdentifier, who: &AccountId ) -> Self::Balance
Slash all the reserved balance, returning the negative imbalance
created. Read more
source§fn repatriate_all_reserved_named(
id: &ReserveIdentifier,
slashed: &AccountId,
beneficiary: &AccountId,
status: BalanceStatus
) -> Result<(), DispatchError>
fn repatriate_all_reserved_named( id: &ReserveIdentifier, slashed: &AccountId, beneficiary: &AccountId, status: BalanceStatus ) -> Result<(), DispatchError>
Move all the named reserved balance of one account into the balance of
another, according to
status
. If status
is Reserved
, the balance
will be reserved with given id
. Read moreAuto Trait Implementations§
impl<T, Currency, Amount, Moment> Freeze for BasicCurrencyAdapter<T, Currency, Amount, Moment>
impl<T, Currency, Amount, Moment> RefUnwindSafe for BasicCurrencyAdapter<T, Currency, Amount, Moment>
impl<T, Currency, Amount, Moment> Send for BasicCurrencyAdapter<T, Currency, Amount, Moment>
impl<T, Currency, Amount, Moment> Sync for BasicCurrencyAdapter<T, Currency, Amount, Moment>
impl<T, Currency, Amount, Moment> Unpin for BasicCurrencyAdapter<T, Currency, Amount, Moment>
impl<T, Currency, Amount, Moment> UnwindSafe for BasicCurrencyAdapter<T, Currency, Amount, Moment>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.