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>

source

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.
source

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 the transfer_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).
source

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.
source

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.
source

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>

source

pub fn total_issuance<KArg>(k: KArg) -> T::Balance
where KArg: EncodeLike<T::CurrencyId>,

An auto-generated getter for TotalIssuance.

source§

impl<T: Config> Pallet<T>

source

pub fn locks<KArg1, KArg2>( k1: KArg1, k2: KArg2 ) -> BoundedVec<BalanceLock<T::Balance>, T::MaxLocks>
where KArg1: EncodeLike<T::AccountId>, KArg2: EncodeLike<T::CurrencyId>,

An auto-generated getter for Locks.

source§

impl<T: Config> Pallet<T>

source

pub fn accounts<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> AccountData<T::Balance>
where KArg1: EncodeLike<T::AccountId>, KArg2: EncodeLike<T::CurrencyId>,

An auto-generated getter for Accounts.

source§

impl<T: Config> Pallet<T>

source

pub fn reserves<KArg1, KArg2>( k1: KArg1, k2: KArg2 ) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves>
where KArg1: EncodeLike<T::AccountId>, KArg2: EncodeLike<T::CurrencyId>,

An auto-generated getter for Reserves.

Trait Implementations§

source§

impl<T: Config> Balanced<<T as Config>::AccountId> for Pallet<T>

§

type OnDropDebt = IncreaseIssuance<<T as Config>::AccountId, Pallet<T>>

The type for managing what happens when an instance of Debt is dropped without being used.
§

type OnDropCredit = DecreaseIssuance<<T as Config>::AccountId, Pallet<T>>

The type for managing what happens when an instance of Credit is dropped without being used.
source§

fn done_deposit( currency_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance )

source§

fn done_withdraw( currency_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance )

source§

fn done_issue(currency_id: Self::AssetId, amount: Self::Balance)

source§

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>

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

fn issue( asset: Self::AssetId, amount: Self::Balance ) -> Imbalance<Self::AssetId, Self::Balance, Self::OnDropCredit, Self::OnDropDebt>

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

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>

Produce a pair of imbalances that cancel each other out exactly. Read more
source§

fn deposit( asset: Self::AssetId, who: &AccountId, value: Self::Balance, precision: Precision ) -> Result<Imbalance<Self::AssetId, Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, DispatchError>

Mints value into the account of who, creating it as needed. Read more
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>

Removes value balance from who account if possible. Read more
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>>

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

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>>

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

impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>

source§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
source§

impl<T: Config> Callable<T> for Pallet<T>

source§

impl<T> Clone for Pallet<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Pallet<T>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Config> GetStorageVersion for Pallet<T>

§

type InCodeStorageVersion = NoStorageVersionSet

This type is generated by the pallet macro. Read more
source§

fn in_code_storage_version() -> Self::InCodeStorageVersion

Returns the in-code storage version as specified in the storage_version attribute, or NoStorageVersionSet if the attribute is missing.
source§

fn on_chain_storage_version() -> StorageVersion

Returns the storage version of the pallet as last set in the actual on-chain storage.
source§

fn current_storage_version() -> Self::InCodeStorageVersion

👎Deprecated: This method has been renamed to in_code_storage_version and will be removed after March 2024.
DEPRECATED: Use Self::current_storage_version instead. Read more
source§

impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_initialize(_n: BlockNumber) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
source§

fn on_finalize(_n: BlockNumber)

Block finalization hook. This is called at the very end of block execution. Read more
source§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before Hooks::on_finalize). Read more
source§

fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)

A hook to run logic after inherent application. Read more
source§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by the FRAME Executive pallet. Read more
source§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main blockchain execution. Read more
source§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
source§

impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>

§

type AssetId = <T as Config>::CurrencyId

Means of identifying one asset class from another.
§

type Balance = <T as Config>::Balance

Scalar type for representing balance of an account.
source§

fn total_issuance(asset_id: Self::AssetId) -> Self::Balance

The total amount of issuance in the system.
source§

fn minimum_balance(asset_id: Self::AssetId) -> Self::Balance

The minimum balance any single account may have.
source§

fn balance(asset_id: Self::AssetId, who: &T::AccountId) -> Self::Balance

Get the balance of who which does not include funds which are exclusively allocated to subsystems of the chain (“on hold” or “reserved”). Read more
source§

fn total_balance(asset_id: Self::AssetId, who: &T::AccountId) -> Self::Balance

Get the total amount of funds whose ultimate beneficial ownership can be determined as who. Read more
source§

fn reducible_balance( asset_id: Self::AssetId, who: &T::AccountId, preservation: Preservation, _force: Fortitude ) -> Self::Balance

Get the maximum amount that 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 more
source§

fn can_deposit( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance, _provenance: Provenance ) -> DepositConsequence

Returns true if the asset balance of who may be increased by amount. Read more
source§

fn can_withdraw( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance ) -> WithdrawConsequence<Self::Balance>

Returns Failed if the asset balance of who may not be decreased by amount, otherwise the consequence.
source§

