From 1c615fc72130bf31d17e65ac5ab6dac3174f7437 Mon Sep 17 00:00:00 2001 From: Ozgun Ozerk Date: Thu, 27 Feb 2025 17:36:01 +0300 Subject: [PATCH 1/3] inline docs standardized, and emit removed from set_allowance --- .../src/extensions/burnable/storage.rs | 11 +--- .../fungible/src/extensions/capped/storage.rs | 6 +- .../src/extensions/metadata/storage.rs | 9 +-- .../src/extensions/mintable/storage.rs | 4 ++ contracts/token/fungible/src/storage.rs | 66 ++++++------------- contracts/token/fungible/src/test.rs | 10 +-- contracts/utils/pausable-macros/src/helper.rs | 5 +- 7 files changed, 38 insertions(+), 73 deletions(-) diff --git a/contracts/token/fungible/src/extensions/burnable/storage.rs b/contracts/token/fungible/src/extensions/burnable/storage.rs index 31295aa..3fa216e 100644 --- a/contracts/token/fungible/src/extensions/burnable/storage.rs +++ b/contracts/token/fungible/src/extensions/burnable/storage.rs @@ -16,9 +16,7 @@ use crate::{ /// /// # Errors /// -/// * [`crate::FungibleTokenError::InsufficientBalance`] - When attempting to -/// burn more tokens than `from` current balance. -/// * [`crate::FungibleTokenError::LessThanZero`] - When `amount < 0`. +/// * refer to [`update`] errors. /// /// # Events /// @@ -48,11 +46,8 @@ pub fn burn(e: &Env, from: &Address, amount: i128) { /// /// # Errors /// -/// * [`crate::FungibleTokenError::InsufficientBalance`] - When attempting to -/// burn more tokens than `from` current balance. -/// * [`crate::FungibleTokenError::InsufficientAllowance`] - When attempting to -/// burn more tokens than `spender`s current allowance. -/// * [`crate::FungibleTokenError::LessThanZero`] - When `amount < 0`. +/// * refer to [`spend_allowance`] errors. +/// * refer to [`update`] errors. /// /// # Events /// diff --git a/contracts/token/fungible/src/extensions/capped/storage.rs b/contracts/token/fungible/src/extensions/capped/storage.rs index af24a09..2f41577 100644 --- a/contracts/token/fungible/src/extensions/capped/storage.rs +++ b/contracts/token/fungible/src/extensions/capped/storage.rs @@ -28,7 +28,7 @@ pub fn set_cap(e: &Env, cap: i128) { e.storage().instance().set(&CAP_KEY, &cap); } -/// Query the maximum supply of tokens. +/// Returns the maximum supply of tokens. /// /// # Arguments /// @@ -37,10 +37,6 @@ pub fn set_cap(e: &Env, cap: i128) { /// # Errors /// /// * [`FungibleTokenError::CapNotSet`] - Occurs when the cap has not been set. -/// -/// # Returns -/// -/// the maximum supply of tokens. pub fn query_cap(e: &Env) -> i128 { e.storage() .instance() diff --git a/contracts/token/fungible/src/extensions/metadata/storage.rs b/contracts/token/fungible/src/extensions/metadata/storage.rs index 2600991..5d2c260 100644 --- a/contracts/token/fungible/src/extensions/metadata/storage.rs +++ b/contracts/token/fungible/src/extensions/metadata/storage.rs @@ -38,8 +38,7 @@ pub fn get_metadata(e: &Env) -> Metadata { /// /// # Errors /// -/// * [`FungibleTokenError::UnsetMetadata`] - When trying to access -/// uninitialized metadata. +/// * refer to [`get_metadata`] errors. pub fn decimals(e: &Env) -> u32 { get_metadata(e).decimals } @@ -52,8 +51,7 @@ pub fn decimals(e: &Env) -> u32 { /// /// # Errors /// -/// * [`FungibleTokenError::UnsetMetadata`] - When trying to access -/// uninitialized metadata. +/// * refer to [`get_metadata`] errors. pub fn name(e: &Env) -> String { get_metadata(e).name } @@ -66,8 +64,7 @@ pub fn name(e: &Env) -> String { /// /// # Errors /// -/// * [`FungibleTokenError::UnsetMetadata`] - When trying to access -/// uninitialized metadata. +/// * refer to [`get_metadata`] errors. pub fn symbol(e: &Env) -> String { get_metadata(e).symbol } diff --git a/contracts/token/fungible/src/extensions/mintable/storage.rs b/contracts/token/fungible/src/extensions/mintable/storage.rs index 908b922..916cd42 100644 --- a/contracts/token/fungible/src/extensions/mintable/storage.rs +++ b/contracts/token/fungible/src/extensions/mintable/storage.rs @@ -11,6 +11,10 @@ use crate::{extensions::mintable::emit_mint, storage::update}; /// * `account` - The address receiving the new tokens. /// * `amount` - The amount of tokens to mint. /// +/// # Errors +/// +/// refer to [`update`] errors. +/// /// # Events /// /// * topics - `["mint", account: Address]` diff --git a/contracts/token/fungible/src/storage.rs b/contracts/token/fungible/src/storage.rs index 0c87858..da3c765 100644 --- a/contracts/token/fungible/src/storage.rs +++ b/contracts/token/fungible/src/storage.rs @@ -125,10 +125,7 @@ pub fn allowance(e: &Env, owner: &Address, spender: &Address) -> i128 { /// /// # Errors /// -/// * [`FungibleTokenError::InvalidLiveUntilLedger`] - Occurs when attempting to -/// set `live_until_ledger` that is 1) greater than the maximum allowed or 2) -/// less than the current ledger number and `amount` is greater than `0`. -/// * [`FungibleTokenError::LessThanZero`] - Occurs when `amount < 0`. +/// * refer to [`set_allowance`] errors. /// /// # Events /// @@ -144,14 +141,13 @@ pub fn allowance(e: &Env, owner: &Address, spender: &Address) -> i128 { /// "Stellar Asset Contract" implementation for consistency reasons. pub fn approve(e: &Env, owner: &Address, spender: &Address, amount: i128, live_until_ledger: u32) { owner.require_auth(); - set_allowance(e, owner, spender, amount, live_until_ledger, true); + set_allowance(e, owner, spender, amount, live_until_ledger); + emit_approve(e, owner, spender, amount, live_until_ledger); } /// Sets the amount of tokens a `spender` is allowed to spend on behalf of an /// `owner`. Overrides any existing allowance set between `spender` and `owner`. -/// Variant of [`approve()`] that doesn't handle authorization, but controls -/// event emission. That can be useful in operations like spending allowance -/// during [`transfer_from()`]. +/// Doesn't handle authorization, nor event emission. /// /// # Arguments /// @@ -160,7 +156,6 @@ pub fn approve(e: &Env, owner: &Address, spender: &Address, amount: i128, live_u /// * `spender` - The address authorized to spend the tokens. /// * `amount` - The amount of tokens made available to `spender`. /// * `live_until_ledger` - The ledger number at which the allowance expires. -/// * `emit` - A flag to enable or disable event emission. /// /// # Errors /// @@ -169,15 +164,9 @@ pub fn approve(e: &Env, owner: &Address, spender: &Address, amount: i128, live_u /// less than the current ledger number and `amount` is greater than `0`. /// * [`FungibleTokenError::LessThanZero`] - Occurs when `amount < 0`. /// -/// # Events -/// -/// Emits an event if `emit` is `true`. -/// * topics - `["approve", from: Address, spender: Address]` -/// * data - `[amount: i128, live_until_ledger: u32]` -/// /// # Notes /// -/// * No authorization is required. +/// * It is expected that the caller of this function handles the authorization. /// * Allowance is implicitly timebound by the maximum allowed storage TTL value /// which is a network parameter, i.e. one cannot set an allowance for a /// longer period. This behavior closely mirrors the functioning of the @@ -188,7 +177,6 @@ pub fn set_allowance( spender: &Address, amount: i128, live_until_ledger: u32, - emit: bool, ) { if amount < 0 { panic_with_error!(e, FungibleTokenError::LessThanZero); @@ -216,10 +204,6 @@ pub fn set_allowance( e.storage().temporary().extend_ttl(&key, live_for, live_for) } - - if emit { - emit_approve(e, owner, spender, amount, live_until_ledger); - } } /// Deducts the amount of tokens a `spender` is allowed to spend on behalf of an @@ -237,10 +221,11 @@ pub fn set_allowance( /// * [`FungibleTokenError::InsufficientAllowance`] - When attempting to /// transfer more tokens than `spender` current allowance. /// * [`FungibleTokenError::LessThanZero`] - Occurs when `amount < 0`. +/// * also refer to [`set_allowance`] errors. /// /// # Notes /// -/// No authorization is required. +/// * It is expected that the caller of this function handles the authorization. pub fn spend_allowance(e: &Env, owner: &Address, spender: &Address, amount: i128) { if amount < 0 { panic_with_error!(e, FungibleTokenError::LessThanZero) @@ -253,14 +238,7 @@ pub fn spend_allowance(e: &Env, owner: &Address, spender: &Address, amount: i128 } if amount > 0 { - set_allowance( - e, - owner, - spender, - allowance.amount - amount, - allowance.live_until_ledger, - false, - ); + set_allowance(e, owner, spender, allowance.amount - amount, allowance.live_until_ledger); } } @@ -275,13 +253,11 @@ pub fn spend_allowance(e: &Env, owner: &Address, spender: &Address, amount: i128 /// /// # Errors /// -/// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer -/// more tokens than `from` current balance. +/// * refer to [`do_transfer`] errors. /// /// # Events /// -/// * topics - `["transfer", from: Address, to: Address]` -/// * data - `[amount: i128]` +/// * refer to [`do_transfer`] events. /// /// # Notes /// @@ -305,16 +281,12 @@ pub fn transfer(e: &Env, from: &Address, to: &Address, amount: i128) { /// /// # Errors /// -/// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer -/// more tokens than `from` current balance. -/// * [`FungibleTokenError::InsufficientAllowance`] - When attempting to -/// transfer more tokens than `spender` current allowance. -/// +/// * refer to [`spend_allowance`] errors. +/// * refer to [`do_transfer`] errors. /// /// # Events /// -/// * topics - `["transfer", from: Address, to: Address]` -/// * data - `[amount: i128]` +/// * refer to [`do_transfer`] events. /// /// # Notes /// @@ -325,7 +297,9 @@ pub fn transfer_from(e: &Env, spender: &Address, from: &Address, to: &Address, a do_transfer(e, from, to, amount); } -/// Equivalent to [`transfer()`] but doesn't handle authorization. +/// Equivalent to [`transfer()`] but: +/// - does NOT handle authorization. +/// - does handles event emission /// /// # Arguments /// @@ -336,8 +310,7 @@ pub fn transfer_from(e: &Env, spender: &Address, from: &Address, to: &Address, a /// /// # Errors /// -/// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer -/// more tokens than `from` current balance. +/// * refer to [`update`] errors. /// /// # Events /// @@ -346,10 +319,9 @@ pub fn transfer_from(e: &Env, spender: &Address, from: &Address, to: &Address, a /// /// # Notes /// -/// No authorization is required. +/// * It is expected that the caller of this function handles the authorization. pub fn do_transfer(e: &Env, from: &Address, to: &Address, amount: i128) { update(e, Some(from), Some(to), amount); - emit_transfer(e, from, to, amount); } @@ -373,7 +345,7 @@ pub fn do_transfer(e: &Env, from: &Address, to: &Address, amount: i128) { /// /// # Notes /// -/// No authorization is required. +/// * It is expected that the caller of this function handles the authorization. pub fn update(e: &Env, from: Option<&Address>, to: Option<&Address>, amount: i128) { if amount < 0 { panic_with_error!(e, FungibleTokenError::LessThanZero); diff --git a/contracts/token/fungible/src/test.rs b/contracts/token/fungible/src/test.rs index fc4d877..80a04b5 100644 --- a/contracts/token/fungible/src/test.rs +++ b/contracts/token/fungible/src/test.rs @@ -173,7 +173,7 @@ fn set_allowance_with_expired_ledger_fails() { e.as_contract(&address, || { e.ledger().set_sequence_number(10); - set_allowance(&e, &owner, &spender, 50, 5, true); + set_allowance(&e, &owner, &spender, 50, 5); }); } @@ -187,7 +187,7 @@ fn set_allowance_with_greater_than_max_ledger_fails() { e.as_contract(&address, || { let ttl = e.storage().max_ttl() + 1; - set_allowance(&e, &owner, &spender, 50, ttl, true); + set_allowance(&e, &owner, &spender, 50, ttl); }); } @@ -200,7 +200,7 @@ fn set_allowance_with_neg_amount_fails() { let spender = Address::generate(&e); e.as_contract(&address, || { - set_allowance(&e, &owner, &spender, -1, 5, true); + set_allowance(&e, &owner, &spender, -1, 5); }); } @@ -213,13 +213,13 @@ fn set_allowance_with_zero_amount() { let spender = Address::generate(&e); e.as_contract(&address, || { - set_allowance(&e, &owner, &spender, 0, 5, false); + set_allowance(&e, &owner, &spender, 0, 5); let allowance_val = allowance(&e, &owner, &spender); assert_eq!(allowance_val, 0); // should pass for a past ledger e.ledger().set_sequence_number(10); - set_allowance(&e, &owner2, &spender, 0, 5, false); + set_allowance(&e, &owner2, &spender, 0, 5); let allowance_val = allowance(&e, &owner2, &spender); assert_eq!(allowance_val, 0); }); diff --git a/contracts/utils/pausable-macros/src/helper.rs b/contracts/utils/pausable-macros/src/helper.rs index 4234c94..08d47c6 100644 --- a/contracts/utils/pausable-macros/src/helper.rs +++ b/contracts/utils/pausable-macros/src/helper.rs @@ -39,8 +39,9 @@ fn check_env_arg(input_fn: &ItemFn) -> (syn::Ident, bool) { // Extract the pattern and type from the argument let (pat, ty) = match first_arg { FnArg::Typed(PatType { pat, ty, .. }) => (pat, ty), - _ => - panic!("first argument of function '{}' must be a typed parameter", input_fn.sig.ident), + _ => { + panic!("first argument of function '{}' must be a typed parameter", input_fn.sig.ident) + } }; // Get the identifier from the pattern From 4bb799e6504e108fa38074afbaa2dbad9e35c7a8 Mon Sep 17 00:00:00 2001 From: Ozgun Ozerk Date: Fri, 28 Feb 2025 13:30:34 +0300 Subject: [PATCH 2/3] finalize --- .../token/fungible/src/extensions/burnable/mod.rs | 2 ++ .../fungible/src/extensions/capped/storage.rs | 6 +++--- .../token/fungible/src/extensions/mintable/mod.rs | 6 ++++++ contracts/token/fungible/src/fungible.rs | 12 +++++++----- contracts/token/fungible/src/storage.rs | 12 ++++++++---- contracts/utils/pausable/src/storage.rs | 14 ++------------ 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/contracts/token/fungible/src/extensions/burnable/mod.rs b/contracts/token/fungible/src/extensions/burnable/mod.rs index ef91491..6e09aef 100644 --- a/contracts/token/fungible/src/extensions/burnable/mod.rs +++ b/contracts/token/fungible/src/extensions/burnable/mod.rs @@ -33,6 +33,7 @@ pub trait FungibleBurnable { /// /// * [`crate::FungibleTokenError::InsufficientBalance`] - When attempting /// to burn more tokens than `from` current balance. + /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. /// /// # Events /// @@ -61,6 +62,7 @@ pub trait FungibleBurnable { /// to burn more tokens than `from` current balance. /// * [`crate::FungibleTokenError::InsufficientAllowance`] - When attempting /// to burn more tokens than `from` allowance. + /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. /// /// # Events /// diff --git a/contracts/token/fungible/src/extensions/capped/storage.rs b/contracts/token/fungible/src/extensions/capped/storage.rs index ec0db80..bba0a93 100644 --- a/contracts/token/fungible/src/extensions/capped/storage.rs +++ b/contracts/token/fungible/src/extensions/capped/storage.rs @@ -18,9 +18,9 @@ pub const CAP_KEY: Symbol = symbol_short!("CAP"); /// /// # Notes /// -/// We recommend using this function in the constructor of your smart contract. -/// Cap functionality is designed to be used in conjunction with the `mintable` -/// extension. +/// * We recommend using this function in the constructor of your smart contract. +/// * Cap functionality is designed to be used in conjunction with the `mintable` +/// extension. pub fn set_cap(e: &Env, cap: i128) { if cap < 0 { panic_with_error!(e, FungibleTokenError::InvalidCap); diff --git a/contracts/token/fungible/src/extensions/mintable/mod.rs b/contracts/token/fungible/src/extensions/mintable/mod.rs index 2481cf0..0f43f61 100644 --- a/contracts/token/fungible/src/extensions/mintable/mod.rs +++ b/contracts/token/fungible/src/extensions/mintable/mod.rs @@ -25,6 +25,11 @@ pub trait FungibleMintable { /// * `account` - The address receiving the new tokens. /// * `amount` - The amount of tokens to mint. /// + /// # Errors + /// + /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. + /// * [`FungibleTokenError::MathOverflow`] - When `total_supply` overflows. + /// /// # Events /// /// * topics - `["mint", account: Address]` @@ -45,6 +50,7 @@ pub trait FungibleMintable { /// some authorization controls for minting tokens. fn mint(e: &Env, account: Address, amount: i128); } + // ################## EVENTS ################## /// Emits an event indicating a mint of tokens. diff --git a/contracts/token/fungible/src/fungible.rs b/contracts/token/fungible/src/fungible.rs index a997641..3d9de8b 100644 --- a/contracts/token/fungible/src/fungible.rs +++ b/contracts/token/fungible/src/fungible.rs @@ -63,8 +63,9 @@ pub trait FungibleToken { /// /// # Errors /// - /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to - /// transfer more tokens than `from` current balance. + /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer + /// more tokens than `from` current balance. + /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. /// /// # Events /// @@ -92,12 +93,12 @@ pub trait FungibleToken { /// /// # Errors /// - /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to - /// transfer more tokens than `from` current balance. + /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer + /// more tokens than `from` current balance. + /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. /// * [`FungibleTokenError::InsufficientAllowance`] - When attempting to /// transfer more tokens than `spender` current allowance. /// - /// /// # Events /// /// * topics - `["transfer", from: Address, to: Address]` @@ -127,6 +128,7 @@ pub trait FungibleToken { /// * [`FungibleTokenError::InvalidLiveUntilLedger`] - Occurs when /// attempting to set `live_until_ledger` that is less than the current /// ledger number and greater than `0`. + /// * [`FungibleTokenError::LessThanZero`] - Occurs when `amount < 0`. /// /// # Events /// diff --git a/contracts/token/fungible/src/storage.rs b/contracts/token/fungible/src/storage.rs index da3c765..fda10e4 100644 --- a/contracts/token/fungible/src/storage.rs +++ b/contracts/token/fungible/src/storage.rs @@ -166,7 +166,8 @@ pub fn approve(e: &Env, owner: &Address, spender: &Address, amount: i128, live_u /// /// # Notes /// -/// * It is expected that the caller of this function handles the authorization. +/// * This function does not enforce authorization. Ensure that authorization +/// is handled at a higher level. /// * Allowance is implicitly timebound by the maximum allowed storage TTL value /// which is a network parameter, i.e. one cannot set an allowance for a /// longer period. This behavior closely mirrors the functioning of the @@ -225,7 +226,8 @@ pub fn set_allowance( /// /// # Notes /// -/// * It is expected that the caller of this function handles the authorization. +/// This function does not enforce authorization. Ensure that authorization +/// is handled at a higher level. pub fn spend_allowance(e: &Env, owner: &Address, spender: &Address, amount: i128) { if amount < 0 { panic_with_error!(e, FungibleTokenError::LessThanZero) @@ -319,7 +321,8 @@ pub fn transfer_from(e: &Env, spender: &Address, from: &Address, to: &Address, a /// /// # Notes /// -/// * It is expected that the caller of this function handles the authorization. +/// This function does not enforce authorization. Ensure that authorization +/// is handled at a higher level. pub fn do_transfer(e: &Env, from: &Address, to: &Address, amount: i128) { update(e, Some(from), Some(to), amount); emit_transfer(e, from, to, amount); @@ -345,7 +348,8 @@ pub fn do_transfer(e: &Env, from: &Address, to: &Address, amount: i128) { /// /// # Notes /// -/// * It is expected that the caller of this function handles the authorization. +/// This function does not enforce authorization. Ensure that authorization +/// is handled at a higher level. pub fn update(e: &Env, from: Option<&Address>, to: Option<&Address>, amount: i128) { if amount < 0 { panic_with_error!(e, FungibleTokenError::LessThanZero); diff --git a/contracts/utils/pausable/src/storage.rs b/contracts/utils/pausable/src/storage.rs index 1ccde4a..c8e9f51 100644 --- a/contracts/utils/pausable/src/storage.rs +++ b/contracts/utils/pausable/src/storage.rs @@ -28,8 +28,7 @@ pub fn paused(e: &Env) -> bool { /// /// # Errors /// -/// * [`PausableError::EnforcedPause`] - Occurs when the contract is already in -/// `Paused` state. +/// * refer to [`when_not_paused`] errors. /// /// # Events /// @@ -55,8 +54,7 @@ pub fn pause(e: &Env, caller: &Address) { /// /// # Errors /// -/// * [`PausableError::ExpectedPause`] - Occurs when the contract is already in -/// `Unpaused` state. +/// * refer to [`when_paused`] errors. /// /// # Events /// @@ -83,10 +81,6 @@ pub fn unpause(e: &Env, caller: &Address) { /// /// * [`PausableError::EnforcedPause`] - Occurs when the contract is already in /// `Paused` state. -/// -/// # Notes -/// -/// No authorization is required. pub fn when_not_paused(e: &Env) { if paused(e) { panic_with_error!(e, PausableError::EnforcedPause); @@ -103,10 +97,6 @@ pub fn when_not_paused(e: &Env) { /// /// * [`PausableError::ExpectedPause`] - Occurs when the contract is already in /// `Unpaused` state. -/// -/// # Notes -/// -/// No authorization is required. pub fn when_paused(e: &Env) { if !paused(e) { panic_with_error!(e, PausableError::ExpectedPause); From 2f4e0554da34196bce52deb89e76c858c5d6a750 Mon Sep 17 00:00:00 2001 From: Ozgun Ozerk Date: Fri, 28 Feb 2025 13:33:02 +0300 Subject: [PATCH 3/3] cargo fmt --- contracts/token/fungible/src/extensions/capped/storage.rs | 7 ++++--- contracts/token/fungible/src/fungible.rs | 8 ++++---- contracts/token/fungible/src/storage.rs | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/contracts/token/fungible/src/extensions/capped/storage.rs b/contracts/token/fungible/src/extensions/capped/storage.rs index bba0a93..49285c7 100644 --- a/contracts/token/fungible/src/extensions/capped/storage.rs +++ b/contracts/token/fungible/src/extensions/capped/storage.rs @@ -18,9 +18,10 @@ pub const CAP_KEY: Symbol = symbol_short!("CAP"); /// /// # Notes /// -/// * We recommend using this function in the constructor of your smart contract. -/// * Cap functionality is designed to be used in conjunction with the `mintable` -/// extension. +/// * We recommend using this function in the constructor of your smart +/// contract. +/// * Cap functionality is designed to be used in conjunction with the +/// `mintable` extension. pub fn set_cap(e: &Env, cap: i128) { if cap < 0 { panic_with_error!(e, FungibleTokenError::InvalidCap); diff --git a/contracts/token/fungible/src/fungible.rs b/contracts/token/fungible/src/fungible.rs index 3d9de8b..fe7a684 100644 --- a/contracts/token/fungible/src/fungible.rs +++ b/contracts/token/fungible/src/fungible.rs @@ -63,8 +63,8 @@ pub trait FungibleToken { /// /// # Errors /// - /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer - /// more tokens than `from` current balance. + /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to + /// transfer more tokens than `from` current balance. /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. /// /// # Events @@ -93,8 +93,8 @@ pub trait FungibleToken { /// /// # Errors /// - /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to transfer - /// more tokens than `from` current balance. + /// * [`FungibleTokenError::InsufficientBalance`] - When attempting to + /// transfer more tokens than `from` current balance. /// * [`FungibleTokenError::LessThanZero`] - When `amount < 0`. /// * [`FungibleTokenError::InsufficientAllowance`] - When attempting to /// transfer more tokens than `spender` current allowance. diff --git a/contracts/token/fungible/src/storage.rs b/contracts/token/fungible/src/storage.rs index fda10e4..b4b631f 100644 --- a/contracts/token/fungible/src/storage.rs +++ b/contracts/token/fungible/src/storage.rs @@ -166,8 +166,8 @@ pub fn approve(e: &Env, owner: &Address, spender: &Address, amount: i128, live_u /// /// # Notes /// -/// * This function does not enforce authorization. Ensure that authorization -/// is handled at a higher level. +/// * This function does not enforce authorization. Ensure that authorization is +/// handled at a higher level. /// * Allowance is implicitly timebound by the maximum allowed storage TTL value /// which is a network parameter, i.e. one cannot set an allowance for a /// longer period. This behavior closely mirrors the functioning of the