Router: increase base CU (#12)

This commit is contained in:
Serge Farny 2024-10-08 11:52:24 +02:00 committed by GitHub
parent e7029e846e
commit ae2f5bfc5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ use solana_program::pubkey::Pubkey;
use std::str::FromStr;
const CU_PER_HOP_DEFAULT: u32 = 75_000;
const CU_BASE: u32 = 50_000;
const CU_BASE: u32 = 75_000;
pub trait SwapStepInstructionBuilder {
fn build_ix(
@ -146,13 +146,13 @@ impl<T: SwapStepInstructionBuilder> SwapInstructionsBuilder for SwapInstructions
for step in &swap_instructions {
if auto_create_out || (step.out_mint == sol_mint && auto_wrap_sol) {
Self::create_ata(&wallet_pk, &mut setup_instructions, &step.out_mint);
cu_estimate += 5000;
cu_estimate += 10_000;
}
if step.out_mint == sol_mint && auto_wrap_sol {
let wsol_account = get_associated_token_address(wallet_pk, &sol_mint);
Self::close_wsol_ata(&wallet_pk, &mut cleanup_instructions, &wsol_account)?;
cu_estimate += 5000;
cu_estimate += 10_000;
}
cu_estimate += step.cu_estimate.unwrap_or(CU_PER_HOP_DEFAULT);