Struct pallet_balances::pallet::Pallet [−][src]
pub struct Pallet<T, I = ()>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations
pub fn transfer(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
Transfer some liquid free balance to another account.
transfer
will set the FreeBalance
of the sender and receiver.
It will decrease the total issuance of the system by the TransferFee
.
If the sender’s account is below the existential deposit as a result
of the transfer, the account will be reaped.
The dispatch origin for this call must be Signed
by the transactor.
- Dependent on arguments but not critical, given proper implementations for input config types. See related functions below.
- It contains a limited number of reads and writes internally and no complex computation.
Related functions:
ensure_can_withdraw
is always called internally but has a bounded complexity.- Transferring balances to accounts that did not exist before will cause
T::OnNewAccount::on_new_account
to be called. - Removing enough funds from an account will trigger
T::DustRemoval::on_unbalanced
. transfer_keep_alive
works the same way astransfer
, but has an additional check that the transfer will not kill the origin account.
- Base Weight: 73.64 µs, worst case scenario (account created, account removed)
- DB Weight: 1 Read and 1 Write to destination account
- Origin account is already in memory, so no DB operations for them.
pub fn set_balance(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
new_free: T::Balance,
new_reserved: T::Balance
) -> DispatchResultWithPostInfo
pub fn set_balance(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
new_free: T::Balance,
new_reserved: T::Balance
) -> DispatchResultWithPostInfo
Set the balances of a given account.
This will alter FreeBalance
and ReservedBalance
in storage. it will
also decrease the total issuance of the system (TotalIssuance
).
If the new free or reserved balance is below the existential deposit,
it will reset the account nonce (frame_system::AccountNonce
).
The dispatch origin for this call is root
.
- Independent of the arguments.
- Contains a limited number of reads and writes.
- Base Weight:
- Creating: 27.56 µs
- Killing: 35.11 µs
- DB Weight: 1 Read, 1 Write to
who
pub fn force_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn force_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer_keep_alive(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer_keep_alive(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer_all(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
keep_alive: bool
) -> DispatchResultWithPostInfo
pub fn transfer_all(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
keep_alive: bool
) -> DispatchResultWithPostInfo
Transfer the entire transferable balance from the caller account.
NOTE: This function only attempts to transfer transferable balances. This means that
any locked, reserved, or existential deposits (when keep_alive
is true
), will not be
transferred by this function. To ensure that this function results in a killed account,
you might need to prepare the account by removing any reference counters, storage
deposits, etc…
The dispatch origin of this call must be Signed.
dest
: The recipient of the transfer.keep_alive
: A boolean to determine if thetransfer_all
operation should send all of the funds the account has, causing the sender account to be killed (false), or transfer everything except at least the existential deposit, which will guarantee to keep the sender account alive (true). #- O(1). Just like transfer, but reading the user’s transferable balance first. #
The total units issued in the system.
pub fn locks<KArg>(
k: KArg
) -> WeakBoundedVec<BalanceLock<T::Balance>, T::MaxLocks> where
KArg: EncodeLike<T::AccountId>,
pub fn locks<KArg>(
k: KArg
) -> WeakBoundedVec<BalanceLock<T::Balance>, T::MaxLocks> where
KArg: EncodeLike<T::AccountId>,
Any liquidity locks on some account balances. NOTE: Should only be accessed when setting, changing and freeing a lock.
pub fn reserves<KArg>(
k: KArg
) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves> where
KArg: EncodeLike<T::AccountId>,
pub fn reserves<KArg>(
k: KArg
) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves> where
KArg: EncodeLike<T::AccountId>,
Named reserves on some account balances.
Get the free balance of an account.
Get the balance of an account that can be used for transfers, reservations, or any other
non-locking, non-transaction-fee activity. Will be at most free_balance
.
Get the balance of an account that can be used for paying transaction fees (not tipping,
or any other kind of fees, though). Will be at most free_balance
.
Get the reserved balance of an account.
pub fn mutate_account<R>(
who: &T::AccountId,
f: impl FnOnce(&mut AccountData<T::Balance>) -> R
) -> Result<R, DispatchError>
pub fn mutate_account<R>(
who: &T::AccountId,
f: impl FnOnce(&mut AccountData<T::Balance>) -> R
) -> Result<R, DispatchError>
Mutate an account to some new value, or delete it entirely with None
. Will enforce
ExistentialDeposit
law, annulling the account as needed.
NOTE: Doesn’t do any preparatory work for creating a new account, so should only be used when it is known that the account already exists.
NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that the caller will do this.
Trait Implementations
impl<T: Config<I>, I: 'static> Benchmarking<BenchmarkResults> for Pallet<T, I> where
T: Config,
impl<T: Config<I>, I: 'static> Benchmarking<BenchmarkResults> for Pallet<T, I> where
T: Config,
Get the benchmarks available for this pallet. Generally there is one benchmark per extrinsic, so these are sometimes just called “extrinsics”. Read more
fn run_benchmark(
extrinsic: &[u8],
c: &[(BenchmarkParameter, u32)],
whitelist: &[TrackedStorageKey],
verify: bool,
internal_repeats: u32
) -> Result<Vec<BenchmarkResults>, &'static str>
fn run_benchmark(
extrinsic: &[u8],
c: &[(BenchmarkParameter, u32)],
whitelist: &[TrackedStorageKey],
verify: bool,
internal_repeats: u32
) -> Result<Vec<BenchmarkResults>, &'static str>
Run the benchmarks for this pallet.
Slash a target account who
, returning the negative imbalance created and any left over
amount that could not be slashed.
Is a no-op if value
to be slashed is zero or the account does not exist.
NOTE: slash()
prefers free balance, but assumes that reserve balance can be drawn
from in extreme circumstances. can_slash()
should be used prior to slash()
to avoid
having to draw from reserved funds, however we err on the side of punishment if things are
inconsistent or can_slash
wasn’t used appropriately.
fn deposit_into_existing(
who: &T::AccountId,
value: Self::Balance
) -> Result<Self::PositiveImbalance, DispatchError>
fn deposit_into_existing(
who: &T::AccountId,
value: Self::Balance
) -> Result<Self::PositiveImbalance, DispatchError>
Deposit some value
into the free balance of an existing target account who
.
Is a no-op if the value
to be deposited is zero.
Deposit some value
into the free balance of who
, possibly creating a new account.
This function is a no-op if:
- the
value
to be deposited is zero; or - the
value
to be deposited is less than the required ED and the account does not yet exist; or - the deposit would necessitate the account to exist and there are no provider references; or
value
is so large it would cause the balance ofwho
to overflow.
fn withdraw(
who: &T::AccountId,
value: Self::Balance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<Self::NegativeImbalance, DispatchError>
fn withdraw(
who: &T::AccountId,
value: Self::Balance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<Self::NegativeImbalance, DispatchError>
Withdraw some free balance from an account, respecting existence requirements.
Is a no-op if value to be withdrawn is zero.
fn make_free_balance_be(
who: &T::AccountId,
value: Self::Balance
) -> SignedImbalance<Self::Balance, Self::PositiveImbalance>
fn make_free_balance_be(
who: &T::AccountId,
value: Self::Balance
) -> SignedImbalance<Self::Balance, Self::PositiveImbalance>
Force the new free balance of a target account who
to some new value balance
.
type PositiveImbalance = PositiveImbalance<T, I>
type PositiveImbalance = PositiveImbalance<T, I>
The opaque token type for an imbalance. This is returned by unbalanced operations and must be dealt with. It may be dropped but cannot be cloned. Read more
type NegativeImbalance = NegativeImbalance<T, I>
type NegativeImbalance = NegativeImbalance<T, I>
The opaque token type for an imbalance. This is returned by unbalanced operations and must be dealt with. It may be dropped but cannot be cloned. Read more
The combined balance of who
.
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. Read more
The total amount of issuance in the system.
The minimum balance any single account may have. This is equivalent to the Balances
module’s ExistentialDeposit
. Read more
Reduce the total issuance by amount
and return the according imbalance. The imbalance will
typically be used to reduce an account by the same amount with e.g. settle
. Read more
Increase the total issuance by amount
and return the according imbalance. The imbalance
will typically be used to increase an account by the same amount with e.g.
resolve_into_existing
or resolve_creating
. Read more
The ‘free’ balance of a given account. Read more
fn ensure_can_withdraw(
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
new_balance: T::Balance
) -> DispatchResult
fn ensure_can_withdraw(
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
new_balance: T::Balance
) -> DispatchResult
Returns Ok
iff the account is able to make a withdrawal of the given amount
for the given reason. Basically, it’s just a dry-run of withdraw
. Read more
fn transfer(
transactor: &T::AccountId,
dest: &T::AccountId,
value: Self::Balance,
existence_requirement: ExistenceRequirement
) -> DispatchResult
fn transfer(
transactor: &T::AccountId,
dest: &T::AccountId,
value: Self::Balance,
existence_requirement: ExistenceRequirement
) -> DispatchResult
Transfer some liquid free balance to another staker. Read more
Produce a pair of imbalances that cancel each other out exactly. Read more
fn resolve_into_existing(
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
fn resolve_into_existing(
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
Similar to deposit_creating, only accepts a NegativeImbalance
and returns nothing on
success. Read more
Similar to deposit_creating, only accepts a NegativeImbalance
and returns nothing on
success. Read more
fn settle(
who: &AccountId,
value: Self::PositiveImbalance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<(), Self::PositiveImbalance>
fn settle(
who: &AccountId,
value: Self::PositiveImbalance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<(), Self::PositiveImbalance>
Similar to withdraw, only accepts a PositiveImbalance
and returns nothing on success.
Returns the current storage version as supported by the pallet.
Returns the on-chain storage version of the pallet as stored in the storage.
The block is being finalized. Implement to have something happen.
This will be run when the block is being finalized (before on_finalize
).
Implement to have something happen using the remaining weight.
Will not fire if the remaining weight is 0.
Return the weight used, the hook will subtract it from current weight used
and pass the result to the next on_idle
hook if it exists. Read more
The block is being initialized. Implement to have something happen. Read more
Perform a module upgrade. Read more
Execute some pre-checks prior to a runtime upgrade. Read more
Execute some post-checks after a runtime upgrade. Read more
Implementing this function on a module allows you to perform long-running tasks that make (by default) validators generate transactions that feed results of those long-running computations back on chain. Read more
Run integrity test. Read more
The total amount of issuance in the system.
The minimum balance any single account may have.
Get the maximum amount that who
can withdraw/transfer successfully.
Returns true
if the balance of who
may be increased by amount
.
fn can_withdraw(
who: &T::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
fn can_withdraw(
who: &T::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
Returns Failed
if the balance of who
may not be decreased by amount
, otherwise
the consequence. Read more
Run integrity test. Read more
impl<T: Config<I>, I: 'static> LockableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> LockableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
type Moment = T::BlockNumber
type Moment = T::BlockNumber
The quantity used to denote time; usually just a BlockNumber
.
fn set_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
fn set_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
Create a new balance lock on account who
. Read more
fn extend_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
fn extend_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
Changes a balance lock (selected by id
) so that it becomes less liquid in all
parameters or creates a new one if it does not exist. Read more
Remove an existing lock.
Increase the balance of who
by exactly amount
, minting new tokens. If that isn’t
possible then an Err
is returned and nothing is changed. Read more
Decrease the balance of who
by at least amount
, possibly slightly more in the case of
minimum_balance requirements, burning the tokens. If that isn’t possible then an Err
is
returned and nothing is changed. If successful, the amount of tokens reduced is returned. Read more
Attempt to reduce the balance of who
by as much as possible up to amount
, and possibly
slightly more due to minimum_balance requirements. If no decrease is possible then an Err
is returned and nothing is changed. If successful, the amount of tokens reduced is returned. Read more
Hold some funds in an account.
Release up to amount
held funds in an account. Read more
impl<T: Config<I>, I: 'static> NamedReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> NamedReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
fn reserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> DispatchResult
fn reserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> DispatchResult
Move value
from the free balance from who
to a named reserve balance.
Is a no-op if value to be reserved is zero.
fn unreserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
fn unreserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
Unreserve some funds, returning any amount that was unable to be unreserved.
Is a no-op if the value to be unreserved is zero.
fn slash_reserved_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
fn slash_reserved_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
Slash from reserved balance, returning the negative imbalance created, and any amount that was unable to be slashed.
Is a no-op if the value to be slashed is zero.
fn repatriate_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status
) -> Result<Self::Balance, DispatchError>
Move the 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
.
Is a no-op if:
- the value to be moved is zero; or
- the
slashed
id equal tobeneficiary
and thestatus
isReserved
.
type ReserveIdentifier = T::ReserveIdentifier
type ReserveIdentifier = T::ReserveIdentifier
An identifier for a reserve. Used for disambiguating different reserves so that they can be individually replaced or removed. Read more
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
fn ensure_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Result<(), DispatchError>
fn ensure_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Result<(), DispatchError>
Ensure the reserved balance is equal to value
. Read more
Unreserve all the named reserved balances, returning unreserved amount. Read more
fn slash_all_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId
) -> Self::NegativeImbalance
fn slash_all_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId
) -> Self::NegativeImbalance
Slash all the reserved balance, returning the negative imbalance created. Read more
fn repatriate_all_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &AccountId,
beneficiary: &AccountId,
status: BalanceStatus
) -> Result<(), DispatchError>
fn repatriate_all_reserved_named(
id: &Self::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
This function is being called after every block import (when fully synced). Read more
The block is being finalized. Implement to have something happen. Read more
Something that should happen at genesis.
The block is being finalized.
Implement to have something happen in case there is leftover weight.
Check the passed remaining_weight
to make sure it is high enough to allow for
your pallet’s extra computation. Read more
The block is being initialized. Implement to have something happen. Read more
impl<T: Config<I>, I: 'static> ReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> ReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
Check if who
can reserve value
from their free balance.
Always true
if value to be reserved is zero.
Move value
from the free balance from who
to their reserved balance.
Is a no-op if value to be reserved is zero.
Unreserve some funds, returning any amount that was unable to be unreserved.
Is a no-op if the value to be unreserved is zero or the account does not exist.
fn slash_reserved(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
fn slash_reserved(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
Slash from reserved balance, returning the negative imbalance created, and any amount that was unable to be slashed.
Is a no-op if the value to be slashed is zero or the account does not exist.
fn repatriate_reserved(
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved(
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status
) -> Result<Self::Balance, DispatchError>
Move the reserved balance of one account into the balance of another, according to status
.
Is a no-op if:
- the value to be moved is zero; or
- the
slashed
id equal tobeneficiary
and thestatus
isReserved
.
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
Set the balance of who
to amount
. If this cannot be done for some reason (e.g.
because the account cannot be created or an overflow) then an Err
is returned. Read more
Set the total issuance to amount
.
fn decrease_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn decrease_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Reduce the balance of who
by amount
. If it cannot be reduced by that amount for
some reason, return Err
and don’t reduce it at all. If Ok, return the imbalance. Read more
Reduce the balance of who
by the most that is possible, up to amount
. Read more
fn increase_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn increase_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Increase the balance of who
by amount
. If it cannot be increased by that amount
for some reason, return Err
and don’t increase it at all. If Ok, return the imbalance. Read more
Auto Trait Implementations
impl<T, I> RefUnwindSafe for Pallet<T, I> where
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> UnwindSafe for Pallet<T, I> where
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
type OnDropCredit = DecreaseIssuance<AccountId, U>
type OnDropCredit = DecreaseIssuance<AccountId, U>
The type for managing what happens when an instance of Credit
is dropped without being
used. Read more
type OnDropDebt = IncreaseIssuance<AccountId, U>
type OnDropDebt = IncreaseIssuance<AccountId, U>
The type for managing what happens when an instance of Debt
is dropped without being used.
Reduce the total issuance by amount
and return the according imbalance. The imbalance will
typically be used to reduce an account by the same amount with e.g. settle
. Read more
Increase the total issuance by amount
and return the according imbalance. The imbalance
will typically be used to increase an account by the same amount with e.g.
resolve_into_existing
or resolve_creating
. Read more
Deducts up to value
from the combined balance of who
. This function cannot fail. Read more
Mints exactly value
into the account of who
. Read more
Removes value
balance from who
account if possible. Read more
fn pair(
amount: Self::Balance
) -> (Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>)
fn pair(
amount: Self::Balance
) -> (Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>)
Produce a pair of imbalances that cancel each other out exactly. Read more
fn resolve(
who: &AccountId,
credit: Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
) -> Result<(), Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>>
fn resolve(
who: &AccountId,
credit: Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
) -> Result<(), Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>>
The balance of who
is increased in order to counter credit
. If the whole of credit
cannot be countered, then nothing is changed and the original credit
is returned in an
Err
. Read more
fn settle(
who: &AccountId,
debt: Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
) -> Result<Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>
fn settle(
who: &AccountId,
debt: Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
) -> Result<Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>
The balance of who
is decreased in order to counter debt
. If the whole of debt
cannot be countered, then nothing is changed and the original debt
is returned in an
Err
. Read more
impl<AccountId, T> BalancedHold<AccountId> for T where
T: Balanced<AccountId> + MutateHold<AccountId>,
impl<AccountId, T> BalancedHold<AccountId> for T where
T: Balanced<AccountId> + MutateHold<AccountId>,
Reduce the balance of some funds on hold in an account. Read more
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Generate a storage key unique to this runtime upgrade. Read more
Get temporary storage data written by Self::set_temp_storage
. Read more
Write some temporary data to a specific storage that can be read (potentially in
post-upgrade hook) via Self::get_temp_storage
. Read more
impl<T> PalletVersionToStorageVersionHelper for T where
T: GetStorageVersion + PalletInfoAccess,
impl<T> PalletVersionToStorageVersionHelper for T where
T: GetStorageVersion + PalletInfoAccess,
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
pub fn vzip(self) -> V
impl<T> MaybeDebug for T where
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,