Expand description
Shared integer accounting math for Roshi vaults.
Constants§
Functions§
- assets_
for_ redeem - assets_
for_ shares - Floor-rounded base value of
shares. Zero is a valid result: a dust position can be worth less than one base atom, and withdrawal-ticket strikes must price it (to nothing) rather than wedge. Immediate redemption paths that must pay out should useassets_for_redeem. - base_
atoms_ from_ asset_ atoms - Floor-rounded base atoms for
asset_atoms, priced through two whole-token oracle legs sharing one quote currency: - bps_
ceil - bps_
floor - ceil_
mul - Ceiling of
value * num / denasu128— a committed proportional rate applied to an amount (e.g. a flash-loannum/denfee on a borrow).num == 0yields0without dividing, so a zero rate needs no valid denominator; a non-zeronumoverden == 0isDivisionByZero. Returnsu128so the caller checks thevalue + feesum against its own bound. - checked_
u64 - mul_
div_ ceil - mul_
div_ ceil_ u64 - mul_
div_ floor - mul_
div_ floor_ u64 - performance_
fee_ for_ nav - pow10
- share_
price_ from_ assets - shares_
for_ deposit - validate_
percentage_ bps - virtual_
share_ offset - The virtual share supply backing one virtual base atom:
10^(SHARE_DECIMALS - base_decimals), the empty-vault mint ratio.