Skip to content

Commit

Permalink
Improve docs on transfer() + minimum_balance() (#540)
Browse files Browse the repository at this point in the history
* Fix typo

* Make minimum_balance docs clearer

* Fix transfer() docs
  • Loading branch information
Michael Müller authored Oct 26, 2020
1 parent 0bdbd54 commit 0b1be71
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions crates/env/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ where
})
}

/// Returns the minimum balance for the contracts chain.
/// Returns the minimum balance that is required for creating an account.
///
/// # Errors
///
Expand Down Expand Up @@ -422,9 +422,11 @@ where
/// contract call or invoke a runtime function that performs the
/// transaction.
///
/// # Panics
/// # Errors
///
/// If the contract doesn't have sufficient funds.
/// - If the contract doesn't have sufficient funds.
/// - If the transfer would have brought the sender's total balance below the
/// subsistence threshold.
pub fn transfer<T>(destination: T::AccountId, value: T::Balance) -> Result<()>
where
T: Environment,
Expand Down
2 changes: 1 addition & 1 deletion crates/env/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub trait TypedEnvBackend: EnvBackend {
/// For more details visit: [`ink_env::block_number`]
fn block_number<T: Environment>(&mut self) -> Result<T::BlockNumber>;

/// Returns the minimum balance of the contracts chain.
/// Returns the minimum balance that is required for creating an account.
///
/// # Note
///
Expand Down
2 changes: 1 addition & 1 deletion crates/env/src/engine/off_chain/db/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl ChainSpec {
self.gas_price = OffBalance::new(&gas_price)
}

/// Returns the minimum balance for an account on the chain.
/// Returns the minimum balance that is required for creating an account.
pub fn minimum_balance<T>(&self) -> Result<T::Balance>
where
T: Environment,
Expand Down
2 changes: 1 addition & 1 deletion crates/env/src/engine/on_chain/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ define_error_codes! {
/// The passed key does not exist in storage.
KeyNotFound = 3,
/// Transfer failed because it would have brought the sender's total balance
/// bwlow the subsistence threshold.
/// below the subsistence threshold.
BelowSubsistenceThreshold = 4,
/// Transfer failed for other not further specified reason. Most probably
/// reserved or locked balance of the sender that was preventing the transfer.
Expand Down
2 changes: 1 addition & 1 deletion crates/env/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Error {
/// The queried contract storage entry is missing.
KeyNotFound,
/// Transfer failed because it would have brought the sender's total balance
/// bwlow the subsistence threshold.
/// below the subsistence threshold.
BelowSubsistenceThreshold,
/// Transfer failed for other not further specified reason. Most probably
/// reserved or locked balance of the sender that was preventing the transfer.
Expand Down
2 changes: 1 addition & 1 deletion crates/lang/src/env_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ where
ink_env::block_number::<T>().expect("couldn't decode block number")
}

/// Returns the minimum balance for the contracts chain.
/// Returns the minimum balance that is required for creating an account.
///
/// # Note
///
Expand Down

0 comments on commit 0b1be71

Please sign in to comment.