PRBMath: A Modern Smart Contract Library for Fixed-Point Math
summary
Library adds 18-decimal fixed‑point math to Solidity 0.8 with ready implementations of logarithms, exponentials, pow, sqrt and a binary exponent, plus a ud60x18 type and 10^18 scaling. It reimplements a mulDiv-style overflow-avoiding routine so intermediate products never revert, uses custom errors to cut revert gas ~10x, and ships an AMM formula proof-of-concept. Test suite totals 1,400 tests with about 96% coverage and reports only minor rounding edge cases after long use.
AI-written summary · about
chapters (10)
- 0:00Start
- 2:22What is Solidity?
- 3:16What is the Problem?
- 5:53Example Projects
- 10:21Basic Features
- 10:38Advanced Features
- 11:03Simple Numbers
- 15:42Solidity v0.8 Features
- 18:16Developer Experience
- 19:43Testing and Security
related talks
14mPRBMath: A Smart Contract Library for Fixed Point Math
31m“Multi-Precision Arithmetic for Cryptology in C++, at Run-Time and at Compile-Time”
21mSolType: Refinement Types for Arithmetic Overflow in Solidity
16mSpain: Succinct Proofs for Numerical Computations
26mSolType: Refinement Types for Arithmetic Overflow in Solidity
01h 07mProofs - Practice 2
25mCommSec D2 - Smart Contract (In)Security
18mAll the things I wish (native) Solidity would let me do
