use alloy::primitives::{Address, U256, address, uint};
pub const MULTICALL3: Address = address!("cA11bde05977b3631167028862bE2a173976CA11");
pub const Q96: U256 = U256::from_limbs([0, 0x1_0000_0000, 0, 0]);
pub const Q96_U128: u128 = 1_u128 << 96;
pub const SCALE_1E6: u32 = 1_000_000;
pub const ONE_HALF: u32 = 500_000;
pub const WAD: U256 = U256::from_limbs([1_000_000_000_000_000_000, 0, 0, 0]);
pub const WAD_ONE_PERCENT: U256 = U256::from_limbs([10_000_000_000_000_000, 0, 0, 0]);
pub const TICK_SPACING: i32 = 30;
pub const TWAVG_WINDOW: u32 = 3600;
pub const MIN_OPENING_MARGIN: u32 = 5_000_000;
pub const INTERVAL: u64 = 86_400;
pub const MIN_SQRT_PRICE_X96: U256 = uint!(2505414483750479311864138016_U256);
pub const MAX_SQRT_PRICE_X96: U256 = uint!(2505414483750479311864138015696_U256);
pub const MIN_TICK: i32 = -69_090;
pub const MAX_TICK: i32 = 69_090;
pub const ACCOUNTING_TOKEN_SUPPLY: U256 = U256::from_limbs([u64::MAX, u64::MAX >> 8, 0, 0]);
pub const MAX_PROTOCOL_FEE: u32 = 50_000;
pub const Q96_PRECISION: f64 = 0.000001;
pub const ERC721_NAME: &str = "Perp City Positions";
pub const ERC721_SYMBOL: &str = "PERPCITY";
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn q96_equals_two_pow_96() {
assert_eq!(Q96, U256::from(1u64) << 96);
}
#[test]
fn q96_u128_equals_two_pow_96() {
assert_eq!(Q96_U128, 79_228_162_514_264_337_593_543_950_336);
}
#[test]
fn one_half_is_half_of_scale() {
assert_eq!(ONE_HALF, SCALE_1E6 / 2);
}
#[test]
fn wad_value() {
assert_eq!(WAD, U256::from(10u64).pow(U256::from(18)));
}
#[test]
fn wad_one_percent_value() {
assert_eq!(WAD_ONE_PERCENT, U256::from(10u64).pow(U256::from(16)));
}
#[test]
fn tick_range_symmetric() {
assert_eq!(MIN_TICK, -MAX_TICK);
}
#[test]
fn accounting_token_supply_is_uint120_max() {
assert_eq!(
ACCOUNTING_TOKEN_SUPPLY,
(U256::from(1u64) << 120) - U256::from(1u64)
);
}
#[test]
fn min_sqrt_price_less_than_max() {
assert!(MIN_SQRT_PRICE_X96 < MAX_SQRT_PRICE_X96);
}
#[test]
fn min_sqrt_price_x96_matches_contract() {
let expected = U256::from_str_radix("2505414483750479311864138016", 10).unwrap();
assert_eq!(MIN_SQRT_PRICE_X96, expected);
}
#[test]
fn max_sqrt_price_x96_matches_contract() {
let expected = U256::from_str_radix("2505414483750479311864138015696", 10).unwrap();
assert_eq!(MAX_SQRT_PRICE_X96, expected);
}
}