Reusable mathematical patterns for financial safety in MultiversX smart contracts.
| BPS (4) | 10,000 = 100% | Fees, simple percentages, reserve factors | | PPM (6) | 1,000,000 = 100% | Fine-grained percentages, partial withdrawals | | WAD (18) | 1e18 = 1.0 | Token amounts, prices, share ratios | | RAY (27) | 1e27 = 1.0 | Interest indices, compounding rates, any math needing minimal precision loss |
Rule of thumb: Use the lowest precision that avoids rounding errors in your domain. For intermediate calculations, always use a higher precision than the final result.
Financial math patterns for MultiversX smart contracts — precision management, half-up rounding, safe rescaling, and percentage calculations. Use when building any DeFi contract that handles financial calculations, fees, rates, or token math. Source: multiversx/mx-ai-skills.