Struct pallet_balances::pallet::Pallet [−][src]
Implementations
impl<T: Config<I>, I: 'static> Pallet<T, I>
[src]
pub fn transfer(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
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 astransfer
, 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.
pub fn force_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
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.
pub fn transfer_keep_alive(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
impl<T: Config<I>, I: 'static> Pallet<T, I>
[src]
pub fn total_issuance() -> T::Balance
[src]
The total units issued in the system.
impl<T: Config<I>, I: 'static> Pallet<T, I>
[src]
pub fn locks<KArg>(k: KArg) -> Vec<BalanceLock<T::Balance>> where
KArg: EncodeLike<T::AccountId>,
[src]
KArg: EncodeLike<T::AccountId>,
Any liquidity locks on some account balances. NOTE: Should only be accessed when setting, changing and freeing a lock.
impl<T: Config<I>, I: 'static> Pallet<T, I>
[src]
pub fn free_balance(who: impl Borrow<T::AccountId>) -> T::Balance
[src]
Get the free balance of an account.
pub fn usable_balance(who: impl Borrow<T::AccountId>) -> T::Balance
[src]
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
.
pub fn usable_balance_for_fees(who: impl Borrow<T::AccountId>) -> T::Balance
[src]
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
.
pub fn reserved_balance(who: impl Borrow<T::AccountId>) -> T::Balance
[src]
Get the reserved balance of an account.
pub fn mutate_account<R>(
who: &T::AccountId,
f: impl FnOnce(&mut AccountData<T::Balance>) -> R
) -> Result<R, StoredMapError>
[src]
who: &T::AccountId,
f: impl FnOnce(&mut AccountData<T::Balance>) -> R
) -> Result<R, StoredMapError>
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
impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
[src]
impl<T, I> Clone for Pallet<T, I>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Config<I>, I: 'static> Currency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
[src]
T::Balance: MaybeSerializeDeserialize + Debug,
type Balance = T::Balance
The balance of an account.
type PositiveImbalance = PositiveImbalance<T, I>
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
type NegativeImbalance = NegativeImbalance<T, I>
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
fn total_balance(who: &T::AccountId) -> Self::Balance
[src]
fn can_slash(who: &T::AccountId, value: Self::Balance) -> bool
[src]
fn total_issuance() -> Self::Balance
[src]
fn minimum_balance() -> Self::Balance
[src]
fn burn(amount: Self::Balance) -> Self::PositiveImbalance
[src]
fn issue(amount: Self::Balance) -> Self::NegativeImbalance
[src]
fn free_balance(who: &T::AccountId) -> Self::Balance
[src]
fn ensure_can_withdraw(
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
new_balance: T::Balance
) -> DispatchResult
[src]
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
new_balance: T::Balance
) -> DispatchResult
fn transfer(
transactor: &T::AccountId,
dest: &T::AccountId,
value: Self::Balance,
existence_requirement: ExistenceRequirement
) -> DispatchResult
[src]
transactor: &T::AccountId,
dest: &T::AccountId,
value: Self::Balance,
existence_requirement: ExistenceRequirement
) -> DispatchResult
fn slash(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
[src]
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
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.
fn deposit_into_existing(
who: &T::AccountId,
value: Self::Balance
) -> Result<Self::PositiveImbalance, DispatchError>
[src]
who: &T::AccountId,
value: Self::Balance
) -> Result<Self::PositiveImbalance, DispatchError>
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.
fn deposit_creating(
who: &T::AccountId,
value: Self::Balance
) -> Self::PositiveImbalance
[src]
who: &T::AccountId,
value: Self::Balance
) -> Self::PositiveImbalance
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 ofwho
to overflow.
fn withdraw(
who: &T::AccountId,
value: Self::Balance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<Self::NegativeImbalance, DispatchError>
[src]
who: &T::AccountId,
value: Self::Balance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<Self::NegativeImbalance, DispatchError>
Withdraw some free balance from an account, respecting existence requirements.
Is a no-op if value to be withdrawn is zero.
fn make_free_balance_be(
who: &T::AccountId,
value: Self::Balance
) -> SignedImbalance<Self::Balance, Self::PositiveImbalance>
[src]
who: &T::AccountId,
value: Self::Balance
) -> SignedImbalance<Self::Balance, Self::PositiveImbalance>
Force the new free balance of a target account who
to some new value balance
.
pub fn pair(
amount: Self::Balance
) -> (Self::PositiveImbalance, Self::NegativeImbalance)
[src]
amount: Self::Balance
) -> (Self::PositiveImbalance, Self::NegativeImbalance)
pub fn resolve_into_existing(
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
[src]
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
pub fn resolve_creating(who: &AccountId, value: Self::NegativeImbalance)
[src]
pub fn settle(
who: &AccountId,
value: Self::PositiveImbalance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<(), Self::PositiveImbalance>
[src]
who: &AccountId,
value: Self::PositiveImbalance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<(), Self::PositiveImbalance>
impl<T, I> Debug for Pallet<T, I>
[src]
impl<T, I> Eq for Pallet<T, I>
[src]
impl<T: Config<I>, I: 'static> GetPalletVersion for Pallet<T, I>
[src]
fn current_version() -> PalletVersion
[src]
fn storage_version() -> Option<PalletVersion>
[src]
impl<T: Config<I>, I: 'static> Hooks<<T as Config>::BlockNumber> for Pallet<T, I>
[src]
pub fn on_finalize(_n: BlockNumber)
[src]
pub fn on_initialize(_n: BlockNumber) -> u64
[src]
pub fn on_runtime_upgrade() -> u64
[src]
pub fn offchain_worker(_n: BlockNumber)
[src]
pub fn integrity_test()
[src]
impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
[src]
fn integrity_test()
[src]
impl<T: Config<I>, I: 'static> LockableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
[src]
T::Balance: MaybeSerializeDeserialize + Debug,
type Moment = T::BlockNumber
The quantity used to denote time; usually just a BlockNumber
.
type MaxLocks = T::MaxLocks
The maximum number of locks a user should have on their account.
fn set_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
[src]
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
fn extend_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
[src]
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
fn remove_lock(id: LockIdentifier, who: &T::AccountId)
[src]
impl<T: Config<I>, I: 'static> ModuleErrorMetadata for Pallet<T, I>
[src]
impl<T: Config<I>, I: 'static> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T, I>
[src]
fn offchain_worker(n: <T as Config>::BlockNumber)
[src]
impl<T: Config<I>, I: 'static> OnFinalize<<T as Config>::BlockNumber> for Pallet<T, I>
[src]
fn on_finalize(n: <T as Config>::BlockNumber)
[src]
impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
[src]
fn on_genesis()
[src]
impl<T: Config<I>, I: 'static> OnInitialize<<T as Config>::BlockNumber> for Pallet<T, I>
[src]
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
[src]
impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
[src]
fn on_runtime_upgrade() -> Weight
[src]
impl<T, I> PartialEq<Pallet<T, I>> for Pallet<T, I>
[src]
impl<T: Config<I>, I: 'static> ReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
[src]
T::Balance: MaybeSerializeDeserialize + Debug,
fn can_reserve(who: &T::AccountId, value: Self::Balance) -> bool
[src]
Check if who
can reserve value
from their free balance.
Always true
if value to be reserved is zero.
fn reserved_balance(who: &T::AccountId) -> Self::Balance
[src]
fn reserve(who: &T::AccountId, value: Self::Balance) -> DispatchResult
[src]
Move value
from the free balance from who
to their reserved balance.
Is a no-op if value to be reserved is zero.
fn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance
[src]
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.
fn slash_reserved(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
[src]
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
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.
fn repatriate_reserved(
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: Status
) -> Result<Self::Balance, DispatchError>
[src]
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
.
Is a no-op if:
- the value to be moved is zero; or
- the
slashed
id equal tobeneficiary
and thestatus
isReserved
.
Auto Trait Implementations
impl<T, I> RefUnwindSafe for Pallet<T, I> where
I: RefUnwindSafe,
T: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> Send for Pallet<T, I> where
I: Send,
T: Send,
I: Send,
T: Send,
impl<T, I> Sync for Pallet<T, I> where
I: Sync,
T: Sync,
I: Sync,
T: Sync,
impl<T, I> Unpin for Pallet<T, I> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<T, I> UnwindSafe for Pallet<T, I> where
I: UnwindSafe,
T: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
pub fn from_ref(t: &T) -> &T
[src]
pub fn into_ref(&self) -> &T
[src]
pub fn from_mut(t: &mut T) -> &mut T
[src]
pub fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
pub fn from_mut(outer: &mut Outer) -> &mut T
[src]
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
[src]
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
[src]
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
[src]
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
[src]
Self: UniqueSaturatedInto<T>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
[src]
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,