Skip to content

Commit

Permalink
fixed comment
Browse files Browse the repository at this point in the history
Signed-off-by: Dzmitry Lahoda <dzmitry@lahoda.pro>
  • Loading branch information
dzmitry-lahoda committed Jan 12, 2022
1 parent 290e574 commit ee40922
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions frame/composable-traits/src/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ pub trait CurrencyFactory<CurrencyId> {
fn create() -> Result<CurrencyId, DispatchError>;
}

/// Local presentation of asset information.
/// Most pallets do not need it.
pub trait LocalAssets<MayBeAssetId> {
/// decimals of of big unit over minimal unit
/// ORML also has separate trait on Balances to inspect decimals, that is not on type it self
fn decimals(currency_id: MayBeAssetId) -> Result<Exponent, DispatchError>;

fn unit<T: From<u64>>(currency_id: MayBeAssetId) -> Result<T, DispatchError> {
let exponent = Self::decimals(currency_id)?;
Ok(10_u64.pow(exponent).into())
}
/// decimals of of big unit over minimal unit
/// ORML also has separate trait on Balances to inspect decimals, that is not on type it self
fn decimals(currency_id: MayBeAssetId) -> Result<Exponent, DispatchError>;
/// Amount which humans operate as `1` usually.
/// Amount is probably priceable by Oracles.
/// Amount resonably higher than minimal tradeable amount or minial trading step on DEX.
fn unit<T: From<u64>>(currency_id: MayBeAssetId) -> Result<T, DispatchError> {
let exponent = Self::decimals(currency_id)?;
Ok(10_u64.pow(exponent).into())
}
}

/// when we store assets in native form to chain in smallest units or for mock in tests
Expand Down

0 comments on commit ee40922

Please sign in to comment.