Struct orml_tokens::module::Pallet
source · pub struct Pallet<T>(/* private fields */);
Expand description
The Pallet
struct, the main type that implements traits and standalone
functions within the pallet.
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn transfer(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
currency_id: T::CurrencyId,
amount: T::Balance
) -> DispatchResult
pub fn transfer( origin: OriginFor<T>, dest: <T::Lookup as StaticLookup>::Source, currency_id: T::CurrencyId, amount: T::Balance ) -> DispatchResult
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.
dest
: The recipient of the transfer.currency_id
: currency type.amount
: free balance amount to tranfer.
sourcepub fn transfer_all(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
currency_id: T::CurrencyId,
keep_alive: bool
) -> DispatchResult
pub fn transfer_all( origin: OriginFor<T>, dest: <T::Lookup as StaticLookup>::Source, currency_id: T::CurrencyId, keep_alive: bool ) -> DispatchResult
Transfer all remaining balance to the given 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 for this call must be Signed
by the
transactor.
dest
: The recipient of the transfer.currency_id
: currency type.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).
sourcepub fn transfer_keep_alive(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
currency_id: T::CurrencyId,
amount: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer_keep_alive( origin: OriginFor<T>, dest: <T::Lookup as StaticLookup>::Source, currency_id: T::CurrencyId, amount: T::Balance ) -> DispatchResultWithPostInfo
Same as the [transfer
] call, but with a check that the transfer
will not kill the origin account.
99% of the time you want [transfer
] instead.
The dispatch origin for this call must be Signed
by the
transactor.
dest
: The recipient of the transfer.currency_id
: currency type.amount
: free balance amount to tranfer.
sourcepub fn force_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
currency_id: T::CurrencyId,
amount: T::Balance
) -> DispatchResult
pub fn force_transfer( origin: OriginFor<T>, source: <T::Lookup as StaticLookup>::Source, dest: <T::Lookup as StaticLookup>::Source, currency_id: T::CurrencyId, amount: T::Balance ) -> DispatchResult
Exactly as transfer
, except the origin must be root and the source
account may be specified.
The dispatch origin for this call must be Root.
source
: The sender of the transfer.dest
: The recipient of the transfer.currency_id
: currency type.amount
: free balance amount to tranfer.
sourcepub fn set_balance(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
currency_id: T::CurrencyId,
new_free: T::Balance,
new_reserved: T::Balance
) -> DispatchResult
pub fn set_balance( origin: OriginFor<T>, who: <T::Lookup as StaticLookup>::Source, currency_id: T::CurrencyId, new_free: T::Balance, new_reserved: T::Balance ) -> DispatchResult
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 reap the AccountInfo
.
The dispatch origin for this call is root
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn total_issuance<KArg>(k: KArg) -> T::Balancewhere
KArg: EncodeLike<T::CurrencyId>,
pub fn total_issuance<KArg>(k: KArg) -> T::Balancewhere
KArg: EncodeLike<T::CurrencyId>,
An auto-generated getter for TotalIssuance
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn locks<KArg1, KArg2>(
k1: KArg1,
k2: KArg2
) -> BoundedVec<BalanceLock<T::Balance>, T::MaxLocks>
pub fn locks<KArg1, KArg2>( k1: KArg1, k2: KArg2 ) -> BoundedVec<BalanceLock<T::Balance>, T::MaxLocks>
An auto-generated getter for Locks
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn accounts<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> AccountData<T::Balance>
pub fn accounts<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> AccountData<T::Balance>
An auto-generated getter for Accounts
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn reserves<KArg1, KArg2>(
k1: KArg1,
k2: KArg2
) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves>
pub fn reserves<KArg1, KArg2>( k1: KArg1, k2: KArg2 ) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves>
An auto-generated getter for Reserves
.
Trait Implementations§
source§impl<T: Config> Balanced<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Balanced<<T as Config>::AccountId> for Pallet<T>
§type OnDropDebt = IncreaseIssuance<<T as Config>::AccountId, Pallet<T>>
type OnDropDebt = IncreaseIssuance<<T as Config>::AccountId, Pallet<T>>
Debt
is dropped without being used.§type OnDropCredit = DecreaseIssuance<<T as Config>::AccountId, Pallet<T>>
type OnDropCredit = DecreaseIssuance<<T as Config>::AccountId, Pallet<T>>
Credit
is dropped without being
used.fn done_deposit( currency_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance )
fn done_withdraw( currency_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance )
fn done_issue(currency_id: Self::AssetId, amount: Self::Balance)
fn done_rescind(currency_id: Self::AssetId, amount: Self::Balance)
source§fn rescind(
asset: Self::AssetId,
amount: Self::Balance
) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
fn rescind( asset: Self::AssetId, amount: Self::Balance ) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
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 moresource§fn issue(
asset: Self::AssetId,
amount: Self::Balance
) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
fn issue( asset: Self::AssetId, amount: Self::Balance ) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
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 moresource§fn pair(
asset: Self::AssetId,
amount: Self::Balance
) -> Result<(Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>), DispatchError>
fn pair( asset: Self::AssetId, amount: Self::Balance ) -> Result<(Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>), DispatchError>
source§fn deposit(
asset: Self::AssetId,
who: &AccountId,
value: Self::Balance,
precision: Precision
) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, DispatchError>
fn deposit( asset: Self::AssetId, who: &AccountId, value: Self::Balance, precision: Precision ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, DispatchError>
source§fn withdraw(
asset: Self::AssetId,
who: &AccountId,
value: Self::Balance,
precision: Precision,
preservation: Preservation,
force: Fortitude
) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, DispatchError>
fn withdraw( asset: Self::AssetId, who: &AccountId, value: Self::Balance, precision: Precision, preservation: Preservation, force: Fortitude ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, DispatchError>
source§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>>
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 moresource§fn settle(
who: &AccountId,
debt: Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>,
preservation: Preservation
) -> 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>, preservation: Preservation ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>
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
.source§impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
source§fn in_code_storage_version() -> Self::InCodeStorageVersion
fn in_code_storage_version() -> Self::InCodeStorageVersion
storage_version
attribute, or
NoStorageVersionSet
if the attribute is missing.source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
source§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
instead. Read moresource§impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
source§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
source§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
). Read moresource§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read moresource§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
source§fn integrity_test()
fn integrity_test()
source§impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>
§type AssetId = <T as Config>::CurrencyId
type AssetId = <T as Config>::CurrencyId
source§fn total_issuance(asset_id: Self::AssetId) -> Self::Balance
fn total_issuance(asset_id: Self::AssetId) -> Self::Balance
source§fn minimum_balance(asset_id: Self::AssetId) -> Self::Balance
fn minimum_balance(asset_id: Self::AssetId) -> Self::Balance
source§fn balance(asset_id: Self::AssetId, who: &T::AccountId) -> Self::Balance
fn balance(asset_id: Self::AssetId, who: &T::AccountId) -> Self::Balance
who
which does not include funds which are exclusively allocated to
subsystems of the chain (“on hold” or “reserved”). Read moresource§fn total_balance(asset_id: Self::AssetId, who: &T::AccountId) -> Self::Balance
fn total_balance(asset_id: Self::AssetId, who: &T::AccountId) -> Self::Balance
who
. Read moresource§fn reducible_balance(
asset_id: Self::AssetId,
who: &T::AccountId,
preservation: Preservation,
_force: Fortitude
) -> Self::Balance
fn reducible_balance( asset_id: Self::AssetId, who: &T::AccountId, preservation: Preservation, _force: Fortitude ) -> Self::Balance
who
can withdraw/transfer successfully based on whether the
account should be kept alive (preservation
) or whether we are willing to force the
transfer and potentially go below user-level restrictions on the minimum amount of the
account. Read moresource§fn can_deposit(
asset_id: Self::AssetId,
who: &T::AccountId,
amount: Self::Balance,
_provenance: Provenance
) -> DepositConsequence
fn can_deposit( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance, _provenance: Provenance ) -> DepositConsequence
source§fn can_withdraw(
asset_id: Self::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
fn can_withdraw( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance ) -> WithdrawConsequence<Self::Balance>
Failed
if the asset
balance of who
may not be decreased by amount
, otherwise
the consequence.source§fn asset_exists(asset: Self::AssetId) -> bool
fn asset_exists(asset: Self::AssetId) -> bool
true
if an asset
exists.source§fn active_issuance(asset: Self::AssetId) -> Self::Balance
fn active_issuance(asset: Self::AssetId) -> Self::Balance
source§impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>
§type Reason = ()
type Reason = ()
source§fn balance_on_hold(
asset_id: Self::AssetId,
_reason: &Self::Reason,
who: &T::AccountId
) -> T::Balance
fn balance_on_hold( asset_id: Self::AssetId, _reason: &Self::Reason, who: &T::AccountId ) -> T::Balance
who
.source§fn total_balance_on_hold(
asset: Self::AssetId,
who: &T::AccountId
) -> Self::Balance
fn total_balance_on_hold( asset: Self::AssetId, who: &T::AccountId ) -> Self::Balance
who
.source§fn reducible_total_balance_on_hold(
_asset: Self::AssetId,
_who: &T::AccountId,
_force: Fortitude
) -> Self::Balance
fn reducible_total_balance_on_hold( _asset: Self::AssetId, _who: &T::AccountId, _force: Fortitude ) -> Self::Balance
total_balance_on_hold
of who
can be reduced successfully
based on whether we are willing to force the reduction and potentially go below user-level
restrictions on the minimum amount of the account. Note: This cannot bring the account into
an inconsistent state with regards any required existential deposit. Read moresource§fn hold_available(
_asset: Self::AssetId,
_reason: &Self::Reason,
_who: &T::AccountId
) -> bool
fn hold_available( _asset: Self::AssetId, _reason: &Self::Reason, _who: &T::AccountId ) -> bool
true
if it’s possible to place (additional) funds under a hold of a given
reason
. This may fail if the account has exhausted a limited number of concurrent
holds or if it cannot be made to exist (e.g. there is no provider reference). Read moresource§fn can_hold(
asset_id: Self::AssetId,
_reason: &Self::Reason,
who: &T::AccountId,
amount: T::Balance
) -> bool
fn can_hold( asset_id: Self::AssetId, _reason: &Self::Reason, who: &T::AccountId, amount: T::Balance ) -> bool
amount
of funds of who
may be placed on hold for the given
reason
. Reasons why this may not be true: Read moresource§fn ensure_can_hold(
asset: Self::AssetId,
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance
) -> Result<(), DispatchError>
fn ensure_can_hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance ) -> Result<(), DispatchError>
amount
of funds of who
may be placed on hold with the given
reason
. Reasons why this may not be true: Read moresource§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
source§impl<T: Config> MultiCurrency<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> MultiCurrency<<T as Config>::AccountId> for Pallet<T>
source§fn slash(
currency_id: Self::CurrencyId,
who: &T::AccountId,
amount: Self::Balance
) -> Self::Balance
fn slash( currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> Self::Balance
Is a no-op if value
to be slashed is zero.
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.
§type CurrencyId = <T as Config>::CurrencyId
type CurrencyId = <T as Config>::CurrencyId
source§fn minimum_balance(currency_id: Self::CurrencyId) -> Self::Balance
fn minimum_balance(currency_id: Self::CurrencyId) -> Self::Balance
currency_id
.source§fn total_issuance(currency_id: Self::CurrencyId) -> Self::Balance
fn total_issuance(currency_id: Self::CurrencyId) -> Self::Balance
currency_id
.fn total_balance( currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance
fn free_balance( currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance
source§fn ensure_can_withdraw(
currency_id: Self::CurrencyId,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn ensure_can_withdraw( currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
withdraw
. Returns Ok
iff the account is able to make a
withdrawal of the given amount.source§fn transfer(
currency_id: Self::CurrencyId,
from: &T::AccountId,
to: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn transfer( currency_id: Self::CurrencyId, from: &T::AccountId, to: &T::AccountId, amount: Self::Balance ) -> DispatchResult
source§fn deposit(
currency_id: Self::CurrencyId,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn deposit( currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
amount
to the balance of who
under currency_id
and increase
total issuance.source§fn withdraw(
currency_id: Self::CurrencyId,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn withdraw( currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
amount
from the balance of who
under currency_id
and reduce
total issuance.source§impl<T: Config> MultiCurrencyExtended<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> MultiCurrencyExtended<<T as Config>::AccountId> for Pallet<T>
source§fn update_balance(
currency_id: Self::CurrencyId,
who: &T::AccountId,
by_amount: Self::Amount
) -> DispatchResult
fn update_balance( currency_id: Self::CurrencyId, who: &T::AccountId, by_amount: Self::Amount ) -> DispatchResult
by_amount
) from the balance of who
under
currency_id
. If positive by_amount
, do add, else do remove.source§impl<T: Config> MultiLockableCurrency<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> MultiLockableCurrency<<T as Config>::AccountId> for Pallet<T>
§type Moment = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
type Moment = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
BlockNumber
.source§fn set_lock(
lock_id: LockIdentifier,
currency_id: Self::CurrencyId,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn set_lock( lock_id: LockIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
who
. Read moresource§fn extend_lock(
lock_id: LockIdentifier,
currency_id: Self::CurrencyId,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn extend_lock( lock_id: LockIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
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,
currency_id: Self::CurrencyId,
who: &T::AccountId
) -> DispatchResult
fn remove_lock( lock_id: LockIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId ) -> DispatchResult
source§impl<T: Config> MultiReservableCurrency<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> MultiReservableCurrency<<T as Config>::AccountId> for Pallet<T>
source§fn can_reserve(
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> bool
fn can_reserve( currency_id: Self::CurrencyId, who: &T::AccountId, value: Self::Balance ) -> bool
Check if who
can reserve value
from their free balance.
Always true
if value to be reserved is zero.
source§fn slash_reserved(
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
fn slash_reserved( currency_id: Self::CurrencyId, who: &T::AccountId, value: Self::Balance ) -> Self::Balance
Slash from reserved balance, returning any amount that was unable to be slashed.
Is a no-op if the value to be slashed is zero.
source§fn reserve(
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> DispatchResult
fn reserve( currency_id: Self::CurrencyId, who: &T::AccountId, value: Self::Balance ) -> DispatchResult
Move value
from the free balance from who
to their reserved
balance.
Is a no-op if value to be reserved is zero.
source§fn unreserve(
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
fn unreserve( currency_id: Self::CurrencyId, 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.
source§fn repatriate_reserved(
currency_id: Self::CurrencyId,
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved( currency_id: Self::CurrencyId, slashed: &T::AccountId, beneficiary: &T::AccountId, value: Self::Balance, status: BalanceStatus ) -> 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
.
source§fn reserved_balance(
currency_id: Self::CurrencyId,
who: &T::AccountId
) -> Self::Balance
fn reserved_balance( currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance
source§impl<T: Config> Mutate<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Mutate<<T as Config>::AccountId> for Pallet<T>
source§fn mint_into(
asset_id: Self::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn mint_into( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>
who
by exactly amount
, minting new tokens. If that isn’t
possible then an Err
is returned and nothing is changed.source§fn burn_from(
asset_id: Self::AssetId,
who: &T::AccountId,
amount: Self::Balance,
_precision: Precision,
_fortitude: Fortitude
) -> Result<Self::Balance, DispatchError>
fn burn_from( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance, _precision: Precision, _fortitude: Fortitude ) -> Result<Self::Balance, DispatchError>
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.source§fn transfer(
asset_id: Self::AssetId,
source: &T::AccountId,
dest: &T::AccountId,
amount: T::Balance,
preservation: Preservation
) -> Result<T::Balance, DispatchError>
fn transfer( asset_id: Self::AssetId, source: &T::AccountId, dest: &T::AccountId, amount: T::Balance, preservation: Preservation ) -> Result<T::Balance, DispatchError>
source§fn shelve(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn shelve( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>
source§fn restore(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn restore( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>
source§fn set_balance(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance
) -> Self::Balance
fn set_balance( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Self::Balance
fn done_mint_into( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance )
fn done_burn_from( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance )
fn done_shelve(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)
fn done_restore(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)
fn done_transfer( _asset: Self::AssetId, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance )
source§impl<T: Config> Mutate<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Mutate<<T as Config>::AccountId> for Pallet<T>
source§fn hold(
asset_id: Self::AssetId,
_reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn hold( asset_id: Self::AssetId, _reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
reason
is already in place, then this
will increase it.source§fn release(
asset_id: Self::AssetId,
_reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason,
who: &T::AccountId,
amount: Self::Balance,
precision: Precision
) -> Result<T::Balance, DispatchError>
fn release( asset_id: Self::AssetId, _reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason, who: &T::AccountId, amount: Self::Balance, precision: Precision ) -> Result<T::Balance, DispatchError>
amount
held funds in an account. Read moresource§fn transfer_on_hold(
asset_id: Self::AssetId,
reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason,
source: &T::AccountId,
dest: &T::AccountId,
amount: Self::Balance,
precision: Precision,
restriction: Restriction,
_fortitude: Fortitude
) -> Result<Self::Balance, DispatchError>
fn transfer_on_hold( asset_id: Self::AssetId, reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason, source: &T::AccountId, dest: &T::AccountId, amount: Self::Balance, precision: Precision, restriction: Restriction, _fortitude: Fortitude ) -> Result<Self::Balance, DispatchError>
source§fn burn_held(
asset: Self::AssetId,
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
force: Fortitude
) -> Result<Self::Balance, DispatchError>
fn burn_held( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, force: Fortitude ) -> Result<Self::Balance, DispatchError>
asset
balance of who
which is held for the given reason
by
amount
. Read moresource§fn burn_all_held(
asset: Self::AssetId,
reason: &Self::Reason,
who: &AccountId,
precision: Precision,
force: Fortitude
) -> Result<Self::Balance, DispatchError>
fn burn_all_held( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, precision: Precision, force: Fortitude ) -> Result<Self::Balance, DispatchError>
source§fn transfer_and_hold(
asset: Self::AssetId,
reason: &Self::Reason,
source: &AccountId,
dest: &AccountId,
amount: Self::Balance,
precision: Precision,
expendability: Preservation,
force: Fortitude
) -> Result<Self::Balance, DispatchError>
fn transfer_and_hold( asset: Self::AssetId, reason: &Self::Reason, source: &AccountId, dest: &AccountId, amount: Self::Balance, precision: Precision, expendability: Preservation, force: Fortitude ) -> Result<Self::Balance, DispatchError>
amount
of free balance from source
to become owned by dest
but on hold
for reason
.
for reason
. Read morefn done_hold( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance )
fn done_release( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance )
fn done_burn_held( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance )
fn done_transfer_on_hold( _asset: Self::AssetId, _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance )
fn done_transfer_and_hold( _asset: Self::AssetId, _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _transferred: Self::Balance )
source§impl<T: Config> NamedMultiReservableCurrency<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> NamedMultiReservableCurrency<<T as Config>::AccountId> for Pallet<T>
source§fn reserve_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> DispatchResult
fn reserve_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, 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.
source§fn unreserve_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
fn unreserve_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, 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.
source§fn slash_reserved_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
fn slash_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId, value: Self::Balance ) -> Self::Balance
Slash from reserved balance, returning the amount that was unable to be slashed.
Is a no-op if the value to be slashed is zero.
source§fn repatriate_reserved_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, 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 as Config>::ReserveIdentifier
type ReserveIdentifier = <T as Config>::ReserveIdentifier
source§fn reserved_balance_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &T::AccountId
) -> Self::Balance
fn reserved_balance_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance
source§fn ensure_reserved_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &AccountId,
value: Self::Balance
) -> Result<(), DispatchError>
fn ensure_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &AccountId, value: Self::Balance ) -> Result<(), DispatchError>
value
. Read moresource§fn unreserve_all_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &AccountId
) -> Self::Balance
fn unreserve_all_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &AccountId ) -> Self::Balance
source§fn slash_all_reserved_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
who: &AccountId
) -> Self::Balance
fn slash_all_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &AccountId ) -> Self::Balance
source§fn repatriate_all_reserved_named(
id: &Self::ReserveIdentifier,
currency_id: Self::CurrencyId,
slashed: &AccountId,
beneficiary: &AccountId,
status: BalanceStatus
) -> Result<(), DispatchError>
fn repatriate_all_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, slashed: &AccountId, beneficiary: &AccountId, status: BalanceStatus ) -> Result<(), DispatchError>
status
. If status
is Reserved
, the balance
will be reserved with given id
. Read moresource§impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
source§impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
.source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
source§fn on_genesis()
fn on_genesis()
source§impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight
fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight
Hooks::on_idle
.source§impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
.source§impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_poll(n: BlockNumberFor<T>, weight: &mut WeightMeter)
fn on_poll(n: BlockNumberFor<T>, weight: &mut WeightMeter)
source§impl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
source§impl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
source§fn module_name() -> &'static str
fn module_name() -> &'static str
source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
source§impl<T: Config> PalletsInfoAccess for Pallet<T>
impl<T: Config> PalletsInfoAccess for Pallet<T>
source§impl<T> PartialEq for Pallet<T>
impl<T> PartialEq for Pallet<T>
source§impl<T: Config> StorageInfoTrait for Pallet<T>
impl<T: Config> StorageInfoTrait for Pallet<T>
fn storage_info() -> Vec<StorageInfo>
source§impl<T: Config> TransferAll<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> TransferAll<<T as Config>::AccountId> for Pallet<T>
fn transfer_all(source: &T::AccountId, dest: &T::AccountId) -> DispatchResult
source§impl<T: Config> Unbalanced<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Unbalanced<<T as Config>::AccountId> for Pallet<T>
source§fn handle_dust(_dust: Dust<T::AccountId, Self>)
fn handle_dust(_dust: Dust<T::AccountId, Self>)
Dust
can be converted
into a Credit
with the Balanced
trait impl.source§fn write_balance(
asset_id: Self::AssetId,
who: &T::AccountId,
amount: Self::Balance
) -> Result<Option<Self::Balance>, DispatchError>
fn write_balance( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance ) -> Result<Option<Self::Balance>, DispatchError>
source§fn set_total_issuance(asset_id: Self::AssetId, amount: Self::Balance)
fn set_total_issuance(asset_id: Self::AssetId, amount: Self::Balance)
amount
.source§fn decrease_balance(
asset: Self::AssetId,
who: &T::AccountId,
amount: Self::Balance,
precision: Precision,
preservation: Preservation,
force: Fortitude
) -> Result<Self::Balance, DispatchError>
fn decrease_balance( asset: Self::AssetId, who: &T::AccountId, amount: Self::Balance, precision: Precision, preservation: Preservation, force: Fortitude ) -> Result<Self::Balance, DispatchError>
source§fn handle_raw_dust(asset: Self::AssetId, amount: Self::Balance)
fn handle_raw_dust(asset: Self::AssetId, amount: Self::Balance)
Self::handle_dust
. This is an unbalanced operation
and it must only be used when an account is modified in a raw fashion, outside of the entire
fungibles API. The amount
is capped at Self::minimum_balance() - 1
. Read moresource§fn increase_balance(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance,
precision: Precision
) -> Result<Self::Balance, DispatchError>
fn increase_balance( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, precision: Precision ) -> Result<Self::Balance, DispatchError>
source§fn deactivate(_asset: Self::AssetId, _: Self::Balance)
fn deactivate(_asset: Self::AssetId, _: Self::Balance)
source§fn reactivate(_asset: Self::AssetId, _: Self::Balance)
fn reactivate(_asset: Self::AssetId, _: Self::Balance)
source§impl<T: Config> Unbalanced<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> Unbalanced<<T as Config>::AccountId> for Pallet<T>
source§fn set_balance_on_hold(
asset: Self::AssetId,
_reason: &Self::Reason,
who: &T::AccountId,
amount: Self::Balance
) -> DispatchResult
fn set_balance_on_hold( asset: Self::AssetId, _reason: &Self::Reason, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult
who
to amount
. This is independent of any other
balances on hold or the main (“free”) balance. Read moresource§fn decrease_balance_on_hold(
asset: Self::AssetId,
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision
) -> Result<Self::Balance, DispatchError>
fn decrease_balance_on_hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision ) -> Result<Self::Balance, DispatchError>
source§fn increase_balance_on_hold(
asset: Self::AssetId,
reason: &Self::Reason,
who: &AccountId,
amount: Self::Balance,
precision: Precision
) -> Result<Self::Balance, DispatchError>
fn increase_balance_on_hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision ) -> Result<Self::Balance, DispatchError>
source§impl<T: Config> WhitelistedStorageKeys for Pallet<T>
impl<T: Config> WhitelistedStorageKeys for Pallet<T>
source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.impl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> Freeze for Pallet<T>
impl<T> RefUnwindSafe for Pallet<T>where
T: RefUnwindSafe,
impl<T> Send for Pallet<T>where
T: Send,
impl<T> Sync for Pallet<T>where
T: Sync,
impl<T> Unpin for Pallet<T>where
T: Unpin,
impl<T> UnwindSafe for Pallet<T>where
T: UnwindSafe,
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
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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>,
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
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
T
.