Skip to main content

Module math

Module math 

Source
Expand description

Shared integer accounting math for Roshi vaults.

Constants§

BPS_DENOMINATOR
SHARE_DECIMALS

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 use assets_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 / den as u128 — a committed proportional rate applied to an amount (e.g. a flash-loan num/den fee on a borrow). num == 0 yields 0 without dividing, so a zero rate needs no valid denominator; a non-zero num over den == 0 is DivisionByZero. Returns u128 so the caller checks the value + fee sum 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.

Type Aliases§

MathResult