fn asset_exists(asset: Self::AssetId) -> bool

Returns true if an asset exists.
source§

fn active_issuance(asset: Self::AssetId) -> Self::Balance

The total amount of issuance in the system excluding those which are controlled by the system.
source§

impl<T: Config> Inspect<<T as Config>::AccountId> for Pallet<T>

§

type Reason = ()

An identifier for a hold. Used for disambiguating different holds so that they can be individually replaced or removed and funds from one hold don’t accidentally become unreserved or slashed for another.
source§

fn balance_on_hold( asset_id: Self::AssetId, _reason: &Self::Reason, who: &T::AccountId ) -> T::Balance

Amount of funds on hold (for the given reason) of who.
source§

fn total_balance_on_hold( asset: Self::AssetId, who: &T::AccountId ) -> Self::Balance

Amount of funds on hold (for all hold reasons) of who.
source§

fn reducible_total_balance_on_hold( _asset: Self::AssetId, _who: &T::AccountId, _force: Fortitude ) -> Self::Balance

Get the maximum amount that the 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 more
source§

fn hold_available( _asset: Self::AssetId, _reason: &Self::Reason, _who: &T::AccountId ) -> bool

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

fn can_hold( asset_id: Self::AssetId, _reason: &Self::Reason, who: &T::AccountId, amount: T::Balance ) -> bool

Check to see if some amount of funds of who may be placed on hold for the given reason. Reasons why this may not be true: Read more
source§

fn ensure_can_hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance ) -> Result<(), DispatchError>

Check to see if some amount of funds of who may be placed on hold with the given reason. Reasons why this may not be true: Read more
source§

impl<T: Config> IntegrityTest for Pallet<T>

source§

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

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

The currency identifier.
§

type Balance = <T as Config>::Balance

The balance of an account.
source§

fn minimum_balance(currency_id: Self::CurrencyId) -> Self::Balance

Existential deposit of currency_id.
source§

fn total_issuance(currency_id: Self::CurrencyId) -> Self::Balance

The total amount of issuance of currency_id.
source§

