Skip to main content

a_to_b

Function a_to_b 

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

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

§Parameters

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

§Returns

  • u64 - The amount in token B