Skip to main content

b_to_a

Function b_to_a 

Source
pub fn b_to_a(
    amount_b: u64,
    price: U128,
    round_up: bool,
) -> Result<u64, CoreError>
Expand description

Convert an amount in token B to an amount in token A

§Parameters

  • amount_b - The amount in token B
  • price - The Q64.64 price in B/A
  • round_up - Whether to round up the result

§Returns

  • u64 - The amount in token A