Struct orml_tokens::module::Pallet

source ·
pub struct Pallet<T>(_);
Expand description

The pallet implementing the on-chain logic.

Implementations§

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.

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

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.

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.

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.

The total issuance of a token type.

Any liquidity locks of a token type under an account. NOTE: Should only be accessed when setting, changing and freeing a lock.

The balance of a token type under an account.

NOTE: If the total is ever zero, decrease account ref account.

NOTE: This is only used in the case that this module is used to store balances.

Named reserves on some account balances.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
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 the sanity checks of this pallet, per block. 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
Means of identifying one asset class from another.
Scalar type for representing balance of an account.
The total amount of issuance in the system.
The minimum balance any single account may have.
Get the asset balance of who.
Get the maximum amount of asset that who can withdraw/transfer successfully.
Returns true if the asset balance of who may be increased by amount. Read more
Returns Failed if the asset balance of who may not be decreased by amount, otherwise the consequence. Read more
Amount of funds held in hold.
Check to see if some amount of asset may be held on the account of who.
Run integrity test. Read more

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.

The currency identifier.
The balance of an account.
Existential deposit of currency_id.
The total amount of issuance of currency_id.
A dry-run of withdraw. Returns Ok iff the account is able to make a withdrawal of the given amount. Read more
Transfer some amount from one account to another.
Add amount to the balance of who under currency_id and increase total issuance. Read more
Remove amount from the balance of who under currency_id and reduce total issuance. Read more
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. Read more
The type for balance related operations, typically signed int.
Add or remove abs(by_amount) from the balance of who under currency_id. If positive by_amount, do add, else do remove. Read more
The quantity used to denote time; usually just a BlockNumber.
Create a new balance lock on account who. Read more
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
Remove an existing lock.

Check if who can reserve value from their free balance.

Always true if value to be reserved is zero.

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.

Move value from the free balance from who to their reserved balance.

Is a no-op if value to be reserved is zero.

Unreserve some funds, returning any amount that was unable to be unreserved.

Is a no-op if the value to be unreserved is zero.

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.
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
Attempt to increase the asset balance of who by amount. Read more
Attempt to reduce the asset balance of who by amount. Read more
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
Transfer funds from one account into another. The default implementation uses mint_into and burn_from and may generate unwanted events. Read more
Hold some funds in an account.
Release some funds in an account from being on hold. Read more
Transfer held funds into a destination account. Read more

Move value from the free balance from who to a named reserve balance.

Is a no-op if value to be reserved is zero.

Unreserve some funds, returning any amount that was unable to be unreserved.

Is a no-op if the value to be unreserved is zero.

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.

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.
An identifier for a reserve. Used for disambiguating different reserves so that they can be individually replaced or removed. Read more
The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. Read more
Ensure the reserved balance is equal to value. Read more
Unreserve all the named reserved balances, returning unreserved amount. Read more
Slash all the reserved balance, returning the amount that was unable to be slashed. Read more
Move all the named reserved balance of one account into the balance of another, according to status. If status is Reserved, the balance will be reserved with given id. Read more
This function is being called after every block import (when fully synced). Read more
The block is being finalized. Implement to have something happen. Read more
Something that should happen at genesis.
The block is being finalized. Implement to have something happen in case there is leftover weight. Check the passed remaining_weight to make sure it is high enough to allow for your pallet’s extra computation. Read more
The block is being initialized. Implement to have something happen. Read more
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
Index of the pallet as configured in the runtime.
Name of the pallet as configured in the runtime.
Name of the Rust module containing the pallet.
Version of the crate containing the pallet.
The number of pallets’ information that this type represents. Read more
All of the pallets’ information that this type represents.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Transfer funds from one account into another.
Execute the state checks.
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.
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
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
Increase the asset balance of who by the most that is possible, up to amount. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
The type for managing what happens when an instance of Credit is dropped without being used. Read more
The type for managing what happens when an instance of Debt is dropped without being used.
Reduce the total issuance by amount and return the according imbalance. The imbalance will typically be used to reduce an account by the same amount with e.g. settle. Read more
Increase the total issuance by amount and return the according imbalance. The imbalance will typically be used to increase an account by the same amount with e.g. resolve_into_existing or resolve_creating. Read more
Deducts up to value from the combined balance of who, 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
Produce a pair of imbalances that cancel each other out exactly. Read more
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
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
Release and slash some funds in an account. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert from a value of T into an equivalent instance of Option<Self>. Read more
Consume self to return Some equivalent value of Option<T>. Read more
Converts self into T using Into<T>. Read more
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
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
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
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more
Compare self to key and return true if they are equal.
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Cast reference.
Cast reference.
Cast mutable reference.
Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

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
Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Convert from a value of T into an equivalent instance of Self. Read more
Consume self to return an equivalent value of T. Read more
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The counterpart to unchecked_from.
Consume self to return an equivalent value of T.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more