pub struct Pallet<T, I = ()>(_);

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.

  • Dependent on arguments but not critical, given proper implementations for input config types. See related functions below.
  • It contains a limited number of reads and writes internally and no complex computation.

Related functions:

  • ensure_can_withdraw is always called internally but has a bounded complexity.
  • Transferring balances to accounts that did not exist before will cause T::OnNewAccount::on_new_account to be called.
  • Removing enough funds from an account will trigger T::DustRemoval::on_unbalanced.
  • transfer_keep_alive works the same way as transfer, but has an additional check that the transfer will not kill the origin account.

  • Base Weight: 73.64 µs, worst case scenario (account created, account removed)
  • DB Weight: 1 Read and 1 Write to destination account
  • Origin account is already in memory, so no DB operations for them.

Exactly as transfer, except the origin must be root and the source account may be specified.

  • Same as transfer, but additional read and write because the source account is not assumed to be in the overlay.

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.

  • Cheaper than transfer because account cannot be killed.
  • Base Weight: 51.4 µs
  • DB Weight: 1 Read and 1 Write to dest (sender is in overlay already) #

The total units issued in the system.

Any liquidity locks on some account balances. NOTE: Should only be accessed when setting, changing and freeing a lock.

Get the free balance of an account.

Get the balance of an account that can be used for transfers, reservations, or any other non-locking, non-transaction-fee activity. Will be at most free_balance.

Get the balance of an account that can be used for paying transaction fees (not tipping, or any other kind of fees, though). Will be at most free_balance.

Get the reserved balance of an account.

Mutate an account to some new value, or delete it entirely with None. Will enforce ExistentialDeposit law, annulling the account as needed.

NOTE: Doesn’t do any preparatory work for creating a new account, so should only be used when it is known that the account already exists.

NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that the caller will do this.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Slash a target account who, returning the negative imbalance created and any left over amount that could not be slashed.

Is a no-op if value to be slashed is zero or the account does not exist.

NOTE: slash() prefers free balance, but assumes that reserve balance can be drawn from in extreme circumstances. can_slash() should be used prior to slash() to avoid having to draw from reserved funds, however we err on the side of punishment if things are inconsistent or can_slash wasn’t used appropriately.

Deposit some value into the free balance of an existing target account who.

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

Deposit some value into the free balance of who, possibly creating a new account.

This function is a no-op if:

  • the value to be deposited is zero; or
  • the value to be deposited is less than the required ED and the account does not yet exist; or
  • the deposit would necessitate the account to exist and there are no provider references; or
  • value is so large it would cause the balance of who to overflow.

Withdraw some free balance from an account, respecting existence requirements.

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

Force the new free balance of a target account who to some new value balance.

The balance of an account.

The opaque token type for an imbalance. This is returned by unbalanced operations and must be dealt with. It may be dropped but cannot be cloned. Read more

The opaque token type for an imbalance. This is returned by unbalanced operations and must be dealt with. It may be dropped but cannot be cloned. Read more

The combined balance of who.

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

The total amount of issuance in the system.

The minimum balance any single account may have. This is equivalent to the Balances module’s ExistentialDeposit. Read more

Reduce the total issuance by amount and return the according imbalance. The imbalance will typically be used to reduce an account by the same amount with e.g. settle. Read more

Increase the total issuance by amount and return the according imbalance. The imbalance will typically be used to increase an account by the same amount with e.g. resolve_into_existing or resolve_creating. Read more

The ‘free’ balance of a given account. Read more

Returns Ok iff the account is able to make a withdrawal of the given amount for the given reason. Basically, it’s just a dry-run of withdraw. Read more

Transfer some liquid free balance to another staker. Read more

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

Similar to deposit_creating, only accepts a NegativeImbalance and returns nothing on success. Read more

Similar to deposit_creating, only accepts a NegativeImbalance and returns nothing on success. Read more

Similar to withdraw, only accepts a PositiveImbalance and returns nothing on success.

Formats the value using the given formatter. Read more

Returns the current version of the pallet.

Returns the version of the pallet that is stored in storage. Read more

The block is being finalized. Implement to have something happen.

The block is being initialized. Implement to have something happen. Read more

Perform a module 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

Run integrity test. Read more

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

The maximum number of locks a user should have on their account.

Create a new balance lock on account who. Read more

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

Remove an existing lock.

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 initialized. Implement to have something happen. Read more

Perform a module upgrade. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Check if who can reserve value from their free balance.

Always true if value to be reserved is zero.

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

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

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

Is a no-op if the value to be unreserved is zero or the account does not exist.

Slash from reserved balance, returning the negative imbalance created, and any amount that was unable to be slashed.

Is a no-op if the value to be slashed is zero or the account does not exist.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. 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

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.

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. 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.