1use cosmwasm_std::{Decimal, Uint128};
2
3pub fn calculate_added_debt(borrow_amount: Uint128, debt_share_price: Decimal) -> Uint128 {
5 borrow_amount.div_ceil(debt_share_price)
6}
7
8pub fn calculate_removed_debt(repay_amount: Uint128, debt_share_price: Decimal) -> Uint128 {
10 repay_amount.div_floor(debt_share_price)
11}
12
13pub fn debt_to_liability(shares: Uint128, rate: Decimal) -> Uint128 {
15 shares.mul_ceil(rate)
16}
17
18pub fn rcpt_tokens_to_owed(tokens: Uint128, rate: Decimal) -> Uint128 {
20 tokens.mul_floor(rate)
21}
22
23pub fn amt_to_rcpt_tokens(amt: Uint128, rate: Decimal) -> Uint128 {
25 amt.div_floor(rate)
26}