balancer_maths_rust/common/constants.rs
1//! Mathematical constants used throughout the Balancer maths implementation
2
3use alloy_primitives::{uint, U256};
4
5/// WAD (1e18) - used for fixed-point arithmetic
6pub const WAD: U256 = uint!(1_000_000_000_000_000_000_U256);
7
8/// TWO_WAD (2e18) - used for power calculations
9pub const TWO_WAD: U256 = uint!(2_000_000_000_000_000_000_U256);
10
11/// FOUR_WAD (4e18) - used for power calculations
12pub const FOUR_WAD: U256 = uint!(4_000_000_000_000_000_000_U256);
13
14/// MAX_POW_RELATIVE_ERROR - used for power calculations
15pub const MAX_POW_RELATIVE_ERROR: U256 = uint!(10_000_U256);
16
17/// RAY constant for 36 decimal precision (1e36)
18pub const RAY: U256 = uint!(1000000000000000000000000000000000000_U256);