fn total_balance( currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance

source§

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

A dry-run of 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

Transfer some amount from one account to another.
source§

fn deposit( currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult

Add 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

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

fn can_slash( currency_id: Self::CurrencyId, who: &T::AccountId, value: Self::Balance ) -> bool

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

impl<T: Config> MultiCurrencyExtended<<T as Config>::AccountId> for Pallet<T>

§

type Amount = <T as Config>::Amount

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

fn update_balance( currency_id: Self::CurrencyId, who: &T::AccountId, by_amount: Self::Amount ) -> DispatchResult

Add or remove abs(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>

§

type Moment = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number

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

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

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

fn extend_lock( lock_id: LockIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult

Changes a balance lock (selected by lock_id) so that it becomes less liquid in all parameters or creates a new one if it does not exist. Read more
source§

fn remove_lock( lock_id: LockIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId ) -> DispatchResult

Remove an existing lock.
source§

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

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

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

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

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>

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 to beneficiary and the status is Reserved.
source§

fn reserved_balance( currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance

The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. Read more
source§

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>

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

fn burn_from( asset_id: Self::AssetId, who: &T::AccountId, amount: Self::Balance, _precision: Precision, _fortitude: Fortitude ) -> Result<Self::Balance, DispatchError>

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

fn transfer( asset_id: Self::AssetId, source: &T::AccountId, dest: &T::AccountId, amount: T::Balance, preservation: Preservation ) -> Result<T::Balance, DispatchError>

Transfer funds from one account into another. Read more
source§

fn shelve( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>

Attempt to decrease the asset balance of who by amount. Read more
source§

fn restore( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Result<Self::Balance, DispatchError>

Attempt to increase the asset balance of who by amount. Read more
source§

fn set_balance( asset: Self::AssetId, who: &AccountId, amount: Self::Balance ) -> Self::Balance

Simple infallible function to force an account to have a particular balance, good for use in tests and benchmarks but not recommended for production code owing to the lack of error reporting. Read more
source§

fn done_mint_into( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance )

source§

fn done_burn_from( _asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance )

source§

fn done_shelve(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)

source§

fn done_restore(_asset: Self::AssetId, _who: &AccountId, _amount: Self::Balance)

source§

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>

source§

fn hold( asset_id: Self::AssetId, _reason: &<Self as InspectHold<<T as Config>::AccountId>>::Reason, who: &T::AccountId, amount: Self::Balance ) -> DispatchResult

Hold some funds in an account. If a hold for 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>

Release up to amount held funds in an account. Read more
source§

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>

Transfer held funds into a destination account. Read more
source§

fn burn_held( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision, force: Fortitude ) -> Result<Self::Balance, DispatchError>

Attempt to decrease the asset balance of who which is held for the given reason by amount. Read more
source§

fn burn_all_held( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, precision: Precision, force: Fortitude ) -> Result<Self::Balance, DispatchError>

Attempt to decrease the asset balance of who which is held for the given reason to zero. Read more
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>

Transfer some amount of free balance from source to become owned by dest but on hold for reason. for reason. Read more
source§

fn done_hold( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance )

source§

fn done_release( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance )

source§

fn done_burn_held( _asset: Self::AssetId, _reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance )

source§

fn done_transfer_on_hold( _asset: Self::AssetId, _reason: &Self::Reason, _source: &AccountId, _dest: &AccountId, _amount: Self::Balance )

source§

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>

source§

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

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

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>

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 to beneficiary and the status is Reserved.
§

type ReserveIdentifier = <T as Config>::ReserveIdentifier

An identifier for a reserve. Used for disambiguating different reserves so that they can be individually replaced or removed.
source§

fn reserved_balance_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &T::AccountId ) -> Self::Balance

The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. Read more
source§

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

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

fn unreserve_all_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &AccountId ) -> Self::Balance

Unreserve all the named reserved balances, returning unreserved amount. Read more
source§

fn slash_all_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, who: &AccountId ) -> Self::Balance

Slash all the reserved balance, returning the amount that was unable to be slashed. Read more
source§

fn repatriate_all_reserved_named( id: &Self::ReserveIdentifier, currency_id: Self::CurrencyId, 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
source§

impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn offchain_worker(n: BlockNumberFor<T>)

This function is being called after every block import (when fully synced). Read more
source§

impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

impl<T: Config> OnGenesis for Pallet<T>

source§

fn on_genesis()

Something that should happen at genesis.
source§

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

source§

impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

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)

Code to execute every now and then at the beginning of the block after inherent application. Read more
source§

impl<T: Config> OnRuntimeUpgrade for Pallet<T>

source§

impl<T: Config> PalletInfoAccess for Pallet<T>

source§

fn index() -> usize

Index of the pallet as configured in the runtime.
source§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
source§

fn name_hash() -> [u8; 16]

Two128 hash of name.
source§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
source§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
source§

impl<T: Config> PalletsInfoAccess for Pallet<T>

source§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
source§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
source§

impl<T> PartialEq for Pallet<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Config> StorageInfoTrait for Pallet<T>

source§

impl<T: Config> TransferAll<<T as Config>::AccountId> for Pallet<T>

source§

impl<T: Config> Unbalanced<<T as Config>::AccountId> for Pallet<T>

source§

fn handle_dust(_dust: Dust<T::AccountId, Self>)

Do something with the dust which has been destroyed from the system. 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>

Forcefully set the balance of who to amount. Read more
source§

fn set_total_issuance(asset_id: Self::AssetId, amount: Self::Balance)

Set the total issuance to amount.
source§

fn decrease_balance( asset: Self::AssetId, who: &T::AccountId, amount: Self::Balance, precision: Precision, preservation: Preservation, force: Fortitude ) -> Result<Self::Balance, DispatchError>

Reduce the balance of who by amount. Read more
source§

fn handle_raw_dust(asset: Self::AssetId, amount: Self::Balance)

Create some dust and handle it with 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 more
source§

fn increase_balance( asset: Self::AssetId, who: &AccountId, amount: Self::Balance, precision: Precision ) -> Result<Self::Balance, DispatchError>

Increase the balance of who by amount. Read more
source§

fn deactivate(_asset: Self::AssetId, _: Self::Balance)

Reduce the active issuance by some amount.
source§

fn reactivate(_asset: Self::AssetId, _: Self::Balance)

Increase the active issuance by some amount, up to the outstanding amount reduced.
source§

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

Forcefully set the balance on hold of who to amount. This is independent of any other balances on hold or the main (“free”) balance. Read more
source§

fn decrease_balance_on_hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision ) -> Result<Self::Balance, DispatchError>

Reduce the balance on hold of who by amount. Read more
source§

fn increase_balance_on_hold( asset: Self::AssetId, reason: &Self::Reason, who: &AccountId, amount: Self::Balance, precision: Precision ) -> Result<Self::Balance, DispatchError>

Increase the balance on hold of who by amount. Read more
source§

impl<T: Config> WhitelistedStorageKeys for Pallet<T>

source§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a 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.
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedConversion for T

source§

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

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

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

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

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

source§

fn into2(self) -> U

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

source§

fn into_key(self) -> U

source§

impl<T> IsType<T> for T

source§

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

Cast reference.
source§

fn into_ref(&self) -> &T

Cast reference.
source§

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

Cast mutable reference.
source§

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

Cast mutable reference.
source§

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

source§

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

Get a reference to the inner from the outer.

source§

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

Get a mutable reference to the inner from the outer.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatedConversion for T

source§

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

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

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

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

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.
source§

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

§

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

source§

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

source§

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

§

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

source§

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

source§

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

source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
source§

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

source§

fn unique_saturated_into(self) -> T

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

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> JsonSchemaMaybe for T

source§

impl<T> MaybeDebug for T
where T: Debug,

source§

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

source§

impl<T> Member for T
where T: Send + Sync + Debug + Eq + PartialEq + Clone + 'static,