Struct pallet_assets::pallet::Pallet [−][src]
pub struct Pallet<T, I = ()>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations
pub fn adjust_extra(
id: T::AssetId,
who: impl Borrow<T::AccountId>
) -> Option<ExtraMutator<T, I>>
pub fn adjust_extra(
id: T::AssetId,
who: impl Borrow<T::AccountId>
) -> Option<ExtraMutator<T, I>>
Return the extra “sid-car” data for id
/who
, or None
if the account doesn’t exist.
Get the asset id
balance of who
.
Get the total supply of an asset id
.
pub fn create(
origin: OriginFor<T>,
id: T::AssetId,
admin: <T::Lookup as StaticLookup>::Source,
min_balance: T::Balance
) -> DispatchResult
pub fn create(
origin: OriginFor<T>,
id: T::AssetId,
admin: <T::Lookup as StaticLookup>::Source,
min_balance: T::Balance
) -> DispatchResult
Issue a new class of fungible assets from a public origin.
This new asset class has no assets initially and its owner is the origin.
The origin must be Signed and the sender must have sufficient funds free.
Funds of sender are reserved by AssetDeposit
.
Parameters:
id
: The identifier of the new asset. This must not be currently in use to identify an existing asset.admin
: The admin of this class of assets. The admin is the initial address of each member of the asset class’s admin team.min_balance
: The minimum balance of this new asset that any single account must have. If an account’s balance is reduced below this, then it collapses to zero.
Emits Created
event when successful.
Weight: O(1)
pub fn force_create(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
is_sufficient: bool,
min_balance: T::Balance
) -> DispatchResult
pub fn force_create(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
is_sufficient: bool,
min_balance: T::Balance
) -> DispatchResult
Issue a new class of fungible assets from a privileged origin.
This new asset class has no assets initially.
The origin must conform to ForceOrigin
.
Unlike create
, no funds are reserved.
id
: The identifier of the new asset. This must not be currently in use to identify an existing asset.owner
: The owner of this class of assets. The owner has full superuser permissions over this asset, but may later change and configure the permissions usingtransfer_ownership
andset_team
.min_balance
: The minimum balance of this new asset that any single account must have. If an account’s balance is reduced below this, then it collapses to zero.
Emits ForceCreated
event when successful.
Weight: O(1)
pub fn destroy(
origin: OriginFor<T>,
id: T::AssetId,
witness: DestroyWitness
) -> DispatchResultWithPostInfo
pub fn destroy(
origin: OriginFor<T>,
id: T::AssetId,
witness: DestroyWitness
) -> DispatchResultWithPostInfo
Destroy a class of fungible assets.
The origin must conform to ForceOrigin
or must be Signed and the sender must be the
owner of the asset id
.
id
: The identifier of the asset to be destroyed. This must identify an existing asset.
Emits Destroyed
event when successful.
NOTE: It can be helpful to first freeze an asset before destroying it so that you can provide accurate witness information and prevent users from manipulating state in a way that can make it harder to destroy.
Weight: O(c + p + a)
where:
c = (witness.accounts - witness.sufficients)
s = witness.sufficients
a = witness.approvals
pub fn mint(
origin: OriginFor<T>,
id: T::AssetId,
beneficiary: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn mint(
origin: OriginFor<T>,
id: T::AssetId,
beneficiary: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Mint assets of a particular class.
The origin must be Signed and the sender must be the Issuer of the asset id
.
id
: The identifier of the asset to have some amount minted.beneficiary
: The account to be credited with the minted assets.amount
: The amount of the asset to be minted.
Emits Issued
event when successful.
Weight: O(1)
Modes: Pre-existing balance of beneficiary
; Account pre-existence of beneficiary
.
pub fn burn(
origin: OriginFor<T>,
id: T::AssetId,
who: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn burn(
origin: OriginFor<T>,
id: T::AssetId,
who: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Reduce the balance of who
by as much as possible up to amount
assets of id
.
Origin must be Signed and the sender should be the Manager of the asset id
.
Bails with BalanceZero
if the who
is already dead.
id
: The identifier of the asset to have some amount burned.who
: The account to be debited from.amount
: The maximum amount by whichwho
’s balance should be reduced.
Emits Burned
with the actual amount burned. If this takes the balance to below the
minimum for the asset, then the amount burned is increased to take it to zero.
Weight: O(1)
Modes: Post-existence of who
; Pre & post Zombie-status of who
.
pub fn transfer(
origin: OriginFor<T>,
id: T::AssetId,
target: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn transfer(
origin: OriginFor<T>,
id: T::AssetId,
target: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Move some assets from the sender account to another.
Origin must be Signed.
id
: The identifier of the asset to have some amount transferred.target
: The account to be credited.amount
: The amount by which the sender’s balance of assets should be reduced andtarget
’s balance increased. The amount actually transferred may be slightly greater in the case that the transfer would otherwise take the sender balance above zero but below the minimum balance. Must be greater than zero.
Emits Transferred
with the actual amount transferred. If this takes the source balance
to below the minimum for the asset, then the amount transferred is increased to take it
to zero.
Weight: O(1)
Modes: Pre-existence of target
; Post-existence of sender; Account pre-existence of
target
.
pub fn transfer_keep_alive(
origin: OriginFor<T>,
id: T::AssetId,
target: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn transfer_keep_alive(
origin: OriginFor<T>,
id: T::AssetId,
target: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Move some assets from the sender account to another, keeping the sender account alive.
Origin must be Signed.
id
: The identifier of the asset to have some amount transferred.target
: The account to be credited.amount
: The amount by which the sender’s balance of assets should be reduced andtarget
’s balance increased. The amount actually transferred may be slightly greater in the case that the transfer would otherwise take the sender balance above zero but below the minimum balance. Must be greater than zero.
Emits Transferred
with the actual amount transferred. If this takes the source balance
to below the minimum for the asset, then the amount transferred is increased to take it
to zero.
Weight: O(1)
Modes: Pre-existence of target
; Post-existence of sender; Account pre-existence of
target
.
pub fn force_transfer(
origin: OriginFor<T>,
id: T::AssetId,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn force_transfer(
origin: OriginFor<T>,
id: T::AssetId,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Move some assets from one account to another.
Origin must be Signed and the sender should be the Admin of the asset id
.
id
: The identifier of the asset to have some amount transferred.source
: The account to be debited.dest
: The account to be credited.amount
: The amount by which thesource
’s balance of assets should be reduced anddest
’s balance increased. The amount actually transferred may be slightly greater in the case that the transfer would otherwise take thesource
balance above zero but below the minimum balance. Must be greater than zero.
Emits Transferred
with the actual amount transferred. If this takes the source balance
to below the minimum for the asset, then the amount transferred is increased to take it
to zero.
Weight: O(1)
Modes: Pre-existence of dest
; Post-existence of source
; Account pre-existence of
dest
.
pub fn freeze(
origin: OriginFor<T>,
id: T::AssetId,
who: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn freeze(
origin: OriginFor<T>,
id: T::AssetId,
who: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
Disallow further unprivileged transfers from an account.
Origin must be Signed and the sender should be the Freezer of the asset id
.
id
: The identifier of the asset to be frozen.who
: The account to be frozen.
Emits Frozen
.
Weight: O(1)
pub fn thaw(
origin: OriginFor<T>,
id: T::AssetId,
who: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn thaw(
origin: OriginFor<T>,
id: T::AssetId,
who: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
Allow unprivileged transfers from an account again.
Origin must be Signed and the sender should be the Admin of the asset id
.
id
: The identifier of the asset to be frozen.who
: The account to be unfrozen.
Emits Thawed
.
Weight: O(1)
Disallow further unprivileged transfers for the asset class.
Origin must be Signed and the sender should be the Freezer of the asset id
.
id
: The identifier of the asset to be frozen.
Emits Frozen
.
Weight: O(1)
Allow unprivileged transfers for the asset again.
Origin must be Signed and the sender should be the Admin of the asset id
.
id
: The identifier of the asset to be thawed.
Emits Thawed
.
Weight: O(1)
pub fn transfer_ownership(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn transfer_ownership(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
Change the Owner of an asset.
Origin must be Signed and the sender should be the Owner of the asset id
.
id
: The identifier of the asset.owner
: The new Owner of this asset.
Emits OwnerChanged
.
Weight: O(1)
pub fn set_team(
origin: OriginFor<T>,
id: T::AssetId,
issuer: <T::Lookup as StaticLookup>::Source,
admin: <T::Lookup as StaticLookup>::Source,
freezer: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn set_team(
origin: OriginFor<T>,
id: T::AssetId,
issuer: <T::Lookup as StaticLookup>::Source,
admin: <T::Lookup as StaticLookup>::Source,
freezer: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
Change the Issuer, Admin and Freezer of an asset.
Origin must be Signed and the sender should be the Owner of the asset id
.
id
: The identifier of the asset to be frozen.issuer
: The new Issuer of this asset.admin
: The new Admin of this asset.freezer
: The new Freezer of this asset.
Emits TeamChanged
.
Weight: O(1)
pub fn set_metadata(
origin: OriginFor<T>,
id: T::AssetId,
name: Vec<u8>,
symbol: Vec<u8>,
decimals: u8
) -> DispatchResult
pub fn set_metadata(
origin: OriginFor<T>,
id: T::AssetId,
name: Vec<u8>,
symbol: Vec<u8>,
decimals: u8
) -> DispatchResult
Set the metadata for an asset.
Origin must be Signed and the sender should be the Owner of the asset id
.
Funds of sender are reserved according to the formula:
MetadataDepositBase + MetadataDepositPerByte * (name.len + symbol.len)
taking into
account any already reserved funds.
id
: The identifier of the asset to update.name
: The user friendly name of this asset. Limited in length byStringLimit
.symbol
: The exchange symbol for this asset. Limited in length byStringLimit
.decimals
: The number of decimals this asset uses to represent one unit.
Emits MetadataSet
.
Weight: O(1)
Clear the metadata for an asset.
Origin must be Signed and the sender should be the Owner of the asset id
.
Any deposit is freed for the asset owner.
id
: The identifier of the asset to clear.
Emits MetadataCleared
.
Weight: O(1)
Force the metadata for an asset to some value.
Origin must be ForceOrigin.
Any deposit is left alone.
id
: The identifier of the asset to update.name
: The user friendly name of this asset. Limited in length byStringLimit
.symbol
: The exchange symbol for this asset. Limited in length byStringLimit
.decimals
: The number of decimals this asset uses to represent one unit.
Emits MetadataSet
.
Weight: O(N + S)
where N and S are the length of the name and symbol respectively.
Clear the metadata for an asset.
Origin must be ForceOrigin.
Any deposit is returned.
id
: The identifier of the asset to clear.
Emits MetadataCleared
.
Weight: O(1)
pub fn force_asset_status(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
issuer: <T::Lookup as StaticLookup>::Source,
admin: <T::Lookup as StaticLookup>::Source,
freezer: <T::Lookup as StaticLookup>::Source,
min_balance: T::Balance,
is_sufficient: bool,
is_frozen: bool
) -> DispatchResult
pub fn force_asset_status(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
issuer: <T::Lookup as StaticLookup>::Source,
admin: <T::Lookup as StaticLookup>::Source,
freezer: <T::Lookup as StaticLookup>::Source,
min_balance: T::Balance,
is_sufficient: bool,
is_frozen: bool
) -> DispatchResult
Alter the attributes of a given asset.
Origin must be ForceOrigin
.
id
: The identifier of the asset.owner
: The new Owner of this asset.issuer
: The new Issuer of this asset.admin
: The new Admin of this asset.freezer
: The new Freezer of this asset.min_balance
: The minimum balance of this new asset that any single account must have. If an account’s balance is reduced below this, then it collapses to zero.is_sufficient
: Whether a non-zero balance of this asset is deposit of sufficient value to account for the state bloat associated with its balance storage. If set totrue
, then non-zero balances may be stored without aconsumer
reference (and thus an ED in the Balances pallet or whatever else is used to control user-account state growth).is_frozen
: Whether this asset class is frozen except for permissioned/admin instructions.
Emits AssetStatusChanged
with the identity of the asset.
Weight: O(1)
pub fn approve_transfer(
origin: OriginFor<T>,
id: T::AssetId,
delegate: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn approve_transfer(
origin: OriginFor<T>,
id: T::AssetId,
delegate: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Approve an amount of asset for transfer by a delegated third-party account.
Origin must be Signed.
Ensures that ApprovalDeposit
worth of Currency
is reserved from signing account
for the purpose of holding the approval. If some non-zero amount of assets is already
approved from signing account to delegate
, then it is topped up or unreserved to
meet the right value.
NOTE: The signing account does not need to own amount
of assets at the point of
making this call.
id
: The identifier of the asset.delegate
: The account to delegate permission to transfer asset.amount
: The amount of asset that may be transferred bydelegate
. If there is already an approval in place, then this acts additively.
Emits ApprovedTransfer
on success.
Weight: O(1)
pub fn cancel_approval(
origin: OriginFor<T>,
id: T::AssetId,
delegate: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn cancel_approval(
origin: OriginFor<T>,
id: T::AssetId,
delegate: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
Cancel all of some asset approved for delegated transfer by a third-party account.
Origin must be Signed and there must be an approval in place between signer and
delegate
.
Unreserves any deposit previously reserved by approve_transfer
for the approval.
id
: The identifier of the asset.delegate
: The account delegated permission to transfer asset.
Emits ApprovalCancelled
on success.
Weight: O(1)
pub fn force_cancel_approval(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
delegate: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn force_cancel_approval(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
delegate: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
Cancel all of some asset approved for delegated transfer by a third-party account.
Origin must be either ForceOrigin or Signed origin with the signer being the Admin
account of the asset id
.
Unreserves any deposit previously reserved by approve_transfer
for the approval.
id
: The identifier of the asset.delegate
: The account delegated permission to transfer asset.
Emits ApprovalCancelled
on success.
Weight: O(1)
pub fn transfer_approved(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
destination: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn transfer_approved(
origin: OriginFor<T>,
id: T::AssetId,
owner: <T::Lookup as StaticLookup>::Source,
destination: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Transfer some asset balance from a previously delegated account to some third-party account.
Origin must be Signed and there must be an approval in place by the owner
to the
signer.
If the entire amount approved for transfer is transferred, then any deposit previously
reserved by approve_transfer
is unreserved.
id
: The identifier of the asset.owner
: The account which previously approved for a transfer of at leastamount
and from which the asset balance will be withdrawn.destination
: The account to which the asset balance ofamount
will be transferred.amount
: The amount of assets to transfer.
Emits TransferredApproved
on success.
Weight: O(1)
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.
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 asset
balance of who
.
fn reducible_balance(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
keep_alive: bool
) -> Self::Balance
fn reducible_balance(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
keep_alive: bool
) -> Self::Balance
Get the maximum amount of asset
that who
can withdraw/transfer successfully.
fn can_deposit(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> DepositConsequence
fn can_deposit(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> DepositConsequence
Returns true
if the asset
balance of who
may be increased by amount
.
fn can_withdraw(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
fn can_withdraw(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
Returns Failed
if the asset
balance of who
may not be decreased by amount
, otherwise
the consequence. Read more
Run integrity test. Read more
fn mint_into(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> DispatchResult
fn mint_into(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> DispatchResult
Attempt to increase the asset
balance of who
by amount
. Read more
fn burn_from(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn burn_from(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Attempt to reduce the asset
balance of who
by amount
. Read more
fn slash(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn slash(
asset: Self::AssetId,
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Attempt to reduce the asset
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
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
Get the item, or its default if it doesn’t yet exist; we make no distinction between the two. Read more
Maybe mutate the item only if an Ok
value is returned from f
. Do nothing if an Err
is
returned. It is removed or reset to default value if it has been mutated to None
Read more
Mutate the item, removing or resetting to default value if it has been mutated to None
. Read more
Set the asset
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 of asset
to amount
.
fn decrease_balance(
asset: T::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn decrease_balance(
asset: T::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Reduce the asset
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 asset
balance of who
by the most that is possible, up to amount
. Read more
fn increase_balance(
asset: T::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn increase_balance(
asset: T::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Increase the asset
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
pub fn slash(
asset: <U as Inspect<AccountId>>::AssetId,
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> (Imbalance<<U as Inspect<AccountId>>::AssetId, <U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>, <U as Inspect<AccountId>>::Balance)
pub fn slash(
asset: <U as Inspect<AccountId>>::AssetId,
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> (Imbalance<<U as Inspect<AccountId>>::AssetId, <U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>, <U as Inspect<AccountId>>::Balance)
Deducts up to value
from the combined balance of who
, preferring to deduct from the
free balance. This function cannot fail. Read more
Mints exactly value
into the asset
account of who
. Read more
Removes value
free asset
balance from who
account if possible. Read more
fn pair(
asset: Self::AssetId,
amount: Self::Balance
) -> (Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>)
fn pair(
asset: Self::AssetId,
amount: Self::Balance
) -> (Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::AssetId, 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::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
) -> Result<(), Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>>
fn resolve(
who: &AccountId,
credit: Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
) -> Result<(), Imbalance<Self::AssetId, 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::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>
fn settle(
who: &AccountId,
debt: Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::AssetId, 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
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,