Skip to content

Commit

Permalink
Comment and adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Feb 27, 2024
1 parent 4bc6026 commit de76856
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/orderbook/src/tick_math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ pub fn divide_by_price(amount: Uint128, price: Decimal256) -> ContractResult<Uin
Ok(amount_to_send)
}

/// Converts a tick amount to it's value given a price and order direction
pub fn amount_to_value(
order: OrderDirection,
amount: Uint128,
price: Decimal256,
) -> ContractResult<Uint128> {
match order {
OrderDirection::Bid => divide_by_price(amount, price),
OrderDirection::Ask => multiply_by_price(amount, price),
OrderDirection::Bid => multiply_by_price(amount, price),
OrderDirection::Ask => divide_by_price(amount, price),
}
}

0 comments on commit de76856

Please sign in to comment.