pub fn calculate_fee(&self, amount: u64, current_slot: u64) -> Result<u64> {
	///code
	
    if slots_passed < 150 {
        // Phase 1: 99% fees
        sol_fee = bps_mul(9900, amount, 10_000).unwrap();
    } else if slots_passed >= 150 && slots_passed <= 250 {
        // Phase 2: Linear decrease - Issue occurs here
        let fee_bps = (-8_300_000_i64)
            .checked_mul(slots_passed as i64)
            .ok_or(ContractError::ArithmeticError)?
            .checked_add(2_162_600_000)
            .ok_or(ContractError::ArithmeticError)?
            .checked_div(100_000)
            .ok_or(ContractError::ArithmeticError)?;
        sol_fee = bps_mul(fee_bps as u64, amount, 10_000).unwrap();
    } else if slots_passed > 250 {
        // Phase 3: 1% fees
        sol_fee = bps_mul(100, amount, 10_000).unwrap();
    }
interface FeeCalculation {
 slot: number;
 feeBps: number;
 feePercentage: number;
 phase: string;
 details?: string;
}

function calculateFee(slot: number): FeeCalculation {
 let feeBps: number;
 let phase: string;
 let details: string = '';

 if (slot < 150) {
   feeBps = 9900;
   phase = "Phase 1: Fixed 99%";
 } else if (slot >= 150 && slot <= 250) {
   const multiplier = -8300000;
   const additive = 2162600000;
   
   const step1 = multiplier * slot;
   const step2 = step1 + additive;
   feeBps = Math.floor(step2 / 100000);
   
   phase = "Phase 2: Linear Decrease";
   details = `
     Step 1 (multiply): ${multiplier} * ${slot} = ${step1}
     Step 2 (add): ${step1} + ${additive} = ${step2}
     Step 3 (divide): ${step2} / 100000 = ${feeBps}
   `;
 } else {
   feeBps = 100;
   phase = "Phase 3: Fixed 1%";
 }

 return {
   slot,
   feeBps,
   feePercentage: feeBps / 100,
   phase,
   details
 };
}

function printAllFees(): void {
 for (let slot = 0; slot <= 252; slot++) {
   const result = calculateFee(slot);
   console.log(`Slot ${slot.toString().padStart(3, ' ')}: ${result.feePercentage.toFixed(2)}% - ${result.phase}`);
   if (result.details) {
     console.log(result.details);
   }
   console.log('-'.repeat(50));
 }
}

// Call function to print all fees
printAllFees();

// Test specific slots
const testSlots = [149, 150, 200, 250, 251];
testSlots.forEach(slot => {
 const result = calculateFee(slot);
 console.log(`\nDetailed analysis for slot ${slot}:`);
 console.log(JSON.stringify(result, null, 2));
});
LOG]: "Slot 250: 8.76% - Phase 2: Linear Decrease" 
[LOG]: "
     Step 1 (multiply): -8300000 * 250 = -2075000000
     Step 2 (add): -2075000000 + 2162600000 = 87600000
     Step 3 (divide): 87600000 / 100000 = 876
   " 
[LOG]: "--------------------------------------------------" 
[LOG]: "Slot 251: 1.00% - Phase 3: Fixed 1%" 
[LOG]: "--------------------------------------------------" 
[LOG]: "Slot 252: 1.00% - Phase 3: Fixed 1%" 
[LOG]: "--------------------------------------------------" 
[LOG]: "
Detailed analysis for slot 149:" 
[LOG]: "{
  "slot": 149,
  "feeBps": 9900,
  "feePercentage": 99,
  "phase": "Phase 1: Fixed 99%",
  "details": ""
}" 
[LOG]: "
Detailed analysis for slot 150:" 
[LOG]: "{
  "slot": 150,
  "feeBps": 9176,
  "feePercentage": 91.76,
  "phase": "Phase 2: Linear Decrease",
  "details": "\n     Step 1 (multiply): -8300000 * 150 = -1245000000\n     Step 2 (add): -1245000000 + 2162600000 = 917600000\n     Step 3 (divide): 917600000 / 100000 = 9176\n   "
}" 
[LOG]: "
Detailed analysis for slot 200:" 
[LOG]: "{
  "slot": 200,
  "feeBps": 5026,
  "feePercentage": 50.26,
  "phase": "Phase 2: Linear Decrease",
  "details": "\n     Step 1 (multiply): -8300000 * 200 = -1660000000\n     Step 2 (add): -1660000000 + 2162600000 = 502600000\n     Step 3 (divide): 502600000 / 100000 = 5026\n   "
}" 
[LOG]: "
Detailed analysis for slot 250:" 
[LOG]: "{
  "slot": 250,
  "feeBps": 876,
  "feePercentage": 8.76,
  "phase": "Phase 2: Linear Decrease",
  "details": "\n     Step 1 (multiply): -8300000 * 250 = -2075000000\n     Step 2 (add): -2075000000 + 2162600000 = 87600000\n     Step 3 (divide): 87600000 / 100000 = 876\n   "
}" 
[LOG]: "
Detailed analysis for slot 251:" 
[LOG]: "{
  "slot": 251,
  "feeBps": 100,
  "feePercentage": 1,
  "phase": "Phase 3: Fixed 1%",
  "details": ""
}"
