#[test]
fn test_stableswap_large_swap() {
    // Use realistic large pool values (e.g. 1M tokens with 18 decimals)
    let large_pool = Uint128::new(1_000_000_000_000_000_000_000_000u128); // 1M tokens
    
    // Large swap amount (100k tokens)
    let large_amount = Uint128::new(100_000_000_000_000_000_000_000u128);
    
    let test_cases = vec![
        // (amp, offer_pool, ask_pool, offer_amount, description)
        (
            MIN_AMP, 
            large_pool, 
            large_pool, 
            large_amount,
            "Balanced pool, minimum amplification"
        ),
    ];

    for (amp, offer_pool, ask_pool, offer_amount, description) in test_cases {
        println!("\nTesting case: {}", description);
        println!("Parameters: amp={}, offer_pool={}, ask_pool={}, offer_amount={}", 
                 amp, offer_pool, ask_pool, offer_amount);
        
        // Convert to Decimal256 for precision
        let offer_pool_dec = Decimal256::from_ratio(offer_pool, Uint128::new(1));
        let ask_pool_dec = Decimal256::from_ratio(ask_pool, Uint128::new(1));
        let offer_amount_dec = Decimal256::from_ratio(offer_amount, Uint128::new(1));
        
            let result = calculate_stableswap_y(
                Uint256::from(2u8),
                offer_pool_dec,
                ask_pool_dec,
                offer_amount_dec,
                &amp,
                18, // Using 18 decimals precision
                StableSwapDirection::Simulate,
            );
            
            match result {
                Ok(value) => {
                    println!("Result: {}", value);
                }
                Err(e) => {
                    panic!(
                        "Failed to converge: {:?}",
                        e
                    );
                }
            }
    }
}
pub fn calculate_stableswap_y(
    n_coins: Uint256,
    offer_pool: Decimal256,
    ask_pool: Decimal256,
    offer_amount: Decimal256,
    amp: &u64,
    ask_precision: u8,
    direction: StableSwapDirection,
) -> Result<Uint128, ContractError> {
    // Convert inputs to Uint512 for intermediate calculations
    let ann = Uint512::from(Uint256::from_u128((*amp).into()).checked_mul(n_coins)?);
    // ... rest of calculations using Uint512
}
