Skip to content

Commit

Permalink
fix failed doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
iboss-ptk committed May 10, 2024
1 parent 943f04e commit b14760b
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions contracts/transmuter/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ pub fn rescale(n: Uint128, numerator: Uint128, denominator: Uint128) -> MathResu

/// Calculate the price of the base asset in terms of the quote asset based on the normalized factors
///
/// ```
/// quote_amt / quote_norm_factor = base_amt / base_norm_factor
/// quote_amt = base_amt * quote_norm_factor / base_norm_factor
/// ```
///
/// spot price is how much of the quote asset is needed to buy one unit of the base asset
/// therefore:
///
/// ```
/// spot_price = 1 * quote_norm_factor / base_norm_factor
/// ```
pub fn price(base_norm_factor: Uint128, quote_norm_factor: Uint128) -> MathResult<Decimal> {
Decimal::checked_from_ratio(quote_norm_factor, base_norm_factor).map_err(Into::into)
}
Expand Down

0 comments on commit b14760b

Please sign in to comment.