Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
74bcfcb
comment updates
joepetrowski Mar 6, 2019
a544d4a
Merge branch 'master' into joe-balances-docs
joepetrowski Mar 6, 2019
1cc5721
added rustdoc and readme
joepetrowski Mar 6, 2019
e4a3bf7
clarified LockableCurrency trait
joepetrowski Mar 6, 2019
3e4b5e4
Currency trait rustdocs
joepetrowski Mar 7, 2019
077cde2
fixed typo
joepetrowski Mar 7, 2019
dd16fd6
fixed suggestions round 1
joepetrowski Mar 8, 2019
ceeb172
UpdateBalanceOutcome docs (open for discussion)
joepetrowski Mar 8, 2019
05894ab
rm description of enum, consolidation, rm ReclaimRebate
joepetrowski Mar 9, 2019
a654735
type clarification, examples overhaul, adoc formatting
joepetrowski Mar 10, 2019
02110b2
adoc to md
joepetrowski Mar 11, 2019
53680af
format change for rustdoc
joepetrowski Mar 12, 2019
f1b62a4
update links and fix typos
joepetrowski Mar 12, 2019
499c239
typos and links
joepetrowski Mar 13, 2019
cf750f8
Merge remote-tracking branch 'origin/master' into joe-balances-docs
joepetrowski Mar 13, 2019
2cf4009
updates according to comments
joepetrowski Mar 13, 2019
d863ff6
new example
joepetrowski Mar 14, 2019
5e28748
small clarifications
joepetrowski Mar 14, 2019
c8ec45a
trait implementation section
joepetrowski Mar 14, 2019
36b1689
missing ```
joepetrowski Mar 14, 2019
3c157e4
small changes, ready for review
joepetrowski Mar 14, 2019
a0ef9b7
line width update
joepetrowski Mar 15, 2019
2d28117
Merge branch 'master' into joe-balances-docs
joepetrowski Mar 18, 2019
df3ced9
Merge branch 'master' into joe-balances-docs
joepetrowski Mar 21, 2019
e42f6b6
small tweaks
joepetrowski Mar 25, 2019
e000871
Update srml/balances/src/lib.rs
gui1117 Mar 25, 2019
faccdbf
Update srml/balances/src/lib.rs
gui1117 Mar 25, 2019
513b377
Update srml/balances/src/lib.rs
gui1117 Mar 25, 2019
ce29349
Update srml/balances/src/lib.rs
gui1117 Mar 25, 2019
fa9f215
Update lib.rs
joepetrowski Mar 25, 2019
28a1d33
address review by thiolliere
joepetrowski Mar 25, 2019
aa43b56
remove common warning
joepetrowski Mar 26, 2019
191ecc0
Merge remote-tracking branch 'origin/master' into joe-balances-docs
gavofyork Mar 26, 2019
665fa6b
Update docs
gavofyork Mar 26, 2019
5f391ae
updated srml example
joepetrowski Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
small tweaks
  • Loading branch information
joepetrowski committed Mar 25, 2019
commit e42f6b63ec23c2ac8e1443125d971a5938a26517
26 changes: 13 additions & 13 deletions srml/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
//! existential deposit then it will be deleted.
//! - **Imbalance:** A condition when some funds were created or deducted without equal and opposite accounting. Functions
//! that result in an imbalance will return an object of the `Imbalance` trait that must be handled.
//! - **Locks:** Locks enable the runtime to lock an account's balance until a specified block number.
//! - **Locks:** A freeze on an account's balance until a specified block number.
//!
//! ### Implementations
//!
//!
//! The balances module provides implementations for the following traits. If these traits provide the functionality
//! that you need, then you can avoid coupling with the balances module.
//!
Expand All @@ -60,13 +60,13 @@
//! - [`LockableCurrency`](https://crates.parity.io/srml_support/traits/trait.LockableCurrency.html): Functions for
//! dealing with accounts that allow liquidity restrictions.
//! - [`Imbalance`]: Functions for handling imbalances between total issuance in the system and account balances.
//! Must be used when a function creates new funds (e.g. a reward) or destroys some funds (e.g. system fee).
//! Must be used when a function creates new funds (e.g. a reward) or destroys some funds (e.g. a system fee).
//! - [`MakePayent`]: Simple trait designed for hooking into a transaction payment. It operates over a single generic
//! `AccountId` type.
//! - [`IsDeadAccount`](https://crates.parity.io/srml_system/trait.IsDeadAccount.html): Determiner to say whether a
//! given account is unused.
//!
//! Example from the treasury module:
//! Example of using the `Currency` trait from the treasury module:
//!
//! ```rust,ignore
//! pub trait Trait: system::Trait {
Expand Down Expand Up @@ -142,7 +142,7 @@
//! ## Genesis config
//!
//! The following storage items depend on the genesis config:
//!
//!
//! - `TotalIssuance`
//! - `ExistentialDeposit`
//! - `TransferFee`
Expand Down Expand Up @@ -183,7 +183,7 @@ pub trait Subtrait<I: Instance = DefaultInstance>: system::Trait {
/// The balance of an account.
type Balance: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As<usize> + As<u64> + MaybeSerializeDebug;

/// A function which is invoked when the free-balance has fallen below the existential deposit and
/// A function that is invoked when the free-balance has fallen below the existential deposit and
/// has been reduced to zero.
///
/// Gives a chance to clean up resources associated with the given account.
Expand All @@ -197,7 +197,7 @@ pub trait Trait<I: Instance = DefaultInstance>: system::Trait {
/// The balance of an account.
type Balance: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As<usize> + As<u64> + MaybeSerializeDebug;

/// A function which is invoked when the free-balance has fallen below the existential deposit and
/// A function that is invoked when the free-balance has fallen below the existential deposit and
/// has been reduced to zero.
///
/// Gives a chance to clean up resources associated with the given account.
Expand Down Expand Up @@ -314,7 +314,7 @@ decl_storage! {
/// This is the only balance that matters in terms of most operations on tokens. It
/// alone is used to determine the balance when in the contract execution environment. When this
/// balance falls below the value of `ExistentialDeposit`, then the 'current account' is
/// deleted: specifically `FreeBalance`. Furthermore, `OnFreeBalanceZero` callback
/// deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback
/// is invoked, giving a chance to external modules to clean up data associated with
/// the deleted account.
///
Expand Down Expand Up @@ -370,7 +370,7 @@ decl_module! {
/// Set the balances of a given account.
///
/// This will alter `FreeBalance` and `ReservedBalance` in storage.
/// If the new free or reserved balance is below the existential deposit,
/// If the new free or reserved balance is below the existential deposit,
/// it will also decrease the total issuance of the system (`TotalIssuance`)
/// and reset the account nonce (`system::AccountNonce`).
///
Expand Down Expand Up @@ -406,9 +406,9 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
/// Set the reserved balance of an account to some new value. Will enforce `ExistentialDeposit`
/// law, annulling the account as needed.
///
/// Doesn't do any preparatory work for creating a new account, so should only be used when it
/// 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to have a standardized preconditions documentation section, many method here have preconditions that have to be meet in order to ensure consistency.

///
///
/// NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that
/// the caller will do this.
fn set_reserved_balance(who: &T::AccountId, balance: T::Balance) -> UpdateBalanceOutcome {
Expand All @@ -422,8 +422,8 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
}
}

/// Set the free balance of an account to some new value. Will enforce ExistentialDeposit
/// law annulling the account as needed.
/// Set the free balance of an account to some new value. Will enforce `ExistentialDeposit`
/// law, annulling the account as needed.
///
/// 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.
Expand Down
7 changes: 4 additions & 3 deletions srml/support/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub trait Currency<AccountId> {
new_balance: Self::Balance,
) -> result::Result<(), &'static str>;

// PUBLIC MUTABLES (DANGEROUS)
// PUBLIC MUTABLES (DANGEROUS)

/// Transfer some liquid free balance to another staker.
///
Expand Down Expand Up @@ -332,7 +332,7 @@ pub trait Currency<AccountId> {
/// Removes some free balance from `who` account for `reason` if possible. If `liveness` is `KeepAlive`,
/// then no less than `ExistentialDeposit` must be left remaining.
///
/// This checks any locks, vesting and liquidity requirements. If the removal is not possible, then it
/// This checks any locks, vesting, and liquidity requirements. If the removal is not possible, then it
/// returns `Err`.
fn withdraw(
who: &AccountId,
Expand Down Expand Up @@ -362,7 +362,7 @@ pub trait Currency<AccountId> {
UpdateBalanceOutcome,
);

/// Moves `value` from balance to reserved balance.
/// Moves `value` from balance to reserved balance.
///
/// If the free balance is lower than `value`, then no funds will be moved and an `Err` will
/// be returned to notify of this. This is different behavior than `unreserve`.
Expand Down Expand Up @@ -467,3 +467,4 @@ bitmask! {
Fee = 0b00001000,
}
}