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,

§

type Balance = <Currency as Currency<AccountId>>::Balance

The balance of an account.
source§

fn minimum_balance() -> Self::Balance

Existential deposit.
source§

fn total_issuance() -> Self::Balance

The total amount of issuance.
source§

fn total_balance(who: &AccountId) -> Self::Balance

The combined balance of who.
source§

fn free_balance(who: &AccountId) -> Self::Balance

The free balance of who.
source§

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

Transfer some amount from one account to another.
source§

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

Remove amount from the balance of who and reduce total issuance.
source§

fn can_slash(who: &AccountId, amount: Self::Balance) -> bool

Same result as slash(who, value) (but without the side-effects) assuming there are no balance changes in the meantime and only the reserved balance is not taken into account.
source§

fn slash(who: &AccountId, amount: Self::Balance) -> Self::Balance

Deduct the balance of who by up to amount. Read more
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,

§

type Amount = Amount

The signed type for balance related operations, typically signed int.
source§

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,

§

type Moment = Moment

The quantity used to denote time; usually just a BlockNumber.
source§

fn set_lock( lock_id: LockIdentifier, who: &AccountId, amount: Self::Balance ) -> DispatchResult

Create a new balance lock on account who. Read more
source§

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 more
source§

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,

source§

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

Deducts up to value from reserved balance of who. This function cannot fail. Read more
source§

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

Moves value from balance to reserved balance. Read more
source§

fn unreserve(who: &AccountId, value: Self::Balance) -> Self::Balance

Moves up to value from reserved balance to free balance. This function cannot fail. Read more
source§

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 more
source§

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

Deducts up to value from reserved balance of who. This function cannot fail. Read more
source§

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

Moves value from balance to reserved balance. Read more
source§

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 more
source§

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 more
source§

fn ensure_reserved_named( id: &ReserveIdentifier, who: &AccountId, value: Self::Balance ) -> Result<(), DispatchError>

Ensure the reserved balance is equal to value. Read more
source§

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

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>

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 more

Auto 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>
where T: RefUnwindSafe, Currency: RefUnwindSafe, Amount: RefUnwindSafe, Moment: RefUnwindSafe,

§

impl<T, Currency, Amount, Moment> Send for BasicCurrencyAdapter<T, Currency, Amount, Moment>
where T: Send, Currency: Send, Amount: Send, Moment: Send,

§

impl<T, Currency, Amount, Moment> Sync for BasicCurrencyAdapter<T, Currency, Amount, Moment>
where T: Sync, Currency: Sync, Amount: Sync, Moment: Sync,

§

impl<T, Currency, Amount, Moment> Unpin for BasicCurrencyAdapter<T, Currency, Amount, Moment>
where T: Unpin, Currency: Unpin, Amount: Unpin, Moment: Unpin,

§

impl<T, Currency, Amount, Moment> UnwindSafe for BasicCurrencyAdapter<T, Currency, Amount, Moment>
where T: UnwindSafe, Currency: UnwindSafe, Amount: UnwindSafe, Moment: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedConversion for T

source§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
source§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> Into2<U> for T
where U: From2<T>,

source§

fn into2(self) -> U

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
source§

impl<T, U> IntoKey<U> for T
where U: FromKey<T>,

source§

fn into_key(self) -> U

source§

impl<T> IsType<T> for T

source§

fn from_ref(t: &T) -> &T

Cast reference.
source§

fn into_ref(&self) -> &T

Cast reference.
source§

fn from_mut(t: &mut T) -> &mut T

Cast mutable reference.
source§

fn into_mut(&mut self) -> &mut T

Cast mutable reference.
source§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
source§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto2<U> for T
where U: TryFrom2<T>,

§

type Error = <U as TryFrom2<T>>::Error

source§

fn try_into2(self) -> Result<U, <U as TryFrom2<T>>::Error>

source§

impl<T, U> TryIntoKey<U> for T
where U: TryFromKey<T>,

§

type Error = <U as TryFromKey<T>>::Error

source§

fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>

source§

impl<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

impl<T, S> UniqueSaturatedInto<T> for S
where T: Bounded, S: TryInto<T>,

source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T

source§

impl<T> MaybeRefUnwindSafe for T
where T: RefUnwindSafe,