Struct pallet_balances::Module [−][src]
Implementations
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_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.
NOTE: Calling this function will bypass origin filters.
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.
- Same as transfer, but additional read and write because the source account is not assumed to be in the overlay.
NOTE: Calling this function will bypass origin filters.
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
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) #
NOTE: Calling this function will bypass origin filters.
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.
pub fn mutate_account<R>(
who: &T::AccountId,
f: impl FnOnce(&mut AccountData<T::Balance>) -> R
) -> R
[src]
who: &T::AccountId,
f: impl FnOnce(&mut AccountData<T::Balance>) -> R
) -> R
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: 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
value
to be deposited is zero; or - if the
value
to be deposited is less than the ED and the account does not yet exist; 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: 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> IntegrityTest for Module<T, I>
[src]
pub fn integrity_test()
[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
.
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: Trait<I>, I: Instance> ModuleErrorMetadata for Module<T, I>
[src]
impl<T: Trait + Trait<I>, I: Instance> OffchainWorker<<T as Trait>::BlockNumber> for Module<T, I>
[src]
pub fn offchain_worker(_n: BlockNumber)
[src]
impl<T: Trait + Trait<I>, I: Instance> OnFinalize<<T as Trait>::BlockNumber> for Module<T, I>
[src]
pub fn on_finalize(_n: BlockNumber)
[src]
impl<T: Trait + Trait<I>, I: Instance> OnInitialize<<T as Trait>::BlockNumber> for Module<T, I>
[src]
pub fn on_initialize(_n: BlockNumber) -> u64
[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]
pub fn on_runtime_upgrade() -> u64
[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
slashed
id equal tobeneficiary
and thestatus
isReserved
.
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,
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<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 + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
[src]
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
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<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>,
[src]
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub unsafe 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>,