Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/adapters/scorch_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl SwapArgs {
/// 14 state_b (writable)
/// 15 state_c (writable)
/// 16 sysvar_ixs (readonly)
/// 17 scorch_param (readonly) - encoded in first 16 bytes of key
/// 17 scorch_param (readonly) - encoded in first 17 bytes of key
///
/// CPI to Scorch (18 accounts): payer injected at position 1.
pub fn swap_v1(payer: &AccountView, rem: &[AccountView], amount_in: u64, _a_to_b: bool) {
Expand Down
34 changes: 17 additions & 17 deletions src/cons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,30 @@ pub mod scorch {
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[repr(u8)]
pub enum Dex {
Alphaq = 0,
AlphaQ = 0,
Aquifer = 1,
Bisonfi = 2,
HumidifiV2 = 3,
HumidifiV3 = 4,
BisonFi = 2,
HumidiFiV2 = 3,
HumidiFiV3 = 4,
Obric = 5,
Scorch = 6,
Solfi = 7,
SolFi = 7,
Tessera = 8,
Zerofi = 9,
ZeroFi = 9,
}

impl Dex {
pub const ALL: [Dex; 10] = [
Dex::Alphaq,
Dex::AlphaQ,
Dex::Aquifer,
Dex::Bisonfi,
Dex::HumidifiV2,
Dex::HumidifiV3,
Dex::BisonFi,
Dex::HumidiFiV2,
Dex::HumidiFiV3,
Dex::Obric,
Dex::Scorch,
Dex::Solfi,
Dex::SolFi,
Dex::Tessera,
Dex::Zerofi,
Dex::ZeroFi,
];

/// Number of remaining accounts per hop for swap_v1 (excludes shared payer).
Expand All @@ -124,15 +124,15 @@ impl Dex {
#[rustfmt::skip]
pub fn dst_ta_offset(&self, a_to_b: bool) -> usize {
match self {
Dex::Alphaq => if a_to_b { 4 } else { 3 },
Dex::AlphaQ => if a_to_b { 4 } else { 3 },
Dex::Aquifer => 3,
Dex::Bisonfi => if a_to_b { 5 } else { 4 },
Dex::HumidifiV2 | Dex::HumidifiV3 => if a_to_b { 5 } else { 4 },
Dex::BisonFi => if a_to_b { 5 } else { 4 },
Dex::HumidiFiV2 | Dex::HumidiFiV3 => if a_to_b { 5 } else { 4 },
Dex::Obric => if a_to_b { 7 } else { 6 },
Dex::Scorch => 3,
Dex::Solfi => if a_to_b { 7 } else { 6 },
Dex::SolFi => if a_to_b { 7 } else { 6 },
Dex::Tessera => if a_to_b { 6 } else { 5 },
Dex::Zerofi => 7,
Dex::ZeroFi => 7,
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/ixs/swap_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ impl SwapV1Chained {
#[inline(always)]
fn dispatch(payer: &AccountView, rem: &[AccountView], amount_in: u64, a_to_b: bool, dex: Dex) {
let handler: fn(&AccountView, &[AccountView], u64, bool) = match dex {
Dex::Alphaq => adapters::alphaq_v1::swap_v1,
Dex::AlphaQ => adapters::alphaq_v1::swap_v1,
Dex::Aquifer => adapters::aquifer_v1::swap_v1,
Dex::Bisonfi => adapters::bisonfi_v1::swap_v1,
Dex::HumidifiV2 | Dex::HumidifiV3 => adapters::humidifi_v1::swap_v3,
Dex::BisonFi => adapters::bisonfi_v1::swap_v1,
Dex::HumidiFiV2 | Dex::HumidiFiV3 => adapters::humidifi_v1::swap_v3,
Dex::Obric => adapters::obric_v2::swap_v1,
Dex::Scorch => adapters::scorch_v1::swap_v1,
Dex::Solfi => adapters::solfi_v2::swap_v1,
Dex::SolFi => adapters::solfi_v2::swap_v1,
Dex::Tessera => adapters::tessera_v1::swap_v1,
Dex::Zerofi => adapters::zerofi_v1::swap_v1,
Dex::ZeroFi => adapters::zerofi_v1::swap_v1,
};

handler(payer, rem, amount_in, a_to_b)
Expand Down
Loading