use alloy::primitives::{FixedBytes, U256};
pub const USDC_DECIMALS: u8 = 6;
pub const USDCE_DECIMALS: u8 = 6;
pub const CTF_DECIMALS: u8 = 6;
pub const ZERO_BYTES32: FixedBytes<32> = FixedBytes::<32>::ZERO;
pub const BINARY_PARTITION: [u8; 2] = [1, 2];
pub fn max_uint256() -> U256 {
U256::MAX
}
pub fn binary_partition_u256() -> Vec<U256> {
vec![U256::from(1), U256::from(2)]
}
pub mod proxy_tx_type {
pub const CALL: u8 = 1;
pub const DELEGATECALL: u8 = 2;
}
pub mod safe_operation {
pub const CALL: u8 = 0;
pub const DELEGATECALL: u8 = 1;
}
pub mod gas_limits {
use alloy::primitives::U256;
pub fn approve() -> U256 {
U256::from(50_000)
}
pub fn transfer() -> U256 {
U256::from(65_000)
}
pub fn split() -> U256 {
U256::from(300_000)
}
pub fn merge() -> U256 {
U256::from(250_000)
}
pub fn redeem() -> U256 {
U256::from(200_000)
}
pub fn proxy() -> U256 {
U256::from(500_000)
}
pub fn safe() -> U256 {
U256::from(400_000)
}
}
pub mod gas_prices {
use alloy::primitives::U256;
fn gwei(amount: u64) -> U256 {
U256::from(amount) * U256::from(1_000_000_000)
}
pub fn low() -> U256 {
gwei(30)
}
pub fn standard() -> U256 {
gwei(50)
}
pub fn high() -> U256 {
gwei(100)
}
pub fn urgent() -> U256 {
gwei(200)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_decimals() {
assert_eq!(USDC_DECIMALS, 6);
assert_eq!(USDCE_DECIMALS, 6);
assert_eq!(CTF_DECIMALS, 6);
}
#[test]
fn test_binary_partition() {
assert_eq!(BINARY_PARTITION, [1, 2]);
let partition = binary_partition_u256();
assert_eq!(partition.len(), 2);
assert_eq!(partition[0], U256::from(1));
assert_eq!(partition[1], U256::from(2));
}
#[test]
fn test_zero_bytes32() {
assert_eq!(ZERO_BYTES32, FixedBytes::<32>::ZERO);
}
#[test]
fn test_max_uint256() {
assert_eq!(max_uint256(), U256::MAX);
}
#[test]
fn test_proxy_tx_types() {
assert_eq!(proxy_tx_type::CALL, 1);
assert_eq!(proxy_tx_type::DELEGATECALL, 2);
}
#[test]
fn test_safe_operations() {
assert_eq!(safe_operation::CALL, 0);
assert_eq!(safe_operation::DELEGATECALL, 1);
}
#[test]
fn test_gas_limits() {
assert_eq!(gas_limits::approve(), U256::from(50_000));
assert_eq!(gas_limits::split(), U256::from(300_000));
}
#[test]
fn test_gas_prices() {
assert_eq!(gas_prices::low(), U256::from(30_000_000_000u64));
assert_eq!(gas_prices::standard(), U256::from(50_000_000_000u64));
assert_eq!(gas_prices::high(), U256::from(100_000_000_000u64));
}
}