Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs on transfer() + minimum_balance() #540

Merged
merged 3 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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