//! Testing constants for Dew Finance contracts //! //! This module contains constants used specifically for testing purposes. //! These are separate from production constants to keep the main constants //! focused on production code. // ============================================================================ // TESTING CONSTANTS // ============================================================================ /// Default share price for testing (1.0 with 8 decimals) pub const DEFAULT_SHARE_PRICE: u128 = 100_000_000; /// Standard decimal scales for financial calculations pub const SCALE_6: u128 = 1_000_000; // 10^6 pub const SCALE_8: u128 = 100_000_000; // 10^8 pub const SCALE_12: u128 = 1_000_000_000_000; // 10^12 pub const SCALE_18: u128 = 1_000_000_000_000_000_000; // 10^18 /// Precision constants for testing pub const HIGH_PRECISION_BPS: u16 = 1; // 0.01% tolerance pub const MEDIUM_PRECISION_BPS: u16 = 10; // 0.1% tolerance pub const LOW_PRECISION_BPS: u16 = 100; // 1% tolerance /// Standard decimal configurations for testing pub const USDC_DECIMALS: u8 = 6; pub const EXTRA_DECIMALS: u8 = 18; pub const TOTAL_DECIMALS: u8 = USDC_DECIMALS + EXTRA_DECIMALS; // 24 /// Standard test amounts (using USDC 6-decimal precision as base) pub const TEST_USDC_AMOUNT: u128 = 1_000_000; // 1 USDC pub const TEST_LARGE_AMOUNT: u128 = 1_000_000_000_000; // 1M USDC pub const TEST_SMALL_AMOUNT: u128 = 1_000; // 0.001 USDC pub const TEST_SHARES_AMOUNT: u128 = 1_000_000_000_000_000_000; // 1 share (18 decimals) /// Safe maximum values for testing edge cases without overflow pub const SAFE_MAX_AMOUNT: u128 = 1_000_000_000_000_000; // 1B USDC (safe for multiplications) pub const SAFE_MAX_SHARES: u128 = 1_000_000_000_000_000_000_000_000; // 1M shares (safe for multiplications) /// Fee testing constants pub const TEST_MANAGEMENT_FEE_BPS: u16 = 200; // 2% pub const TEST_PERFORMANCE_FEE_BPS: u16 = 1500; // 15% pub const TEST_DEPOSIT_FEE_BPS: u16 = 50; // 0.5% pub const TEST_WITHDRAWAL_FEE_BPS: u16 = 100; // 1% pub const TEST_PROTOCOL_FEE_BPS: u16 = 500; // 5% /// Flow control testing constants pub const TEST_FLOW_CAP_AMOUNT: u128 = 10_000_000_000; // 10K USDC pub const TEST_FLOW_WINDOW_SECONDS: u64 = 3600; // 1 hour pub const TEST_DEPOSIT_LOCK_SECONDS: u64 = 86400; // 1 day /// Timing constants (in nanoseconds) pub const ONE_MINUTE_NANO: u64 = 60 * 1_000_000_000; pub const ONE_HOUR_NANO: u64 = 3600 * 1_000_000_000; pub const ONE_DAY_NANO: u64 = 86400 * 1_000_000_000; pub const ONE_WEEK_NANO: u64 = 7 * ONE_DAY_NANO; /// Price validation constants pub const MAX_PRICE_DEVIATION_BPS: u16 = 1000; // 10% pub const STALENESS_THRESHOLD_NANO: u64 = 30 * ONE_MINUTE_NANO; // 30 minutes // ============================================================================ // SHARE PRICE HELPERS // ============================================================================ /// Helper function to create share prices with fractional multipliers /// Example: rate_8_frac(15, 10) = 150_000_000 (represents 1.5) pub const fn rate_8_frac(numerator: u128, denominator: u128) -> u128 { (numerator * SCALE_8) / denominator } /// Common share prices for testing (semantic constants) pub const RATE_1_0: u128 = SCALE_8; // 100_000_000 pub const RATE_1_5: u128 = 150_000_000; // 1.5x pub const RATE_2_0: u128 = 2 * SCALE_8; // 200_000_000 pub const RATE_2_5: u128 = 250_000_000; // 2.5x pub const RATE_0_5: u128 = SCALE_8 / 2; // 50_000_000 (0.5x)