Overview
Reserve Folio uses a comprehensive unit system documented with curly brackets ({}) throughout the codebase. The system includes precision multipliers (D18 and D27) to handle ratios, percentages, and prices with high accuracy.
Base Units
Token Units
{tok}, {share}, {reward} represent token balances in their native quantaTime Units
{s} represents time in secondsPrecision Multipliers
Common Unit Patterns
Percentages and Ratios
D18{1} - Percentage Values
D18{1} - Percentage Values
Percentage values with 18 decimals of precision.Example: Fee portions, allocation percentages
D27{tok/BU} - Basket Unit Weights
D27{tok/BU} - Basket Unit Weights
Weight of a token in the basket unit definition with 27 decimals of precision.Range:
[0, 1e54]Price Units
D27{UoA/tok} - Token Prices
Price in nanoUSD (Unit of Account) per token quanta, with 27 decimals of precision.Valid Range:
(0, 1e45]The Unit of Account can be anything as long as it’s consistent; nanoUSD is most common.Exchange Rates
D27{tok1/tok2} - Token Exchange Rates
Ratio of two token balances with 27 decimals of precision.Used in: Auction pricing, token pair exchanges
Rebalance-Specific Units
Rebalance Limits
- low: Basket units per share to buy assets up to
- spot: Point estimate for unrestricted callers
- high: Basket units per share to sell assets down to
Weight Ranges
Price Ranges
Unit Conversion Examples
Best Practices
Related Documentation
Valid Ranges
Learn about valid ranges for different units
Rebalancing
Understand how units are used in rebalancing