[−][src]Struct pallet_balances::Module
Methods
impl<T: Trait<I> + 'static, I: Instance> Module<T, I>[src]
pub fn total_issuance() -> T::Balance[src]
The total units issued in the system.
pub fn locks<K: EncodeLike<T::AccountId>>(
key: K
) -> Vec<BalanceLock<T::Balance>>[src]
key: K
) -> Vec<BalanceLock<T::Balance>>
Any liquidity locks on some account balances. NOTE: Should only be accessed when setting, changing and freeing a lock.
impl<T: Trait<I>, I: Instance> Module<T, I>[src]
Can also be called using Call.
pub fn transfer(
origin: T::Origin,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResult[src]
origin: T::Origin,
dest: <T::Lookup as StaticLookup>::Source,
value: 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.
- 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_withdrawis always called internally but has a bounded complexity.- Transferring balances to accounts that did not exist before will cause
T::OnNewAccount::on_new_accountto be called. - Removing enough funds from an account will trigger
T::DustRemoval::on_unbalanced. transfer_keep_aliveworks the same way astransfer, but has an additional check that the transfer will not kill the origin account.
pub fn force_transfer(
origin: T::Origin,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResult[src]
origin: T::Origin,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResult
Exactly as transfer, except the origin must be root and the source account may be
specified.
pub fn transfer_keep_alive(
origin: T::Origin,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResult[src]
origin: T::Origin,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResult
impl<T: Trait<I>, I: Instance> Module<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.
Trait Implementations
impl<T: Trait<I>, I: Instance> Callable<T> for Module<T, I>[src]
impl<T: Clone + Trait<I>, I: Clone + Instance> Clone for Module<T, I>[src]
impl<T: Copy + Trait<I>, I: Copy + Instance> Copy for Module<T, I>[src]
impl<T: Trait<I>, I: Instance> Currency<<T as Trait>::AccountId> for Module<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.
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
valueto be deposited is zero; or - if the
valueto be deposited is less than the ED and the account does not yet exist; or valueis so large it would cause the balance ofwhoto 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.
fn resolve_into_existing(
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>[src]
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
fn resolve_creating(who: &AccountId, value: Self::NegativeImbalance)[src]
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: Trait<I>, I: Instance> Debug for Module<T, I> where
T: Debug,
I: Debug, [src]
T: Debug,
I: Debug,
impl<T: Eq + Trait<I>, I: Eq + Instance> Eq for Module<T, I>[src]
impl<T: Trait<I>, I: Instance> IsDeadAccount<<T as Trait>::AccountId> for Module<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug, [src]
T::Balance: MaybeSerializeDeserialize + Debug,
fn is_dead_account(who: &T::AccountId) -> bool[src]
impl<T: Trait<I>, I: Instance> LockableCurrency<<T as Trait>::AccountId> for Module<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.
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: Trait<I>, I: Instance> ModuleErrorMetadata for Module<T, I>[src]
fn metadata() -> &'static [ErrorMetadata][src]
impl<T: Trait<I>, I: Instance> OffchainWorker<<T as Trait>::BlockNumber> for Module<T, I>[src]
fn offchain_worker(_n: BlockNumber)[src]
impl<T: Trait<I>, I: Instance> OnFinalize<<T as Trait>::BlockNumber> for Module<T, I>[src]
fn on_finalize(_n: BlockNumber)[src]
impl<T: Trait<I>, I: Instance> OnInitialize<<T as Trait>::BlockNumber> for Module<T, I>[src]
fn on_initialize(_n: BlockNumber) -> u32[src]
impl<T: Trait<I>, I: Instance> OnKilledAccount<<T as Trait>::AccountId> for Module<T, I>[src]
Implement OnKilledAccount to remove the local account, if using local account storage.
NOTE: You probably won't need to use this! This only needs to be "wired in" to System module if you're using the local balance storage. If you're using the composite system account storage (which is the default in most examples and tests) then there's no need.
fn on_killed_account(who: &T::AccountId)[src]
impl<T: Trait<I>, I: Instance> OnRuntimeUpgrade for Module<T, I>[src]
fn on_runtime_upgrade() -> u32[src]
impl<T: PartialEq + Trait<I>, I: PartialEq + Instance> PartialEq<Module<T, I>> for Module<T, I>[src]
impl<T: Trait<I>, I: Instance> ReservableCurrency<<T as Trait>::AccountId> for Module<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.
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.
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
slashedid equal tobeneficiaryand thestatusisReserved.
impl<T: Trait<I>, I: Instance> StructuralEq for Module<T, I>[src]
impl<T: Trait<I>, I: Instance> StructuralPartialEq for Module<T, I>[src]
Auto Trait Implementations
impl<T, I> RefUnwindSafe for Module<T, I> where
I: RefUnwindSafe,
T: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> Send for Module<T, I> where
I: Send,
T: Send,
I: Send,
T: Send,
impl<T, I> Sync for Module<T, I> where
I: Sync,
T: Sync,
I: Sync,
T: Sync,
impl<T, I> Unpin for Module<T, I> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<T, I> UnwindSafe for Module<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,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> CheckedConversion for T[src]
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>, [src]
Self: TryFrom<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>, [src]
Self: TryInto<T>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
fn from_ref(outer: &Outer) -> &T
Get a reference to the inner from the outer.
fn from_mut(outer: &mut Outer) -> &mut T
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug, [src]
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T> Scalar for T where
T: PartialEq<T> + Copy + Any + Debug, [src]
T: PartialEq<T> + Copy + Any + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
T: UncheckedFrom<S>,
fn unchecked_into(self) -> T
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
T: Bounded,
fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,