interest
essey_sui::interest — interest and index math.
publicowed#
Move
public fun owed(principal: u64, rate_bps: u64, start_s: u64, now_s: u64): u64An offer loan's debt: principal plus ceil(principal × rate_bps × (now_s − start_s) / (10,000 × 31,536,000)). Rounded up, so a borrower owes at least the exact figure and at most one unit plus one second more.
publicgrown#
Move
public fun grown(index: u256, rate_bps: u64, elapsed_s: u64): u256One accrual step of a pool index: simple within the step, compounding across steps, capped so accrual never aborts.
publicowed_on_index#
Move
public fun owed_on_index(principal: u64, index_at_open: u256, index_now: u256): u64A pool loan's debt: principal × index_now / index_at_open, rounded up.
Also year_s() (31,536,000) and max_index().