From ec5d988a16084eae1668cae277940fd00de74bf9 Mon Sep 17 00:00:00 2001 From: arrayappy Date: Mon, 12 May 2025 01:22:01 +0530 Subject: [PATCH 1/4] test: add fixtures and tests for meteora dlmm decoder --- Cargo.lock | 2 + decoders/meteora-dlmm-decoder/Cargo.toml | 2 + .../meteora-dlmm-decoder/src/accounts/mod.rs | 675 ++++ .../src/instructions/add_liquidity.rs | 1 + .../instructions/add_liquidity_by_strategy.rs | 1 + .../add_liquidity_by_strategy_one_side.rs | 1 + .../instructions/add_liquidity_by_weight.rs | 1 + .../instructions/add_liquidity_one_side.rs | 1 + .../add_liquidity_one_side_precise.rs | 1 + .../src/instructions/claim_fee.rs | 1 + .../src/instructions/claim_reward.rs | 1 + .../src/instructions/close_position.rs | 1 + .../instructions/close_preset_parameter.rs | 1 + .../src/instructions/fund_reward.rs | 1 + .../src/instructions/go_to_a_bin.rs | 1 + .../src/instructions/initialize_bin_array.rs | 1 + .../initialize_bin_array_bitmap_extension.rs | 1 + ...ize_customizable_permissionless_lb_pair.rs | 1 + .../src/instructions/initialize_lb_pair.rs | 1 + .../initialize_permission_lb_pair.rs | 1 + .../src/instructions/initialize_position.rs | 1 + .../initialize_position_by_operator.rs | 1 + .../instructions/initialize_position_pda.rs | 1 + .../initialize_preset_parameter.rs | 1 + .../src/instructions/initialize_reward.rs | 1 + .../src/instructions/migrate_position.rs | 1 + .../src/instructions/mod.rs | 3066 +++++++++++++++++ .../src/instructions/remove_all_liquidity.rs | 1 + .../src/instructions/remove_liquidity.rs | 1 + .../instructions/remove_liquidity_by_range.rs | 1 + .../src/instructions/swap.rs | 2 +- .../src/instructions/swap_exact_out.rs | 1 + .../instructions/swap_with_price_impact.rs | 1 + .../src/instructions/update_fee_parameters.rs | 1 + .../instructions/update_fees_and_rewards.rs | 1 + .../src/types/init_permission_pair_ix.rs | 1 + .../src/types/user_reward_info.rs | 2 +- decoders/meteora-dlmm-decoder/tests/README.md | 56 + .../add_liquidity_by_strategy_ix.json | 102 + ...add_liquidity_by_strategy_one_side_ix.json | 78 + .../fixtures/add_liquidity_by_weight_ix.json | 102 + .../tests/fixtures/add_liquidity_ix.json | 102 + .../fixtures/add_liquidity_one_side_ix.json | 78 + .../add_liquidity_one_side_precise_ix.json | 78 + .../tests/fixtures/claim_fee_ix.json | 90 + .../tests/fixtures/claim_reward_ix.json | 72 + .../tests/fixtures/close_position_ix.json | 54 + .../fixtures/close_preset_parameter_ix.json | 24 + .../tests/fixtures/fund_reward_ix.json | 60 + .../tests/fixtures/go_to_a_bin_ix.json | 42 + ...tialize_bin_array_bitmap_extension_ix.json | 36 + .../fixtures/initialize_bin_array_ix.json | 30 + ...ustomizable_permissionless_lb_pair_ix.json | 90 + .../tests/fixtures/initialize_lb_pair_ix.json | 90 + .../initialize_permission_lb_pair_ix.json | 90 + .../initialize_position_by_operator_ix.json | 72 + .../fixtures/initialize_position_ix.json | 54 + .../fixtures/initialize_position_pda_ix.json | 60 + .../initialize_preset_parameter_ix.json | 30 + .../tests/fixtures/initialize_reward_ix.json | 60 + .../tests/fixtures/lb_pair_account.json | 8 + .../tests/fixtures/migrate_position_ix.json | 66 + .../tests/fixtures/position_account.json | 8 + .../fixtures/preset_parameter_account.json | 8 + .../fixtures/remove_all_liquidity_ix.json | 102 + .../remove_liquidity_by_range_ix.json | 102 + .../tests/fixtures/remove_liquidity_ix.json | 102 + .../tests/fixtures/swap_exact_out_ix.json | 106 + .../tests/fixtures/swap_ix.json | 111 + .../fixtures/swap_with_price_impact_ix.json | 111 + .../fixtures/update_fee_parameters_ix.json | 30 + .../fixtures/update_fees_and_rewards_ix.json | 36 + 72 files changed, 6118 insertions(+), 2 deletions(-) create mode 100644 decoders/meteora-dlmm-decoder/tests/README.md create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_one_side_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_weight_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_precise_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/close_position_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/close_preset_parameter_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/go_to_a_bin_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_bitmap_extension_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_by_operator_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_pda_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/migrate_position_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/position_account.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/preset_parameter_account.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/remove_all_liquidity_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/update_fees_and_rewards_ix.json diff --git a/Cargo.lock b/Cargo.lock index ebe14b6e3..042243aa2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1374,11 +1374,13 @@ name = "carbon-meteora-dlmm-decoder" version = "0.8.0" dependencies = [ "carbon-core", + "carbon-test-utils", "serde", "serde-big-array", "solana-account", "solana-instruction", "solana-pubkey", + "solana-sdk", ] [[package]] diff --git a/decoders/meteora-dlmm-decoder/Cargo.toml b/decoders/meteora-dlmm-decoder/Cargo.toml index 1842c6ec7..ab361abb4 100644 --- a/decoders/meteora-dlmm-decoder/Cargo.toml +++ b/decoders/meteora-dlmm-decoder/Cargo.toml @@ -19,3 +19,5 @@ serde-big-array = { workspace = true } solana-account = { workspace = true } solana-instruction = { workspace = true, default-features = false } solana-pubkey = { workspace = true } +solana-sdk = { workspace = true } +carbon-test-utils = { workspace = true } \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs index 1774d0131..995b8a44d 100644 --- a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs @@ -111,3 +111,678 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder { None } } + +#[cfg(test)] +mod tests { + + use crate::types::{ + FeeInfo, ProtocolFee, RewardInfo, StaticParameters, UserRewardInfo, VariableParameters, + }; + use solana_sdk::pubkey; + + use super::{lb_pair::LbPair, position::Position, preset_parameter::PresetParameter, *}; + + #[test] + fn test_decode_lb_pair_account() { + // Arrange + let expected_account = LbPair { + activation_point: 0, + activation_type: 0, + active_id: 2314, + base_factor_seed: [232, 3], + base_key: pubkey!("11111111111111111111111111111111"), + bin_array_bitmap: Default::default(), + bin_step: 100, + bin_step_seed: [100, 0], + bump_seed: [255], + creator: pubkey!("ECT3FF9qYr3YgkPtNeJ4VgeGsybXReDSQ7shp1EFH5mJ"), + last_updated_at: 1735030695, + oracle: pubkey!("A85D9MkhqntAgk8foSvrptG5k4KTVpLrXf7so53C8m2V"), + padding0: 0, + padding1: [0; 32], + padding2: [0; 32], + padding3: [0; 8], + padding4: 0, + pair_type: 0, + parameters: StaticParameters { + base_factor: 1000, + filter_period: 300, + decay_period: 1200, + reduction_factor: 5000, + variable_fee_control: 7500, + max_volatility_accumulator: 150000, + min_bin_id: -4386, + max_bin_id: 4386, + protocol_share: 500, + padding: [0; 6], + }, + pre_activation_duration: 0, + pre_activation_swap_address: pubkey!("11111111111111111111111111111111"), + protocol_fee: ProtocolFee { + amount_x: 0, + amount_y: 0, + }, + require_base_factor_seed: 1, + reserve_x: pubkey!("5XuCjSAsJj4T5W5m8gkSU1i5s5FjxRkFzZHpAcZjaHid"), + reserve_y: pubkey!("97wxjXLaC6vR9aFSLeLWKDf2s4JFrScuCEfbUCggyjjc"), + reserved: Default::default(), + reward_infos: [ + RewardInfo { + mint: pubkey!("11111111111111111111111111111111"), + vault: pubkey!("11111111111111111111111111111111"), + funder: pubkey!("11111111111111111111111111111111"), + reward_duration: 0, + reward_duration_end: 0, + reward_rate: 0, + last_update_time: 0, + cumulative_seconds_with_empty_liquidity_reward: 0, + }, + RewardInfo { + mint: pubkey!("11111111111111111111111111111111"), + vault: pubkey!("11111111111111111111111111111111"), + funder: pubkey!("11111111111111111111111111111111"), + reward_duration: 0, + reward_duration_end: 0, + reward_rate: 0, + last_update_time: 0, + cumulative_seconds_with_empty_liquidity_reward: 0, + }, + ], + status: 0, + token_x_mint: pubkey!("9fEXUmPnDJYAXpoZ9nWi1gQZPwzVKdf8g9fYXW6Epump"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + v_parameters: VariableParameters { + volatility_accumulator: 0, + volatility_reference: 0, + index_reference: 0, + padding: [0; 4], + last_update_timestamp: 0, + padding1: [0; 8], + }, + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let account = carbon_test_utils::read_account("tests/fixtures/lb_pair_account.json") + .expect("read fixture"); + let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + + // Assert + match decoded_account.data { + MeteoraDlmmAccount::LbPair(account) => { + assert_eq!(expected_account.activation_point, account.activation_point); + assert_eq!(expected_account.activation_type, account.activation_type); + assert_eq!(expected_account.active_id, account.active_id); + assert_eq!(expected_account.base_factor_seed, account.base_factor_seed); + assert_eq!(expected_account.base_key, account.base_key); + assert_eq!(expected_account.bin_array_bitmap, account.bin_array_bitmap); + assert_eq!(expected_account.bin_step, account.bin_step); + assert_eq!(expected_account.bin_step_seed, account.bin_step_seed); + assert_eq!(expected_account.bump_seed, account.bump_seed); + assert_eq!(expected_account.creator, account.creator); + assert_eq!(expected_account.last_updated_at, account.last_updated_at); + assert_eq!(expected_account.oracle, account.oracle); + assert_eq!(expected_account.padding1, account.padding1); + assert_eq!(expected_account.padding2, account.padding2); + assert_eq!(expected_account.padding3, account.padding3); + assert_eq!(expected_account.padding4, account.padding4); + assert_eq!(expected_account.pair_type, account.pair_type); + assert_eq!(expected_account.parameters, account.parameters); + assert_eq!( + expected_account.pre_activation_duration, + account.pre_activation_duration + ); + assert_eq!( + expected_account.pre_activation_swap_address, + account.pre_activation_swap_address + ); + assert_eq!(expected_account.protocol_fee, account.protocol_fee); + assert_eq!( + expected_account.require_base_factor_seed, + account.require_base_factor_seed + ); + assert_eq!(expected_account.reserve_x, account.reserve_x); + assert_eq!(expected_account.reserve_y, account.reserve_y); + assert_eq!(expected_account.reserved, account.reserved); + assert_eq!(expected_account.reward_infos, account.reward_infos); + assert_eq!(expected_account.status, account.status); + assert_eq!(expected_account.token_x_mint, account.token_x_mint); + assert_eq!(expected_account.token_y_mint, account.token_y_mint); + assert_eq!(expected_account.v_parameters, account.v_parameters); + } + _ => panic!("Expected LbPairAccount"), + } + } + + #[test] + fn test_decode_position_account() { + // Arrange + let expected_account = Position { + fee_infos: [ + FeeInfo { + fee_x_per_token_complete: 3237430216995946070, + fee_y_per_token_complete: 338315940628455803, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3344215977641041254, + fee_y_per_token_complete: 359095789650660862, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3449067785093342886, + fee_y_per_token_complete: 390207297842947808, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3649746854123535238, + fee_y_per_token_complete: 372813125206544406, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4061348525785686840, + fee_y_per_token_complete: 423600912387165973, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4174051943599568166, + fee_y_per_token_complete: 445721745593672613, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4253164394862537286, + fee_y_per_token_complete: 424774068691991118, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3631511938755515833, + fee_y_per_token_complete: 382122079192575165, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3470715508927983598, + fee_y_per_token_complete: 385675387657977693, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3987418285622101436, + fee_y_per_token_complete: 439206402054294020, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4676575511895198856, + fee_y_per_token_complete: 471890585439944091, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4868613589236393543, + fee_y_per_token_complete: 478838451906984553, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4056474453903998277, + fee_y_per_token_complete: 396353952659702067, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2900985452688169261, + fee_y_per_token_complete: 257431649512112207, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1954244734204519486, + fee_y_per_token_complete: 184546370495890298, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1710709942673573716, + fee_y_per_token_complete: 179297770399655848, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1698160436942218995, + fee_y_per_token_complete: 194980253157133459, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2607164261053237624, + fee_y_per_token_complete: 270448688290498108, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2342060806885896269, + fee_y_per_token_complete: 238003435002880878, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3019341186719815397, + fee_y_per_token_complete: 308538775065394983, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4607511958966065930, + fee_y_per_token_complete: 433966778859712268, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 6451080832649175722, + fee_y_per_token_complete: 606167420423557883, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 8687875173560330499, + fee_y_per_token_complete: 800007388453413869, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 7305177228619618660, + fee_y_per_token_complete: 700150980617911254, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 6410004177076413178, + fee_y_per_token_complete: 646241116445589198, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 6363717907631000413, + fee_y_per_token_complete: 636540478379733740, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 6250195746351436029, + fee_y_per_token_complete: 631070172930907384, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 5630500732261984124, + fee_y_per_token_complete: 563347055381846655, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 5349544728334565168, + fee_y_per_token_complete: 525210519965865253, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3764329285427732080, + fee_y_per_token_complete: 365695527636916700, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3995512331991557943, + fee_y_per_token_complete: 395813535562255275, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4451677614351678142, + fee_y_per_token_complete: 437197265552201064, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3880912260623670734, + fee_y_per_token_complete: 395497833478777476, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4201995051360829556, + fee_y_per_token_complete: 415446678516441506, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 4486779568212043087, + fee_y_per_token_complete: 416500269206756618, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3217846640755188322, + fee_y_per_token_complete: 298767432884691310, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3573275137441754082, + fee_y_per_token_complete: 341667262397036939, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3755338225242181548, + fee_y_per_token_complete: 355262626467208041, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3461655249653659231, + fee_y_per_token_complete: 328177955060004600, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 3269651569214089689, + fee_y_per_token_complete: 297283342114947194, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2715514794685244397, + fee_y_per_token_complete: 245294905066967057, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2367625033796641650, + fee_y_per_token_complete: 213902351053043453, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2634250947370164479, + fee_y_per_token_complete: 246196177474824205, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 2519318248962674164, + fee_y_per_token_complete: 221440051508924725, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1680660981993680015, + fee_y_per_token_complete: 145548371838832985, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1664920973918393194, + fee_y_per_token_complete: 147292010640495879, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1613226648653358450, + fee_y_per_token_complete: 145461501603737762, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1034860904526350205, + fee_y_per_token_complete: 97394981100307429, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1376107217537806549, + fee_y_per_token_complete: 127145580115014617, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1613748999277948507, + fee_y_per_token_complete: 146204383800444496, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 1249589971801912607, + fee_y_per_token_complete: 111412892536818670, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 797464684034192397, + fee_y_per_token_complete: 72348586515025862, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 656612686779265758, + fee_y_per_token_complete: 62704467030982166, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 575803780381410494, + fee_y_per_token_complete: 58731876639458945, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 553186693487790121, + fee_y_per_token_complete: 56364657218830879, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 202336058579925293, + fee_y_per_token_complete: 19214628418178675, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 184939686121133222, + fee_y_per_token_complete: 17576654238193037, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 175946761721174878, + fee_y_per_token_complete: 16735344704666033, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 198991684334454249, + fee_y_per_token_complete: 18942430431927217, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 578631091549282, + fee_y_per_token_complete: 55128072976260, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + FeeInfo { + fee_x_per_token_complete: 0, + fee_y_per_token_complete: 0, + fee_x_pending: 0, + fee_y_pending: 0, + }, + ], + last_updated_at: 1703204155, + lb_pair: pubkey!("FoSDw2L5DmTuQTFe55gWPDXf88euaxAEKFre74CnvQbX"), + liquidity_shares: [ + 134835, 134835, 134835, 134835, 134835, 134835, 134835, 134835, 134835, 134835, + 134835, 134835, 134835, 134835, 134835, 134835, 134835, 134835, 134835, 134835, + 134835, 134835, 134835, 134835, 134835, 134835, 134823, 134835, 134835, 134835, + 134835, 134835, 134835, 149725, 127182, 127321, 127460, 127600, 127600, 127739, + 127878, 128017, 128017, 128156, 128295, 128434, 128435, 128574, 128713, 128852, + 128852, 128991, 129130, 129130, 129269, 129409, 129548, 129548, 129687, 129826, + 129965, 129965, 130104, 130243, 130383, 130383, 130522, 130661, 130743, 0, + ], + lower_bin_id: -2999, + owner: pubkey!("2W7yBhBJDScbun4JbocAcRp5sx8SShy8uaHFDHfBeks6"), + reserved: [0; 160], + reward_infos: [UserRewardInfo { + reward_per_token_completes: [0; 2], + reward_pendings: [0; 2], + }; 70], + total_claimed_fee_x_amount: 0, + total_claimed_fee_y_amount: 0, + total_claimed_rewards: [0, 0], + upper_bin_id: -2931, + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let account = carbon_test_utils::read_account("tests/fixtures/position_account.json") + .expect("read fixture"); + let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + + // Assert + match decoded_account.data { + MeteoraDlmmAccount::Position(account) => { + assert_eq!(expected_account.fee_infos, account.fee_infos); + assert_eq!(expected_account.last_updated_at, account.last_updated_at); + assert_eq!(expected_account.lb_pair, account.lb_pair); + assert_eq!(expected_account.liquidity_shares, account.liquidity_shares); + assert_eq!(expected_account.lower_bin_id, account.lower_bin_id); + assert_eq!(expected_account.owner, account.owner); + assert_eq!(expected_account.reserved, account.reserved); + assert_eq!(expected_account.reward_infos, account.reward_infos); + assert_eq!( + expected_account.total_claimed_fee_x_amount, + account.total_claimed_fee_x_amount + ); + assert_eq!( + expected_account.total_claimed_fee_y_amount, + account.total_claimed_fee_y_amount + ); + assert_eq!( + expected_account.total_claimed_rewards, + account.total_claimed_rewards + ); + assert_eq!(expected_account.upper_bin_id, account.upper_bin_id); + } + _ => panic!("Expected PositionAccount"), + } + } + + #[test] + fn test_decode_preset_parameter_account() { + // Arrange + let expected_account = PresetParameter { + base_factor: 10000, + bin_step: 30, + decay_period: 600, + filter_period: 30, + max_bin_id: 14577, + max_volatility_accumulator: 350000, + min_bin_id: -14577, + protocol_share: 500, + reduction_factor: 5000, + variable_fee_control: 15000, + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let account = + carbon_test_utils::read_account("tests/fixtures/preset_parameter_account.json") + .expect("read fixture"); + let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + + // Assert + match decoded_account.data { + MeteoraDlmmAccount::PresetParameter(account) => { + assert_eq!(expected_account.base_factor, account.base_factor); + assert_eq!(expected_account.bin_step, account.bin_step); + assert_eq!(expected_account.decay_period, account.decay_period); + assert_eq!(expected_account.filter_period, account.filter_period); + assert_eq!(expected_account.max_bin_id, account.max_bin_id); + assert_eq!( + expected_account.max_volatility_accumulator, + account.max_volatility_accumulator + ); + assert_eq!(expected_account.min_bin_id, account.min_bin_id); + assert_eq!(expected_account.protocol_share, account.protocol_share); + assert_eq!(expected_account.reduction_factor, account.reduction_factor); + assert_eq!( + expected_account.variable_fee_control, + account.variable_fee_control + ); + } + _ => panic!("Expected PresetParameterAccount"), + } + } +} diff --git a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity.rs b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity.rs index 60fbffd93..3220e3ec5 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity.rs @@ -11,6 +11,7 @@ pub struct AddLiquidity { pub liquidity_parameter: LiquidityParameter, } +#[derive(PartialEq, Debug)] pub struct AddLiquidityInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy.rs b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy.rs index 608dc58f6..f7ac67f04 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy.rs @@ -11,6 +11,7 @@ pub struct AddLiquidityByStrategy { pub liquidity_parameter: LiquidityParameterByStrategy, } +#[derive(Debug, PartialEq)] pub struct AddLiquidityByStrategyInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy_one_side.rs b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy_one_side.rs index 652c6700e..dea456c60 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy_one_side.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_strategy_one_side.rs @@ -11,6 +11,7 @@ pub struct AddLiquidityByStrategyOneSide { pub liquidity_parameter: LiquidityParameterByStrategyOneSide, } +#[derive(Debug, PartialEq)] pub struct AddLiquidityByStrategyOneSideInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_weight.rs b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_weight.rs index fd228166b..020f7adf3 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_weight.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_by_weight.rs @@ -11,6 +11,7 @@ pub struct AddLiquidityByWeight { pub liquidity_parameter: LiquidityParameterByWeight, } +#[derive(Debug, PartialEq)] pub struct AddLiquidityByWeightInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side.rs b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side.rs index 61f85fe97..50a28afd0 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side.rs @@ -11,6 +11,7 @@ pub struct AddLiquidityOneSide { pub liquidity_parameter: LiquidityOneSideParameter, } +#[derive(PartialEq, Debug)] pub struct AddLiquidityOneSideInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side_precise.rs b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side_precise.rs index 873acc1a6..f3361e9d1 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side_precise.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/add_liquidity_one_side_precise.rs @@ -11,6 +11,7 @@ pub struct AddLiquidityOneSidePrecise { pub parameter: AddLiquiditySingleSidePreciseParameter, } +#[derive(PartialEq, Debug)] pub struct AddLiquidityOneSidePreciseInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/claim_fee.rs b/decoders/meteora-dlmm-decoder/src/instructions/claim_fee.rs index d997d157d..3536b0f62 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/claim_fee.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/claim_fee.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0xa9204f8988e84689")] pub struct ClaimFee {} +#[derive(PartialEq, Debug)] pub struct ClaimFeeInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub position: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/claim_reward.rs b/decoders/meteora-dlmm-decoder/src/instructions/claim_reward.rs index a64686224..c9f34a1a2 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/claim_reward.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/claim_reward.rs @@ -8,6 +8,7 @@ pub struct ClaimReward { pub reward_index: u64, } +#[derive(PartialEq, Debug)] pub struct ClaimRewardInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub position: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/close_position.rs b/decoders/meteora-dlmm-decoder/src/instructions/close_position.rs index 6230bcc35..ef4442914 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/close_position.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/close_position.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0x7b86510031446262")] pub struct ClosePosition {} +#[derive(PartialEq, Debug)] pub struct ClosePositionInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/close_preset_parameter.rs b/decoders/meteora-dlmm-decoder/src/instructions/close_preset_parameter.rs index 9dd55a97e..d8c44b3d1 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/close_preset_parameter.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/close_preset_parameter.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0x04949164861ab53d")] pub struct ClosePresetParameter {} +#[derive(Debug, PartialEq)] pub struct ClosePresetParameterInstructionAccounts { pub preset_parameter: solana_pubkey::Pubkey, pub admin: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/fund_reward.rs b/decoders/meteora-dlmm-decoder/src/instructions/fund_reward.rs index a43938623..0d65f24fa 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/fund_reward.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/fund_reward.rs @@ -10,6 +10,7 @@ pub struct FundReward { pub carry_forward: bool, } +#[derive(PartialEq, Debug)] pub struct FundRewardInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub reward_vault: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/go_to_a_bin.rs b/decoders/meteora-dlmm-decoder/src/instructions/go_to_a_bin.rs index 077adb170..f95101912 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/go_to_a_bin.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/go_to_a_bin.rs @@ -8,6 +8,7 @@ pub struct GoToABin { pub bin_id: i32, } +#[derive(Debug, PartialEq)] pub struct GoToABinInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array.rs index 5d2249cea..119fd4d72 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array.rs @@ -8,6 +8,7 @@ pub struct InitializeBinArray { pub index: i64, } +#[derive(Debug, PartialEq)] pub struct InitializeBinArrayInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array_bitmap_extension.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array_bitmap_extension.rs index 6588df516..4aa0f67f9 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array_bitmap_extension.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_bin_array_bitmap_extension.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0x2f9de2b40cf02147")] pub struct InitializeBinArrayBitmapExtension {} +#[derive(Debug, PartialEq)] pub struct InitializeBinArrayBitmapExtensionInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_customizable_permissionless_lb_pair.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_customizable_permissionless_lb_pair.rs index e7ded297a..5f0d319de 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_customizable_permissionless_lb_pair.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_customizable_permissionless_lb_pair.rs @@ -11,6 +11,7 @@ pub struct InitializeCustomizablePermissionlessLbPair { pub params: CustomizableParams, } +#[derive(Debug, PartialEq)] pub struct InitializeCustomizablePermissionlessLbPairInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_lb_pair.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_lb_pair.rs index 902ad9fa9..b29f29873 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_lb_pair.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_lb_pair.rs @@ -9,6 +9,7 @@ pub struct InitializeLbPair { pub bin_step: u16, } +#[derive(Debug, PartialEq)] pub struct InitializeLbPairInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_permission_lb_pair.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_permission_lb_pair.rs index f986d92de..bf03bac1d 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_permission_lb_pair.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_permission_lb_pair.rs @@ -11,6 +11,7 @@ pub struct InitializePermissionLbPair { pub ix_data: InitPermissionPairIx, } +#[derive(Debug, PartialEq)] pub struct InitializePermissionLbPairInstructionAccounts { pub base: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_position.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_position.rs index f523d5b1d..238a390e4 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_position.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_position.rs @@ -9,6 +9,7 @@ pub struct InitializePosition { pub width: i32, } +#[derive(Debug, PartialEq)] pub struct InitializePositionInstructionAccounts { pub payer: solana_pubkey::Pubkey, pub position: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_by_operator.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_by_operator.rs index acfed934d..146a0dee6 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_by_operator.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_by_operator.rs @@ -11,6 +11,7 @@ pub struct InitializePositionByOperator { pub lock_release_point: u64, } +#[derive(Debug, PartialEq)] pub struct InitializePositionByOperatorInstructionAccounts { pub payer: solana_pubkey::Pubkey, pub base: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_pda.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_pda.rs index 6e16945c9..c518eee2d 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_pda.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_position_pda.rs @@ -9,6 +9,7 @@ pub struct InitializePositionPda { pub width: i32, } +#[derive(Debug, PartialEq)] pub struct InitializePositionPdaInstructionAccounts { pub payer: solana_pubkey::Pubkey, pub base: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_preset_parameter.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_preset_parameter.rs index 2fc6dccee..6556e7a7c 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_preset_parameter.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_preset_parameter.rs @@ -11,6 +11,7 @@ pub struct InitializePresetParameter { pub ix: InitPresetParametersIx, } +#[derive(Debug, PartialEq)] pub struct InitializePresetParameterInstructionAccounts { pub preset_parameter: solana_pubkey::Pubkey, pub admin: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/initialize_reward.rs b/decoders/meteora-dlmm-decoder/src/instructions/initialize_reward.rs index e4b3c0542..46fb48764 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/initialize_reward.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/initialize_reward.rs @@ -10,6 +10,7 @@ pub struct InitializeReward { pub funder: solana_pubkey::Pubkey, } +#[derive(Debug, PartialEq)] pub struct InitializeRewardInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub reward_vault: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/migrate_position.rs b/decoders/meteora-dlmm-decoder/src/instructions/migrate_position.rs index 45dca0c57..25e9d7479 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/migrate_position.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/migrate_position.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0x0f843b32c706fb2e")] pub struct MigratePosition {} +#[derive(Debug, PartialEq)] pub struct MigratePositionInstructionAccounts { pub position_v2: solana_pubkey::Pubkey, pub position_v1: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs index bfda28415..e8f173b12 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs @@ -221,3 +221,3069 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MeteoraDlmmDecoder { ) } } + +#[cfg(test)] +mod tests { + use carbon_core::{deserialize::ArrangeAccounts, instruction::InstructionDecoder}; + use solana_instruction::AccountMeta; + use solana_sdk::pubkey; + + use crate::{ + instructions::{ + add_liquidity::{AddLiquidity, AddLiquidityInstructionAccounts}, + add_liquidity_by_strategy::{ + AddLiquidityByStrategy, AddLiquidityByStrategyInstructionAccounts, + }, + add_liquidity_by_strategy_one_side::{ + AddLiquidityByStrategyOneSide, AddLiquidityByStrategyOneSideInstructionAccounts, + }, + add_liquidity_by_weight::{ + AddLiquidityByWeight, AddLiquidityByWeightInstructionAccounts, + }, + add_liquidity_one_side::{AddLiquidityOneSide, AddLiquidityOneSideInstructionAccounts}, + add_liquidity_one_side_precise::{ + AddLiquidityOneSidePrecise, AddLiquidityOneSidePreciseInstructionAccounts, + }, + claim_fee::{ClaimFee, ClaimFeeInstructionAccounts}, + claim_reward::{ClaimReward, ClaimRewardInstructionAccounts}, + close_position::{ClosePosition, ClosePositionInstructionAccounts}, + close_preset_parameter::{ + ClosePresetParameter, ClosePresetParameterInstructionAccounts, + }, + fund_reward::{FundReward, FundRewardInstructionAccounts}, + go_to_a_bin::{GoToABin, GoToABinInstructionAccounts}, + initialize_bin_array::{InitializeBinArray, InitializeBinArrayInstructionAccounts}, + initialize_bin_array_bitmap_extension::{ + InitializeBinArrayBitmapExtension, + InitializeBinArrayBitmapExtensionInstructionAccounts, + }, + initialize_customizable_permissionless_lb_pair::{ + InitializeCustomizablePermissionlessLbPair, + InitializeCustomizablePermissionlessLbPairInstructionAccounts, + }, + initialize_lb_pair::{InitializeLbPair, InitializeLbPairInstructionAccounts}, + initialize_permission_lb_pair::{ + InitializePermissionLbPair, InitializePermissionLbPairInstructionAccounts, + }, + initialize_position::{InitializePosition, InitializePositionInstructionAccounts}, + initialize_position_by_operator::{ + InitializePositionByOperator, InitializePositionByOperatorInstructionAccounts, + }, + initialize_position_pda::{ + InitializePositionPda, InitializePositionPdaInstructionAccounts, + }, + initialize_preset_parameter::{ + InitializePresetParameter, InitializePresetParameterInstructionAccounts, + }, + initialize_reward::{InitializeReward, InitializeRewardInstructionAccounts}, + migrate_position::{MigratePosition, MigratePositionInstructionAccounts}, + remove_all_liquidity::{RemoveAllLiquidity, RemoveAllLiquidityInstructionAccounts}, + remove_liquidity::{RemoveLiquidity, RemoveLiquidityInstructionAccounts}, + remove_liquidity_by_range::{ + RemoveLiquidityByRange, RemoveLiquidityByRangeInstructionAccounts, + }, + swap::{Swap, SwapInstructionAccounts}, + swap_exact_out::{SwapExactOut, SwapExactOutInstructionAccounts}, + swap_with_price_impact::{SwapWithPriceImpact, SwapWithPriceImpactInstructionAccounts}, + update_fee_parameters::{UpdateFeeParameters, UpdateFeeParametersInstructionAccounts}, + update_fees_and_rewards::{ + UpdateFeesAndRewards, UpdateFeesAndRewardsInstructionAccounts, + }, + }, + types::{ + AddLiquiditySingleSidePreciseParameter, BinLiquidityDistribution, + BinLiquidityDistributionByWeight, BinLiquidityReduction, CompressedBinDepositAmount, + CustomizableParams, FeeParameter, InitPermissionPairIx, InitPresetParametersIx, + LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, + LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, StrategyParameters, + StrategyType, + }, + }; + + use super::*; + + #[test] + fn test_decode_add_liquidity_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::AddLiquidity(AddLiquidity { + liquidity_parameter: LiquidityParameter { + amount_x: 300000000000000000, + amount_y: 0, + bin_liquidity_dist: vec![BinLiquidityDistribution { + bin_id: -2022, + distribution_x: 10000, + distribution_y: 0, + }], + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("HmgRf3Pp6ZVzJ819Q7mghHF1u1FwExPPUW4wCLzBnuaa"), + false, + ), + AccountMeta::new( + pubkey!("DBS3T76RM6Ca1LuR5Rq5HSDJaRhFR1njskNpwAj2KJ1j"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G"), + false, + ), + AccountMeta::new( + pubkey!("5Dng6CfUnmB5c5uHF47ZLSvw5RJqXvJotAUfhsk4DzUe"), + false, + ), + AccountMeta::new( + pubkey!("EZ52s5QnBB2RPzJWhEKKRq1qgXCrbPDAMUD6CpST1hyj"), + false, + ), + AccountMeta::new( + pubkey!("EgPtKDncu4xK7ZBrfqvoZ7SUBzFWUJ2UD2TiruZ7P6o2"), + false, + ), + AccountMeta::new_readonly( + pubkey!("A8CDf2UNKR8hDLDXiWnNJRUYCNiqSsRMnK5gScxpRjnL"), + false, + ), + AccountMeta::new_readonly( + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + false, + ), + AccountMeta::new( + pubkey!("78fSXwNfQ1dt3Yo5UoX1c6HeT8JaQ1XSsenEh5gSoSt7"), + false, + ), + AccountMeta::new( + pubkey!("5X5bqEcaGmNp9bMC44JRmVrNFzckBcsefYSHTQB5zjYx"), + false, + ), + AccountMeta::new( + pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = AddLiquidityInstructionAccounts { + position: pubkey!("HmgRf3Pp6ZVzJ819Q7mghHF1u1FwExPPUW4wCLzBnuaa"), + lb_pair: pubkey!("DBS3T76RM6Ca1LuR5Rq5HSDJaRhFR1njskNpwAj2KJ1j"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G"), + user_token_y: pubkey!("5Dng6CfUnmB5c5uHF47ZLSvw5RJqXvJotAUfhsk4DzUe"), + reserve_x: pubkey!("EZ52s5QnBB2RPzJWhEKKRq1qgXCrbPDAMUD6CpST1hyj"), + reserve_y: pubkey!("EgPtKDncu4xK7ZBrfqvoZ7SUBzFWUJ2UD2TiruZ7P6o2"), + token_x_mint: pubkey!("A8CDf2UNKR8hDLDXiWnNJRUYCNiqSsRMnK5gScxpRjnL"), + token_y_mint: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + bin_array_lower: pubkey!("78fSXwNfQ1dt3Yo5UoX1c6HeT8JaQ1XSsenEh5gSoSt7"), + bin_array_upper: pubkey!("5X5bqEcaGmNp9bMC44JRmVrNFzckBcsefYSHTQB5zjYx"), + sender: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + AddLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_add_liquidity_by_strategy_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::AddLiquidityByStrategy(AddLiquidityByStrategy { + liquidity_parameter: LiquidityParameterByStrategy { + active_id: -729, + amount_x: 0, + amount_y: 21523400000, + max_active_bin_slippage: 10000, + strategy_parameters: StrategyParameters { + max_bin_id: -730, + min_bin_id: -730, + parameteres: [0; 64], + strategy_type: StrategyType::SpotBalanced, + }, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("41FpGiwCcRr3qczHts3zqYuZERjddZ2dZDoLvhKzhaKJ"), + true, + ), + AccountMeta::new( + pubkey!("2bYjEuupzFtBwgQuzSDkpnCFX9A2iBK6oL9JA3wXwbsa"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("8d13MHH2DWZfkburgMQ5v9FGgifmK6ejgZM1jJzEVT7n"), + false, + ), + AccountMeta::new( + pubkey!("3nVErWE28y5mU6WFPpbhUm7jqmDTrAiA4hN6vuXGUMuP"), + false, + ), + AccountMeta::new( + pubkey!("G7AsqVKQ7yW7z2VZmk3FCMCyAqdgRq28aPnAWicGuc2b"), + false, + ), + AccountMeta::new( + pubkey!("9hPJ6E7hXEQ5UTPC7SKK6D5mDQKTdZ87uQtG5DDaYrLB"), + false, + ), + AccountMeta::new_readonly( + pubkey!("7XAyfFUXfCWbA1x6jCHVzeFtoKN3x836Pp5zQyhqpump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("F5GxuK8c9Z7JnwBhKbjFbbLgTB9N2RvMXpZbGUVxU74c"), + false, + ), + AccountMeta::new( + pubkey!("AambQn5DuPVWquMrQdhhYeAdM7X6eG2GDc35ek7HwZzB"), + false, + ), + AccountMeta::new( + pubkey!("5h5fDq1A17dKpFQEjkNfYYaJd7CAzymUchjfPZ4Dh8pa"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = AddLiquidityByStrategyInstructionAccounts { + position: pubkey!("41FpGiwCcRr3qczHts3zqYuZERjddZ2dZDoLvhKzhaKJ"), + lb_pair: pubkey!("2bYjEuupzFtBwgQuzSDkpnCFX9A2iBK6oL9JA3wXwbsa"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("8d13MHH2DWZfkburgMQ5v9FGgifmK6ejgZM1jJzEVT7n"), + user_token_y: pubkey!("3nVErWE28y5mU6WFPpbhUm7jqmDTrAiA4hN6vuXGUMuP"), + reserve_x: pubkey!("G7AsqVKQ7yW7z2VZmk3FCMCyAqdgRq28aPnAWicGuc2b"), + reserve_y: pubkey!("9hPJ6E7hXEQ5UTPC7SKK6D5mDQKTdZ87uQtG5DDaYrLB"), + token_x_mint: pubkey!("7XAyfFUXfCWbA1x6jCHVzeFtoKN3x836Pp5zQyhqpump"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + bin_array_lower: pubkey!("F5GxuK8c9Z7JnwBhKbjFbbLgTB9N2RvMXpZbGUVxU74c"), + bin_array_upper: pubkey!("AambQn5DuPVWquMrQdhhYeAdM7X6eG2GDc35ek7HwZzB"), + sender: pubkey!("5h5fDq1A17dKpFQEjkNfYYaJd7CAzymUchjfPZ4Dh8pa"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_by_strategy_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + AddLiquidityByStrategy::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_add_liquidity_by_strategy_one_side_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::AddLiquidityByStrategyOneSide(AddLiquidityByStrategyOneSide { + liquidity_parameter: LiquidityParameterByStrategyOneSide { + active_id: -2059, + amount: 9700000000, + max_active_bin_slippage: 3, + strategy_parameters: StrategyParameters { + max_bin_id: -2060, + min_bin_id: -2100, + parameteres: [0; 64], + strategy_type: StrategyType::SpotOneSide, + }, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("AFJHGqyNai5kYaenM8FnR4bxdacScQHAyeu3NMeMjvuC"), + true, + ), + AccountMeta::new( + pubkey!("BGm1tav58oGcsQJehL9WXBFXF7D27vZsKefj4xJKD5Y"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("HVS8WdPqAia9cEbxqGpXDbgJCgFa57Ufhcfnz4UKwUc"), + false, + ), + AccountMeta::new( + pubkey!("4N22J4vW2juHocTntJNmXywSonYjkndCwahjZ2cYLDgb"), + false, + ), + AccountMeta::new_readonly( + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + false, + ), + AccountMeta::new( + pubkey!("FE6nEninSdoZqVKXDUEa6NtsYfkL13uPB846FpRCF1WZ"), + false, + ), + AccountMeta::new( + pubkey!("9o3pWJhKowpQukQTP5d3xwrGdUZtR5wmKGJwBiMbqGoM"), + false, + ), + AccountMeta::new( + pubkey!("FSM4tqYAWuv5Tvw2wF75AwkmijTjMCD6njYkPzq7m6Cz"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = AddLiquidityByStrategyOneSideInstructionAccounts { + position: pubkey!("AFJHGqyNai5kYaenM8FnR4bxdacScQHAyeu3NMeMjvuC"), + lb_pair: pubkey!("BGm1tav58oGcsQJehL9WXBFXF7D27vZsKefj4xJKD5Y"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token: pubkey!("HVS8WdPqAia9cEbxqGpXDbgJCgFa57Ufhcfnz4UKwUc"), + reserve: pubkey!("4N22J4vW2juHocTntJNmXywSonYjkndCwahjZ2cYLDgb"), + token_mint: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + bin_array_lower: pubkey!("FE6nEninSdoZqVKXDUEa6NtsYfkL13uPB846FpRCF1WZ"), + bin_array_upper: pubkey!("9o3pWJhKowpQukQTP5d3xwrGdUZtR5wmKGJwBiMbqGoM"), + sender: pubkey!("FSM4tqYAWuv5Tvw2wF75AwkmijTjMCD6njYkPzq7m6Cz"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/add_liquidity_by_strategy_one_side_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + AddLiquidityByStrategyOneSide::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_add_liquidity_by_weight_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::AddLiquidityByWeight(AddLiquidityByWeight { + liquidity_parameter: LiquidityParameterByWeight { + active_id: 1698, + amount_x: 191094066, + amount_y: 227162680, + bin_liquidity_dist: vec![ + BinLiquidityDistributionByWeight { + bin_id: 1687, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1688, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1689, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1690, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1691, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1692, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1693, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1694, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1695, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1696, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1697, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1698, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1699, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1700, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1701, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1702, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1703, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1704, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1705, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1706, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1707, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1708, + weight: 1, + }, + BinLiquidityDistributionByWeight { + bin_id: 1709, + weight: 1, + }, + ], + max_active_bin_slippage: 2147483647, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("GTg4upAYuAqXnSAdSGBbcgR7mbxcLwp8pxZp5iQe1tLJ"), + false, + ), + AccountMeta::new( + pubkey!("BoeMUkCLHchTD31HdXsbDExuZZfcUppSLpYtV3LZTH6U"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("6MZw9Y8FiGGjnL4DVXS812w9t9p5B9tK5xcrCWu6p2Ev"), + false, + ), + AccountMeta::new( + pubkey!("H1HwdDkL5qHM8AZR9tBWYZQDTt9wwigKqCdF4KWuX7zP"), + false, + ), + AccountMeta::new( + pubkey!("93d6ukn24o1xMcMDip2SACKG8GbvhGUZim1e3ZEcQVm2"), + false, + ), + AccountMeta::new( + pubkey!("CodroyzrRNvc5kHRoAQYjpVSr1jA9fLcUWVFouiuWGsD"), + false, + ), + AccountMeta::new_readonly( + pubkey!("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("CzeWb8k7wDfubQz6McUcYkZuM6UQ7y2XJ6hfYBRCqBea"), + false, + ), + AccountMeta::new( + pubkey!("5Kp3m4p7QxN629DA8wcHuLrHkecxEmdGFLRcB9PD4HAa"), + false, + ), + AccountMeta::new( + pubkey!("HdZCvCH4qwUqfy5YukMyyy5gYDhtmMWK7GvqEbLVsSWj"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = AddLiquidityByWeightInstructionAccounts { + position: pubkey!("GTg4upAYuAqXnSAdSGBbcgR7mbxcLwp8pxZp5iQe1tLJ"), + lb_pair: pubkey!("BoeMUkCLHchTD31HdXsbDExuZZfcUppSLpYtV3LZTH6U"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("6MZw9Y8FiGGjnL4DVXS812w9t9p5B9tK5xcrCWu6p2Ev"), + user_token_y: pubkey!("H1HwdDkL5qHM8AZR9tBWYZQDTt9wwigKqCdF4KWuX7zP"), + reserve_x: pubkey!("93d6ukn24o1xMcMDip2SACKG8GbvhGUZim1e3ZEcQVm2"), + reserve_y: pubkey!("CodroyzrRNvc5kHRoAQYjpVSr1jA9fLcUWVFouiuWGsD"), + token_x_mint: pubkey!("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + bin_array_lower: pubkey!("CzeWb8k7wDfubQz6McUcYkZuM6UQ7y2XJ6hfYBRCqBea"), + bin_array_upper: pubkey!("5Kp3m4p7QxN629DA8wcHuLrHkecxEmdGFLRcB9PD4HAa"), + sender: pubkey!("HdZCvCH4qwUqfy5YukMyyy5gYDhtmMWK7GvqEbLVsSWj"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_by_weight_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + AddLiquidityByWeight::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_add_liquidity_one_side_precise_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::AddLiquidityOneSidePrecise(AddLiquidityOneSidePrecise { + parameter: AddLiquiditySingleSidePreciseParameter { + bins: vec![ + CompressedBinDepositAmount { + amount: 92867, + bin_id: -800, + }, + CompressedBinDepositAmount { + amount: 206898, + bin_id: -799, + }, + CompressedBinDepositAmount { + amount: 299326, + bin_id: -798, + }, + CompressedBinDepositAmount { + amount: 384861, + bin_id: -797, + }, + CompressedBinDepositAmount { + amount: 467370, + bin_id: -796, + }, + CompressedBinDepositAmount { + amount: 548676, + bin_id: -795, + }, + ], + decompress_multiplier: 1000000000, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Ce8W9ThaNsa15BtyvnGU85xTLGANgpWqyxwt5o4uaKUv"), + false, + ), + AccountMeta::new( + pubkey!("3uref9YcGnma388KKM2kqP6NAcuCdPh5NbwYpqzcYZfK"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("J75TPk5xqCR6VPN6ZvyX2A2TvPG7oE8oCggmp1kHWmq1"), + false, + ), + AccountMeta::new( + pubkey!("HSKLo63VLJj61oNwfMMr9S761NRpm1U6s2pXfBRqGdzG"), + false, + ), + AccountMeta::new_readonly( + pubkey!("Grk4aSvTDdeNgi5JodDTuwGCb1oXLj9dmTfn4x5o7Q9t"), + false, + ), + AccountMeta::new( + pubkey!("Huk9wcMCsNXiDj8SocVm5axc3WZ9gpzdWaQ8waTVpRqU"), + false, + ), + AccountMeta::new( + pubkey!("8zzYe5K8CfemwbivccZvXbZpNbMgkEijVitNNTwfpjYk"), + false, + ), + AccountMeta::new( + pubkey!("7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = AddLiquidityOneSidePreciseInstructionAccounts { + position: pubkey!("Ce8W9ThaNsa15BtyvnGU85xTLGANgpWqyxwt5o4uaKUv"), + lb_pair: pubkey!("3uref9YcGnma388KKM2kqP6NAcuCdPh5NbwYpqzcYZfK"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token: pubkey!("J75TPk5xqCR6VPN6ZvyX2A2TvPG7oE8oCggmp1kHWmq1"), + reserve: pubkey!("HSKLo63VLJj61oNwfMMr9S761NRpm1U6s2pXfBRqGdzG"), + token_mint: pubkey!("Grk4aSvTDdeNgi5JodDTuwGCb1oXLj9dmTfn4x5o7Q9t"), + bin_array_lower: pubkey!("Huk9wcMCsNXiDj8SocVm5axc3WZ9gpzdWaQ8waTVpRqU"), + bin_array_upper: pubkey!("8zzYe5K8CfemwbivccZvXbZpNbMgkEijVitNNTwfpjYk"), + sender: pubkey!("7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/add_liquidity_one_side_precise_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + AddLiquidityOneSidePrecise::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_add_liquidity_one_side_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::AddLiquidityOneSide(AddLiquidityOneSide { + liquidity_parameter: LiquidityOneSideParameter { + active_id: -428, + amount: 25650410760, + bin_liquidity_dist: vec![ + BinLiquidityDistributionByWeight { + bin_id: -428, + weight: 2252, + }, + BinLiquidityDistributionByWeight { + bin_id: -427, + weight: 4568, + }, + BinLiquidityDistributionByWeight { + bin_id: -426, + weight: 5738, + }, + BinLiquidityDistributionByWeight { + bin_id: -425, + weight: 6918, + }, + BinLiquidityDistributionByWeight { + bin_id: -424, + weight: 8088, + }, + BinLiquidityDistributionByWeight { + bin_id: -423, + weight: 9266, + }, + BinLiquidityDistributionByWeight { + bin_id: -422, + weight: 10439, + }, + BinLiquidityDistributionByWeight { + bin_id: -421, + weight: 8092, + }, + BinLiquidityDistributionByWeight { + bin_id: -420, + weight: 5739, + }, + BinLiquidityDistributionByWeight { + bin_id: -419, + weight: 3388, + }, + BinLiquidityDistributionByWeight { + bin_id: -418, + weight: 1041, + }, + ], + max_active_bin_slippage: 4, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("D6SJ8sMRou9nrU4JsWC1SdtgdQroykjf3bLV12MLjnwv"), + false, + ), + AccountMeta::new( + pubkey!("9NNAwkhZGTWbb3ASqsZcp8vAx9TSqa6QrBiNbRGvcBaN"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("3yKz2iUNG2QdYkkejp9HUUtzt4PimkZumTrQpKkewepn"), + false, + ), + AccountMeta::new( + pubkey!("7VhWRicruPXN8W8w3mTWUjrnQQAFrjB1REtGiGTH8cPz"), + false, + ), + AccountMeta::new_readonly( + pubkey!("7Y6Rix8X2botuMaJ2mno4UqSWdQZqU4RezY6qp7zpump"), + false, + ), + AccountMeta::new( + pubkey!("HXsEBdoAusbKCnixyPMAmTX1HbNJ9KEJQi32jZ7dbHQm"), + false, + ), + AccountMeta::new( + pubkey!("3SjbLYKjDWGLqmW6xx8UnQU9ahkNUjpD1AshXxDh7ryq"), + false, + ), + AccountMeta::new( + pubkey!("GdLm4b7x67JaieLYkPkXpzyqX9RhLGmzM6MDXhTpU7kf"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = AddLiquidityOneSideInstructionAccounts { + position: pubkey!("D6SJ8sMRou9nrU4JsWC1SdtgdQroykjf3bLV12MLjnwv"), + lb_pair: pubkey!("9NNAwkhZGTWbb3ASqsZcp8vAx9TSqa6QrBiNbRGvcBaN"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token: pubkey!("3yKz2iUNG2QdYkkejp9HUUtzt4PimkZumTrQpKkewepn"), + reserve: pubkey!("7VhWRicruPXN8W8w3mTWUjrnQQAFrjB1REtGiGTH8cPz"), + token_mint: pubkey!("7Y6Rix8X2botuMaJ2mno4UqSWdQZqU4RezY6qp7zpump"), + bin_array_lower: pubkey!("HXsEBdoAusbKCnixyPMAmTX1HbNJ9KEJQi32jZ7dbHQm"), + bin_array_upper: pubkey!("3SjbLYKjDWGLqmW6xx8UnQU9ahkNUjpD1AshXxDh7ryq"), + sender: pubkey!("GdLm4b7x67JaieLYkPkXpzyqX9RhLGmzM6MDXhTpU7kf"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_one_side_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + AddLiquidityOneSide::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_claim_fee_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClaimFee(ClaimFee {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("CczaEikMAfA4F6gaXKBe5qfd2Mwc7pu4KpetTg88Tica"), + false, + ), + AccountMeta::new( + pubkey!("C2poDHs8dRBC8HsM8zzw4Zwe1pFMgD9LfXJd25M3Hajz"), + false, + ), + AccountMeta::new( + pubkey!("2rhbcMDNDxVqBJR8EnKWmZb8qTUD5ga67mDz4m2uPtSR"), + false, + ), + AccountMeta::new( + pubkey!("AdPnhr43oMUtNr6k9GUZd65zwKcSCLQXouPyYkjQyGsv"), + false, + ), + AccountMeta::new( + pubkey!("71KMt1Z57CnQpgxuHU5wFvweakjpvsjGx5ucADnrGoDr"), + true, + ), + AccountMeta::new( + pubkey!("za39KwZejtyZEfLVk1PqumSKcwstQX3yqVK8k2pgmRL"), + false, + ), + AccountMeta::new( + pubkey!("6mfAFMJCqMuQUvDAoYcxhC1wmHuAey3AYa79sEHGLp6s"), + false, + ), + AccountMeta::new( + pubkey!("FsKePukyoEW14F7XVkeS38veoCR6VAxjXprm6L6C9gfK"), + false, + ), + AccountMeta::new( + pubkey!("7Mv53UFYF3b9vaFsmhVTLMsnfBMY9L2699zcQRjvBbJm"), + false, + ), + AccountMeta::new_readonly( + pubkey!("Hjw6bEcHtbHGpQr8onG3izfJY5DJiWdt7uk2BfdSpump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClaimFeeInstructionAccounts { + lb_pair: pubkey!("CczaEikMAfA4F6gaXKBe5qfd2Mwc7pu4KpetTg88Tica"), + position: pubkey!("C2poDHs8dRBC8HsM8zzw4Zwe1pFMgD9LfXJd25M3Hajz"), + bin_array_lower: pubkey!("2rhbcMDNDxVqBJR8EnKWmZb8qTUD5ga67mDz4m2uPtSR"), + bin_array_upper: pubkey!("AdPnhr43oMUtNr6k9GUZd65zwKcSCLQXouPyYkjQyGsv"), + sender: pubkey!("71KMt1Z57CnQpgxuHU5wFvweakjpvsjGx5ucADnrGoDr"), + reserve_x: pubkey!("za39KwZejtyZEfLVk1PqumSKcwstQX3yqVK8k2pgmRL"), + reserve_y: pubkey!("6mfAFMJCqMuQUvDAoYcxhC1wmHuAey3AYa79sEHGLp6s"), + user_token_x: pubkey!("FsKePukyoEW14F7XVkeS38veoCR6VAxjXprm6L6C9gfK"), + user_token_y: pubkey!("7Mv53UFYF3b9vaFsmhVTLMsnfBMY9L2699zcQRjvBbJm"), + token_x_mint: pubkey!("Hjw6bEcHtbHGpQr8onG3izfJY5DJiWdt7uk2BfdSpump"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction("tests/fixtures/claim_fee_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClaimFee::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_claim_reward_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClaimReward(ClaimReward { reward_index: 0 }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), + false, + ), + AccountMeta::new( + pubkey!("5VAkBGkRRsoPx6PxQr4jeCAGS1Mb1PHuqDPcFZPquCLX"), + false, + ), + AccountMeta::new( + pubkey!("AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK"), + false, + ), + AccountMeta::new( + pubkey!("5B6DoUgQHYfftC89eALn94QfaUzjKJUr3dKQzKYEXDih"), + false, + ), + AccountMeta::new( + pubkey!("HWg7gUo8aSZD61q4wfwwr9AYZDDZtb5NKgLVpGuxvgw3"), + true, + ), + AccountMeta::new( + pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), + false, + ), + AccountMeta::new_readonly( + pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), + false, + ), + AccountMeta::new( + pubkey!("5kZ9Fis9hvdnhVCpxHGXCc9Yjf1GagLnacJkxSikJ77G"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClaimRewardInstructionAccounts { + lb_pair: pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), + position: pubkey!("5VAkBGkRRsoPx6PxQr4jeCAGS1Mb1PHuqDPcFZPquCLX"), + bin_array_lower: pubkey!("AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK"), + bin_array_upper: pubkey!("5B6DoUgQHYfftC89eALn94QfaUzjKJUr3dKQzKYEXDih"), + sender: pubkey!("HWg7gUo8aSZD61q4wfwwr9AYZDDZtb5NKgLVpGuxvgw3"), + reward_vault: pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), + reward_mint: pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), + user_token_account: pubkey!("5kZ9Fis9hvdnhVCpxHGXCc9Yjf1GagLnacJkxSikJ77G"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/claim_reward_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClaimReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_close_position_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClosePosition(ClosePosition {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Bqy3p4nsgPeddNLD98cDFHvXTVNd3ay1qU8aiE75Me8E"), + false, + ), + AccountMeta::new( + pubkey!("8aSioDcoMjZ1gQYXSZTKetXaceUts2ZBHz2twKqYRGK1"), + false, + ), + AccountMeta::new( + pubkey!("8hUdax3HbAeRbxAK59xUZBJytmpHu5CkFbKFfkyMph1F"), + false, + ), + AccountMeta::new( + pubkey!("HsSsSEd6YDRVRbqbUop3uWPaFtqobyrJUraQ7AxhgRy5"), + false, + ), + AccountMeta::new(pubkey!("u9KjZ2Lie1EuJF3BsMR3U7PKSPesCQFkTupK4hantbs"), true), + AccountMeta::new(pubkey!("u9KjZ2Lie1EuJF3BsMR3U7PKSPesCQFkTupK4hantbs"), true), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClosePositionInstructionAccounts { + position: pubkey!("Bqy3p4nsgPeddNLD98cDFHvXTVNd3ay1qU8aiE75Me8E"), + lb_pair: pubkey!("8aSioDcoMjZ1gQYXSZTKetXaceUts2ZBHz2twKqYRGK1"), + bin_array_lower: pubkey!("8hUdax3HbAeRbxAK59xUZBJytmpHu5CkFbKFfkyMph1F"), + bin_array_upper: pubkey!("HsSsSEd6YDRVRbqbUop3uWPaFtqobyrJUraQ7AxhgRy5"), + sender: pubkey!("u9KjZ2Lie1EuJF3BsMR3U7PKSPesCQFkTupK4hantbs"), + rent_receiver: pubkey!("u9KjZ2Lie1EuJF3BsMR3U7PKSPesCQFkTupK4hantbs"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/close_position_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClosePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_close_preset_parameter_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClosePresetParameter(ClosePresetParameter {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + ]; + let expected_arranged_accounts = ClosePresetParameterInstructionAccounts { + preset_parameter: pubkey!("Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + rent_receiver: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/close_preset_parameter_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClosePresetParameter::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_fund_reward_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::FundReward(FundReward { + amount: 50000000000, + carry_forward: Default::default(), + reward_index: 0, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), + false, + ), + AccountMeta::new( + pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), + false, + ), + AccountMeta::new_readonly( + pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), + false, + ), + AccountMeta::new( + pubkey!("5V1RFYBKBZ78zG6cYJ5ssGLQmttLC1KSM6bSdSpgSV5i"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new( + pubkey!("AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = FundRewardInstructionAccounts { + lb_pair: pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), + reward_vault: pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), + reward_mint: pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), + funder_token_account: pubkey!("5V1RFYBKBZ78zG6cYJ5ssGLQmttLC1KSM6bSdSpgSV5i"), + funder: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + bin_array: pubkey!("AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction("tests/fixtures/fund_reward_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + FundReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_go_to_a_bin_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::GoToABin(GoToABin { bin_id: -11653 }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("CRnGNKPrdgucFPSMsMn7ENAA2eJWn6CsCtunpVU8b3v8"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = GoToABinInstructionAccounts { + lb_pair: pubkey!("CRnGNKPrdgucFPSMsMn7ENAA2eJWn6CsCtunpVU8b3v8"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + from_bin_array: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + to_bin_array: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction("tests/fixtures/go_to_a_bin_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + GoToABin::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_bin_array_bitmap_extension_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializeBinArrayBitmapExtension( + InitializeBinArrayBitmapExtension {}, + ); + let expected_accounts = vec![ + AccountMeta::new_readonly( + pubkey!("7bGcnxwxHhWKtE7L7opZPqzJH6aU3HbRbuQnrGKf8779"), + false, + ), + AccountMeta::new( + pubkey!("H2mrTZ7gSQ6EknZUeBakw6u6VEfd4t4g7KEPWgRV5Ffv"), + false, + ), + AccountMeta::new( + pubkey!("BZ9BoTtGkPXCJ73EdBLvy36kop8tMpzHXVboEnB71T2m"), + true, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + ]; + let expected_arranged_accounts = InitializeBinArrayBitmapExtensionInstructionAccounts { + lb_pair: pubkey!("7bGcnxwxHhWKtE7L7opZPqzJH6aU3HbRbuQnrGKf8779"), + bin_array_bitmap_extension: pubkey!("H2mrTZ7gSQ6EknZUeBakw6u6VEfd4t4g7KEPWgRV5Ffv"), + funder: pubkey!("BZ9BoTtGkPXCJ73EdBLvy36kop8tMpzHXVboEnB71T2m"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/initialize_bin_array_bitmap_extension_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeBinArrayBitmapExtension::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_bin_array_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::InitializeBinArray(InitializeBinArray { index: 6 }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Bwf8q9r1wgSvQWcAdLXJqMM6icGSVW5BWrHWEEpyCAcP"), + false, + ), + AccountMeta::new( + pubkey!("C4ytp5DSAHx2nveimbZYR3rBPgvPKPYQY38V8abDNiUh"), + false, + ), + AccountMeta::new( + pubkey!("235sX2nwcsYqJrzSYeViPJJNgaQ73atZ3oJbYqt5eA1i"), + true, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + ]; + let expected_arranged_accounts = InitializeBinArrayInstructionAccounts { + lb_pair: pubkey!("Bwf8q9r1wgSvQWcAdLXJqMM6icGSVW5BWrHWEEpyCAcP"), + bin_array: pubkey!("C4ytp5DSAHx2nveimbZYR3rBPgvPKPYQY38V8abDNiUh"), + funder: pubkey!("235sX2nwcsYqJrzSYeViPJJNgaQ73atZ3oJbYqt5eA1i"), + system_program: pubkey!("11111111111111111111111111111111"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/initialize_bin_array_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeBinArray::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_customizable_permissionless_lb_pair_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializeCustomizablePermissionlessLbPair( + InitializeCustomizablePermissionlessLbPair { + params: CustomizableParams { + activation_point: Some(1741610419), + activation_type: 1, + active_id: -813, + base_factor: 10000, + bin_step: 200, + has_alpha_vault: false, + padding: [0; 64], + }, + }, + ); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("E7fHCw9G6KuCA2jg3uxvJn1MWL8ySD68kDLPyGDvcStT"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("fiSpHY8vkjABpAKGCaLs3pDnkZpeqNiYrADp4GZLYZY"), + false, + ), + AccountMeta::new_readonly( + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + false, + ), + AccountMeta::new( + pubkey!("5Lbm1X6oYcSUcscMmvWqmg7sz2Qh3XJ3ydBy2v8cTrTV"), + false, + ), + AccountMeta::new( + pubkey!("Fov1U4FMX8u4Ln5gM9LHsZcWgwHAeZ526usUjaYza2BR"), + false, + ), + AccountMeta::new( + pubkey!("nJuXpHhaM9nNtY8XKiCfrsYAojRFEmrw33DYbiKqkAW"), + false, + ), + AccountMeta::new_readonly( + pubkey!("DujguCjLgZhVT7oTZ8XhDUYNgVYXn3EhqHGciXxKNLJ1"), + false, + ), + AccountMeta::new( + pubkey!("7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("Z7bkDerKzHpy5XtLYfNvtLq6PttYpxWmhXAeEFhCHff"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = + InitializeCustomizablePermissionlessLbPairInstructionAccounts { + lb_pair: pubkey!("E7fHCw9G6KuCA2jg3uxvJn1MWL8ySD68kDLPyGDvcStT"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_mint_x: pubkey!("fiSpHY8vkjABpAKGCaLs3pDnkZpeqNiYrADp4GZLYZY"), + token_mint_y: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + reserve_x: pubkey!("5Lbm1X6oYcSUcscMmvWqmg7sz2Qh3XJ3ydBy2v8cTrTV"), + reserve_y: pubkey!("Fov1U4FMX8u4Ln5gM9LHsZcWgwHAeZ526usUjaYza2BR"), + oracle: pubkey!("nJuXpHhaM9nNtY8XKiCfrsYAojRFEmrw33DYbiKqkAW"), + user_token_x: pubkey!("DujguCjLgZhVT7oTZ8XhDUYNgVYXn3EhqHGciXxKNLJ1"), + funder: pubkey!("7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("Z7bkDerKzHpy5XtLYfNvtLq6PttYpxWmhXAeEFhCHff"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeCustomizablePermissionlessLbPair::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_lb_pair_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializeLbPair(InitializeLbPair { + active_id: 91, + bin_step: 250, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("12PMuMKowpmSndiUvQVZ9Nbs4ck6X35iqoZXBerR4ojf"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("631BvY2KLFbUcQvUhK2nn2buWw1K1yfS2eMHU8t9pump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("5oHBxFoJqGjL6eZHi9buv3JvvxdutVEVsZNEyafjWroY"), + false, + ), + AccountMeta::new( + pubkey!("J6TQ9iXZGg1K5P2MXtBqkZUjMbRPL26D3y21DtaPCxAm"), + false, + ), + AccountMeta::new( + pubkey!("3qQXfWooz78RBCpC1My76mBcgbPAPDK3HrhJmjRsxicL"), + false, + ), + AccountMeta::new_readonly( + pubkey!("83XWJx8TNDYtiKA15EbCBKSTvNZ3h2jGjHz87CXncRVH"), + false, + ), + AccountMeta::new( + pubkey!("DiPkWknz9MccGhGmj4ku7yWuyhtmNP385j1UXnHLZPqZ"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializeLbPairInstructionAccounts { + lb_pair: pubkey!("12PMuMKowpmSndiUvQVZ9Nbs4ck6X35iqoZXBerR4ojf"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_mint_x: pubkey!("631BvY2KLFbUcQvUhK2nn2buWw1K1yfS2eMHU8t9pump"), + token_mint_y: pubkey!("So11111111111111111111111111111111111111112"), + reserve_x: pubkey!("5oHBxFoJqGjL6eZHi9buv3JvvxdutVEVsZNEyafjWroY"), + reserve_y: pubkey!("J6TQ9iXZGg1K5P2MXtBqkZUjMbRPL26D3y21DtaPCxAm"), + oracle: pubkey!("3qQXfWooz78RBCpC1My76mBcgbPAPDK3HrhJmjRsxicL"), + preset_parameter: pubkey!("83XWJx8TNDYtiKA15EbCBKSTvNZ3h2jGjHz87CXncRVH"), + funder: pubkey!("DiPkWknz9MccGhGmj4ku7yWuyhtmNP385j1UXnHLZPqZ"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/initialize_lb_pair_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeLbPair::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_permission_lb_pair_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::InitializePermissionLbPair(InitializePermissionLbPair { + ix_data: InitPermissionPairIx { + activation_type: 1, + active_id: -1595, + base_factor: 37500, + bin_step: 80, + max_bin_id: 5480, + min_bin_id: -5480, + lock_duration: 0, + }, + }); + let expected_accounts = vec![ + AccountMeta::new_readonly( + pubkey!("AeSLQ4ty9qfhEkzBpQAKypptur3giRDLWm3QGP1mze26"), + true, + ), + AccountMeta::new( + pubkey!("DgSVNgNofqZyhmkSdUwuqvyTjHNYmq799RYMcadKnb2q"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("DVYtHdaDc77W1oYTtAYd6kz9QVTj8wPWwiUTbkqzgN4n"), + false, + ), + AccountMeta::new_readonly( + pubkey!("8VJNVtvL5JcCrCgkb3gEjYT8NtA5rqen9YztcPhiwVCP"), + false, + ), + AccountMeta::new( + pubkey!("31Hx85DFuKr15Xr5XKse5tdWLTRQrEXCkKsoeipTHCfi"), + false, + ), + AccountMeta::new( + pubkey!("E55HFtp5AgG4hXK1ELbv9LD7V6872ZxW7tetuADJN5iC"), + false, + ), + AccountMeta::new( + pubkey!("B3EUUmEF4h4ZLmnYKbqP8LKYdLjoCmWH7j7JLcxsFfQc"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializePermissionLbPairInstructionAccounts { + base: pubkey!("AeSLQ4ty9qfhEkzBpQAKypptur3giRDLWm3QGP1mze26"), + lb_pair: pubkey!("DgSVNgNofqZyhmkSdUwuqvyTjHNYmq799RYMcadKnb2q"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_mint_x: pubkey!("DVYtHdaDc77W1oYTtAYd6kz9QVTj8wPWwiUTbkqzgN4n"), + token_mint_y: pubkey!("8VJNVtvL5JcCrCgkb3gEjYT8NtA5rqen9YztcPhiwVCP"), + reserve_x: pubkey!("31Hx85DFuKr15Xr5XKse5tdWLTRQrEXCkKsoeipTHCfi"), + reserve_y: pubkey!("E55HFtp5AgG4hXK1ELbv9LD7V6872ZxW7tetuADJN5iC"), + oracle: pubkey!("B3EUUmEF4h4ZLmnYKbqP8LKYdLjoCmWH7j7JLcxsFfQc"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/initialize_permission_lb_pair_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializePermissionLbPair::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_position_by_operator_ix() { + // Arrange + // left: InitializePositionByOperator(InitializePositionByOperator { lower_bin_id: -2022, width: 1, fee_owner: 2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu, lock_release_point: 0 }) + // right: InitializePositionByOperator(InitializePositionByOperator { lower_bin_id: -2022, width: 1, fee_owner: 11111111111111111111111111111111, lock_release_point: 0 }) + let expected_ix = + MeteoraDlmmInstruction::InitializePositionByOperator(InitializePositionByOperator { + fee_owner: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + lock_release_point: 0, + lower_bin_id: -2022, + width: 1, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + true, + ), + AccountMeta::new( + pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + true, + ), + AccountMeta::new( + pubkey!("HmgRf3Pp6ZVzJ819Q7mghHF1u1FwExPPUW4wCLzBnuaa"), + false, + ), + AccountMeta::new( + pubkey!("DBS3T76RM6Ca1LuR5Rq5HSDJaRhFR1njskNpwAj2KJ1j"), + false, + ), + AccountMeta::new( + pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + true, + ), + AccountMeta::new( + pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + true, + ), + AccountMeta::new( + pubkey!("2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G"), + false, + ), + AccountMeta::new( + pubkey!("2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializePositionByOperatorInstructionAccounts { + payer: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + base: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + position: pubkey!("HmgRf3Pp6ZVzJ819Q7mghHF1u1FwExPPUW4wCLzBnuaa"), + lb_pair: pubkey!("DBS3T76RM6Ca1LuR5Rq5HSDJaRhFR1njskNpwAj2KJ1j"), + owner: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + operator: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), + operator_token_x: pubkey!("2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G"), + owner_token_x: pubkey!("2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G"), + system_program: pubkey!("11111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/initialize_position_by_operator_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializePositionByOperator::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_position_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializePosition(InitializePosition { + lower_bin_id: -730, + width: 1, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("2gV1bRqcF4kmmwe3ahUbzD6xaDE1E1hZ7cys2hWis6Cs"), + true, + ), + AccountMeta::new( + pubkey!("2zQPS74ub2Rsyjcjn226HGJVGhQSCLZmsrezBGcee4JY"), + true, + ), + AccountMeta::new( + pubkey!("2bYjEuupzFtBwgQuzSDkpnCFX9A2iBK6oL9JA3wXwbsa"), + false, + ), + AccountMeta::new( + pubkey!("2gV1bRqcF4kmmwe3ahUbzD6xaDE1E1hZ7cys2hWis6Cs"), + true, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializePositionInstructionAccounts { + payer: pubkey!("2gV1bRqcF4kmmwe3ahUbzD6xaDE1E1hZ7cys2hWis6Cs"), + position: pubkey!("2zQPS74ub2Rsyjcjn226HGJVGhQSCLZmsrezBGcee4JY"), + lb_pair: pubkey!("2bYjEuupzFtBwgQuzSDkpnCFX9A2iBK6oL9JA3wXwbsa"), + owner: pubkey!("2gV1bRqcF4kmmwe3ahUbzD6xaDE1E1hZ7cys2hWis6Cs"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/initialize_position_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_position_pda_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializePositionPda(InitializePositionPda { + lower_bin_id: -2070, + width: 70, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("5xScxBWRWFVuMGBLJFVSsj2jAi5WZzNXD7skTS4Qqyed"), + true, + ), + AccountMeta::new_readonly( + pubkey!("4gUTbkvyP6nMS74N6pTtWt9pSLagjewLf221DriGZAML"), + true, + ), + AccountMeta::new( + pubkey!("75uZqmbettMfwem3w7KvWdRHHhx5iYE7LuGj8fV5oHAn"), + false, + ), + AccountMeta::new_readonly( + pubkey!("8gJ7UWboMeQ6z6AQwFP3cAZwSYG8udVS2UesyCbH79r7"), + false, + ), + AccountMeta::new( + pubkey!("5xScxBWRWFVuMGBLJFVSsj2jAi5WZzNXD7skTS4Qqyed"), + true, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializePositionPdaInstructionAccounts { + payer: pubkey!("5xScxBWRWFVuMGBLJFVSsj2jAi5WZzNXD7skTS4Qqyed"), + base: pubkey!("4gUTbkvyP6nMS74N6pTtWt9pSLagjewLf221DriGZAML"), + position: pubkey!("75uZqmbettMfwem3w7KvWdRHHhx5iYE7LuGj8fV5oHAn"), + lb_pair: pubkey!("8gJ7UWboMeQ6z6AQwFP3cAZwSYG8udVS2UesyCbH79r7"), + owner: pubkey!("5xScxBWRWFVuMGBLJFVSsj2jAi5WZzNXD7skTS4Qqyed"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/initialize_position_pda_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializePositionPda::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_preset_parameter_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::InitializePresetParameter(InitializePresetParameter { + ix: InitPresetParametersIx { + base_factor: 1250, + bin_step: 8, + decay_period: 600, + filter_period: 30, + max_bin_id: 54607, + max_volatility_accumulator: 300000, + min_bin_id: -54607, + protocol_share: 500, + reduction_factor: 5000, + variable_fee_control: 120000, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + ]; + let expected_arranged_accounts = InitializePresetParameterInstructionAccounts { + preset_parameter: pubkey!("Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/initialize_preset_parameter_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializePresetParameter::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_reward_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializeReward(InitializeReward { + funder: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + reward_duration: 2419200, + reward_index: 0, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), + false, + ), + AccountMeta::new( + pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), + false, + ), + AccountMeta::new_readonly( + pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("SysvarRent111111111111111111111111111111111"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializeRewardInstructionAccounts { + lb_pair: pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), + reward_vault: pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), + reward_mint: pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + system_program: pubkey!("11111111111111111111111111111111"), + rent: pubkey!("SysvarRent111111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/initialize_reward_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_migrate_position_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::MigratePosition(MigratePosition {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("AEYyKDsv4fRebC2pAmv3hksXwtzzDKG5dCMxbXrVKzRf"), + true, + ), + AccountMeta::new( + pubkey!("8y9Rjqvb3UdT9SDfcM7v94Po2G36ndVM3pe1gLpGLRhx"), + false, + ), + AccountMeta::new_readonly( + pubkey!("FoSDw2L5DmTuQTFe55gWPDXf88euaxAEKFre74CnvQbX"), + false, + ), + AccountMeta::new( + pubkey!("6XnihiWoRfgFUncqAYeajEFEdu5m5bpY9kA39goDuDk9"), + false, + ), + AccountMeta::new( + pubkey!("3kBRpy3Lj434ZXiCJ8u7TSRDcL2PKCGCCHrW4WuZWzbZ"), + false, + ), + AccountMeta::new( + pubkey!("DxocTN1otn4MUpJZED6XFbRxQmK5RrB3hqMYjoBZnXUb"), + true, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new( + pubkey!("DxocTN1otn4MUpJZED6XFbRxQmK5RrB3hqMYjoBZnXUb"), + true, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = MigratePositionInstructionAccounts { + position_v2: pubkey!("AEYyKDsv4fRebC2pAmv3hksXwtzzDKG5dCMxbXrVKzRf"), + position_v1: pubkey!("8y9Rjqvb3UdT9SDfcM7v94Po2G36ndVM3pe1gLpGLRhx"), + lb_pair: pubkey!("FoSDw2L5DmTuQTFe55gWPDXf88euaxAEKFre74CnvQbX"), + bin_array_lower: pubkey!("6XnihiWoRfgFUncqAYeajEFEdu5m5bpY9kA39goDuDk9"), + bin_array_upper: pubkey!("3kBRpy3Lj434ZXiCJ8u7TSRDcL2PKCGCCHrW4WuZWzbZ"), + owner: pubkey!("DxocTN1otn4MUpJZED6XFbRxQmK5RrB3hqMYjoBZnXUb"), + system_program: pubkey!("11111111111111111111111111111111"), + rent_receiver: pubkey!("DxocTN1otn4MUpJZED6XFbRxQmK5RrB3hqMYjoBZnXUb"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/migrate_position_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + MigratePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_remove_all_liquidity_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::RemoveAllLiquidity(RemoveAllLiquidity {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("9ryhChmSnFjN1Guow3wmCMfHcDqnPMNQWw1fd22re6B3"), + false, + ), + AccountMeta::new( + pubkey!("BaAcxMzRRLPsCeozVFxSBkNKRNtGxWsuwAJD97FwHrFS"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("DSbDmhQ2g83dB7gxgEj2SU4YXmNTsuu1rJ7ZpYRD4FFN"), + false, + ), + AccountMeta::new( + pubkey!("8WDJNUUet9GKYp2LFZtMPn2szjADWqDBxh36xMzN34RG"), + false, + ), + AccountMeta::new( + pubkey!("HvsP7Sc6FdcYQgjMsZFmgucfXWpHBV2Z4ZSxokGDmvw3"), + false, + ), + AccountMeta::new( + pubkey!("5F8BjK245zNk8gDZ4wfzqFk5zNKnfBZu1nQqxTf9bw3q"), + false, + ), + AccountMeta::new_readonly( + pubkey!("6ugNo7XbU5RpaNVi6MMP8tMN85MmNeXFZmcPyPvWpump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("4ogZsCfAmNAnNyWRqDpny2Fx7q2hxXsY64eHtmqmT9eH"), + false, + ), + AccountMeta::new( + pubkey!("7a4ucyBoMGmse63FQ8irJ7JskAtHne9Tanidf3uWnXKD"), + false, + ), + AccountMeta::new( + pubkey!("GiLZMHHhLG34bv5uhDimeycrdGKhBqUc4W7rzFcPHT5o"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = RemoveAllLiquidityInstructionAccounts { + position: pubkey!("9ryhChmSnFjN1Guow3wmCMfHcDqnPMNQWw1fd22re6B3"), + lb_pair: pubkey!("BaAcxMzRRLPsCeozVFxSBkNKRNtGxWsuwAJD97FwHrFS"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("DSbDmhQ2g83dB7gxgEj2SU4YXmNTsuu1rJ7ZpYRD4FFN"), + user_token_y: pubkey!("8WDJNUUet9GKYp2LFZtMPn2szjADWqDBxh36xMzN34RG"), + reserve_x: pubkey!("HvsP7Sc6FdcYQgjMsZFmgucfXWpHBV2Z4ZSxokGDmvw3"), + reserve_y: pubkey!("5F8BjK245zNk8gDZ4wfzqFk5zNKnfBZu1nQqxTf9bw3q"), + token_x_mint: pubkey!("6ugNo7XbU5RpaNVi6MMP8tMN85MmNeXFZmcPyPvWpump"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + bin_array_lower: pubkey!("4ogZsCfAmNAnNyWRqDpny2Fx7q2hxXsY64eHtmqmT9eH"), + bin_array_upper: pubkey!("7a4ucyBoMGmse63FQ8irJ7JskAtHne9Tanidf3uWnXKD"), + sender: pubkey!("GiLZMHHhLG34bv5uhDimeycrdGKhBqUc4W7rzFcPHT5o"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/remove_all_liquidity_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + RemoveAllLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_remove_liquidity_by_range_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::RemoveLiquidityByRange(RemoveLiquidityByRange { + bps_to_remove: 10000, + from_bin_id: -239, + to_bin_id: -171, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("8q5pnyLyZDywab5ELtfEmjeukN6QjAiLyVjA1jtz1Hjo"), + false, + ), + AccountMeta::new( + pubkey!("HZErmEhFdPtEv8miyRNJ6YYDCJVTUDQ8vb6b9gYV1pAY"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("8soE8tjnUX9hW6pacq8Fhmb14zaxmxYZrvd4AHttGpN5"), + false, + ), + AccountMeta::new( + pubkey!("5gACEv1QcqviCgKDC3JrWQbvgfFv9rqYE4L3y6SnZyXg"), + false, + ), + AccountMeta::new( + pubkey!("DScYDgLUTZLoB8D1YQUHS8btV1DcddyArwMwpZvaX9F2"), + false, + ), + AccountMeta::new( + pubkey!("8F8GPCCPsqDiwshYthe4NZjBCNYmZFx2abmbFRni2dZu"), + false, + ), + AccountMeta::new_readonly( + pubkey!("CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("bKnQuoFJkhJvaTfEtvv1bQxJwnU1Qoor3C8nZ2x9VZR"), + false, + ), + AccountMeta::new( + pubkey!("567njsp2GVpy62Q6WsSeMLGTNFfChe8SNXbe1egew5FM"), + false, + ), + AccountMeta::new( + pubkey!("Hisq5w4hewLPPXvDHkVwDzcweq8XRM5a1fphKWXrLeYL"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = RemoveLiquidityByRangeInstructionAccounts { + position: pubkey!("8q5pnyLyZDywab5ELtfEmjeukN6QjAiLyVjA1jtz1Hjo"), + lb_pair: pubkey!("HZErmEhFdPtEv8miyRNJ6YYDCJVTUDQ8vb6b9gYV1pAY"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("8soE8tjnUX9hW6pacq8Fhmb14zaxmxYZrvd4AHttGpN5"), + user_token_y: pubkey!("5gACEv1QcqviCgKDC3JrWQbvgfFv9rqYE4L3y6SnZyXg"), + reserve_x: pubkey!("DScYDgLUTZLoB8D1YQUHS8btV1DcddyArwMwpZvaX9F2"), + reserve_y: pubkey!("8F8GPCCPsqDiwshYthe4NZjBCNYmZFx2abmbFRni2dZu"), + token_x_mint: pubkey!("CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + bin_array_lower: pubkey!("bKnQuoFJkhJvaTfEtvv1bQxJwnU1Qoor3C8nZ2x9VZR"), + bin_array_upper: pubkey!("567njsp2GVpy62Q6WsSeMLGTNFfChe8SNXbe1egew5FM"), + sender: pubkey!("Hisq5w4hewLPPXvDHkVwDzcweq8XRM5a1fphKWXrLeYL"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/remove_liquidity_by_range_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + RemoveLiquidityByRange::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_remove_liquidity_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::RemoveLiquidity(RemoveLiquidity { + bin_liquidity_removal: vec![ + BinLiquidityReduction { + bin_id: 1687, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1688, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1689, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1690, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1691, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1692, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1693, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1694, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1695, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1696, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1697, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1698, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1699, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1700, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1701, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1702, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1703, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1704, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1705, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1706, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1707, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1708, + bps_to_remove: 1, + }, + BinLiquidityReduction { + bin_id: 1709, + bps_to_remove: 1, + }, + ], + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("GTg4upAYuAqXnSAdSGBbcgR7mbxcLwp8pxZp5iQe1tLJ"), + false, + ), + AccountMeta::new( + pubkey!("BoeMUkCLHchTD31HdXsbDExuZZfcUppSLpYtV3LZTH6U"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("6MZw9Y8FiGGjnL4DVXS812w9t9p5B9tK5xcrCWu6p2Ev"), + false, + ), + AccountMeta::new( + pubkey!("H1HwdDkL5qHM8AZR9tBWYZQDTt9wwigKqCdF4KWuX7zP"), + false, + ), + AccountMeta::new( + pubkey!("93d6ukn24o1xMcMDip2SACKG8GbvhGUZim1e3ZEcQVm2"), + false, + ), + AccountMeta::new( + pubkey!("CodroyzrRNvc5kHRoAQYjpVSr1jA9fLcUWVFouiuWGsD"), + false, + ), + AccountMeta::new_readonly( + pubkey!("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("CzeWb8k7wDfubQz6McUcYkZuM6UQ7y2XJ6hfYBRCqBea"), + false, + ), + AccountMeta::new( + pubkey!("5Kp3m4p7QxN629DA8wcHuLrHkecxEmdGFLRcB9PD4HAa"), + false, + ), + AccountMeta::new_readonly( + pubkey!("HdZCvCH4qwUqfy5YukMyyy5gYDhtmMWK7GvqEbLVsSWj"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = RemoveLiquidityInstructionAccounts { + position: pubkey!("GTg4upAYuAqXnSAdSGBbcgR7mbxcLwp8pxZp5iQe1tLJ"), + lb_pair: pubkey!("BoeMUkCLHchTD31HdXsbDExuZZfcUppSLpYtV3LZTH6U"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("6MZw9Y8FiGGjnL4DVXS812w9t9p5B9tK5xcrCWu6p2Ev"), + user_token_y: pubkey!("H1HwdDkL5qHM8AZR9tBWYZQDTt9wwigKqCdF4KWuX7zP"), + reserve_x: pubkey!("93d6ukn24o1xMcMDip2SACKG8GbvhGUZim1e3ZEcQVm2"), + reserve_y: pubkey!("CodroyzrRNvc5kHRoAQYjpVSr1jA9fLcUWVFouiuWGsD"), + token_x_mint: pubkey!("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + bin_array_lower: pubkey!("CzeWb8k7wDfubQz6McUcYkZuM6UQ7y2XJ6hfYBRCqBea"), + bin_array_upper: pubkey!("5Kp3m4p7QxN629DA8wcHuLrHkecxEmdGFLRcB9PD4HAa"), + sender: pubkey!("HdZCvCH4qwUqfy5YukMyyy5gYDhtmMWK7GvqEbLVsSWj"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/remove_liquidity_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + RemoveLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_swap_exact_out_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::SwapExactOut(SwapExactOut { + max_in_amount: 18446744073709551615, + out_amount: 4604710206, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Cwwiuxix6vHJRUhYVt5Hn1wD3Dpsg23TGdnhraTKNdwp"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("8QveFxtVeRUYGmrnCpAMMFTbQH4KWCgFtirAynrnWpHu"), + false, + ), + AccountMeta::new( + pubkey!("8rV6fY14TBcNt7t27rMG4qY4sPyCtYbZx3MxNuJt7DN8"), + false, + ), + AccountMeta::new( + pubkey!("2tNZcU1rd3hN5nLGQNVm86mSLvuRGGpgsSF3stBaDDLo"), + false, + ), + AccountMeta::new( + pubkey!("EJeYX6pHEkQTPR6gu7jvB6NCdorNDKg37vgeCVVwg185"), + false, + ), + AccountMeta::new_readonly( + pubkey!("h5NciPdMZ5QCB5BYETJMYBMpVx9ZuitR6HcVjyBhood"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("7uF53ew4nfPo6fqzrpCWkiojLTGYBcqoXoH5Snq1Riyv"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("GqvpRMaYKYRYon1BBEGSDFfqsuwX1zcP5zMVGHD78P2K"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("7L5XySdengRtraWSk63c3RUSwDS3QDUzK8iGAyfswe72"), + false, + ), + AccountMeta::new( + pubkey!("6fiDSc65xS2hx86D8shtURZEH184eGA6RtSY36vUNByY"), + false, + ), + ]; + let expected_arranged_accounts = SwapExactOutInstructionAccounts { + lb_pair: pubkey!("Cwwiuxix6vHJRUhYVt5Hn1wD3Dpsg23TGdnhraTKNdwp"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + reserve_x: pubkey!("8QveFxtVeRUYGmrnCpAMMFTbQH4KWCgFtirAynrnWpHu"), + reserve_y: pubkey!("8rV6fY14TBcNt7t27rMG4qY4sPyCtYbZx3MxNuJt7DN8"), + user_token_in: pubkey!("2tNZcU1rd3hN5nLGQNVm86mSLvuRGGpgsSF3stBaDDLo"), + user_token_out: pubkey!("EJeYX6pHEkQTPR6gu7jvB6NCdorNDKg37vgeCVVwg185"), + token_x_mint: pubkey!("h5NciPdMZ5QCB5BYETJMYBMpVx9ZuitR6HcVjyBhood"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + oracle: pubkey!("7uF53ew4nfPo6fqzrpCWkiojLTGYBcqoXoH5Snq1Riyv"), + host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user: pubkey!("GqvpRMaYKYRYon1BBEGSDFfqsuwX1zcP5zMVGHD78P2K"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![ + AccountMeta::new( + pubkey!("7L5XySdengRtraWSk63c3RUSwDS3QDUzK8iGAyfswe72"), + false, + ), + AccountMeta::new( + pubkey!("6fiDSc65xS2hx86D8shtURZEH184eGA6RtSY36vUNByY"), + false, + ), + ], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/swap_exact_out_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SwapExactOut::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_swap_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::Swap(Swap { + amount_in: 864821960, + min_amount_out: 0, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("HAb26kxRVZBLAeVokuhSyfhTes7YLiD6GMT8X2c8DmH2"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("HJEHtafejeXa1zkjtrMu6s8mUk3EN7ZQSFErzP1hoQSB"), + false, + ), + AccountMeta::new( + pubkey!("9yG1b2qLCDMdLMM1C8UnAxwEXsCG628joitnJTfL3YaH"), + false, + ), + AccountMeta::new( + pubkey!("7x4VcEX8aLd3kFsNWULTp1qFgVtDwyWSxpTGQkoMM6XX"), + false, + ), + AccountMeta::new( + pubkey!("FqACg6svfqZqqnMuoYNgcd8xw6fJvFtjBANFMG321BHq"), + false, + ), + AccountMeta::new_readonly( + pubkey!("DvjbEsdca43oQcw2h3HW1CT7N3x5vRcr3QrvTUHnXvgV"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("CBpCNLKUmFfRTvuuksBNivDrewaYrc4S3mMv6C4o7Ldq"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("Dt7EriabLX5HCJkbTqtxF7ziDFWnJTKCirekGccMFMYk"), + false, + ), + AccountMeta::new( + pubkey!("8Nbdb3SPofvda3ZBjvjTKZrXUmqkcRXqhVRck1vnwJXm"), + false, + ), + AccountMeta::new( + pubkey!("5Er6ukkyhmzAyz44h7hcDrtMKzVsSMNnt3vAn233HCcD"), + false, + ), + ]; + let expected_arranged_accounts = SwapInstructionAccounts { + lb_pair: pubkey!("HAb26kxRVZBLAeVokuhSyfhTes7YLiD6GMT8X2c8DmH2"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + reserve_x: pubkey!("HJEHtafejeXa1zkjtrMu6s8mUk3EN7ZQSFErzP1hoQSB"), + reserve_y: pubkey!("9yG1b2qLCDMdLMM1C8UnAxwEXsCG628joitnJTfL3YaH"), + user_token_in: pubkey!("7x4VcEX8aLd3kFsNWULTp1qFgVtDwyWSxpTGQkoMM6XX"), + user_token_out: pubkey!("FqACg6svfqZqqnMuoYNgcd8xw6fJvFtjBANFMG321BHq"), + token_x_mint: pubkey!("DvjbEsdca43oQcw2h3HW1CT7N3x5vRcr3QrvTUHnXvgV"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + oracle: pubkey!("CBpCNLKUmFfRTvuuksBNivDrewaYrc4S3mMv6C4o7Ldq"), + host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user: pubkey!("6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![ + AccountMeta::new( + pubkey!("Dt7EriabLX5HCJkbTqtxF7ziDFWnJTKCirekGccMFMYk"), + false, + ), + AccountMeta::new( + pubkey!("8Nbdb3SPofvda3ZBjvjTKZrXUmqkcRXqhVRck1vnwJXm"), + false, + ), + AccountMeta::new( + pubkey!("5Er6ukkyhmzAyz44h7hcDrtMKzVsSMNnt3vAn233HCcD"), + false, + ), + ], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + Swap::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_swap_with_price_impact_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::SwapWithPriceImpact(SwapWithPriceImpact { + active_id: Some(-5212), + amount_in: 3265416567, + max_price_impact_bps: 11, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("EYj9xKw6ZszwpyNibHY7JD5o3QgTVrSdcBp1fMJhrR9o"), + false, + ), + AccountMeta::new( + pubkey!("CoaxzEh8p5YyGLcj36Eo3cUThVJxeKCs7qvLAGDYwBcz"), + false, + ), + AccountMeta::new( + pubkey!("yuJDeF4EpH6a3yrU99877vUckzoySSUBQXdMQsKBH9S"), + false, + ), + AccountMeta::new( + pubkey!("nWzG3iVBEJw5kWV3V8GjbnGvHX9uoMVrrsiS6XMBViG"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new_readonly( + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + false, + ), + AccountMeta::new( + pubkey!("59YuGWPunbchD2mbi9U7qvjWQKQReGeepn4ZSr9zz9Li"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("BsWvqrgcaKZcZsXKawDJTGpYbHsDjjFQRo35wob7DvUv"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("Ehkf9XQLVnY8HV6jbbDU25fTxF1qQ3NuScWfawSb79pu"), + false, + ), + AccountMeta::new( + pubkey!("G9QNw5nwv6JMkLSQ8ignWWEXybUfwBoJm4z5goGbU7d"), + false, + ), + AccountMeta::new( + pubkey!("CU8ZSJ7nxD3aqsk6mJYreN4gXWqnrw8jJtNM3yeBAejo"), + false, + ), + ]; + let expected_arranged_accounts = SwapWithPriceImpactInstructionAccounts { + lb_pair: pubkey!("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + reserve_x: pubkey!("EYj9xKw6ZszwpyNibHY7JD5o3QgTVrSdcBp1fMJhrR9o"), + reserve_y: pubkey!("CoaxzEh8p5YyGLcj36Eo3cUThVJxeKCs7qvLAGDYwBcz"), + user_token_in: pubkey!("yuJDeF4EpH6a3yrU99877vUckzoySSUBQXdMQsKBH9S"), + user_token_out: pubkey!("nWzG3iVBEJw5kWV3V8GjbnGvHX9uoMVrrsiS6XMBViG"), + token_x_mint: pubkey!("So11111111111111111111111111111111111111112"), + token_y_mint: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + oracle: pubkey!("59YuGWPunbchD2mbi9U7qvjWQKQReGeepn4ZSr9zz9Li"), + host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user: pubkey!("BsWvqrgcaKZcZsXKawDJTGpYbHsDjjFQRo35wob7DvUv"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + remaining_accounts: vec![ + AccountMeta::new( + pubkey!("Ehkf9XQLVnY8HV6jbbDU25fTxF1qQ3NuScWfawSb79pu"), + false, + ), + AccountMeta::new( + pubkey!("G9QNw5nwv6JMkLSQ8ignWWEXybUfwBoJm4z5goGbU7d"), + false, + ), + AccountMeta::new( + pubkey!("CU8ZSJ7nxD3aqsk6mJYreN4gXWqnrw8jJtNM3yeBAejo"), + false, + ), + ], + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/swap_with_price_impact_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SwapWithPriceImpact::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_update_fee_parameters_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::UpdateFeeParameters(UpdateFeeParameters { + fee_parameter: FeeParameter { + base_factor: 20000, + protocol_share: 500, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("A9KUjKXwqajsGrCRZSnQBkrvJ6iBoQ4Yjs49dVLruDBV"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = UpdateFeeParametersInstructionAccounts { + lb_pair: pubkey!("A9KUjKXwqajsGrCRZSnQBkrvJ6iBoQ4Yjs49dVLruDBV"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/update_fee_parameters_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + UpdateFeeParameters::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_update_fees_and_rewards_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::UpdateFeesAndRewards(UpdateFeesAndRewards {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("xVntejWTytykHTM33wHCfogpQRcy7mDAnH3U5b7X8eD"), + false, + ), + AccountMeta::new( + pubkey!("6cDtJkcJKFEsGDhptmgvy3XtbwyRqnW3GoGcmnwVzJ7U"), + false, + ), + AccountMeta::new( + pubkey!("3bi5tFzspV17UGEKra1HReFN6doQ2iSsyvWY8XzQGaoc"), + false, + ), + AccountMeta::new( + pubkey!("5vfo4AvbiE4T1VBtqYhv8YAA92fERDevKCGHj8sVyYuQ"), + false, + ), + AccountMeta::new( + pubkey!("6jW5kGzAQ6dM3CUGF7k1uTRBb8DFm9whv52UTEPFpgF8"), + false, + ), + ]; + let expected_arranged_accounts = UpdateFeesAndRewardsInstructionAccounts { + position: pubkey!("xVntejWTytykHTM33wHCfogpQRcy7mDAnH3U5b7X8eD"), + lb_pair: pubkey!("6cDtJkcJKFEsGDhptmgvy3XtbwyRqnW3GoGcmnwVzJ7U"), + bin_array_lower: pubkey!("3bi5tFzspV17UGEKra1HReFN6doQ2iSsyvWY8XzQGaoc"), + bin_array_upper: pubkey!("5vfo4AvbiE4T1VBtqYhv8YAA92fERDevKCGHj8sVyYuQ"), + owner: pubkey!("6jW5kGzAQ6dM3CUGF7k1uTRBb8DFm9whv52UTEPFpgF8"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/update_fees_and_rewards_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + UpdateFeesAndRewards::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } +} diff --git a/decoders/meteora-dlmm-decoder/src/instructions/remove_all_liquidity.rs b/decoders/meteora-dlmm-decoder/src/instructions/remove_all_liquidity.rs index 287e357db..23563734c 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/remove_all_liquidity.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/remove_all_liquidity.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0x0a333d2370691855")] pub struct RemoveAllLiquidity {} +#[derive(Debug, PartialEq)] pub struct RemoveAllLiquidityInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity.rs b/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity.rs index 51007dc8e..386c761ab 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity.rs @@ -11,6 +11,7 @@ pub struct RemoveLiquidity { pub bin_liquidity_removal: Vec, } +#[derive(Debug, PartialEq)] pub struct RemoveLiquidityInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity_by_range.rs b/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity_by_range.rs index 230da3016..0d5614f76 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity_by_range.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/remove_liquidity_by_range.rs @@ -10,6 +10,7 @@ pub struct RemoveLiquidityByRange { pub bps_to_remove: u16, } +#[derive(Debug, PartialEq)] pub struct RemoveLiquidityByRangeInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/swap.rs b/decoders/meteora-dlmm-decoder/src/instructions/swap.rs index cd747a5c6..de49dc711 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/swap.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/swap.rs @@ -8,7 +8,7 @@ pub struct Swap { pub amount_in: u64, pub min_amount_out: u64, } - +#[derive(Debug, PartialEq)] pub struct SwapInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/swap_exact_out.rs b/decoders/meteora-dlmm-decoder/src/instructions/swap_exact_out.rs index fb5c5b64b..d177c0738 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/swap_exact_out.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/swap_exact_out.rs @@ -9,6 +9,7 @@ pub struct SwapExactOut { pub out_amount: u64, } +#[derive(Debug, PartialEq)] pub struct SwapExactOutInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/swap_with_price_impact.rs b/decoders/meteora-dlmm-decoder/src/instructions/swap_with_price_impact.rs index 5bf99520e..7ed6a6b89 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/swap_with_price_impact.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/swap_with_price_impact.rs @@ -10,6 +10,7 @@ pub struct SwapWithPriceImpact { pub max_price_impact_bps: u16, } +#[derive(Debug, PartialEq)] pub struct SwapWithPriceImpactInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub bin_array_bitmap_extension: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/update_fee_parameters.rs b/decoders/meteora-dlmm-decoder/src/instructions/update_fee_parameters.rs index 214151534..59b47fd74 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/update_fee_parameters.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/update_fee_parameters.rs @@ -11,6 +11,7 @@ pub struct UpdateFeeParameters { pub fee_parameter: FeeParameter, } +#[derive(Debug, PartialEq)] pub struct UpdateFeeParametersInstructionAccounts { pub lb_pair: solana_pubkey::Pubkey, pub admin: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/instructions/update_fees_and_rewards.rs b/decoders/meteora-dlmm-decoder/src/instructions/update_fees_and_rewards.rs index 60558e81b..f1bd4ac16 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/update_fees_and_rewards.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/update_fees_and_rewards.rs @@ -6,6 +6,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[carbon(discriminator = "0x9ae6fa0decd14bdf")] pub struct UpdateFeesAndRewards {} +#[derive(Debug, PartialEq)] pub struct UpdateFeesAndRewardsInstructionAccounts { pub position: solana_pubkey::Pubkey, pub lb_pair: solana_pubkey::Pubkey, diff --git a/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs b/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs index 7d55f845b..d3f362be9 100644 --- a/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs +++ b/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs @@ -9,5 +9,6 @@ pub struct InitPermissionPairIx { pub base_factor: u16, pub min_bin_id: i32, pub max_bin_id: i32, + pub lock_duration: u64, pub activation_type: u8, } diff --git a/decoders/meteora-dlmm-decoder/src/types/user_reward_info.rs b/decoders/meteora-dlmm-decoder/src/types/user_reward_info.rs index b4076f35d..dabd22ab2 100644 --- a/decoders/meteora-dlmm-decoder/src/types/user_reward_info.rs +++ b/decoders/meteora-dlmm-decoder/src/types/user_reward_info.rs @@ -1,7 +1,7 @@ use carbon_core::{borsh, CarbonDeserialize}; #[derive( - CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash, + CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash, Copy, )] pub struct UserRewardInfo { pub reward_per_token_completes: [u128; 2], diff --git a/decoders/meteora-dlmm-decoder/tests/README.md b/decoders/meteora-dlmm-decoder/tests/README.md new file mode 100644 index 000000000..373c79464 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/README.md @@ -0,0 +1,56 @@ +# Meteora DLMM Decoder Tests + +## Instructions +- [InitializeLbPair](https://solscan.io/tx/56zeqRP2pjAHPbub9ayteMy3PWunbaQCWbHrYULiQnhq1GvPe6njTyYyaqQupgNA9NYWBtDYFwos6hxJLVmLXw3U) +- [InitializePermissionLbPair](https://solscan.io/tx/2xvpA7ugRVTsgQrPEw1RVHWY4r25QdwqdCS1QhJayQe2bx6gNM2mH4W7TRKM5s3sj1HwpDh2F462LXC8G2nzBasE) +- [InitializeCustomizablePermissionlessLbPair](https://solscan.io/tx/4JrJ42JvBJ25HbfvcV5mmcs3yssw1yan5uVsnm3fXkQPBcmmCyHehgHxFtk997pqBLVJk7DPD7nqUnYaJ8oD7Zbc) +- [InitializeBinArrayBitmapExtension](https://solscan.io/tx/2b4xwjdYGZ51rKJEyNwKuExXVvHYQgsdfuT1BfHicN3dUfnCJsmAqMQk35Y4UqdvVsDCeiHaiMUzdcU4xSWwwboV) +- [InitializeBinArray](https://solscan.io/tx/2n5bjg2rMaTMJroCaYuKYLRoKMd2nbrhAhSRcVKWZ5ST21SjGXRbgMN8FGQnu43n9eKnRsvrCfhTBdmHioUYQRYx) +- [AddLiquidity](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) +- [AddLiquidityByWeight](https://solscan.io/tx/51U5NMj4gQgtp6AEiEQTfGi37EJob7uYDP6rLN6W1eY4traNA5dXnQy59rBZEN1b2uCgA2wpKZwK9wXaA6AZ44fb) +- [AddLiquidityByStrategy](https://solscan.io/tx/DFHN5c4XkxPKmuu3MaBdwhqavQp2qW4yUVp8LkWVYp2ATGHiSqPAiZPahYndjyEac36Q22VrK95DqSFKNTM9zJd) +- [AddLiquidityByStrategyOneSide](https://solscan.io/tx/3FWcxKDr9PwzJaCHBKHeRqocTcpzVtrPnCZvaXZseS55KLDHr1tfnb9PCSFDCjXcsDnSACgsLhPKgrA5sELuKh6W) +- [AddLiquidityOneSide](https://solscan.io/tx/2nsGZ7eTP1kPWhgX8sb6Pk6sUagN8QiPt2aWTFJmzFriuWKKDSF6QZGHZ5kgByzeeoC1HrmZUVD9s62HuyLBvgpP) +- [RemoveLiquidity](https://solscan.io/tx/3GaCC8hX8yaQsMsj3q4X4ZVjjpGZdgBSg154ZaCxWKcwKxzeW3LA7naat4qjXVgiethiL5ahXY55jDSgsqwGbEmu) +- [InitializePosition](https://solscan.io/tx/zrqVY1PNvqnPDfAnVAtKM7iiHs6sn6RogmhUzR6tH2bCZojsR4mRKMM76Azy7rkcEEMHfzdznoLhybkDkbnSPn3) +- [InitializePositionPda](https://solscan.io/tx/3TQrSnFEAXcYPW7eeM1S6h5jKSHrfZkVSN7rBJENRzUxfhRamdhjbWpLoTRFkaA2FzaTLBUGcz2Hq2tWtSbZ1z5T) +- [InitializePositionByOperator](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) +- [UpdatePositionOperator](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) +- [Swap](https://solscan.io/tx/2E2EFSrAoFY31Edy4N3Mh7o17BWorp4kfQb7qWwVoy4BYm3j8HX2r1b4MY8XePuWUyAFnHtkQz7Kpmsj7jusikeE) +- [SwapExactOut](https://solscan.io/tx/29eNrCgFWvZ8TUwxD4ybRtWmE9QDnafz8w7G27gLECgFpo2wQ8sM6TyDNhHnsTz8umJaJqh2hJVQA4im5Lk54eLh) +- [SwapWithPriceImpact](https://solscan.io/tx/29FKUpybWHn3JUUC2soPqN8SNDKT4VeJZ7HLmpMwWkFavUkkEoVBNVqJUXvXPs1HcJza63P1aDECKJ5WZWwz23cS) +- [InitializeReward](https://solscan.io/tx/4PPQZ3WGygM2rSzNppn8UaGASoQJrpmtcoB6Aqa77X8EcvXMVYi6VwQ7HKvN7yqqaMTYbkAbnfZ4fa5xaTzSvs7f) +- [FundReward](https://solscan.io/tx/5yeyRkoLnshKGqPDoAmV71tEPwLThtfUSwYc5vFMaRMdjWo3upv3ErDtdYShQb9AbAWWKBxsh6qcF3KWtPBDqDyf) +- [ClaimReward](https://solscan.io/tx/47De6LKmvLXnyF1LsbFenYGbbRPzsyXhrdiaMHyQUE6r8o1jJt9YGXJF9S11FWmSRHr5Tz1YVLwhxxiUNAG6RMTa) +- [ClaimFee](https://solscan.io/tx/3oYQxHQFimNBmXoFe2kqoKLvEPWJhNbmSGMuyXJPZ6XviB2jeTfhtNUd16u7CCikNL5v1jfwkdh5GtA969tNQKrY) +- [ClosePosition](https://solscan.io/tx/2yGLHktGYho1rQ4eiVvtAEfmfXJdMjPoLdaixjg4RvHp2LB9bFn1ZN2A16bibUQkSNgwyQGucRSZxTtGWDNEb2KD) +- [UpdateFeeParameters](https://solscan.io/tx/2rmygSGvJeQwnmHGpsdKgyP53u7VV22d8evSiUTnhWB7rT4CdPkWgopCd2YY9T9w5SZMuwJGvyDdPor4gKGwBMXa) +- [InitializePresetParameter](https://solscan.io/tx/LjA5JwULSyvzxYa1Z4qAXQFCRQXMrafB64RTQ5NEKxu1a2CaVPBwWhtkGoydGuRXBYzGURbHVTgXnt15ewoEVvq) +- [ClosePresetParameter](https://solscan.io/tx/LjA5JwULSyvzxYa1Z4qAXQFCRQXMrafB64RTQ5NEKxu1a2CaVPBwWhtkGoydGuRXBYzGURbHVTgXnt15ewoEVvq) +- [RemoveAllLiquidity](https://solscan.io/tx/45DLXSXVcogvrURaYa3rM5htZTh3VUGeHNsJ1AsmZH7NXtDBkbrNy58AyibkzLxLLoAeKY78xeyPUshjYPW3QEV6) +- [MigratePosition](https://solscan.io/tx/3B61kxDTC2a5rwW6CCVu83tQb8G6MLRBumeLEUFLCW264NgCEUefSpG5dEbWptC8W7BqM3HCsNbmLFHjoTVFMz11) +- [UpdateFeesAndRewards](https://solscan.io/tx/3hkBmxRpiomnQDu34YRBd5AYTQCrzjaB6aeVDLkSoNQLFUtAANGZvckFG1vyCD7GN7mcWe6NonEXtD9M6YUJCjnE) +- [RemoveLiquidityByRange](https://solscan.io/tx/hmd7WZ2wnDYA4yWJLYD1URk3UQu5q18Ln7nR3QcXN7zSXuZPrv5QFgE5Jz9rsxgsi2dTu4yAPtdUKQGYLLvyqAB) +- [AddLiquidityOneSidePrecise](https://solscan.io/tx/39URMKxPHuZyNQdDxTtxE2A5SHmEmcMDGM8Ee2dXtaR7btLqUMsXhJWRuLopN5rC9x1gd5VbcfeGUY11H1M9a3oe) +- [GoToABin](https://solscan.io/tx/31VhsCV7ki9K97BWupQC4YkLsBgbuEvXvKMgL3fQY5aCTjXGTxktGJZtoC37zSLc4Lt3tHKsbdpAGr7BVXr6mJrz) +- [UpdateRewardFunderEvent]() +- [PositionCloseEvent]() +- [ClaimFeeEvent]() +- [LbPairCreateEvent]() +- [PositionCreateEvent]() +- [FeeParameterUpdateEvent]() +- [IncreaseObservationEvent]() +- [WithdrawIneligibleRewardEvent]() +- [UpdatePositionOperatorEvent]() +- [UpdatePositionLockReleasePointEvent]() +- [GoToABinEvent]() + +## Accounts + +- [LbPair](https://solscan.io/account/7wR3Zy7ywZiPu9DiP7hqbGi3gPQUdGs8Yy5LK5pkFmCh) +- [Position](https://solscan.io/account/12589PP9fRE5Ve7CPE1ABfFHJPFa6BtTQ85yvN7Xxega) +- [PresetParameter](https://solscan.io/account/F37fb46nFwBTK5Q5upDWjfkZetRyV7dqeUP9LfSvhi6c) +- [BinArrayBitmapExtension]() +- [BinArray]() +- [Oracle]() +- [PositionV2]() \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_ix.json new file mode 100644 index 000000000..379855610 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "41FpGiwCcRr3qczHts3zqYuZERjddZ2dZDoLvhKzhaKJ", + "is_signer": true, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "2bYjEuupzFtBwgQuzSDkpnCFX9A2iBK6oL9JA3wXwbsa", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "8d13MHH2DWZfkburgMQ5v9FGgifmK6ejgZM1jJzEVT7n", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "3nVErWE28y5mU6WFPpbhUm7jqmDTrAiA4hN6vuXGUMuP", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "G7AsqVKQ7yW7z2VZmk3FCMCyAqdgRq28aPnAWicGuc2b", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "9hPJ6E7hXEQ5UTPC7SKK6D5mDQKTdZ87uQtG5DDaYrLB", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "7XAyfFUXfCWbA1x6jCHVzeFtoKN3x836Pp5zQyhqpump", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "F5GxuK8c9Z7JnwBhKbjFbbLgTB9N2RvMXpZbGUVxU74c", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "AambQn5DuPVWquMrQdhhYeAdM7X6eG2GDc35ek7HwZzB", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "5h5fDq1A17dKpFQEjkNfYYaJd7CAzymUchjfPZ4Dh8pa", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "0703967f94283dc800000000000000004005e5020500000027fdffff1027000026fdffff26fdffff0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_one_side_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_one_side_ix.json new file mode 100644 index 000000000..154ad6268 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_strategy_one_side_ix.json @@ -0,0 +1,78 @@ +{ + "accounts": [ + { + "pubkey": "AFJHGqyNai5kYaenM8FnR4bxdacScQHAyeu3NMeMjvuC", + "is_signer": true, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "BGm1tav58oGcsQJehL9WXBFXF7D27vZsKefj4xJKD5Y", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "HVS8WdPqAia9cEbxqGpXDbgJCgFa57Ufhcfnz4UKwUc", + "is_signer": false, + "is_writable": true, + "label": "userToken" + }, + { + "pubkey": "4N22J4vW2juHocTntJNmXywSonYjkndCwahjZ2cYLDgb", + "is_signer": false, + "is_writable": true, + "label": "reserve" + }, + { + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "is_signer": false, + "is_writable": false, + "label": "tokenMint" + }, + { + "pubkey": "FE6nEninSdoZqVKXDUEa6NtsYfkL13uPB846FpRCF1WZ", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "9o3pWJhKowpQukQTP5d3xwrGdUZtR5wmKGJwBiMbqGoM", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "FSM4tqYAWuv5Tvw2wF75AwkmijTjMCD6njYkPzq7m6Cz", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "2905eeaf64e106cd00412a4202000000f5f7ffff03000000ccf7fffff4f7ffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_weight_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_weight_ix.json new file mode 100644 index 000000000..ff6845dd2 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_by_weight_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "GTg4upAYuAqXnSAdSGBbcgR7mbxcLwp8pxZp5iQe1tLJ", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "BoeMUkCLHchTD31HdXsbDExuZZfcUppSLpYtV3LZTH6U", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "6MZw9Y8FiGGjnL4DVXS812w9t9p5B9tK5xcrCWu6p2Ev", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "H1HwdDkL5qHM8AZR9tBWYZQDTt9wwigKqCdF4KWuX7zP", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "93d6ukn24o1xMcMDip2SACKG8GbvhGUZim1e3ZEcQVm2", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "CodroyzrRNvc5kHRoAQYjpVSr1jA9fLcUWVFouiuWGsD", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "CzeWb8k7wDfubQz6McUcYkZuM6UQ7y2XJ6hfYBRCqBea", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "5Kp3m4p7QxN629DA8wcHuLrHkecxEmdGFLRcB9PD4HAa", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "HdZCvCH4qwUqfy5YukMyyy5gYDhtmMWK7GvqEbLVsSWj", + "is_signer": false, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "1c8cee63e7a2159532dd630b00000000383a8a0d00000000a2060000ffffff7f170000009706000001009806000001009906000001009a06000001009b06000001009c06000001009d06000001009e06000001009f0600000100a00600000100a10600000100a20600000100a30600000100a40600000100a50600000100a60600000100a70600000100a80600000100a90600000100aa0600000100ab0600000100ac0600000100ad0600000100", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_ix.json new file mode 100644 index 000000000..2f5d6346d --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "HmgRf3Pp6ZVzJ819Q7mghHF1u1FwExPPUW4wCLzBnuaa", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "DBS3T76RM6Ca1LuR5Rq5HSDJaRhFR1njskNpwAj2KJ1j", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "5Dng6CfUnmB5c5uHF47ZLSvw5RJqXvJotAUfhsk4DzUe", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "EZ52s5QnBB2RPzJWhEKKRq1qgXCrbPDAMUD6CpST1hyj", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "EgPtKDncu4xK7ZBrfqvoZ7SUBzFWUJ2UD2TiruZ7P6o2", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "A8CDf2UNKR8hDLDXiWnNJRUYCNiqSsRMnK5gScxpRjnL", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "78fSXwNfQ1dt3Yo5UoX1c6HeT8JaQ1XSsenEh5gSoSt7", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "5X5bqEcaGmNp9bMC44JRmVrNFzckBcsefYSHTQB5zjYx", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "b59d59438fb6344800009e1869d029040000000000000000010000001af8ffff10270000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_ix.json new file mode 100644 index 000000000..7c01de32c --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_ix.json @@ -0,0 +1,78 @@ +{ + "accounts": [ + { + "pubkey": "D6SJ8sMRou9nrU4JsWC1SdtgdQroykjf3bLV12MLjnwv", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "9NNAwkhZGTWbb3ASqsZcp8vAx9TSqa6QrBiNbRGvcBaN", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "3yKz2iUNG2QdYkkejp9HUUtzt4PimkZumTrQpKkewepn", + "is_signer": false, + "is_writable": true, + "label": "userToken" + }, + { + "pubkey": "7VhWRicruPXN8W8w3mTWUjrnQQAFrjB1REtGiGTH8cPz", + "is_signer": false, + "is_writable": true, + "label": "reserve" + }, + { + "pubkey": "7Y6Rix8X2botuMaJ2mno4UqSWdQZqU4RezY6qp7zpump", + "is_signer": false, + "is_writable": false, + "label": "tokenMint" + }, + { + "pubkey": "HXsEBdoAusbKCnixyPMAmTX1HbNJ9KEJQi32jZ7dbHQm", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "3SjbLYKjDWGLqmW6xx8UnQU9ahkNUjpD1AshXxDh7ryq", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "GdLm4b7x67JaieLYkPkXpzyqX9RhLGmzM6MDXhTpU7kf", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "5e9b6797465fdca50835e2f80500000054feffff040000000b00000054feffffcc0855feffffd81156feffff6a1657feffff061b58feffff981f59feffff32245afeffffc7285bfeffff9c1f5cfeffff6b165dfeffff3c0d5efeffff1104", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_precise_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_precise_ix.json new file mode 100644 index 000000000..22b737980 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/add_liquidity_one_side_precise_ix.json @@ -0,0 +1,78 @@ +{ + "accounts": [ + { + "pubkey": "Ce8W9ThaNsa15BtyvnGU85xTLGANgpWqyxwt5o4uaKUv", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "3uref9YcGnma388KKM2kqP6NAcuCdPh5NbwYpqzcYZfK", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "J75TPk5xqCR6VPN6ZvyX2A2TvPG7oE8oCggmp1kHWmq1", + "is_signer": false, + "is_writable": true, + "label": "userToken" + }, + { + "pubkey": "HSKLo63VLJj61oNwfMMr9S761NRpm1U6s2pXfBRqGdzG", + "is_signer": false, + "is_writable": true, + "label": "reserve" + }, + { + "pubkey": "Grk4aSvTDdeNgi5JodDTuwGCb1oXLj9dmTfn4x5o7Q9t", + "is_signer": false, + "is_writable": false, + "label": "tokenMint" + }, + { + "pubkey": "Huk9wcMCsNXiDj8SocVm5axc3WZ9gpzdWaQ8waTVpRqU", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "8zzYe5K8CfemwbivccZvXbZpNbMgkEijVitNNTwfpjYk", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "a1c26754ab47fa9a06000000e0fcffffc36a0100e1fcffff32280300e2fcffff3e910400e3fcffff5ddf0500e4fcffffaa210700e5fcffff445f080000ca9a3b00000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee_ix.json new file mode 100644 index 000000000..3330060be --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee_ix.json @@ -0,0 +1,90 @@ +{ + "accounts": [ + { + "pubkey": "CczaEikMAfA4F6gaXKBe5qfd2Mwc7pu4KpetTg88Tica", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "C2poDHs8dRBC8HsM8zzw4Zwe1pFMgD9LfXJd25M3Hajz", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "2rhbcMDNDxVqBJR8EnKWmZb8qTUD5ga67mDz4m2uPtSR", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "AdPnhr43oMUtNr6k9GUZd65zwKcSCLQXouPyYkjQyGsv", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "71KMt1Z57CnQpgxuHU5wFvweakjpvsjGx5ucADnrGoDr", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "za39KwZejtyZEfLVk1PqumSKcwstQX3yqVK8k2pgmRL", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "6mfAFMJCqMuQUvDAoYcxhC1wmHuAey3AYa79sEHGLp6s", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "FsKePukyoEW14F7XVkeS38veoCR6VAxjXprm6L6C9gfK", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "7Mv53UFYF3b9vaFsmhVTLMsnfBMY9L2699zcQRjvBbJm", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "Hjw6bEcHtbHGpQr8onG3izfJY5DJiWdt7uk2BfdSpump", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "a9204f8988e84689", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward_ix.json new file mode 100644 index 000000000..78d76bc7c --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward_ix.json @@ -0,0 +1,72 @@ +{ + "accounts": [ + { + "pubkey": "J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5VAkBGkRRsoPx6PxQr4jeCAGS1Mb1PHuqDPcFZPquCLX", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "5B6DoUgQHYfftC89eALn94QfaUzjKJUr3dKQzKYEXDih", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "HWg7gUo8aSZD61q4wfwwr9AYZDDZtb5NKgLVpGuxvgw3", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk", + "is_signer": false, + "is_writable": true, + "label": "rewardVault" + }, + { + "pubkey": "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr", + "is_signer": false, + "is_writable": false, + "label": "rewardMint" + }, + { + "pubkey": "5kZ9Fis9hvdnhVCpxHGXCc9Yjf1GagLnacJkxSikJ77G", + "is_signer": false, + "is_writable": true, + "label": "userTokenAccount" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "955fb5f25e5a9ea20000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/close_position_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/close_position_ix.json new file mode 100644 index 000000000..2b3e3c988 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/close_position_ix.json @@ -0,0 +1,54 @@ +{ + "accounts": [ + { + "pubkey": "Bqy3p4nsgPeddNLD98cDFHvXTVNd3ay1qU8aiE75Me8E", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "8aSioDcoMjZ1gQYXSZTKetXaceUts2ZBHz2twKqYRGK1", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "8hUdax3HbAeRbxAK59xUZBJytmpHu5CkFbKFfkyMph1F", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "HsSsSEd6YDRVRbqbUop3uWPaFtqobyrJUraQ7AxhgRy5", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "u9KjZ2Lie1EuJF3BsMR3U7PKSPesCQFkTupK4hantbs", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "u9KjZ2Lie1EuJF3BsMR3U7PKSPesCQFkTupK4hantbs", + "is_signer": true, + "is_writable": true, + "label": "rentReceiver" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "7b86510031446262", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/close_preset_parameter_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/close_preset_parameter_ix.json new file mode 100644 index 000000000..b6d638150 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/close_preset_parameter_ix.json @@ -0,0 +1,24 @@ +{ + "accounts": [ + { + "pubkey": "Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei", + "is_signer": false, + "is_writable": true, + "label": "presetParameter" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "rentReceiver" + } + ], + "data": "04949164861ab53d", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json new file mode 100644 index 000000000..7ab71c3ff --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json @@ -0,0 +1,60 @@ +{ + "accounts": [ + { + "pubkey": "J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk", + "is_signer": false, + "is_writable": true, + "label": "rewardVault" + }, + { + "pubkey": "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr", + "is_signer": false, + "is_writable": false, + "label": "rewardMint" + }, + { + "pubkey": "5V1RFYBKBZ78zG6cYJ5ssGLQmttLC1KSM6bSdSpgSV5i", + "is_signer": false, + "is_writable": true, + "label": "funderTokenAccount" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "funder" + }, + { + "pubkey": "AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK", + "is_signer": false, + "is_writable": true, + "label": "binArray" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "bc32f9a55d97263f000000000000000000743ba40b00000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/go_to_a_bin_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/go_to_a_bin_ix.json new file mode 100644 index 000000000..2173e13df --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/go_to_a_bin_ix.json @@ -0,0 +1,42 @@ +{ + "accounts": [ + { + "pubkey": "CRnGNKPrdgucFPSMsMn7ENAA2eJWn6CsCtunpVU8b3v8", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "fromBinArray" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "toBinArray" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "9248aee028fd54ae7bd2ffff", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_bitmap_extension_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_bitmap_extension_ix.json new file mode 100644 index 000000000..f0e3602f9 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_bitmap_extension_ix.json @@ -0,0 +1,36 @@ +{ + "accounts": [ + { + "pubkey": "7bGcnxwxHhWKtE7L7opZPqzJH6aU3HbRbuQnrGKf8779", + "is_signer": false, + "is_writable": false, + "label": "lbPair" + }, + { + "pubkey": "H2mrTZ7gSQ6EknZUeBakw6u6VEfd4t4g7KEPWgRV5Ffv", + "is_signer": false, + "is_writable": true, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "BZ9BoTtGkPXCJ73EdBLvy36kop8tMpzHXVboEnB71T2m", + "is_signer": true, + "is_writable": true, + "label": "funder" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + } + ], + "data": "2f9de2b40cf02147", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_ix.json new file mode 100644 index 000000000..8784f7ec4 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_bin_array_ix.json @@ -0,0 +1,30 @@ +{ + "accounts": [ + { + "pubkey": "Bwf8q9r1wgSvQWcAdLXJqMM6icGSVW5BWrHWEEpyCAcP", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "C4ytp5DSAHx2nveimbZYR3rBPgvPKPYQY38V8abDNiUh", + "is_signer": false, + "is_writable": true, + "label": "binArray" + }, + { + "pubkey": "235sX2nwcsYqJrzSYeViPJJNgaQ73atZ3oJbYqt5eA1i", + "is_signer": true, + "is_writable": true, + "label": "funder" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + } + ], + "data": "235613b94ed44bd30600000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json new file mode 100644 index 000000000..be36577df --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json @@ -0,0 +1,90 @@ +{ + "accounts": [ + { + "pubkey": "E7fHCw9G6KuCA2jg3uxvJn1MWL8ySD68kDLPyGDvcStT", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "fiSpHY8vkjABpAKGCaLs3pDnkZpeqNiYrADp4GZLYZY", + "is_signer": false, + "is_writable": false, + "label": "tokenMintX" + }, + { + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "is_signer": false, + "is_writable": false, + "label": "tokenMintY" + }, + { + "pubkey": "5Lbm1X6oYcSUcscMmvWqmg7sz2Qh3XJ3ydBy2v8cTrTV", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "Fov1U4FMX8u4Ln5gM9LHsZcWgwHAeZ526usUjaYza2BR", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "nJuXpHhaM9nNtY8XKiCfrsYAojRFEmrw33DYbiKqkAW", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "DujguCjLgZhVT7oTZ8XhDUYNgVYXn3EhqHGciXxKNLJ1", + "is_signer": false, + "is_writable": false, + "label": "userTokenX" + }, + { + "pubkey": "7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU", + "is_signer": true, + "is_writable": true, + "label": "funder" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "Z7bkDerKzHpy5XtLYfNvtLq6PttYpxWmhXAeEFhCHff", + "is_signer": false, + "is_writable": false, + "label": "rent" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "2e2729876fb7c840d3fcffffc8001027010001b3ddce670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair_ix.json new file mode 100644 index 000000000..54146b283 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair_ix.json @@ -0,0 +1,90 @@ +{ + "accounts": [ + { + "pubkey": "12PMuMKowpmSndiUvQVZ9Nbs4ck6X35iqoZXBerR4ojf", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "631BvY2KLFbUcQvUhK2nn2buWw1K1yfS2eMHU8t9pump", + "is_signer": false, + "is_writable": false, + "label": "tokenMintX" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenMintY" + }, + { + "pubkey": "5oHBxFoJqGjL6eZHi9buv3JvvxdutVEVsZNEyafjWroY", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "J6TQ9iXZGg1K5P2MXtBqkZUjMbRPL26D3y21DtaPCxAm", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "3qQXfWooz78RBCpC1My76mBcgbPAPDK3HrhJmjRsxicL", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "83XWJx8TNDYtiKA15EbCBKSTvNZ3h2jGjHz87CXncRVH", + "is_signer": false, + "is_writable": false, + "label": "presetParameter" + }, + { + "pubkey": "DiPkWknz9MccGhGmj4ku7yWuyhtmNP385j1UXnHLZPqZ", + "is_signer": true, + "is_writable": true, + "label": "funder" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "2d9aedd2dd0fa65c5b000000fa00", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json new file mode 100644 index 000000000..1947755ce --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json @@ -0,0 +1,90 @@ +{ + "accounts": [ + { + "pubkey": "AeSLQ4ty9qfhEkzBpQAKypptur3giRDLWm3QGP1mze26", + "is_signer": true, + "is_writable": false, + "label": "base" + }, + { + "pubkey": "DgSVNgNofqZyhmkSdUwuqvyTjHNYmq799RYMcadKnb2q", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "DVYtHdaDc77W1oYTtAYd6kz9QVTj8wPWwiUTbkqzgN4n", + "is_signer": false, + "is_writable": false, + "label": "tokenMintX" + }, + { + "pubkey": "8VJNVtvL5JcCrCgkb3gEjYT8NtA5rqen9YztcPhiwVCP", + "is_signer": false, + "is_writable": false, + "label": "tokenMintY" + }, + { + "pubkey": "31Hx85DFuKr15Xr5XKse5tdWLTRQrEXCkKsoeipTHCfi", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "E55HFtp5AgG4hXK1ELbv9LD7V6872ZxW7tetuADJN5iC", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "B3EUUmEF4h4ZLmnYKbqP8LKYdLjoCmWH7j7JLcxsFfQc", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "6c66d555fb033515c5f9ffff50007c9298eaffff68150000000000000000000001", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_by_operator_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_by_operator_ix.json new file mode 100644 index 000000000..caa0e0e01 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_by_operator_ix.json @@ -0,0 +1,72 @@ +{ + "accounts": [ + { + "pubkey": "2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu", + "is_signer": true, + "is_writable": true, + "label": "payer" + }, + { + "pubkey": "2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu", + "is_signer": true, + "is_writable": true, + "label": "base" + }, + { + "pubkey": "HmgRf3Pp6ZVzJ819Q7mghHF1u1FwExPPUW4wCLzBnuaa", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "DBS3T76RM6Ca1LuR5Rq5HSDJaRhFR1njskNpwAj2KJ1j", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu", + "is_signer": true, + "is_writable": true, + "label": "owner" + }, + { + "pubkey": "2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu", + "is_signer": true, + "is_writable": true, + "label": "operator" + }, + { + "pubkey": "2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G", + "is_signer": false, + "is_writable": true, + "label": "operatorTokenX" + }, + { + "pubkey": "2JJpTp9mxYDfMv2LeVYwNWqaiiPUkcyCQeG1MDBTGA7G", + "is_signer": false, + "is_writable": true, + "label": "ownerTokenX" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "fbbdbef475fe23941af8ffff010000001d4f907b896d33ba9af4501144a86245a2588373bfa3c93cf2ffc701f459eabc0000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_ix.json new file mode 100644 index 000000000..26afc249b --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_ix.json @@ -0,0 +1,54 @@ +{ + "accounts": [ + { + "pubkey": "2gV1bRqcF4kmmwe3ahUbzD6xaDE1E1hZ7cys2hWis6Cs", + "is_signer": true, + "is_writable": true, + "label": "payer" + }, + { + "pubkey": "2zQPS74ub2Rsyjcjn226HGJVGhQSCLZmsrezBGcee4JY", + "is_signer": true, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "2bYjEuupzFtBwgQuzSDkpnCFX9A2iBK6oL9JA3wXwbsa", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "2gV1bRqcF4kmmwe3ahUbzD6xaDE1E1hZ7cys2hWis6Cs", + "is_signer": true, + "is_writable": true, + "label": "owner" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "dbc0ea47bebf665026fdffff01000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_pda_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_pda_ix.json new file mode 100644 index 000000000..e73dde7ea --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_position_pda_ix.json @@ -0,0 +1,60 @@ +{ + "accounts": [ + { + "pubkey": "5xScxBWRWFVuMGBLJFVSsj2jAi5WZzNXD7skTS4Qqyed", + "is_signer": true, + "is_writable": true, + "label": "payer" + }, + { + "pubkey": "4gUTbkvyP6nMS74N6pTtWt9pSLagjewLf221DriGZAML", + "is_signer": true, + "is_writable": false, + "label": "base" + }, + { + "pubkey": "75uZqmbettMfwem3w7KvWdRHHhx5iYE7LuGj8fV5oHAn", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "8gJ7UWboMeQ6z6AQwFP3cAZwSYG8udVS2UesyCbH79r7", + "is_signer": false, + "is_writable": false, + "label": "lbPair" + }, + { + "pubkey": "5xScxBWRWFVuMGBLJFVSsj2jAi5WZzNXD7skTS4Qqyed", + "is_signer": true, + "is_writable": true, + "label": "owner" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "2e527d92558de499eaf7ffff46000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json new file mode 100644 index 000000000..46da34b09 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json @@ -0,0 +1,30 @@ +{ + "accounts": [ + { + "pubkey": "Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei", + "is_signer": false, + "is_writable": true, + "label": "presetParameter" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + } + ], + "data": "42bc47d3626d0eba0800e2041e0058028813c0d40100e0930400b12affff4fd50000f401", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json new file mode 100644 index 000000000..ca2587bf7 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json @@ -0,0 +1,60 @@ +{ + "accounts": [ + { + "pubkey": "J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk", + "is_signer": false, + "is_writable": true, + "label": "rewardVault" + }, + { + "pubkey": "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr", + "is_signer": false, + "is_writable": false, + "label": "rewardMint" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "SysvarRent111111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "rent" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "5f87c0c4f281e644000000000000000000ea24000000000048f459ea35f02146c458cac9763f4b11057255cbee3c4e45adeec3db8b2a1b37", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json b/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json new file mode 100644 index 000000000..724b675f8 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json @@ -0,0 +1,8 @@ +{ + "data": "IQsxYrVlsQ3oAywBsASIE0wdAADwSQIA3u7//yIRAAD0AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/2QAAAoJAABkAAAB6AMAAICo3Ab+CKNq56/rc1sxFBrDvFqooJaptNS5OZ0RFMv/BpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAFDWTKAZrsiX5Q47BK3iZSBzaWwE0EcNOgfsjkR8nlDtnilH/EJF6d69S95/ZkMseCHsCWQukTG7AiKAwQoTn1fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAh4kB76ZLtFSHpEFhFYncd7sc7uK7we5cdt12DW0ONo4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKd3amcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEFsLRyVT7CI12d5NcSOPPeNl+dB2zt4vld+1fWlsamQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "executable": false, + "lamports": 7182720, + "owner": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "space": 904, + "rent_epoch": 18446744073709551615 +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/migrate_position_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/migrate_position_ix.json new file mode 100644 index 000000000..c21ef5b9b --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/migrate_position_ix.json @@ -0,0 +1,66 @@ +{ + "accounts": [ + { + "pubkey": "AEYyKDsv4fRebC2pAmv3hksXwtzzDKG5dCMxbXrVKzRf", + "is_signer": true, + "is_writable": true, + "label": "positionV2" + }, + { + "pubkey": "8y9Rjqvb3UdT9SDfcM7v94Po2G36ndVM3pe1gLpGLRhx", + "is_signer": false, + "is_writable": true, + "label": "positionV1" + }, + { + "pubkey": "FoSDw2L5DmTuQTFe55gWPDXf88euaxAEKFre74CnvQbX", + "is_signer": false, + "is_writable": false, + "label": "lbPair" + }, + { + "pubkey": "6XnihiWoRfgFUncqAYeajEFEdu5m5bpY9kA39goDuDk9", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "3kBRpy3Lj434ZXiCJ8u7TSRDcL2PKCGCCHrW4WuZWzbZ", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "DxocTN1otn4MUpJZED6XFbRxQmK5RrB3hqMYjoBZnXUb", + "is_signer": true, + "is_writable": true, + "label": "owner" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "DxocTN1otn4MUpJZED6XFbRxQmK5RrB3hqMYjoBZnXUb", + "is_signer": true, + "is_writable": true, + "label": "rentReceiver" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "0f843b32c706fb2e", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/position_account.json b/decoders/meteora-dlmm-decoder/tests/fixtures/position_account.json new file mode 100644 index 000000000..4a62a0ca8 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/position_account.json @@ -0,0 +1,8 @@ +{ + "data": "qryP5HpA99Db6NqXcLkR+rThWWkAxB6lFv7J2xok8TQkMyudRzpCxhZRaPBzsLPCy8Ztc3J8ywqrJKJ6eabOZ3WB8Kw8/CSNsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAAKcOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAAsw4CAAAAAACzDgIAAAAAALMOAgAAAAAA3UgCAAAAAADO8AEAAAAAAFnxAQAAAAAA5PEBAAAAAABw8gEAAAAAAHDyAQAAAAAA+/IBAAAAAACG8wEAAAAAABH0AQAAAAAAEfQBAAAAAACc9AEAAAAAACf1AQAAAAAAsvUBAAAAAACz9QEAAAAAAD72AQAAAAAAyfYBAAAAAABU9wEAAAAAAFT3AQAAAAAA3/cBAAAAAABq+AEAAAAAAGr4AQAAAAAA9fgBAAAAAACB+QEAAAAAAAz6AQAAAAAADPoBAAAAAACX+gEAAAAAACL7AQAAAAAArfsBAAAAAACt+wEAAAAAADj8AQAAAAAAw/wBAAAAAABP/QEAAAAAAE/9AQAAAAAA2v0BAAAAAABl/gEAAAAAALf+AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWvig1oantLAAAAAAAAAAAe+ECN47wsQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABm3XqXtgppLgAAAAAAAAAA/k131rfD+wQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACmZrto4IzdLwAAAAAAAAAA4KaxUHhLagUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACG+yE4bYGmMgAAAAAAAAAAFhCK549/LAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4I4Nc985cOAAAAAAAAAAAFU9eFcnu4AUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAm9UesIDbtOQAAAAAAAAAApSPH6pCFLwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABG6h6fe0YGOwAAAAAAAAAATvou0sMZ5QUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC51Rwj3rhlMgAAAAAAAAAAvWwbpwGSTQUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADubxfiXXUqMAAAAAAAAAAAXf/2v7gxWgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC8BWf1zSdWNwAAAAAAAAAABAqGSeVfGAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIzM2HpojmQAAAAAAAAAAAm73/vfx9jAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHJhOvQ8qQQwAAAAAAAAAAabq29ggtpQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABF/WQRBn5LOAAAAAAAAAAAM4Ga6dEhgAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAt2Q0u5l5CKAAAAAAAAAAAT8Acp7iUkgMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+JHBSO98eGwAAAAAAAAAAesP+OfKjjwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABUh8kOoam9FwAAAAAAAAAAqOewSV/+fAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADzJpCP6xORFwAAAAAAAAAAk4yl14G1tAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4CSwDFYIuJAAAAAAAAAAAPIaGK6bTwAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNcMwk5auAIAAAAAAAAAAAbmOr9tyOTQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADlFiTqz9rmKQAAAAAAAAAAJ/80l2EmSAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKW4kMtyvxPwAAAAAAAAAADO9AcnzCBQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACqomKH1teGWQAAAAAAAAAA+9LCqA6KaQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADqf+kcIiReAAAAAAAAAAA7SN0LnsyGgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkGSUl/DNhZQAAAAAAAAAA1jvfeJtvtwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD64mhf1uj0WAAAAAAAAAAAzr79GN/o9wgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABdSyN3uHdQWAAAAAAAAAAA7DL7SjFy1QgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9UO+V6ie9VgAAAAAAAAAA+BzkjfoCwggAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8Zw2WlY4jTgAAAAAAAAAAfxpMgSlp0QcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw/3FalmY9SgAAAAAAAAAAJRXdai/sSQcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwHoVzipU9NAAAAAAAAAAA3Fm/FCU2EwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwz8S+lyNwAAAAAAAAAAq8t6QFA2fgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC+ev1JNInHPQAAAAAAAAAAaNUCvpg8EQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOne6aI8XbNQAAAAAAAAAAhGrwIS8XfQUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0wE9wPHxQOgAAAAAAAAAAoqEWkI32wwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPZcLMPj5EPgAAAAAAAAAACl3swsm0xwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABiouWLeBaoLAAAAAAAAAAAbiGMs2VvJQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADia/MzztKWMQAAAAAAAAAAizmOnpDYvQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsjwEfOKQdNAAAAAAAAAAAaduM/Hkl7gQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABf9njiG0UKMAAAAAAAAAAA+DZ3ghzsjQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADZ6U1ixyJgLQAAAAAAAAAAegBn5J8pIAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADtI4h/UXKvJQAAAAAAAAAAEdC6oWp2ZwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAByY8WMbH7bIAAAAAAAAAAA/TYjEw7v9wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/IDyfR72OJAAAAAAAAAAADShydx6qagMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD0TZR5mWr2IgAAAAAAAAAANdE7uY22EgMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACPrJczQuhSFwAAAAAAAAAAWREXGXkXBQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABq04D9zfwaFwAAAAAAAAAAB9V6pE1JCwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAByZS33FlVjFgAAAAAAAAAAovCVC3fIBAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB9hzt+gpBcDgAAAAAAAAAA5cNjIzgEWgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADVMDEyOeoYEwAAAAAAAAAA2TOEQTu2wwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbrpoyKjBlFgAAAAAAAAAAUMYHyRxsBwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAftSRwdW9XEQAAAAAAAAAA7ksOe2/RiwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN9Mas5ykRCwAAAAAAAAAAxs8696cIAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADeMn5+wsEcCQAAAAAAAAAAFj42a2HF3gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC+BPbNfKr9BwAAAAAAAAAAgUYWpFSo0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApCNDnXVCtBwAAAAAAAAAAH0Jqa1s/yAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtuejAktfOAgAAAAAAAAAAc05bTZpDRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACmVB8oqgmRAgAAAAAAAAAAjRU1uN9xPgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABeW8XHpRZxAgAAAAAAAAAAsblQFLV0OwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADpBQPy4fXCAgAAAAAAAAAAsdsTRQpMQwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABi9KoMQw4CAAAAAAAAAAAAhPc0gSMyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABJ9P//jfT//zvVhGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "executable": false, + "lamports": 53508480, + "owner": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "space": 7560, + "rent_epoch": 18446744073709551615 +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/preset_parameter_account.json b/decoders/meteora-dlmm-decoder/tests/fixtures/preset_parameter_account.json new file mode 100644 index 000000000..a1690b09f --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/preset_parameter_account.json @@ -0,0 +1,8 @@ +{ + "data": "8j70IrVwOqoeABAnHgBYAogTmDoAADBXBQAPx///8TgAAPQB", + "executable": false, + "lamports": 1141440, + "owner": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "space": 36, + "rent_epoch": 18446744073709551615 +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/remove_all_liquidity_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_all_liquidity_ix.json new file mode 100644 index 000000000..58424268e --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_all_liquidity_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "9ryhChmSnFjN1Guow3wmCMfHcDqnPMNQWw1fd22re6B3", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "BaAcxMzRRLPsCeozVFxSBkNKRNtGxWsuwAJD97FwHrFS", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "DSbDmhQ2g83dB7gxgEj2SU4YXmNTsuu1rJ7ZpYRD4FFN", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "8WDJNUUet9GKYp2LFZtMPn2szjADWqDBxh36xMzN34RG", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "HvsP7Sc6FdcYQgjMsZFmgucfXWpHBV2Z4ZSxokGDmvw3", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "5F8BjK245zNk8gDZ4wfzqFk5zNKnfBZu1nQqxTf9bw3q", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "6ugNo7XbU5RpaNVi6MMP8tMN85MmNeXFZmcPyPvWpump", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "4ogZsCfAmNAnNyWRqDpny2Fx7q2hxXsY64eHtmqmT9eH", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "7a4ucyBoMGmse63FQ8irJ7JskAtHne9Tanidf3uWnXKD", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "GiLZMHHhLG34bv5uhDimeycrdGKhBqUc4W7rzFcPHT5o", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "0a333d2370691855", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range_ix.json new file mode 100644 index 000000000..178499d15 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "8q5pnyLyZDywab5ELtfEmjeukN6QjAiLyVjA1jtz1Hjo", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "HZErmEhFdPtEv8miyRNJ6YYDCJVTUDQ8vb6b9gYV1pAY", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "8soE8tjnUX9hW6pacq8Fhmb14zaxmxYZrvd4AHttGpN5", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "5gACEv1QcqviCgKDC3JrWQbvgfFv9rqYE4L3y6SnZyXg", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "DScYDgLUTZLoB8D1YQUHS8btV1DcddyArwMwpZvaX9F2", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "8F8GPCCPsqDiwshYthe4NZjBCNYmZFx2abmbFRni2dZu", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "CniPCE4b3s8gSUPhUiyMjXnytrEqUrMfSsnbBjLCpump", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "bKnQuoFJkhJvaTfEtvv1bQxJwnU1Qoor3C8nZ2x9VZR", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "567njsp2GVpy62Q6WsSeMLGTNFfChe8SNXbe1egew5FM", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "Hisq5w4hewLPPXvDHkVwDzcweq8XRM5a1fphKWXrLeYL", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "1a526698f04a691a11ffffff55ffffff1027", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_ix.json new file mode 100644 index 000000000..a5c0e1318 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "GTg4upAYuAqXnSAdSGBbcgR7mbxcLwp8pxZp5iQe1tLJ", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "BoeMUkCLHchTD31HdXsbDExuZZfcUppSLpYtV3LZTH6U", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "6MZw9Y8FiGGjnL4DVXS812w9t9p5B9tK5xcrCWu6p2Ev", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "H1HwdDkL5qHM8AZR9tBWYZQDTt9wwigKqCdF4KWuX7zP", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "93d6ukn24o1xMcMDip2SACKG8GbvhGUZim1e3ZEcQVm2", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "CodroyzrRNvc5kHRoAQYjpVSr1jA9fLcUWVFouiuWGsD", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "CzeWb8k7wDfubQz6McUcYkZuM6UQ7y2XJ6hfYBRCqBea", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "5Kp3m4p7QxN629DA8wcHuLrHkecxEmdGFLRcB9PD4HAa", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "HdZCvCH4qwUqfy5YukMyyy5gYDhtmMWK7GvqEbLVsSWj", + "is_signer": false, + "is_writable": false, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "5055d14818ceb16c170000009706000001009806000001009906000001009a06000001009b06000001009c06000001009d06000001009e06000001009f0600000100a00600000100a10600000100a20600000100a30600000100a40600000100a50600000100a60600000100a70600000100a80600000100a90600000100aa0600000100ab0600000100ac0600000100ad0600000100", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json new file mode 100644 index 000000000..43700099d --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json @@ -0,0 +1,106 @@ +{ + "accounts": [ + { + "pubkey": "Cwwiuxix6vHJRUhYVt5Hn1wD3Dpsg23TGdnhraTKNdwp", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "8QveFxtVeRUYGmrnCpAMMFTbQH4KWCgFtirAynrnWpHu", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "8rV6fY14TBcNt7t27rMG4qY4sPyCtYbZx3MxNuJt7DN8", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "2tNZcU1rd3hN5nLGQNVm86mSLvuRGGpgsSF3stBaDDLo", + "is_signer": false, + "is_writable": true, + "label": "userTokenIn" + }, + { + "pubkey": "EJeYX6pHEkQTPR6gu7jvB6NCdorNDKg37vgeCVVwg185", + "is_signer": false, + "is_writable": true, + "label": "userTokenOut" + }, + { + "pubkey": "h5NciPdMZ5QCB5BYETJMYBMpVx9ZuitR6HcVjyBhood", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "7uF53ew4nfPo6fqzrpCWkiojLTGYBcqoXoH5Snq1Riyv", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "hostFeeIn" + }, + { + "pubkey": "GqvpRMaYKYRYon1BBEGSDFfqsuwX1zcP5zMVGHD78P2K", + "is_signer": true, + "is_writable": true, + "label": "user" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + }, + { + "pubkey": "7L5XySdengRtraWSk63c3RUSwDS3QDUzK8iGAyfswe72", + "is_signer": false, + "is_writable": true + }, + { + "pubkey": "6fiDSc65xS2hx86D8shtURZEH184eGA6RtSY36vUNByY", + "is_signer": false, + "is_writable": true + } + ], + "data": "fa49652126cf4bb8ffffffffffffffff3e4d761201000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json new file mode 100644 index 000000000..92cd99200 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json @@ -0,0 +1,111 @@ +{ + "accounts": [ + { + "pubkey": "HAb26kxRVZBLAeVokuhSyfhTes7YLiD6GMT8X2c8DmH2", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "HJEHtafejeXa1zkjtrMu6s8mUk3EN7ZQSFErzP1hoQSB", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "9yG1b2qLCDMdLMM1C8UnAxwEXsCG628joitnJTfL3YaH", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "7x4VcEX8aLd3kFsNWULTp1qFgVtDwyWSxpTGQkoMM6XX", + "is_signer": false, + "is_writable": true, + "label": "userTokenIn" + }, + { + "pubkey": "FqACg6svfqZqqnMuoYNgcd8xw6fJvFtjBANFMG321BHq", + "is_signer": false, + "is_writable": true, + "label": "userTokenOut" + }, + { + "pubkey": "DvjbEsdca43oQcw2h3HW1CT7N3x5vRcr3QrvTUHnXvgV", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "CBpCNLKUmFfRTvuuksBNivDrewaYrc4S3mMv6C4o7Ldq", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "hostFeeIn" + }, + { + "pubkey": "6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB", + "is_signer": false, + "is_writable": true, + "label": "user" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + }, + { + "pubkey": "Dt7EriabLX5HCJkbTqtxF7ziDFWnJTKCirekGccMFMYk", + "is_signer": false, + "is_writable": true + }, + { + "pubkey": "8Nbdb3SPofvda3ZBjvjTKZrXUmqkcRXqhVRck1vnwJXm", + "is_signer": false, + "is_writable": true + }, + { + "pubkey": "5Er6ukkyhmzAyz44h7hcDrtMKzVsSMNnt3vAn233HCcD", + "is_signer": false, + "is_writable": true + } + ], + "data": "f8c69e91e17587c8c8228c33000000000000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json new file mode 100644 index 000000000..ca6f49fc4 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json @@ -0,0 +1,111 @@ +{ + "accounts": [ + { + "pubkey": "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "EYj9xKw6ZszwpyNibHY7JD5o3QgTVrSdcBp1fMJhrR9o", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "CoaxzEh8p5YyGLcj36Eo3cUThVJxeKCs7qvLAGDYwBcz", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "yuJDeF4EpH6a3yrU99877vUckzoySSUBQXdMQsKBH9S", + "is_signer": false, + "is_writable": true, + "label": "userTokenIn" + }, + { + "pubkey": "nWzG3iVBEJw5kWV3V8GjbnGvHX9uoMVrrsiS6XMBViG", + "is_signer": false, + "is_writable": true, + "label": "userTokenOut" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "59YuGWPunbchD2mbi9U7qvjWQKQReGeepn4ZSr9zz9Li", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "hostFeeIn" + }, + { + "pubkey": "BsWvqrgcaKZcZsXKawDJTGpYbHsDjjFQRo35wob7DvUv", + "is_signer": true, + "is_writable": true, + "label": "user" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + }, + { + "pubkey": "Ehkf9XQLVnY8HV6jbbDU25fTxF1qQ3NuScWfawSb79pu", + "is_signer": false, + "is_writable": true + }, + { + "pubkey": "G9QNw5nwv6JMkLSQ8ignWWEXybUfwBoJm4z5goGbU7d", + "is_signer": false, + "is_writable": true + }, + { + "pubkey": "CU8ZSJ7nxD3aqsk6mJYreN4gXWqnrw8jJtNM3yeBAejo", + "is_signer": false, + "is_writable": true + } + ], + "data": "38ade6d0ade49ccd774da2c20000000001a4ebffff0b00", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json new file mode 100644 index 000000000..4c88dd721 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json @@ -0,0 +1,30 @@ +{ + "accounts": [ + { + "pubkey": "A9KUjKXwqajsGrCRZSnQBkrvJ6iBoQ4Yjs49dVLruDBV", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "8080d05bf6351fb0f401204e", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/update_fees_and_rewards_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/update_fees_and_rewards_ix.json new file mode 100644 index 000000000..d5bceee83 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/update_fees_and_rewards_ix.json @@ -0,0 +1,36 @@ +{ + "accounts": [ + { + "pubkey": "xVntejWTytykHTM33wHCfogpQRcy7mDAnH3U5b7X8eD", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "6cDtJkcJKFEsGDhptmgvy3XtbwyRqnW3GoGcmnwVzJ7U", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "3bi5tFzspV17UGEKra1HReFN6doQ2iSsyvWY8XzQGaoc", + "is_signer": false, + "is_writable": true, + "label": "binArrayLower" + }, + { + "pubkey": "5vfo4AvbiE4T1VBtqYhv8YAA92fERDevKCGHj8sVyYuQ", + "is_signer": false, + "is_writable": true, + "label": "binArrayUpper" + }, + { + "pubkey": "6jW5kGzAQ6dM3CUGF7k1uTRBb8DFm9whv52UTEPFpgF8", + "is_signer": false, + "is_writable": true, + "label": "owner" + } + ], + "data": "9ae6fa0decd14bdf", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file From 50d458eb4e77f7a90aa74d7c342587814efc1013 Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 30 May 2025 21:38:27 +0530 Subject: [PATCH 2/4] fix existing instructions with latest type changes --- decoders/meteora-dlmm-decoder/Cargo.toml | 3 +- .../meteora-dlmm-decoder/src/accounts/mod.rs | 74 +- .../src/instructions/mod.rs | 754 ++++++------------ .../src/types/init_permission_pair_ix.rs | 1 - decoders/meteora-dlmm-decoder/tests/README.md | 23 +- .../tests/fixtures/fund_reward_ix.json | 60 -- ...tomizable_permissionless_lb_pair2_ix.json} | 77 +- ...ustomizable_permissionless_lb_pair_ix.json | 16 +- .../initialize_permission_lb_pair_ix.json | 42 +- .../initialize_preset_parameter_ix.json | 30 - .../tests/fixtures/initialize_reward_ix.json | 60 -- .../tests/fixtures/lb_pair_account.json | 2 +- .../tests/fixtures/swap_exact_out_ix.json | 28 +- .../tests/fixtures/swap_ix.json | 26 +- .../fixtures/update_fee_parameters_ix.json | 30 - 15 files changed, 400 insertions(+), 826 deletions(-) delete mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json rename decoders/meteora-dlmm-decoder/tests/fixtures/{swap_with_price_impact_ix.json => initialize_customizable_permissionless_lb_pair2_ix.json} (58%) delete mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json delete mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json delete mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json diff --git a/decoders/meteora-dlmm-decoder/Cargo.toml b/decoders/meteora-dlmm-decoder/Cargo.toml index b97bb20d5..406095bb6 100644 --- a/decoders/meteora-dlmm-decoder/Cargo.toml +++ b/decoders/meteora-dlmm-decoder/Cargo.toml @@ -19,5 +19,6 @@ serde-big-array = { workspace = true } solana-account = { workspace = true } solana-instruction = { workspace = true, default-features = false } solana-pubkey = { workspace = true } -solana-sdk = { workspace = true } + +[dev-dependencies] carbon-test-utils = { workspace = true } \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs index db9b7ce3d..181ee4bb3 100644 --- a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs @@ -161,7 +161,7 @@ mod tests { use crate::types::{ FeeInfo, ProtocolFee, RewardInfo, StaticParameters, UserRewardInfo, VariableParameters, }; - use solana_sdk::pubkey; + use solana_pubkey::pubkey; use super::{lb_pair::LbPair, position::Position, preset_parameter::PresetParameter, *}; @@ -171,44 +171,64 @@ mod tests { let expected_account = LbPair { activation_point: 0, activation_type: 0, - active_id: 2314, - base_factor_seed: [232, 3], - base_key: pubkey!("11111111111111111111111111111111"), - bin_array_bitmap: Default::default(), - bin_step: 100, - bin_step_seed: [100, 0], + active_id: -1054, + base_factor_seed: [36, 244], + base_key: pubkey!("VamLzWq6NAZMK8Vw2tFEfr4bkkeeaS7yDDf2C5sNqLQ"), + bin_array_bitmap: [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3377699720527872, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + bin_step: 80, + bin_step_seed: [80, 0], bump_seed: [255], - creator: pubkey!("ECT3FF9qYr3YgkPtNeJ4VgeGsybXReDSQ7shp1EFH5mJ"), - last_updated_at: 1735030695, - oracle: pubkey!("A85D9MkhqntAgk8foSvrptG5k4KTVpLrXf7so53C8m2V"), - padding0: 0, + creator: pubkey!("5oWhudgFVd1mEeKTzduHreYWSmYgfsMmBFLxqkD5AeJT"), + last_updated_at: 0, + oracle: pubkey!("YJ2QX2V48nZiB4kH2XtRZnLNKkA7v7N1sXnWfQ8n9Jq"), + creator_pool_on_off_control: 0, + token_mint_x_program_flag: 0, + token_mint_y_program_flag: 0, padding1: [0; 32], padding2: [0; 32], padding3: [0; 8], padding4: 0, - pair_type: 0, + pair_type: 3, parameters: StaticParameters { - base_factor: 1000, + base_factor: 62500, filter_period: 300, decay_period: 1200, reduction_factor: 5000, variable_fee_control: 7500, max_volatility_accumulator: 150000, - min_bin_id: -4386, - max_bin_id: 4386, + min_bin_id: -5458, + max_bin_id: 5458, protocol_share: 500, - padding: [0; 6], + base_fee_power_factor: 0, + padding: [0; 5], }, pre_activation_duration: 0, pre_activation_swap_address: pubkey!("11111111111111111111111111111111"), protocol_fee: ProtocolFee { - amount_x: 0, - amount_y: 0, + amount_x: 317260998460, + amount_y: 240423958, }, - require_base_factor_seed: 1, - reserve_x: pubkey!("5XuCjSAsJj4T5W5m8gkSU1i5s5FjxRkFzZHpAcZjaHid"), - reserve_y: pubkey!("97wxjXLaC6vR9aFSLeLWKDf2s4JFrScuCEfbUCggyjjc"), - reserved: Default::default(), + require_base_factor_seed: 0, + reserve_x: pubkey!("7SWjpLPaLKxGogCY321XRFbiSiAkXSKh8q8qioGdu8N8"), + reserve_y: pubkey!("iiWfKZygJii3g8RrKyWVQJdc6CciK2xGpuD8aCbgqbS"), + reserved: [0; 22], reward_infos: [ RewardInfo { mint: pubkey!("11111111111111111111111111111111"), @@ -232,14 +252,14 @@ mod tests { }, ], status: 0, - token_x_mint: pubkey!("9fEXUmPnDJYAXpoZ9nWi1gQZPwzVKdf8g9fYXW6Epump"), + token_x_mint: pubkey!("FzytSxQv6nBgH3dByVJtgMVg6rANTZaZPzU6dcRbpump"), token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), v_parameters: VariableParameters { - volatility_accumulator: 0, - volatility_reference: 0, - index_reference: 0, + volatility_accumulator: 150000, + volatility_reference: 75000, + index_reference: -886, padding: [0; 4], - last_update_timestamp: 0, + last_update_timestamp: 1748616125, padding1: [0; 8], }, }; diff --git a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs index 6c3bb2a96..79e67b637 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs @@ -293,7 +293,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MeteoraDlmmDecoder { mod tests { use carbon_core::{deserialize::ArrangeAccounts, instruction::InstructionDecoder}; use solana_instruction::AccountMeta; - use solana_sdk::pubkey; + use solana_pubkey::pubkey; use crate::{ instructions::{ @@ -317,7 +317,6 @@ mod tests { close_preset_parameter::{ ClosePresetParameter, ClosePresetParameterInstructionAccounts, }, - fund_reward::{FundReward, FundRewardInstructionAccounts}, go_to_a_bin::{GoToABin, GoToABinInstructionAccounts}, initialize_bin_array::{InitializeBinArray, InitializeBinArrayInstructionAccounts}, initialize_bin_array_bitmap_extension::{ @@ -328,6 +327,10 @@ mod tests { InitializeCustomizablePermissionlessLbPair, InitializeCustomizablePermissionlessLbPairInstructionAccounts, }, + initialize_customizable_permissionless_lb_pair2::{ + InitializeCustomizablePermissionlessLbPair2, + InitializeCustomizablePermissionlessLbPair2InstructionAccounts, + }, initialize_lb_pair::{InitializeLbPair, InitializeLbPairInstructionAccounts}, initialize_permission_lb_pair::{ InitializePermissionLbPair, InitializePermissionLbPairInstructionAccounts, @@ -339,10 +342,6 @@ mod tests { initialize_position_pda::{ InitializePositionPda, InitializePositionPdaInstructionAccounts, }, - initialize_preset_parameter::{ - InitializePresetParameter, InitializePresetParameterInstructionAccounts, - }, - initialize_reward::{InitializeReward, InitializeRewardInstructionAccounts}, migrate_position::{MigratePosition, MigratePositionInstructionAccounts}, remove_all_liquidity::{RemoveAllLiquidity, RemoveAllLiquidityInstructionAccounts}, remove_liquidity::{RemoveLiquidity, RemoveLiquidityInstructionAccounts}, @@ -351,8 +350,6 @@ mod tests { }, swap::{Swap, SwapInstructionAccounts}, swap_exact_out::{SwapExactOut, SwapExactOutInstructionAccounts}, - swap_with_price_impact::{SwapWithPriceImpact, SwapWithPriceImpactInstructionAccounts}, - update_fee_parameters::{UpdateFeeParameters, UpdateFeeParametersInstructionAccounts}, update_fees_and_rewards::{ UpdateFeesAndRewards, UpdateFeesAndRewardsInstructionAccounts, }, @@ -360,10 +357,9 @@ mod tests { types::{ AddLiquiditySingleSidePreciseParameter, BinLiquidityDistribution, BinLiquidityDistributionByWeight, BinLiquidityReduction, CompressedBinDepositAmount, - CustomizableParams, FeeParameter, InitPermissionPairIx, InitPresetParametersIx, - LiquidityOneSideParameter, LiquidityParameter, LiquidityParameterByStrategy, - LiquidityParameterByStrategyOneSide, LiquidityParameterByWeight, StrategyParameters, - StrategyType, + CustomizableParams, InitPermissionPairIx, LiquidityOneSideParameter, + LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, + LiquidityParameterByWeight, StrategyParameters, StrategyType, }, }; @@ -1465,81 +1461,6 @@ mod tests { assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); } - #[test] - fn test_decode_fund_reward_ix() { - // Arrange - let expected_ix = MeteoraDlmmInstruction::FundReward(FundReward { - amount: 50000000000, - carry_forward: Default::default(), - reward_index: 0, - }); - let expected_accounts = vec![ - AccountMeta::new( - pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), - false, - ), - AccountMeta::new( - pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), - false, - ), - AccountMeta::new_readonly( - pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), - false, - ), - AccountMeta::new( - pubkey!("5V1RFYBKBZ78zG6cYJ5ssGLQmttLC1KSM6bSdSpgSV5i"), - false, - ), - AccountMeta::new( - pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - true, - ), - AccountMeta::new( - pubkey!("AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK"), - false, - ), - AccountMeta::new_readonly( - pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - false, - ), - AccountMeta::new_readonly( - pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - false, - ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - false, - ), - ]; - let expected_arranged_accounts = FundRewardInstructionAccounts { - lb_pair: pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), - reward_vault: pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), - reward_mint: pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), - funder_token_account: pubkey!("5V1RFYBKBZ78zG6cYJ5ssGLQmttLC1KSM6bSdSpgSV5i"), - funder: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - bin_array: pubkey!("AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK"), - token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - }; - - // Act - let decoder = MeteoraDlmmDecoder; - let instruction = carbon_test_utils::read_instruction("tests/fixtures/fund_reward_ix.json") - .expect("read fixture"); - let decoded = decoder - .decode_instruction(&instruction) - .expect("decode instruction"); - let decoded_arranged_accounts = - FundReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); - - // Assert - assert_eq!(decoded.data, expected_ix); - assert_eq!(decoded.accounts, expected_accounts); - assert_eq!(decoded.program_id, PROGRAM_ID); - assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); - } - #[test] fn test_decode_go_to_a_bin_ix() { // Arrange @@ -1700,19 +1621,21 @@ mod tests { let expected_ix = MeteoraDlmmInstruction::InitializeCustomizablePermissionlessLbPair( InitializeCustomizablePermissionlessLbPair { params: CustomizableParams { - activation_point: Some(1741610419), - activation_type: 1, - active_id: -813, - base_factor: 10000, - bin_step: 200, + activation_point: None, + activation_type: 0, + active_id: 1, + base_factor: 5000, + bin_step: 2, has_alpha_vault: false, - padding: [0; 64], + creator_pool_on_off_control: false, + base_fee_power_factor: 0, + padding: [0; 62], }, }, ); let expected_accounts = vec![ AccountMeta::new( - pubkey!("E7fHCw9G6KuCA2jg3uxvJn1MWL8ySD68kDLPyGDvcStT"), + pubkey!("Em94tW6wo3K15z7mM6wW926QRamuLKhiRe52tvk92ARs"), false, ), AccountMeta::new_readonly( @@ -1720,7 +1643,7 @@ mod tests { false, ), AccountMeta::new_readonly( - pubkey!("fiSpHY8vkjABpAKGCaLs3pDnkZpeqNiYrADp4GZLYZY"), + pubkey!("BSJUzBQfPe7snyjxJxAJG183yYhDtLUEi3c8LGW7DCVw"), false, ), AccountMeta::new_readonly( @@ -1736,15 +1659,15 @@ mod tests { false, ), AccountMeta::new( - pubkey!("nJuXpHhaM9nNtY8XKiCfrsYAojRFEmrw33DYbiKqkAW"), + pubkey!("AG47v72cfwRUwdk9M2AfE691wzsETrjo8iieH3gAWsTX"), false, ), AccountMeta::new_readonly( - pubkey!("DujguCjLgZhVT7oTZ8XhDUYNgVYXn3EhqHGciXxKNLJ1"), + pubkey!("8dn7co13une6bT7dt7caCFj5E8cCuH5wzCZLaTncL3D2"), false, ), AccountMeta::new( - pubkey!("7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU"), + pubkey!("3A2f4jax9vQRsaxDpocDKA3MhHdibwwZBSsBFcgfgkLw"), true, ), AccountMeta::new_readonly( @@ -1753,7 +1676,7 @@ mod tests { ), AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), AccountMeta::new_readonly( - pubkey!("Z7bkDerKzHpy5XtLYfNvtLq6PttYpxWmhXAeEFhCHff"), + pubkey!("SysvarRent111111111111111111111111111111111"), false, ), AccountMeta::new_readonly( @@ -1767,18 +1690,18 @@ mod tests { ]; let expected_arranged_accounts = InitializeCustomizablePermissionlessLbPairInstructionAccounts { - lb_pair: pubkey!("E7fHCw9G6KuCA2jg3uxvJn1MWL8ySD68kDLPyGDvcStT"), + lb_pair: pubkey!("Em94tW6wo3K15z7mM6wW926QRamuLKhiRe52tvk92ARs"), bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - token_mint_x: pubkey!("fiSpHY8vkjABpAKGCaLs3pDnkZpeqNiYrADp4GZLYZY"), + token_mint_x: pubkey!("BSJUzBQfPe7snyjxJxAJG183yYhDtLUEi3c8LGW7DCVw"), token_mint_y: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), reserve_x: pubkey!("5Lbm1X6oYcSUcscMmvWqmg7sz2Qh3XJ3ydBy2v8cTrTV"), reserve_y: pubkey!("Fov1U4FMX8u4Ln5gM9LHsZcWgwHAeZ526usUjaYza2BR"), - oracle: pubkey!("nJuXpHhaM9nNtY8XKiCfrsYAojRFEmrw33DYbiKqkAW"), - user_token_x: pubkey!("DujguCjLgZhVT7oTZ8XhDUYNgVYXn3EhqHGciXxKNLJ1"), - funder: pubkey!("7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU"), + oracle: pubkey!("AG47v72cfwRUwdk9M2AfE691wzsETrjo8iieH3gAWsTX"), + user_token_x: pubkey!("8dn7co13une6bT7dt7caCFj5E8cCuH5wzCZLaTncL3D2"), + funder: pubkey!("3A2f4jax9vQRsaxDpocDKA3MhHdibwwZBSsBFcgfgkLw"), token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), system_program: pubkey!("11111111111111111111111111111111"), - rent: pubkey!("Z7bkDerKzHpy5XtLYfNvtLq6PttYpxWmhXAeEFhCHff"), + user_token_y: pubkey!("SysvarRent111111111111111111111111111111111"), event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), }; @@ -1803,6 +1726,132 @@ mod tests { assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); } + #[test] + fn test_decode_initialize_customizable_permissionless_lb_pair2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializeCustomizablePermissionlessLbPair2( + InitializeCustomizablePermissionlessLbPair2 { + params: CustomizableParams { + active_id: -1157, + bin_step: 100, + base_factor: 10000, + activation_type: 1, + has_alpha_vault: true, + activation_point: Some(1748602200), + creator_pool_on_off_control: false, + base_fee_power_factor: 0, + padding: [0; 62], + }, + }, + ); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("8ookeFtaPGhyi3dSJY9ULjzePWfAe1cykRr7xtoSbgfz"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("FCjQFN49K5ufVnXkLHMPSMvtbyo8jMB1tdrGQ8QHtfnD"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("8k6Cwds2WbD9cx4hTfZubaSLpzniL8Vs8ZKo5ZQAsfQW"), + false, + ), + AccountMeta::new( + pubkey!("8994hrKpj7aoZocJvbV59Z9o4ah1se1HjW4Wsi6wSiMu"), + false, + ), + AccountMeta::new( + pubkey!("HMCCePCcK1jizjz4MJx3VYb9f9uHXY4UJPcaaRtwATVZ"), + false, + ), + AccountMeta::new_readonly( + pubkey!("CjGtuik6GHKbTh9xuDHCzq2reGtMcJtTMqHjkBcbCMNX"), + false, + ), + AccountMeta::new( + pubkey!("GMtwcuktJfrRcnyGktWW4Vab8cfjPcBy3xbuZgRegw6E"), + true, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("23s7qdnDSVxFqGUURKMdTz8Pte1pf3T92kGmXWrWi8vS"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = + InitializeCustomizablePermissionlessLbPair2InstructionAccounts { + lb_pair: pubkey!("8ookeFtaPGhyi3dSJY9ULjzePWfAe1cykRr7xtoSbgfz"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_mint_x: pubkey!("FCjQFN49K5ufVnXkLHMPSMvtbyo8jMB1tdrGQ8QHtfnD"), + token_mint_y: pubkey!("So11111111111111111111111111111111111111112"), + reserve_x: pubkey!("8k6Cwds2WbD9cx4hTfZubaSLpzniL8Vs8ZKo5ZQAsfQW"), + reserve_y: pubkey!("8994hrKpj7aoZocJvbV59Z9o4ah1se1HjW4Wsi6wSiMu"), + oracle: pubkey!("HMCCePCcK1jizjz4MJx3VYb9f9uHXY4UJPcaaRtwATVZ"), + user_token_x: pubkey!("CjGtuik6GHKbTh9xuDHCzq2reGtMcJtTMqHjkBcbCMNX"), + funder: pubkey!("GMtwcuktJfrRcnyGktWW4Vab8cfjPcBy3xbuZgRegw6E"), + token_badge_x: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_badge_y: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_program_x: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_program_y: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + system_program: pubkey!("11111111111111111111111111111111"), + user_token_y: pubkey!("23s7qdnDSVxFqGUURKMdTz8Pte1pf3T92kGmXWrWi8vS"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/initialize_customizable_permissionless_lb_pair2_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeCustomizablePermissionlessLbPair2::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + #[test] fn test_decode_initialize_lb_pair_ix() { // Arrange @@ -1906,52 +1955,63 @@ mod tests { let expected_ix = MeteoraDlmmInstruction::InitializePermissionLbPair(InitializePermissionLbPair { ix_data: InitPermissionPairIx { + active_id: -48930, + bin_step: 1, + base_factor: 10000, + base_fee_power_factor: 0, activation_type: 1, - active_id: -1595, - base_factor: 37500, - bin_step: 80, - max_bin_id: 5480, - min_bin_id: -5480, - lock_duration: 0, + protocol_share: 500, }, }); let expected_accounts = vec![ AccountMeta::new_readonly( - pubkey!("AeSLQ4ty9qfhEkzBpQAKypptur3giRDLWm3QGP1mze26"), + pubkey!("5FtFfp6KyxmTzb4if6FkFDTZqMN6FMdMd6A2eAkuhwNN"), true, ), AccountMeta::new( - pubkey!("DgSVNgNofqZyhmkSdUwuqvyTjHNYmq799RYMcadKnb2q"), + pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), false, ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + AccountMeta::new( + pubkey!("BvNQqUt9NwKb9nBrmpAH6mqvxXM6Uno6eC4cewD1PhwV"), false, ), AccountMeta::new_readonly( - pubkey!("DVYtHdaDc77W1oYTtAYd6kz9QVTj8wPWwiUTbkqzgN4n"), + pubkey!("HUMA1821qVDKta3u2ovmfDQeW2fSQouSKE8fkF44wvGw"), false, ), AccountMeta::new_readonly( - pubkey!("8VJNVtvL5JcCrCgkb3gEjYT8NtA5rqen9YztcPhiwVCP"), + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), false, ), AccountMeta::new( - pubkey!("31Hx85DFuKr15Xr5XKse5tdWLTRQrEXCkKsoeipTHCfi"), + pubkey!("EiNhNKD4nR5zZm6YkAKpWHE2wWGSof5LZ7uSGfG3star"), false, ), AccountMeta::new( - pubkey!("E55HFtp5AgG4hXK1ELbv9LD7V6872ZxW7tetuADJN5iC"), + pubkey!("EoW2xdPSyDeRyGiATyZ58sPuchPfvQnNudLq1dLKYX8o"), false, ), AccountMeta::new( - pubkey!("B3EUUmEF4h4ZLmnYKbqP8LKYdLjoCmWH7j7JLcxsFfQc"), + pubkey!("sUiZ2rXZyD2B5aGVZeK9XXrsgCAgvhNPedTuePVpkA2"), false, ), AccountMeta::new( pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), true, ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), AccountMeta::new_readonly( pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), false, @@ -1971,16 +2031,19 @@ mod tests { ), ]; let expected_arranged_accounts = InitializePermissionLbPairInstructionAccounts { - base: pubkey!("AeSLQ4ty9qfhEkzBpQAKypptur3giRDLWm3QGP1mze26"), - lb_pair: pubkey!("DgSVNgNofqZyhmkSdUwuqvyTjHNYmq799RYMcadKnb2q"), - bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - token_mint_x: pubkey!("DVYtHdaDc77W1oYTtAYd6kz9QVTj8wPWwiUTbkqzgN4n"), - token_mint_y: pubkey!("8VJNVtvL5JcCrCgkb3gEjYT8NtA5rqen9YztcPhiwVCP"), - reserve_x: pubkey!("31Hx85DFuKr15Xr5XKse5tdWLTRQrEXCkKsoeipTHCfi"), - reserve_y: pubkey!("E55HFtp5AgG4hXK1ELbv9LD7V6872ZxW7tetuADJN5iC"), - oracle: pubkey!("B3EUUmEF4h4ZLmnYKbqP8LKYdLjoCmWH7j7JLcxsFfQc"), + base: pubkey!("5FtFfp6KyxmTzb4if6FkFDTZqMN6FMdMd6A2eAkuhwNN"), + lb_pair: pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + bin_array_bitmap_extension: pubkey!("BvNQqUt9NwKb9nBrmpAH6mqvxXM6Uno6eC4cewD1PhwV"), + token_mint_x: pubkey!("HUMA1821qVDKta3u2ovmfDQeW2fSQouSKE8fkF44wvGw"), + token_mint_y: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + reserve_x: pubkey!("EiNhNKD4nR5zZm6YkAKpWHE2wWGSof5LZ7uSGfG3star"), + reserve_y: pubkey!("EoW2xdPSyDeRyGiATyZ58sPuchPfvQnNudLq1dLKYX8o"), + oracle: pubkey!("sUiZ2rXZyD2B5aGVZeK9XXrsgCAgvhNPedTuePVpkA2"), admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_badge_x: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_badge_y: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_program_x: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_program_y: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), system_program: pubkey!("11111111111111111111111111111111"), rent: pubkey!("SysvarRent111111111111111111111111111111111"), event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), @@ -2010,8 +2073,6 @@ mod tests { #[test] fn test_decode_initialize_position_by_operator_ix() { // Arrange - // left: InitializePositionByOperator(InitializePositionByOperator { lower_bin_id: -2022, width: 1, fee_owner: 2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu, lock_release_point: 0 }) - // right: InitializePositionByOperator(InitializePositionByOperator { lower_bin_id: -2022, width: 1, fee_owner: 11111111111111111111111111111111, lock_release_point: 0 }) let expected_ix = MeteoraDlmmInstruction::InitializePositionByOperator(InitializePositionByOperator { fee_owner: pubkey!("2yRC3SXXh8dUpHfKYXyWwn1b1QJPrJwuJ7UKtLU4Usmu"), @@ -2236,139 +2297,6 @@ mod tests { assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); } - #[test] - fn test_decode_initialize_preset_parameter_ix() { - // Arrange - let expected_ix = - MeteoraDlmmInstruction::InitializePresetParameter(InitializePresetParameter { - ix: InitPresetParametersIx { - base_factor: 1250, - bin_step: 8, - decay_period: 600, - filter_period: 30, - max_bin_id: 54607, - max_volatility_accumulator: 300000, - min_bin_id: -54607, - protocol_share: 500, - reduction_factor: 5000, - variable_fee_control: 120000, - }, - }); - let expected_accounts = vec![ - AccountMeta::new( - pubkey!("Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei"), - false, - ), - AccountMeta::new( - pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - true, - ), - AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), - AccountMeta::new_readonly( - pubkey!("SysvarRent111111111111111111111111111111111"), - false, - ), - ]; - let expected_arranged_accounts = InitializePresetParameterInstructionAccounts { - preset_parameter: pubkey!("Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei"), - admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - system_program: pubkey!("11111111111111111111111111111111"), - rent: pubkey!("SysvarRent111111111111111111111111111111111"), - }; - - // Act - let decoder = MeteoraDlmmDecoder; - let instruction = carbon_test_utils::read_instruction( - "tests/fixtures/initialize_preset_parameter_ix.json", - ) - .expect("read fixture"); - let decoded = decoder - .decode_instruction(&instruction) - .expect("decode instruction"); - let decoded_arranged_accounts = - InitializePresetParameter::arrange_accounts(&instruction.accounts) - .expect("arrange accounts"); - - // Assert - assert_eq!(decoded.data, expected_ix); - assert_eq!(decoded.accounts, expected_accounts); - assert_eq!(decoded.program_id, PROGRAM_ID); - assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); - } - - #[test] - fn test_decode_initialize_reward_ix() { - // Arrange - let expected_ix = MeteoraDlmmInstruction::InitializeReward(InitializeReward { - funder: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - reward_duration: 2419200, - reward_index: 0, - }); - let expected_accounts = vec![ - AccountMeta::new( - pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), - false, - ), - AccountMeta::new( - pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), - false, - ), - AccountMeta::new_readonly( - pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), - false, - ), - AccountMeta::new( - pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - true, - ), - AccountMeta::new_readonly( - pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - false, - ), - AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), - AccountMeta::new_readonly( - pubkey!("SysvarRent111111111111111111111111111111111"), - false, - ), - AccountMeta::new_readonly( - pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - false, - ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - false, - ), - ]; - let expected_arranged_accounts = InitializeRewardInstructionAccounts { - lb_pair: pubkey!("J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ"), - reward_vault: pubkey!("A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk"), - reward_mint: pubkey!("HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"), - admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - system_program: pubkey!("11111111111111111111111111111111"), - rent: pubkey!("SysvarRent111111111111111111111111111111111"), - event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - }; - - // Act - let decoder = MeteoraDlmmDecoder; - let instruction = - carbon_test_utils::read_instruction("tests/fixtures/initialize_reward_ix.json") - .expect("read fixture"); - let decoded = decoder - .decode_instruction(&instruction) - .expect("decode instruction"); - let decoded_arranged_accounts = - InitializeReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); - - // Assert - assert_eq!(decoded.data, expected_ix); - assert_eq!(decoded.accounts, expected_accounts); - assert_eq!(decoded.program_id, PROGRAM_ID); - assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); - } - #[test] fn test_decode_migrate_position_ix() { // Arrange @@ -2869,11 +2797,11 @@ mod tests { // Arrange let expected_ix = MeteoraDlmmInstruction::SwapExactOut(SwapExactOut { max_in_amount: 18446744073709551615, - out_amount: 4604710206, + out_amount: 5950000, }); let expected_accounts = vec![ AccountMeta::new( - pubkey!("Cwwiuxix6vHJRUhYVt5Hn1wD3Dpsg23TGdnhraTKNdwp"), + pubkey!("8gJ7UWboMeQ6z6AQwFP3cAZwSYG8udVS2UesyCbH79r7"), false, ), AccountMeta::new_readonly( @@ -2881,39 +2809,39 @@ mod tests { false, ), AccountMeta::new( - pubkey!("8QveFxtVeRUYGmrnCpAMMFTbQH4KWCgFtirAynrnWpHu"), + pubkey!("chM5ZB1uPZxvJJAK4D1Z4KHAYjWKvwuQTy6fFAeWQ1T"), false, ), AccountMeta::new( - pubkey!("8rV6fY14TBcNt7t27rMG4qY4sPyCtYbZx3MxNuJt7DN8"), + pubkey!("FGFaiYjXTVuLsKvzn6ueckraNTeqUGHeYqrQPQCpd7kH"), false, ), AccountMeta::new( - pubkey!("2tNZcU1rd3hN5nLGQNVm86mSLvuRGGpgsSF3stBaDDLo"), + pubkey!("BF9S5Kvygv3Qf4aSnjyG98aoij11k3yiSLBHcxTa53h3"), false, ), AccountMeta::new( - pubkey!("EJeYX6pHEkQTPR6gu7jvB6NCdorNDKg37vgeCVVwg185"), + pubkey!("He2uhHBU7uE9BiSe2QLRzQd9U3fWwjZY5anmC9k84nzd"), false, ), AccountMeta::new_readonly( - pubkey!("h5NciPdMZ5QCB5BYETJMYBMpVx9ZuitR6HcVjyBhood"), + pubkey!("So11111111111111111111111111111111111111112"), false, ), AccountMeta::new_readonly( - pubkey!("So11111111111111111111111111111111111111112"), + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), false, ), AccountMeta::new( - pubkey!("7uF53ew4nfPo6fqzrpCWkiojLTGYBcqoXoH5Snq1Riyv"), + pubkey!("DoBNfRox1ZjEsZq6QPY4jpN8hN4Fu9JVkAxJQro164VR"), false, ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + AccountMeta::new( + pubkey!("BF9S5Kvygv3Qf4aSnjyG98aoij11k3yiSLBHcxTa53h3"), false, ), AccountMeta::new( - pubkey!("GqvpRMaYKYRYon1BBEGSDFfqsuwX1zcP5zMVGHD78P2K"), + pubkey!("HuTshmtwcQkWBLzgW3m4uwcmik7Lmz4YFpYcTqMJpXiP"), true, ), AccountMeta::new_readonly( @@ -2933,40 +2861,30 @@ mod tests { false, ), AccountMeta::new( - pubkey!("7L5XySdengRtraWSk63c3RUSwDS3QDUzK8iGAyfswe72"), + pubkey!("FXrrHPdrSodRZWXNMf8DRXCogkX1vSzLWNS7zonYHiSw"), false, ), AccountMeta::new( - pubkey!("6fiDSc65xS2hx86D8shtURZEH184eGA6RtSY36vUNByY"), + pubkey!("8A6sET38nPh6VX6bs9df6HjcvvQ14bNJvxhGRJ5eHGbh"), false, ), ]; let expected_arranged_accounts = SwapExactOutInstructionAccounts { - lb_pair: pubkey!("Cwwiuxix6vHJRUhYVt5Hn1wD3Dpsg23TGdnhraTKNdwp"), + lb_pair: pubkey!("8gJ7UWboMeQ6z6AQwFP3cAZwSYG8udVS2UesyCbH79r7"), bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - reserve_x: pubkey!("8QveFxtVeRUYGmrnCpAMMFTbQH4KWCgFtirAynrnWpHu"), - reserve_y: pubkey!("8rV6fY14TBcNt7t27rMG4qY4sPyCtYbZx3MxNuJt7DN8"), - user_token_in: pubkey!("2tNZcU1rd3hN5nLGQNVm86mSLvuRGGpgsSF3stBaDDLo"), - user_token_out: pubkey!("EJeYX6pHEkQTPR6gu7jvB6NCdorNDKg37vgeCVVwg185"), - token_x_mint: pubkey!("h5NciPdMZ5QCB5BYETJMYBMpVx9ZuitR6HcVjyBhood"), - token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), - oracle: pubkey!("7uF53ew4nfPo6fqzrpCWkiojLTGYBcqoXoH5Snq1Riyv"), - host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - user: pubkey!("GqvpRMaYKYRYon1BBEGSDFfqsuwX1zcP5zMVGHD78P2K"), + reserve_x: pubkey!("chM5ZB1uPZxvJJAK4D1Z4KHAYjWKvwuQTy6fFAeWQ1T"), + reserve_y: pubkey!("FGFaiYjXTVuLsKvzn6ueckraNTeqUGHeYqrQPQCpd7kH"), + user_token_in: pubkey!("BF9S5Kvygv3Qf4aSnjyG98aoij11k3yiSLBHcxTa53h3"), + user_token_out: pubkey!("He2uhHBU7uE9BiSe2QLRzQd9U3fWwjZY5anmC9k84nzd"), + token_x_mint: pubkey!("So11111111111111111111111111111111111111112"), + token_y_mint: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + oracle: pubkey!("DoBNfRox1ZjEsZq6QPY4jpN8hN4Fu9JVkAxJQro164VR"), + host_fee_in: pubkey!("BF9S5Kvygv3Qf4aSnjyG98aoij11k3yiSLBHcxTa53h3"), + user: pubkey!("HuTshmtwcQkWBLzgW3m4uwcmik7Lmz4YFpYcTqMJpXiP"), token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - remaining_accounts: vec![ - AccountMeta::new( - pubkey!("7L5XySdengRtraWSk63c3RUSwDS3QDUzK8iGAyfswe72"), - false, - ), - AccountMeta::new( - pubkey!("6fiDSc65xS2hx86D8shtURZEH184eGA6RtSY36vUNByY"), - false, - ), - ], }; // Act @@ -2991,12 +2909,12 @@ mod tests { fn test_decode_swap_ix() { // Arrange let expected_ix = MeteoraDlmmInstruction::Swap(Swap { - amount_in: 864821960, + amount_in: 60165522, min_amount_out: 0, }); let expected_accounts = vec![ AccountMeta::new( - pubkey!("HAb26kxRVZBLAeVokuhSyfhTes7YLiD6GMT8X2c8DmH2"), + pubkey!("FwwjuDSCZGRqB4ngwZd4zqjvLdbykU7PQaFTzocSAxmt"), false, ), AccountMeta::new_readonly( @@ -3004,23 +2922,23 @@ mod tests { false, ), AccountMeta::new( - pubkey!("HJEHtafejeXa1zkjtrMu6s8mUk3EN7ZQSFErzP1hoQSB"), + pubkey!("CWBe4vsnqxK87NzFRnhoXH4Pi2mDhLAfpmZZVw7rmtDr"), false, ), AccountMeta::new( - pubkey!("9yG1b2qLCDMdLMM1C8UnAxwEXsCG628joitnJTfL3YaH"), + pubkey!("7u9JUmEDLbF4FAQmybpbYwUXHtSFP7HsESMsop6yHtBR"), false, ), AccountMeta::new( - pubkey!("7x4VcEX8aLd3kFsNWULTp1qFgVtDwyWSxpTGQkoMM6XX"), + pubkey!("GjxJ1KCKU6tduWpgJKXA81spVK5mHZHbXNFTSvFELqgN"), false, ), AccountMeta::new( - pubkey!("FqACg6svfqZqqnMuoYNgcd8xw6fJvFtjBANFMG321BHq"), + pubkey!("7sfqR1grUb5jCTrpYm31cc1HA4quapJ8ur8ZdkUwUqtS"), false, ), AccountMeta::new_readonly( - pubkey!("DvjbEsdca43oQcw2h3HW1CT7N3x5vRcr3QrvTUHnXvgV"), + pubkey!("Cy1GS2FqefgaMbi45UunrUzin1rfEmTUYnomddzBpump"), false, ), AccountMeta::new_readonly( @@ -3028,7 +2946,7 @@ mod tests { false, ), AccountMeta::new( - pubkey!("CBpCNLKUmFfRTvuuksBNivDrewaYrc4S3mMv6C4o7Ldq"), + pubkey!("GJiUHhpg1E2asD4iHhVd8sGPryxg8uiyjmRygieRNkVr"), false, ), AccountMeta::new_readonly( @@ -3036,8 +2954,8 @@ mod tests { false, ), AccountMeta::new( - pubkey!("6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB"), - false, + pubkey!("CfKSQ1DbJa79XGp3fieJJwnskHBbWkgrpC3DmL6rTzQH"), + true, ), AccountMeta::new_readonly( pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), @@ -3056,48 +2974,34 @@ mod tests { false, ), AccountMeta::new( - pubkey!("Dt7EriabLX5HCJkbTqtxF7ziDFWnJTKCirekGccMFMYk"), + pubkey!("9d9WZ5dUB8AfQ7LkBoe4NjKwZRDjFaBhzRvw5DoWtTk6"), false, ), AccountMeta::new( - pubkey!("8Nbdb3SPofvda3ZBjvjTKZrXUmqkcRXqhVRck1vnwJXm"), + pubkey!("HiSfB3uFcPENZABoE94VJ8YzhdeuQucFT1N5dbfquWeQ"), false, ), AccountMeta::new( - pubkey!("5Er6ukkyhmzAyz44h7hcDrtMKzVsSMNnt3vAn233HCcD"), + pubkey!("GXx6rxy44GrxWYqKmiLUgoAw5WPX6zaK7RzhifJzH29M"), false, ), ]; let expected_arranged_accounts = SwapInstructionAccounts { - lb_pair: pubkey!("HAb26kxRVZBLAeVokuhSyfhTes7YLiD6GMT8X2c8DmH2"), + lb_pair: pubkey!("FwwjuDSCZGRqB4ngwZd4zqjvLdbykU7PQaFTzocSAxmt"), bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - reserve_x: pubkey!("HJEHtafejeXa1zkjtrMu6s8mUk3EN7ZQSFErzP1hoQSB"), - reserve_y: pubkey!("9yG1b2qLCDMdLMM1C8UnAxwEXsCG628joitnJTfL3YaH"), - user_token_in: pubkey!("7x4VcEX8aLd3kFsNWULTp1qFgVtDwyWSxpTGQkoMM6XX"), - user_token_out: pubkey!("FqACg6svfqZqqnMuoYNgcd8xw6fJvFtjBANFMG321BHq"), - token_x_mint: pubkey!("DvjbEsdca43oQcw2h3HW1CT7N3x5vRcr3QrvTUHnXvgV"), + reserve_x: pubkey!("CWBe4vsnqxK87NzFRnhoXH4Pi2mDhLAfpmZZVw7rmtDr"), + reserve_y: pubkey!("7u9JUmEDLbF4FAQmybpbYwUXHtSFP7HsESMsop6yHtBR"), + user_token_in: pubkey!("GjxJ1KCKU6tduWpgJKXA81spVK5mHZHbXNFTSvFELqgN"), + user_token_out: pubkey!("7sfqR1grUb5jCTrpYm31cc1HA4quapJ8ur8ZdkUwUqtS"), + token_x_mint: pubkey!("Cy1GS2FqefgaMbi45UunrUzin1rfEmTUYnomddzBpump"), token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), - oracle: pubkey!("CBpCNLKUmFfRTvuuksBNivDrewaYrc4S3mMv6C4o7Ldq"), + oracle: pubkey!("GJiUHhpg1E2asD4iHhVd8sGPryxg8uiyjmRygieRNkVr"), host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - user: pubkey!("6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB"), + user: pubkey!("CfKSQ1DbJa79XGp3fieJJwnskHBbWkgrpC3DmL6rTzQH"), token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - remaining_accounts: vec![ - AccountMeta::new( - pubkey!("Dt7EriabLX5HCJkbTqtxF7ziDFWnJTKCirekGccMFMYk"), - false, - ), - AccountMeta::new( - pubkey!("8Nbdb3SPofvda3ZBjvjTKZrXUmqkcRXqhVRck1vnwJXm"), - false, - ), - AccountMeta::new( - pubkey!("5Er6ukkyhmzAyz44h7hcDrtMKzVsSMNnt3vAn233HCcD"), - false, - ), - ], }; // Act @@ -3117,190 +3021,6 @@ mod tests { assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); } - #[test] - fn test_decode_swap_with_price_impact_ix() { - // Arrange - let expected_ix = MeteoraDlmmInstruction::SwapWithPriceImpact(SwapWithPriceImpact { - active_id: Some(-5212), - amount_in: 3265416567, - max_price_impact_bps: 11, - }); - let expected_accounts = vec![ - AccountMeta::new( - pubkey!("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6"), - false, - ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - false, - ), - AccountMeta::new( - pubkey!("EYj9xKw6ZszwpyNibHY7JD5o3QgTVrSdcBp1fMJhrR9o"), - false, - ), - AccountMeta::new( - pubkey!("CoaxzEh8p5YyGLcj36Eo3cUThVJxeKCs7qvLAGDYwBcz"), - false, - ), - AccountMeta::new( - pubkey!("yuJDeF4EpH6a3yrU99877vUckzoySSUBQXdMQsKBH9S"), - false, - ), - AccountMeta::new( - pubkey!("nWzG3iVBEJw5kWV3V8GjbnGvHX9uoMVrrsiS6XMBViG"), - false, - ), - AccountMeta::new_readonly( - pubkey!("So11111111111111111111111111111111111111112"), - false, - ), - AccountMeta::new_readonly( - pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), - false, - ), - AccountMeta::new( - pubkey!("59YuGWPunbchD2mbi9U7qvjWQKQReGeepn4ZSr9zz9Li"), - false, - ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - false, - ), - AccountMeta::new( - pubkey!("BsWvqrgcaKZcZsXKawDJTGpYbHsDjjFQRo35wob7DvUv"), - true, - ), - AccountMeta::new_readonly( - pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - false, - ), - AccountMeta::new_readonly( - pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - false, - ), - AccountMeta::new_readonly( - pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - false, - ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - false, - ), - AccountMeta::new( - pubkey!("Ehkf9XQLVnY8HV6jbbDU25fTxF1qQ3NuScWfawSb79pu"), - false, - ), - AccountMeta::new( - pubkey!("G9QNw5nwv6JMkLSQ8ignWWEXybUfwBoJm4z5goGbU7d"), - false, - ), - AccountMeta::new( - pubkey!("CU8ZSJ7nxD3aqsk6mJYreN4gXWqnrw8jJtNM3yeBAejo"), - false, - ), - ]; - let expected_arranged_accounts = SwapWithPriceImpactInstructionAccounts { - lb_pair: pubkey!("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6"), - bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - reserve_x: pubkey!("EYj9xKw6ZszwpyNibHY7JD5o3QgTVrSdcBp1fMJhrR9o"), - reserve_y: pubkey!("CoaxzEh8p5YyGLcj36Eo3cUThVJxeKCs7qvLAGDYwBcz"), - user_token_in: pubkey!("yuJDeF4EpH6a3yrU99877vUckzoySSUBQXdMQsKBH9S"), - user_token_out: pubkey!("nWzG3iVBEJw5kWV3V8GjbnGvHX9uoMVrrsiS6XMBViG"), - token_x_mint: pubkey!("So11111111111111111111111111111111111111112"), - token_y_mint: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), - oracle: pubkey!("59YuGWPunbchD2mbi9U7qvjWQKQReGeepn4ZSr9zz9Li"), - host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - user: pubkey!("BsWvqrgcaKZcZsXKawDJTGpYbHsDjjFQRo35wob7DvUv"), - token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), - event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - remaining_accounts: vec![ - AccountMeta::new( - pubkey!("Ehkf9XQLVnY8HV6jbbDU25fTxF1qQ3NuScWfawSb79pu"), - false, - ), - AccountMeta::new( - pubkey!("G9QNw5nwv6JMkLSQ8ignWWEXybUfwBoJm4z5goGbU7d"), - false, - ), - AccountMeta::new( - pubkey!("CU8ZSJ7nxD3aqsk6mJYreN4gXWqnrw8jJtNM3yeBAejo"), - false, - ), - ], - }; - - // Act - let decoder = MeteoraDlmmDecoder; - let instruction = - carbon_test_utils::read_instruction("tests/fixtures/swap_with_price_impact_ix.json") - .expect("read fixture"); - let decoded = decoder - .decode_instruction(&instruction) - .expect("decode instruction"); - let decoded_arranged_accounts = - SwapWithPriceImpact::arrange_accounts(&instruction.accounts).expect("arrange accounts"); - - // Assert - assert_eq!(decoded.data, expected_ix); - assert_eq!(decoded.accounts, expected_accounts); - assert_eq!(decoded.program_id, PROGRAM_ID); - assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); - } - - #[test] - fn test_decode_update_fee_parameters_ix() { - // Arrange - let expected_ix = MeteoraDlmmInstruction::UpdateFeeParameters(UpdateFeeParameters { - fee_parameter: FeeParameter { - base_factor: 20000, - protocol_share: 500, - }, - }); - let expected_accounts = vec![ - AccountMeta::new( - pubkey!("A9KUjKXwqajsGrCRZSnQBkrvJ6iBoQ4Yjs49dVLruDBV"), - false, - ), - AccountMeta::new( - pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - true, - ), - AccountMeta::new_readonly( - pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - false, - ), - AccountMeta::new_readonly( - pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - false, - ), - ]; - let expected_arranged_accounts = UpdateFeeParametersInstructionAccounts { - lb_pair: pubkey!("A9KUjKXwqajsGrCRZSnQBkrvJ6iBoQ4Yjs49dVLruDBV"), - admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), - event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), - program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), - }; - - // Act - let decoder = MeteoraDlmmDecoder; - let instruction = - carbon_test_utils::read_instruction("tests/fixtures/update_fee_parameters_ix.json") - .expect("read fixture"); - let decoded = decoder - .decode_instruction(&instruction) - .expect("decode instruction"); - let decoded_arranged_accounts = - UpdateFeeParameters::arrange_accounts(&instruction.accounts).expect("arrange accounts"); - - // Assert - assert_eq!(decoded.data, expected_ix); - assert_eq!(decoded.accounts, expected_accounts); - assert_eq!(decoded.program_id, PROGRAM_ID); - assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); - } - #[test] fn test_decode_update_fees_and_rewards_ix() { // Arrange diff --git a/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs b/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs index 0005d4cce..7fe7044b8 100644 --- a/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs +++ b/decoders/meteora-dlmm-decoder/src/types/init_permission_pair_ix.rs @@ -8,7 +8,6 @@ pub struct InitPermissionPairIx { pub bin_step: u16, pub base_factor: u16, pub base_fee_power_factor: u8, - pub lock_duration: u64, pub activation_type: u8, pub protocol_share: u16, } diff --git a/decoders/meteora-dlmm-decoder/tests/README.md b/decoders/meteora-dlmm-decoder/tests/README.md index 373c79464..5924e8975 100644 --- a/decoders/meteora-dlmm-decoder/tests/README.md +++ b/decoders/meteora-dlmm-decoder/tests/README.md @@ -2,8 +2,9 @@ ## Instructions - [InitializeLbPair](https://solscan.io/tx/56zeqRP2pjAHPbub9ayteMy3PWunbaQCWbHrYULiQnhq1GvPe6njTyYyaqQupgNA9NYWBtDYFwos6hxJLVmLXw3U) -- [InitializePermissionLbPair](https://solscan.io/tx/2xvpA7ugRVTsgQrPEw1RVHWY4r25QdwqdCS1QhJayQe2bx6gNM2mH4W7TRKM5s3sj1HwpDh2F462LXC8G2nzBasE) -- [InitializeCustomizablePermissionlessLbPair](https://solscan.io/tx/4JrJ42JvBJ25HbfvcV5mmcs3yssw1yan5uVsnm3fXkQPBcmmCyHehgHxFtk997pqBLVJk7DPD7nqUnYaJ8oD7Zbc) +- [InitializePermissionLbPair](https://solscan.io/tx/2bHYoha1NTNRSJtpLxoxz2kDcUkJtoT47dNECGJJ1MnaP7cb5a58YW2Wo3yoHqDxKLQk941o42hUHyYowwkfsRYL) +- [InitializeCustomizablePermissionlessLbPair](https://solscan.io/tx/4cEZB1GzzN3J8UGSvfuv7C2wPEBT6Tu9xGBi8NSxUWXr3cB2V3Jtiuo1fyXZ8dhR3V87q2mF3LqjDk7xPPFmtP5H) +- [InitializeCustomizablePermissionlessLbPair2](https://solscan.io/tx/5juhYiMn1XieEHi93nFnWkuNLqQtjJqWR5cKVUBSi7EKazYt7apNz5nZGYwuJZJRftyR4bnPZ9yixT63Lna4uVQt) - [InitializeBinArrayBitmapExtension](https://solscan.io/tx/2b4xwjdYGZ51rKJEyNwKuExXVvHYQgsdfuT1BfHicN3dUfnCJsmAqMQk35Y4UqdvVsDCeiHaiMUzdcU4xSWwwboV) - [InitializeBinArray](https://solscan.io/tx/2n5bjg2rMaTMJroCaYuKYLRoKMd2nbrhAhSRcVKWZ5ST21SjGXRbgMN8FGQnu43n9eKnRsvrCfhTBdmHioUYQRYx) - [AddLiquidity](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) @@ -16,23 +17,21 @@ - [InitializePositionPda](https://solscan.io/tx/3TQrSnFEAXcYPW7eeM1S6h5jKSHrfZkVSN7rBJENRzUxfhRamdhjbWpLoTRFkaA2FzaTLBUGcz2Hq2tWtSbZ1z5T) - [InitializePositionByOperator](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) - [UpdatePositionOperator](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) -- [Swap](https://solscan.io/tx/2E2EFSrAoFY31Edy4N3Mh7o17BWorp4kfQb7qWwVoy4BYm3j8HX2r1b4MY8XePuWUyAFnHtkQz7Kpmsj7jusikeE) -- [SwapExactOut](https://solscan.io/tx/29eNrCgFWvZ8TUwxD4ybRtWmE9QDnafz8w7G27gLECgFpo2wQ8sM6TyDNhHnsTz8umJaJqh2hJVQA4im5Lk54eLh) -- [SwapWithPriceImpact](https://solscan.io/tx/29FKUpybWHn3JUUC2soPqN8SNDKT4VeJZ7HLmpMwWkFavUkkEoVBNVqJUXvXPs1HcJza63P1aDECKJ5WZWwz23cS) -- [InitializeReward](https://solscan.io/tx/4PPQZ3WGygM2rSzNppn8UaGASoQJrpmtcoB6Aqa77X8EcvXMVYi6VwQ7HKvN7yqqaMTYbkAbnfZ4fa5xaTzSvs7f) -- [FundReward](https://solscan.io/tx/5yeyRkoLnshKGqPDoAmV71tEPwLThtfUSwYc5vFMaRMdjWo3upv3ErDtdYShQb9AbAWWKBxsh6qcF3KWtPBDqDyf) +- [Swap](https://solscan.io/tx/4J8uonoGnUeAoecArQpLoJixmygouDS8jZQ15aZymJTzFxfmWNbxGgv8LMqsgbuQ2NTD4vw2EzTnZ8PEDx6RHwt4) +- [SwapExactOut](https://solscan.io/tx/1Ndo68TjDrqaBxAr7pAdhCcfqg6TdbfFMVjvs7mtBCbG7Yacw4SPxnjQtfN722EAy8QkjmkbDBr8xXy93dqud94) - [ClaimReward](https://solscan.io/tx/47De6LKmvLXnyF1LsbFenYGbbRPzsyXhrdiaMHyQUE6r8o1jJt9YGXJF9S11FWmSRHr5Tz1YVLwhxxiUNAG6RMTa) - [ClaimFee](https://solscan.io/tx/3oYQxHQFimNBmXoFe2kqoKLvEPWJhNbmSGMuyXJPZ6XviB2jeTfhtNUd16u7CCikNL5v1jfwkdh5GtA969tNQKrY) - [ClosePosition](https://solscan.io/tx/2yGLHktGYho1rQ4eiVvtAEfmfXJdMjPoLdaixjg4RvHp2LB9bFn1ZN2A16bibUQkSNgwyQGucRSZxTtGWDNEb2KD) -- [UpdateFeeParameters](https://solscan.io/tx/2rmygSGvJeQwnmHGpsdKgyP53u7VV22d8evSiUTnhWB7rT4CdPkWgopCd2YY9T9w5SZMuwJGvyDdPor4gKGwBMXa) -- [InitializePresetParameter](https://solscan.io/tx/LjA5JwULSyvzxYa1Z4qAXQFCRQXMrafB64RTQ5NEKxu1a2CaVPBwWhtkGoydGuRXBYzGURbHVTgXnt15ewoEVvq) -- [ClosePresetParameter](https://solscan.io/tx/LjA5JwULSyvzxYa1Z4qAXQFCRQXMrafB64RTQ5NEKxu1a2CaVPBwWhtkGoydGuRXBYzGURbHVTgXnt15ewoEVvq) - [RemoveAllLiquidity](https://solscan.io/tx/45DLXSXVcogvrURaYa3rM5htZTh3VUGeHNsJ1AsmZH7NXtDBkbrNy58AyibkzLxLLoAeKY78xeyPUshjYPW3QEV6) - [MigratePosition](https://solscan.io/tx/3B61kxDTC2a5rwW6CCVu83tQb8G6MLRBumeLEUFLCW264NgCEUefSpG5dEbWptC8W7BqM3HCsNbmLFHjoTVFMz11) -- [UpdateFeesAndRewards](https://solscan.io/tx/3hkBmxRpiomnQDu34YRBd5AYTQCrzjaB6aeVDLkSoNQLFUtAANGZvckFG1vyCD7GN7mcWe6NonEXtD9M6YUJCjnE) - [RemoveLiquidityByRange](https://solscan.io/tx/hmd7WZ2wnDYA4yWJLYD1URk3UQu5q18Ln7nR3QcXN7zSXuZPrv5QFgE5Jz9rsxgsi2dTu4yAPtdUKQGYLLvyqAB) - [AddLiquidityOneSidePrecise](https://solscan.io/tx/39URMKxPHuZyNQdDxTtxE2A5SHmEmcMDGM8Ee2dXtaR7btLqUMsXhJWRuLopN5rC9x1gd5VbcfeGUY11H1M9a3oe) - [GoToABin](https://solscan.io/tx/31VhsCV7ki9K97BWupQC4YkLsBgbuEvXvKMgL3fQY5aCTjXGTxktGJZtoC37zSLc4Lt3tHKsbdpAGr7BVXr6mJrz) +- [FundReward]() +- [InitializePresetParameter]() +- [InitializeReward]() +- [SwapWithPriceImpact]() +- [UpdateFeeParameters]() - [UpdateRewardFunderEvent]() - [PositionCloseEvent]() - [ClaimFeeEvent]() @@ -47,7 +46,7 @@ ## Accounts -- [LbPair](https://solscan.io/account/7wR3Zy7ywZiPu9DiP7hqbGi3gPQUdGs8Yy5LK5pkFmCh) +- [LbPair](https://solscan.io/account/ESuD7dd6zKM4JwNBTPiSbodt5pFQT4U2nLG72NAxccXL) - [Position](https://solscan.io/account/12589PP9fRE5Ve7CPE1ABfFHJPFa6BtTQ85yvN7Xxega) - [PresetParameter](https://solscan.io/account/F37fb46nFwBTK5Q5upDWjfkZetRyV7dqeUP9LfSvhi6c) - [BinArrayBitmapExtension]() diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json deleted file mode 100644 index 7ab71c3ff..000000000 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/fund_reward_ix.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "accounts": [ - { - "pubkey": "J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ", - "is_signer": false, - "is_writable": true, - "label": "lbPair" - }, - { - "pubkey": "A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk", - "is_signer": false, - "is_writable": true, - "label": "rewardVault" - }, - { - "pubkey": "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr", - "is_signer": false, - "is_writable": false, - "label": "rewardMint" - }, - { - "pubkey": "5V1RFYBKBZ78zG6cYJ5ssGLQmttLC1KSM6bSdSpgSV5i", - "is_signer": false, - "is_writable": true, - "label": "funderTokenAccount" - }, - { - "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", - "is_signer": true, - "is_writable": true, - "label": "funder" - }, - { - "pubkey": "AnDCpj7VxG72LvXdaCn7zsHjaVruSBDWTbpVcdSGiFkK", - "is_signer": false, - "is_writable": true, - "label": "binArray" - }, - { - "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", - "is_signer": false, - "is_writable": false, - "label": "tokenProgram" - }, - { - "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", - "is_signer": false, - "is_writable": false, - "label": "eventAuthority" - }, - { - "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", - "is_signer": false, - "is_writable": false, - "label": "program" - } - ], - "data": "bc32f9a55d97263f000000000000000000743ba40b00000000", - "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" -} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair2_ix.json similarity index 58% rename from decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json rename to decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair2_ix.json index ca6f49fc4..977055134 100644 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact_ix.json +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair2_ix.json @@ -1,7 +1,7 @@ { "accounts": [ { - "pubkey": "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6", + "pubkey": "8ookeFtaPGhyi3dSJY9ULjzePWfAe1cykRr7xtoSbgfz", "is_signer": false, "is_writable": true, "label": "lbPair" @@ -13,99 +13,96 @@ "label": "binArrayBitmapExtension" }, { - "pubkey": "EYj9xKw6ZszwpyNibHY7JD5o3QgTVrSdcBp1fMJhrR9o", + "pubkey": "FCjQFN49K5ufVnXkLHMPSMvtbyo8jMB1tdrGQ8QHtfnD", "is_signer": false, - "is_writable": true, - "label": "reserveX" + "is_writable": false, + "label": "tokenMintX" }, { - "pubkey": "CoaxzEh8p5YyGLcj36Eo3cUThVJxeKCs7qvLAGDYwBcz", + "pubkey": "So11111111111111111111111111111111111111112", "is_signer": false, - "is_writable": true, - "label": "reserveY" + "is_writable": false, + "label": "tokenMintY" }, { - "pubkey": "yuJDeF4EpH6a3yrU99877vUckzoySSUBQXdMQsKBH9S", + "pubkey": "8k6Cwds2WbD9cx4hTfZubaSLpzniL8Vs8ZKo5ZQAsfQW", "is_signer": false, "is_writable": true, - "label": "userTokenIn" + "label": "reserveX" }, { - "pubkey": "nWzG3iVBEJw5kWV3V8GjbnGvHX9uoMVrrsiS6XMBViG", + "pubkey": "8994hrKpj7aoZocJvbV59Z9o4ah1se1HjW4Wsi6wSiMu", "is_signer": false, "is_writable": true, - "label": "userTokenOut" + "label": "reserveY" }, { - "pubkey": "So11111111111111111111111111111111111111112", + "pubkey": "HMCCePCcK1jizjz4MJx3VYb9f9uHXY4UJPcaaRtwATVZ", "is_signer": false, - "is_writable": false, - "label": "tokenXMint" + "is_writable": true, + "label": "oracle" }, { - "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "pubkey": "CjGtuik6GHKbTh9xuDHCzq2reGtMcJtTMqHjkBcbCMNX", "is_signer": false, "is_writable": false, - "label": "tokenYMint" + "label": "userTokenX" }, { - "pubkey": "59YuGWPunbchD2mbi9U7qvjWQKQReGeepn4ZSr9zz9Li", - "is_signer": false, + "pubkey": "GMtwcuktJfrRcnyGktWW4Vab8cfjPcBy3xbuZgRegw6E", + "is_signer": true, "is_writable": true, - "label": "oracle" + "label": "funder" }, { "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", "is_signer": false, "is_writable": false, - "label": "hostFeeIn" - }, - { - "pubkey": "BsWvqrgcaKZcZsXKawDJTGpYbHsDjjFQRo35wob7DvUv", - "is_signer": true, - "is_writable": true, - "label": "user" + "label": "tokenBadgeX" }, { - "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", "is_signer": false, "is_writable": false, - "label": "tokenXProgram" + "label": "tokenBadgeY" }, { "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "is_signer": false, "is_writable": false, - "label": "tokenYProgram" + "label": "tokenProgramX" }, { - "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "is_signer": false, "is_writable": false, - "label": "eventAuthority" + "label": "tokenProgramY" }, { - "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "pubkey": "11111111111111111111111111111111", "is_signer": false, "is_writable": false, - "label": "program" + "label": "systemProgram" }, { - "pubkey": "Ehkf9XQLVnY8HV6jbbDU25fTxF1qQ3NuScWfawSb79pu", + "pubkey": "23s7qdnDSVxFqGUURKMdTz8Pte1pf3T92kGmXWrWi8vS", "is_signer": false, - "is_writable": true + "is_writable": false, + "label": "userTokenY" }, { - "pubkey": "G9QNw5nwv6JMkLSQ8ignWWEXybUfwBoJm4z5goGbU7d", + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", "is_signer": false, - "is_writable": true + "is_writable": false, + "label": "eventAuthority" }, { - "pubkey": "CU8ZSJ7nxD3aqsk6mJYreN4gXWqnrw8jJtNM3yeBAejo", + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", "is_signer": false, - "is_writable": true + "is_writable": false, + "label": "program" } ], - "data": "38ade6d0ade49ccd774da2c20000000001a4ebffff0b00", + "data": "f349817e3313f16b7bfbffff64001027010101588d3968000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json index be36577df..4438deee3 100644 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_customizable_permissionless_lb_pair_ix.json @@ -1,7 +1,7 @@ { "accounts": [ { - "pubkey": "E7fHCw9G6KuCA2jg3uxvJn1MWL8ySD68kDLPyGDvcStT", + "pubkey": "Em94tW6wo3K15z7mM6wW926QRamuLKhiRe52tvk92ARs", "is_signer": false, "is_writable": true, "label": "lbPair" @@ -13,7 +13,7 @@ "label": "binArrayBitmapExtension" }, { - "pubkey": "fiSpHY8vkjABpAKGCaLs3pDnkZpeqNiYrADp4GZLYZY", + "pubkey": "BSJUzBQfPe7snyjxJxAJG183yYhDtLUEi3c8LGW7DCVw", "is_signer": false, "is_writable": false, "label": "tokenMintX" @@ -37,19 +37,19 @@ "label": "reserveY" }, { - "pubkey": "nJuXpHhaM9nNtY8XKiCfrsYAojRFEmrw33DYbiKqkAW", + "pubkey": "AG47v72cfwRUwdk9M2AfE691wzsETrjo8iieH3gAWsTX", "is_signer": false, "is_writable": true, "label": "oracle" }, { - "pubkey": "DujguCjLgZhVT7oTZ8XhDUYNgVYXn3EhqHGciXxKNLJ1", + "pubkey": "8dn7co13une6bT7dt7caCFj5E8cCuH5wzCZLaTncL3D2", "is_signer": false, "is_writable": false, "label": "userTokenX" }, { - "pubkey": "7CNXNAdUDBDYvZPGhRx8MG6nMeCxHC9B1iBVPY4H1gTU", + "pubkey": "3A2f4jax9vQRsaxDpocDKA3MhHdibwwZBSsBFcgfgkLw", "is_signer": true, "is_writable": true, "label": "funder" @@ -67,10 +67,10 @@ "label": "systemProgram" }, { - "pubkey": "Z7bkDerKzHpy5XtLYfNvtLq6PttYpxWmhXAeEFhCHff", + "pubkey": "SysvarRent111111111111111111111111111111111", "is_signer": false, "is_writable": false, - "label": "rent" + "label": "userTokenY" }, { "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", @@ -85,6 +85,6 @@ "label": "program" } ], - "data": "2e2729876fb7c840d3fcffffc8001027010001b3ddce670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "data": "2e2729876fb7c840010000000200881300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json index 1947755ce..8f7e8c005 100644 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_permission_lb_pair_ix.json @@ -1,49 +1,49 @@ { "accounts": [ { - "pubkey": "AeSLQ4ty9qfhEkzBpQAKypptur3giRDLWm3QGP1mze26", + "pubkey": "5FtFfp6KyxmTzb4if6FkFDTZqMN6FMdMd6A2eAkuhwNN", "is_signer": true, "is_writable": false, "label": "base" }, { - "pubkey": "DgSVNgNofqZyhmkSdUwuqvyTjHNYmq799RYMcadKnb2q", + "pubkey": "Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj", "is_signer": false, "is_writable": true, "label": "lbPair" }, { - "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "pubkey": "BvNQqUt9NwKb9nBrmpAH6mqvxXM6Uno6eC4cewD1PhwV", "is_signer": false, - "is_writable": false, + "is_writable": true, "label": "binArrayBitmapExtension" }, { - "pubkey": "DVYtHdaDc77W1oYTtAYd6kz9QVTj8wPWwiUTbkqzgN4n", + "pubkey": "HUMA1821qVDKta3u2ovmfDQeW2fSQouSKE8fkF44wvGw", "is_signer": false, "is_writable": false, "label": "tokenMintX" }, { - "pubkey": "8VJNVtvL5JcCrCgkb3gEjYT8NtA5rqen9YztcPhiwVCP", + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "is_signer": false, "is_writable": false, "label": "tokenMintY" }, { - "pubkey": "31Hx85DFuKr15Xr5XKse5tdWLTRQrEXCkKsoeipTHCfi", + "pubkey": "EiNhNKD4nR5zZm6YkAKpWHE2wWGSof5LZ7uSGfG3star", "is_signer": false, "is_writable": true, "label": "reserveX" }, { - "pubkey": "E55HFtp5AgG4hXK1ELbv9LD7V6872ZxW7tetuADJN5iC", + "pubkey": "EoW2xdPSyDeRyGiATyZ58sPuchPfvQnNudLq1dLKYX8o", "is_signer": false, "is_writable": true, "label": "reserveY" }, { - "pubkey": "B3EUUmEF4h4ZLmnYKbqP8LKYdLjoCmWH7j7JLcxsFfQc", + "pubkey": "sUiZ2rXZyD2B5aGVZeK9XXrsgCAgvhNPedTuePVpkA2", "is_signer": false, "is_writable": true, "label": "oracle" @@ -54,11 +54,29 @@ "is_writable": true, "label": "admin" }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "tokenBadgeX" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "tokenBadgeY" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgramX" + }, { "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "is_signer": false, "is_writable": false, - "label": "tokenProgram" + "label": "tokenProgramY" }, { "pubkey": "11111111111111111111111111111111", @@ -85,6 +103,6 @@ "label": "program" } ], - "data": "6c66d555fb033515c5f9ffff50007c9298eaffff68150000000000000000000001", + "data": "6c66d555fb033515de40ffff010010270001f401", "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" -} \ No newline at end of file +} diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json deleted file mode 100644 index 46da34b09..000000000 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_preset_parameter_ix.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "accounts": [ - { - "pubkey": "Axsuoe5peu6xPnxB4eAzsgWwpgqymjQT5aJ4KE8NgQei", - "is_signer": false, - "is_writable": true, - "label": "presetParameter" - }, - { - "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", - "is_signer": true, - "is_writable": true, - "label": "admin" - }, - { - "pubkey": "11111111111111111111111111111111", - "is_signer": false, - "is_writable": false, - "label": "systemProgram" - }, - { - "pubkey": "SysvarRent111111111111111111111111111111111", - "is_signer": false, - "is_writable": false, - "label": "rent" - } - ], - "data": "42bc47d3626d0eba0800e2041e0058028813c0d40100e0930400b12affff4fd50000f401", - "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" -} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json deleted file mode 100644 index ca2587bf7..000000000 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_reward_ix.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "accounts": [ - { - "pubkey": "J5BwKjUTKLdYQf9sexskHgHLyVWHtmG7gPxf3sGUfJLJ", - "is_signer": false, - "is_writable": true, - "label": "lbPair" - }, - { - "pubkey": "A4kyhECGSMiKoP5DDQa4xqN3QQwwpmkNW5X1vdYDVyGk", - "is_signer": false, - "is_writable": true, - "label": "rewardVault" - }, - { - "pubkey": "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr", - "is_signer": false, - "is_writable": false, - "label": "rewardMint" - }, - { - "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", - "is_signer": true, - "is_writable": true, - "label": "admin" - }, - { - "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", - "is_signer": false, - "is_writable": false, - "label": "tokenProgram" - }, - { - "pubkey": "11111111111111111111111111111111", - "is_signer": false, - "is_writable": false, - "label": "systemProgram" - }, - { - "pubkey": "SysvarRent111111111111111111111111111111111", - "is_signer": false, - "is_writable": false, - "label": "rent" - }, - { - "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", - "is_signer": false, - "is_writable": false, - "label": "eventAuthority" - }, - { - "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", - "is_signer": false, - "is_writable": false, - "label": "program" - } - ], - "data": "5f87c0c4f281e644000000000000000000ea24000000000048f459ea35f02146c458cac9763f4b11057255cbee3c4e45adeec3db8b2a1b37", - "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" -} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json b/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json index 724b675f8..2dead1e01 100644 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/lb_pair_account.json @@ -1,5 +1,5 @@ { - "data": "IQsxYrVlsQ3oAywBsASIE0wdAADwSQIA3u7//yIRAAD0AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/2QAAAoJAABkAAAB6AMAAICo3Ab+CKNq56/rc1sxFBrDvFqooJaptNS5OZ0RFMv/BpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAFDWTKAZrsiX5Q47BK3iZSBzaWwE0EcNOgfsjkR8nlDtnilH/EJF6d69S95/ZkMseCHsCWQukTG7AiKAwQoTn1fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAh4kB76ZLtFSHpEFhFYncd7sc7uK7we5cdt12DW0ONo4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKd3amcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEFsLRyVT7CI12d5NcSOPPeNl+dB2zt4vld+1fWlsamQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "data": "IQsxYrVlsQ0k9CwBsASIE0wdAADwSQIArur//1IVAAD0AQAAAAAAAPBJAgD4JAEAivz//wAAAAC9wzloAAAAAAAAAAAAAAAA/1AAA+L7//9QAAAAJPQAAN7eC6K2ZMgVF+oa7Rsk5mOE1vgf4HU9l6iugBeQlHGvBpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAFfr0RSkKmsREzcNzlAruynIUg/bPe05wJLg+B6RcA3hQqvwBCAa9wZEWc+fDTewmk+Ss9Vk8i0ez6kAO7I4VRlPKc63kkAAAAWlFQOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACARBIyBHOqxHD49A+i5MNDCA86sm5mzqwVkk12Fr4gIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdScLvxJe32OuvTI0qXeY9Gi6msGwuEcdhMI0cirsFNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABHWQ2FMxAzMwd+4tSvB2ELLcEnYl/utarMnP2fB8Y/EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", "executable": false, "lamports": 7182720, "owner": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json index 43700099d..ed79d3b5d 100644 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out_ix.json @@ -1,7 +1,7 @@ { "accounts": [ { - "pubkey": "Cwwiuxix6vHJRUhYVt5Hn1wD3Dpsg23TGdnhraTKNdwp", + "pubkey": "8gJ7UWboMeQ6z6AQwFP3cAZwSYG8udVS2UesyCbH79r7", "is_signer": false, "is_writable": true, "label": "lbPair" @@ -13,55 +13,55 @@ "label": "binArrayBitmapExtension" }, { - "pubkey": "8QveFxtVeRUYGmrnCpAMMFTbQH4KWCgFtirAynrnWpHu", + "pubkey": "chM5ZB1uPZxvJJAK4D1Z4KHAYjWKvwuQTy6fFAeWQ1T", "is_signer": false, "is_writable": true, "label": "reserveX" }, { - "pubkey": "8rV6fY14TBcNt7t27rMG4qY4sPyCtYbZx3MxNuJt7DN8", + "pubkey": "FGFaiYjXTVuLsKvzn6ueckraNTeqUGHeYqrQPQCpd7kH", "is_signer": false, "is_writable": true, "label": "reserveY" }, { - "pubkey": "2tNZcU1rd3hN5nLGQNVm86mSLvuRGGpgsSF3stBaDDLo", + "pubkey": "BF9S5Kvygv3Qf4aSnjyG98aoij11k3yiSLBHcxTa53h3", "is_signer": false, "is_writable": true, "label": "userTokenIn" }, { - "pubkey": "EJeYX6pHEkQTPR6gu7jvB6NCdorNDKg37vgeCVVwg185", + "pubkey": "He2uhHBU7uE9BiSe2QLRzQd9U3fWwjZY5anmC9k84nzd", "is_signer": false, "is_writable": true, "label": "userTokenOut" }, { - "pubkey": "h5NciPdMZ5QCB5BYETJMYBMpVx9ZuitR6HcVjyBhood", + "pubkey": "So11111111111111111111111111111111111111112", "is_signer": false, "is_writable": false, "label": "tokenXMint" }, { - "pubkey": "So11111111111111111111111111111111111111112", + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "is_signer": false, "is_writable": false, "label": "tokenYMint" }, { - "pubkey": "7uF53ew4nfPo6fqzrpCWkiojLTGYBcqoXoH5Snq1Riyv", + "pubkey": "DoBNfRox1ZjEsZq6QPY4jpN8hN4Fu9JVkAxJQro164VR", "is_signer": false, "is_writable": true, "label": "oracle" }, { - "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "pubkey": "BF9S5Kvygv3Qf4aSnjyG98aoij11k3yiSLBHcxTa53h3", "is_signer": false, - "is_writable": false, + "is_writable": true, "label": "hostFeeIn" }, { - "pubkey": "GqvpRMaYKYRYon1BBEGSDFfqsuwX1zcP5zMVGHD78P2K", + "pubkey": "HuTshmtwcQkWBLzgW3m4uwcmik7Lmz4YFpYcTqMJpXiP", "is_signer": true, "is_writable": true, "label": "user" @@ -91,16 +91,16 @@ "label": "program" }, { - "pubkey": "7L5XySdengRtraWSk63c3RUSwDS3QDUzK8iGAyfswe72", + "pubkey": "FXrrHPdrSodRZWXNMf8DRXCogkX1vSzLWNS7zonYHiSw", "is_signer": false, "is_writable": true }, { - "pubkey": "6fiDSc65xS2hx86D8shtURZEH184eGA6RtSY36vUNByY", + "pubkey": "8A6sET38nPh6VX6bs9df6HjcvvQ14bNJvxhGRJ5eHGbh", "is_signer": false, "is_writable": true } ], - "data": "fa49652126cf4bb8ffffffffffffffff3e4d761201000000", + "data": "fa49652126cf4bb8ffffffffffffffff30ca5a0000000000", "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json index 92cd99200..278205e87 100644 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_ix.json @@ -1,7 +1,7 @@ { "accounts": [ { - "pubkey": "HAb26kxRVZBLAeVokuhSyfhTes7YLiD6GMT8X2c8DmH2", + "pubkey": "FwwjuDSCZGRqB4ngwZd4zqjvLdbykU7PQaFTzocSAxmt", "is_signer": false, "is_writable": true, "label": "lbPair" @@ -13,31 +13,31 @@ "label": "binArrayBitmapExtension" }, { - "pubkey": "HJEHtafejeXa1zkjtrMu6s8mUk3EN7ZQSFErzP1hoQSB", + "pubkey": "CWBe4vsnqxK87NzFRnhoXH4Pi2mDhLAfpmZZVw7rmtDr", "is_signer": false, "is_writable": true, "label": "reserveX" }, { - "pubkey": "9yG1b2qLCDMdLMM1C8UnAxwEXsCG628joitnJTfL3YaH", + "pubkey": "7u9JUmEDLbF4FAQmybpbYwUXHtSFP7HsESMsop6yHtBR", "is_signer": false, "is_writable": true, "label": "reserveY" }, { - "pubkey": "7x4VcEX8aLd3kFsNWULTp1qFgVtDwyWSxpTGQkoMM6XX", + "pubkey": "GjxJ1KCKU6tduWpgJKXA81spVK5mHZHbXNFTSvFELqgN", "is_signer": false, "is_writable": true, "label": "userTokenIn" }, { - "pubkey": "FqACg6svfqZqqnMuoYNgcd8xw6fJvFtjBANFMG321BHq", + "pubkey": "7sfqR1grUb5jCTrpYm31cc1HA4quapJ8ur8ZdkUwUqtS", "is_signer": false, "is_writable": true, "label": "userTokenOut" }, { - "pubkey": "DvjbEsdca43oQcw2h3HW1CT7N3x5vRcr3QrvTUHnXvgV", + "pubkey": "Cy1GS2FqefgaMbi45UunrUzin1rfEmTUYnomddzBpump", "is_signer": false, "is_writable": false, "label": "tokenXMint" @@ -49,7 +49,7 @@ "label": "tokenYMint" }, { - "pubkey": "CBpCNLKUmFfRTvuuksBNivDrewaYrc4S3mMv6C4o7Ldq", + "pubkey": "GJiUHhpg1E2asD4iHhVd8sGPryxg8uiyjmRygieRNkVr", "is_signer": false, "is_writable": true, "label": "oracle" @@ -61,8 +61,8 @@ "label": "hostFeeIn" }, { - "pubkey": "6U91aKa8pmMxkJwBCfPTmUEfZi6dHe7DcFq2ALvB2tbB", - "is_signer": false, + "pubkey": "CfKSQ1DbJa79XGp3fieJJwnskHBbWkgrpC3DmL6rTzQH", + "is_signer": true, "is_writable": true, "label": "user" }, @@ -91,21 +91,21 @@ "label": "program" }, { - "pubkey": "Dt7EriabLX5HCJkbTqtxF7ziDFWnJTKCirekGccMFMYk", + "pubkey": "9d9WZ5dUB8AfQ7LkBoe4NjKwZRDjFaBhzRvw5DoWtTk6", "is_signer": false, "is_writable": true }, { - "pubkey": "8Nbdb3SPofvda3ZBjvjTKZrXUmqkcRXqhVRck1vnwJXm", + "pubkey": "HiSfB3uFcPENZABoE94VJ8YzhdeuQucFT1N5dbfquWeQ", "is_signer": false, "is_writable": true }, { - "pubkey": "5Er6ukkyhmzAyz44h7hcDrtMKzVsSMNnt3vAn233HCcD", + "pubkey": "GXx6rxy44GrxWYqKmiLUgoAw5WPX6zaK7RzhifJzH29M", "is_signer": false, "is_writable": true } ], - "data": "f8c69e91e17587c8c8228c33000000000000000000000000", + "data": "f8c69e91e17587c8920d9603000000000000000000000000", "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" } \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json deleted file mode 100644 index 4c88dd721..000000000 --- a/decoders/meteora-dlmm-decoder/tests/fixtures/update_fee_parameters_ix.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "accounts": [ - { - "pubkey": "A9KUjKXwqajsGrCRZSnQBkrvJ6iBoQ4Yjs49dVLruDBV", - "is_signer": false, - "is_writable": true, - "label": "lbPair" - }, - { - "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", - "is_signer": true, - "is_writable": true, - "label": "admin" - }, - { - "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", - "is_signer": false, - "is_writable": false, - "label": "eventAuthority" - }, - { - "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", - "is_signer": false, - "is_writable": false, - "label": "program" - } - ], - "data": "8080d05bf6351fb0f401204e", - "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" -} \ No newline at end of file From 147b0f500ea787e0c0b733aa35ebca08801de9ae Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 30 May 2025 21:39:49 +0530 Subject: [PATCH 3/4] updated cargo.lock --- Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 91e9f9e9e..1f991bd3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1465,7 +1465,6 @@ dependencies = [ "solana-account", "solana-instruction", "solana-pubkey", - "solana-sdk", ] [[package]] From 87784b78eb6c8e3ce022cf28c5fa5b1d8e5d6b2e Mon Sep 17 00:00:00 2001 From: arrayappy Date: Sun, 1 Jun 2025 15:56:15 +0530 Subject: [PATCH 4/4] upd: add meteora v2 ixs and account tests --- .../meteora-dlmm-decoder/src/accounts/mod.rs | 30 +- .../src/instructions/mod.rs | 1319 ++++++++++++++++- decoders/meteora-dlmm-decoder/tests/README.md | 67 +- .../tests/fixtures/claim_fee2_ix.json | 90 ++ .../tests/fixtures/claim_reward2_ix.json | 66 + .../tests/fixtures/close_position2_ix.json | 36 + .../fixtures/close_position_if_empty_ix.json | 36 + .../fixtures/initialize_lb_pair2_ix.json | 102 ++ .../tests/fixtures/migrate_bin_array_ix.json | 12 + .../tests/fixtures/oracle_account.json | 8 + .../tests/fixtures/remove_liquidity2_ix.json | 139 ++ .../remove_liquidity_by_range2_ix.json | 138 ++ .../fixtures/set_activation_point_ix.json | 18 + .../tests/fixtures/set_pair_status_ix.json | 18 + .../set_pair_status_permissionless_ix.json | 18 + .../set_pre_activation_duration_ix.json | 18 + .../set_pre_activation_swap_address_ix.json | 18 + .../tests/fixtures/swap2_ix.json | 127 ++ .../tests/fixtures/swap_exact_out2_ix.json | 127 ++ .../fixtures/swap_with_price_impact2_ix.json | 133 ++ .../update_base_fee_parameters_ix.json | 51 + 21 files changed, 2556 insertions(+), 15 deletions(-) create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/close_position2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/close_position_if_empty_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/migrate_bin_array_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/oracle_account.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/set_activation_point_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_permissionless_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_duration_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_swap_address_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/swap2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact2_ix.json create mode 100644 decoders/meteora-dlmm-decoder/tests/fixtures/update_base_fee_parameters_ix.json diff --git a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs index 181ee4bb3..fad71e6e8 100644 --- a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs @@ -163,7 +163,9 @@ mod tests { }; use solana_pubkey::pubkey; - use super::{lb_pair::LbPair, position::Position, preset_parameter::PresetParameter, *}; + use super::{ + lb_pair::LbPair, oracle::Oracle, position::Position, preset_parameter::PresetParameter, *, + }; #[test] fn test_decode_lb_pair_account() { @@ -848,4 +850,30 @@ mod tests { _ => panic!("Expected PresetParameterAccount"), } } + + #[test] + fn test_decode_oracle_account() { + // Arrange + let expected_account = Oracle { + active_size: 1, + idx: 0, + length: 100, + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let account = carbon_test_utils::read_account("tests/fixtures/oracle_account.json") + .expect("read fixture"); + let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + + // Assert + match decoded_account.data { + MeteoraDlmmAccount::Oracle(account) => { + assert_eq!(expected_account.active_size, account.active_size); + assert_eq!(expected_account.idx, account.idx); + assert_eq!(expected_account.length, account.length); + } + _ => panic!("Expected OracleAccount"), + } + } } diff --git a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs index 79e67b637..6634e4217 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs @@ -312,8 +312,14 @@ mod tests { AddLiquidityOneSidePrecise, AddLiquidityOneSidePreciseInstructionAccounts, }, claim_fee::{ClaimFee, ClaimFeeInstructionAccounts}, + claim_fee2::{ClaimFee2, ClaimFee2InstructionAccounts}, claim_reward::{ClaimReward, ClaimRewardInstructionAccounts}, + claim_reward2::{ClaimReward2, ClaimReward2InstructionAccounts}, close_position::{ClosePosition, ClosePositionInstructionAccounts}, + close_position2::{ClosePosition2, ClosePosition2InstructionAccounts}, + close_position_if_empty::{ + ClosePositionIfEmpty, ClosePositionIfEmptyInstructionAccounts, + }, close_preset_parameter::{ ClosePresetParameter, ClosePresetParameterInstructionAccounts, }, @@ -332,6 +338,7 @@ mod tests { InitializeCustomizablePermissionlessLbPair2InstructionAccounts, }, initialize_lb_pair::{InitializeLbPair, InitializeLbPairInstructionAccounts}, + initialize_lb_pair2::{InitializeLbPair2, InitializeLbPair2InstructionAccounts}, initialize_permission_lb_pair::{ InitializePermissionLbPair, InitializePermissionLbPairInstructionAccounts, }, @@ -342,24 +349,50 @@ mod tests { initialize_position_pda::{ InitializePositionPda, InitializePositionPdaInstructionAccounts, }, + migrate_bin_array::{MigrateBinArray, MigrateBinArrayInstructionAccounts}, migrate_position::{MigratePosition, MigratePositionInstructionAccounts}, remove_all_liquidity::{RemoveAllLiquidity, RemoveAllLiquidityInstructionAccounts}, remove_liquidity::{RemoveLiquidity, RemoveLiquidityInstructionAccounts}, + remove_liquidity2::{RemoveLiquidity2, RemoveLiquidity2InstructionAccounts}, remove_liquidity_by_range::{ RemoveLiquidityByRange, RemoveLiquidityByRangeInstructionAccounts, }, + remove_liquidity_by_range2::{ + RemoveLiquidityByRange2, RemoveLiquidityByRange2InstructionAccounts, + }, + set_activation_point::{SetActivationPoint, SetActivationPointInstructionAccounts}, + set_pair_status::{SetPairStatus, SetPairStatusInstructionAccounts}, + set_pair_status_permissionless::{ + SetPairStatusPermissionless, SetPairStatusPermissionlessInstructionAccounts, + }, + set_pre_activation_duration::{ + SetPreActivationDuration, SetPreActivationDurationInstructionAccounts, + }, + set_pre_activation_swap_address::{ + SetPreActivationSwapAddress, SetPreActivationSwapAddressInstructionAccounts, + }, swap::{Swap, SwapInstructionAccounts}, + swap2::{Swap2, Swap2InstructionAccounts}, swap_exact_out::{SwapExactOut, SwapExactOutInstructionAccounts}, + swap_exact_out2::{SwapExactOut2, SwapExactOut2InstructionAccounts}, + swap_with_price_impact2::{ + SwapWithPriceImpact2, SwapWithPriceImpact2InstructionAccounts, + }, + update_base_fee_parameters::{ + UpdateBaseFeeParameters, UpdateBaseFeeParametersInstructionAccounts, + }, update_fees_and_rewards::{ UpdateFeesAndRewards, UpdateFeesAndRewardsInstructionAccounts, }, }, types::{ - AddLiquiditySingleSidePreciseParameter, BinLiquidityDistribution, - BinLiquidityDistributionByWeight, BinLiquidityReduction, CompressedBinDepositAmount, - CustomizableParams, InitPermissionPairIx, LiquidityOneSideParameter, - LiquidityParameter, LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, - LiquidityParameterByWeight, StrategyParameters, StrategyType, + AccountsType, AddLiquiditySingleSidePreciseParameter, BaseFeeParameter, + BinLiquidityDistribution, BinLiquidityDistributionByWeight, BinLiquidityReduction, + CompressedBinDepositAmount, CustomizableParams, InitPermissionPairIx, + InitializeLbPair2Params, LiquidityOneSideParameter, LiquidityParameter, + LiquidityParameterByStrategy, LiquidityParameterByStrategyOneSide, + LiquidityParameterByWeight, RemainingAccountsInfo, RemainingAccountsSlice, + StrategyParameters, StrategyType, }, }; @@ -3073,4 +3106,1280 @@ mod tests { assert_eq!(decoded.program_id, PROGRAM_ID); assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); } + + #[test] + fn test_decode_close_position_if_empty_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClosePositionIfEmpty(ClosePositionIfEmpty {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("5zasWBT9q3SxnY5nnCYXX6f95f35Jd99f7b6e41Ld8iQ"), + false, + ), + AccountMeta::new( + pubkey!("4R1YbARsv2PjznvXFfPG9tGzHXZnDjP9gHhGQuKGnXi1"), + true, + ), + AccountMeta::new( + pubkey!("4R1YbARsv2PjznvXFfPG9tGzHXZnDjP9gHhGQuKGnXi1"), + true, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClosePositionIfEmptyInstructionAccounts { + position: pubkey!("5zasWBT9q3SxnY5nnCYXX6f95f35Jd99f7b6e41Ld8iQ"), + sender: pubkey!("4R1YbARsv2PjznvXFfPG9tGzHXZnDjP9gHhGQuKGnXi1"), + rent_receiver: pubkey!("4R1YbARsv2PjznvXFfPG9tGzHXZnDjP9gHhGQuKGnXi1"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/close_position_if_empty_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClosePositionIfEmpty::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_close_position2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClosePosition2(ClosePosition2 {}); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("DYrwi3FjL9i87kRPq9Sex7i1qVBPTqwvjjCLJmR2fRGz"), + false, + ), + AccountMeta::new( + pubkey!("3Fki2gTbdT3YQQzGkE3nJA2djU3ijsfCw7EYprqroBGP"), + true, + ), + AccountMeta::new( + pubkey!("3Fki2gTbdT3YQQzGkE3nJA2djU3ijsfCw7EYprqroBGP"), + true, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClosePosition2InstructionAccounts { + position: pubkey!("DYrwi3FjL9i87kRPq9Sex7i1qVBPTqwvjjCLJmR2fRGz"), + sender: pubkey!("3Fki2gTbdT3YQQzGkE3nJA2djU3ijsfCw7EYprqroBGP"), + rent_receiver: pubkey!("3Fki2gTbdT3YQQzGkE3nJA2djU3ijsfCw7EYprqroBGP"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/close_position2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClosePosition2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_migrate_bin_array_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::MigrateBinArray(MigrateBinArray {}); + let expected_accounts = vec![AccountMeta::new_readonly( + pubkey!("zNLqkEXHxVDAbyjSSA8E17e1ksw5XEGrAA2Jha6e3FH"), + false, + )]; + let expected_arranged_accounts = MigrateBinArrayInstructionAccounts { + lb_pair: pubkey!("zNLqkEXHxVDAbyjSSA8E17e1ksw5XEGrAA2Jha6e3FH"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/migrate_bin_array_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + MigrateBinArray::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_remove_liquidity_by_range2_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::RemoveLiquidityByRange2(RemoveLiquidityByRange2 { + bps_to_remove: 10000, + from_bin_id: -3567, + remaining_accounts_info: RemainingAccountsInfo { + slices: vec![ + RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookX, + length: 0, + }, + RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookY, + length: 0, + }, + ], + }, + to_bin_id: -3499, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Cz3nviU2HQofE4cnZGDPTgt9q3T6eMEQbmuaGZB9noXg"), + false, + ), + AccountMeta::new( + pubkey!("AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("2MEBV4deAZ8P2E9ZwKZji9RmQFh4y266hoDh7zRcGjcf"), + false, + ), + AccountMeta::new( + pubkey!("3EY5CVGgCKc5EEfdv5b1aVe2GMevERW69644nLJ4Er6K"), + false, + ), + AccountMeta::new( + pubkey!("DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8"), + false, + ), + AccountMeta::new( + pubkey!("6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc"), + false, + ), + AccountMeta::new_readonly( + pubkey!("Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("7urKMjRZKVt5z2vKRt6tV1xHFQWH3227g6KngnhkFidL"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = RemoveLiquidityByRange2InstructionAccounts { + position: pubkey!("Cz3nviU2HQofE4cnZGDPTgt9q3T6eMEQbmuaGZB9noXg"), + lb_pair: pubkey!("AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("2MEBV4deAZ8P2E9ZwKZji9RmQFh4y266hoDh7zRcGjcf"), + user_token_y: pubkey!("3EY5CVGgCKc5EEfdv5b1aVe2GMevERW69644nLJ4Er6K"), + reserve_x: pubkey!("DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8"), + reserve_y: pubkey!("6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc"), + token_x_mint: pubkey!("Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + sender: pubkey!("7urKMjRZKVt5z2vKRt6tV1xHFQWH3227g6KngnhkFidL"), + token_x_program: pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/remove_liquidity_by_range2_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + RemoveLiquidityByRange2::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_remove_liquidity2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::RemoveLiquidity2(RemoveLiquidity2 { + bin_liquidity_removal: vec![BinLiquidityReduction { + bin_id: -560, + bps_to_remove: 10000, + }], + remaining_accounts_info: RemainingAccountsInfo { + slices: vec![ + RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookX, + length: 0, + }, + RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookY, + length: 0, + }, + ], + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("3gWKqojAWeJRgdSe3bPyzNwjAdjeyaYJuraTEbFkEn9x"), + false, + ), + AccountMeta::new( + pubkey!("FvgJNjvU1swX8roYZpJ3BpjwVDqcrM2tEt18nhTNLCfd"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("Eurd4K4mrUypp3EhXxvBPhUm3e9WLoLyAwkzNDXv4shW"), + false, + ), + AccountMeta::new( + pubkey!("EgJsiHQDTfxXH6EkNTqLE6jd1H9Q1GZJPRMzVDfZKPGn"), + false, + ), + AccountMeta::new( + pubkey!("2u8ZyhXETPLkTGFhgtFm3zjpD1PosF7VySFoc9PdQQ7K"), + false, + ), + AccountMeta::new( + pubkey!("4UN3pAUqsM1X73zPTG1iLaxAWxy5vzg8kspBbqfPEq2n"), + false, + ), + AccountMeta::new_readonly( + pubkey!("dHNnE3a7aJpwmfGhh5QssrPUj4gAMNdkaCvUwyTwest"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("9NQ5D4CjcTa4AsXZ37j7gAjEJiqjSgn5SSTftryMwest"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = RemoveLiquidity2InstructionAccounts { + position: pubkey!("3gWKqojAWeJRgdSe3bPyzNwjAdjeyaYJuraTEbFkEn9x"), + lb_pair: pubkey!("FvgJNjvU1swX8roYZpJ3BpjwVDqcrM2tEt18nhTNLCfd"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user_token_x: pubkey!("Eurd4K4mrUypp3EhXxvBPhUm3e9WLoLyAwkzNDXv4shW"), + user_token_y: pubkey!("EgJsiHQDTfxXH6EkNTqLE6jd1H9Q1GZJPRMzVDfZKPGn"), + reserve_x: pubkey!("2u8ZyhXETPLkTGFhgtFm3zjpD1PosF7VySFoc9PdQQ7K"), + reserve_y: pubkey!("4UN3pAUqsM1X73zPTG1iLaxAWxy5vzg8kspBbqfPEq2n"), + token_x_mint: pubkey!("dHNnE3a7aJpwmfGhh5QssrPUj4gAMNdkaCvUwyTwest"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + sender: pubkey!("9NQ5D4CjcTa4AsXZ37j7gAjEJiqjSgn5SSTftryMwest"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/remove_liquidity2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + RemoveLiquidity2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_set_activation_point_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::SetActivationPoint(SetActivationPoint { + activation_point: 1748178300, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + ]; + let expected_arranged_accounts = SetActivationPointInstructionAccounts { + lb_pair: pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/set_activation_point_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SetActivationPoint::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_set_pair_status_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::SetPairStatus(SetPairStatus { status: 1 }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + ]; + let expected_arranged_accounts = SetPairStatusInstructionAccounts { + lb_pair: pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/set_pair_status_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SetPairStatus::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_set_pair_status_permissionless_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::SetPairStatusPermissionless(SetPairStatusPermissionless { + status: 0, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("C6881xvUWFRBFgDX8TrdiuQzHf6gBrmrh6DRzGa5B3Ft"), + false, + ), + AccountMeta::new( + pubkey!("E4PmHc6Hmsf5soqFsz9ZjsGwTwNjkWd9pw5MZfRctP6e"), + true, + ), + ]; + let expected_arranged_accounts = SetPairStatusPermissionlessInstructionAccounts { + lb_pair: pubkey!("C6881xvUWFRBFgDX8TrdiuQzHf6gBrmrh6DRzGa5B3Ft"), + creator: pubkey!("E4PmHc6Hmsf5soqFsz9ZjsGwTwNjkWd9pw5MZfRctP6e"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/set_pair_status_permissionless_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SetPairStatusPermissionless::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_set_pre_activation_duration_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::SetPreActivationDuration(SetPreActivationDuration { + pre_activation_duration: 3600, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + ]; + let expected_arranged_accounts = SetPreActivationDurationInstructionAccounts { + lb_pair: pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + creator: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/set_pre_activation_duration_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SetPreActivationDuration::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_set_pre_activation_swap_address_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::SetPreActivationSwapAddress(SetPreActivationSwapAddress { + pre_activation_swap_address: pubkey!( + "8gCqHrCcP5PxUf2fPR1nre5B9t2HjWQu6StujDCor4oW" + ), + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + ]; + let expected_arranged_accounts = SetPreActivationSwapAddressInstructionAccounts { + lb_pair: pubkey!("Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj"), + creator: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/set_pre_activation_swap_address_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SetPreActivationSwapAddress::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_swap_exact_out2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::SwapExactOut2(SwapExactOut2 { + max_in_amount: 3826290145, + out_amount: 4891000000000, + remaining_accounts_info: RemainingAccountsInfo { slices: vec![] }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8"), + false, + ), + AccountMeta::new( + pubkey!("6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc"), + false, + ), + AccountMeta::new( + pubkey!("GShxvtESt69624EjwvbLBTHmQYcBUn6KKce3Wm7fCqmL"), + false, + ), + AccountMeta::new( + pubkey!("8y1KDhsqTqi9poaExmnGJ9mUaNa8K1Y5fi6M1LsXZwYi"), + false, + ), + AccountMeta::new_readonly( + pubkey!("Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("AFH1UXkECQwYoWkkCSydxU8UGciH8jxqB9EebV1NJVHs"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("G3ztVULQTspy6wBwKVtGHMfX3GBi1FtsfQHzz3RU2bon"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = SwapExactOut2InstructionAccounts { + lb_pair: pubkey!("AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + reserve_x: pubkey!("DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8"), + reserve_y: pubkey!("6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc"), + user_token_in: pubkey!("GShxvtESt69624EjwvbLBTHmQYcBUn6KKce3Wm7fCqmL"), + user_token_out: pubkey!("8y1KDhsqTqi9poaExmnGJ9mUaNa8K1Y5fi6M1LsXZwYi"), + token_x_mint: pubkey!("Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + oracle: pubkey!("AFH1UXkECQwYoWkkCSydxU8UGciH8jxqB9EebV1NJVHs"), + host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user: pubkey!("G3ztVULQTspy6wBwKVtGHMfX3GBi1FtsfQHzz3RU2bon"), + token_x_program: pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/swap_exact_out2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SwapExactOut2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_swap_with_price_impact2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::SwapWithPriceImpact2(SwapWithPriceImpact2 { + active_id: Some(-533), + amount_in: 58823, + max_price_impact_bps: 1000, + remaining_accounts_info: RemainingAccountsInfo { slices: vec![] }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("D4ARLASjg2Suy7M6vQtHAvx5NZEECuR7SFzWXhp41hfY"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("6RPeoQaz4aCCLY92qiF22eymiu8HtXfi6o96PCHro85R"), + false, + ), + AccountMeta::new( + pubkey!("Eq7wrmK1m4DpvihrnGwzBPccbsdP8u4nxi3obZ4325MC"), + false, + ), + AccountMeta::new( + pubkey!("2YGA6ogjCtCJGg5HaPpreiH7qeiQEWsboiV1UhNVk8LB"), + false, + ), + AccountMeta::new( + pubkey!("J1aRY8W75LHRoTrQjKri9ZrnZWVwH6b9pMYAJYLCxQk1"), + false, + ), + AccountMeta::new_readonly( + pubkey!("7VnT8zHzorYS92snKC4CZU2veigEVnVVBSxTw7G1pump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("CS4LtXuwrM5Z7UcS1GsA9KdSzo6d2yzsaVcJ3YkUvwzj"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("6ZgXjkSmcAqV2ELiRv33D16CQV5GAkFpL8jmuBg5QfPY"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = SwapWithPriceImpact2InstructionAccounts { + lb_pair: pubkey!("D4ARLASjg2Suy7M6vQtHAvx5NZEECuR7SFzWXhp41hfY"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + reserve_x: pubkey!("6RPeoQaz4aCCLY92qiF22eymiu8HtXfi6o96PCHro85R"), + reserve_y: pubkey!("Eq7wrmK1m4DpvihrnGwzBPccbsdP8u4nxi3obZ4325MC"), + user_token_in: pubkey!("2YGA6ogjCtCJGg5HaPpreiH7qeiQEWsboiV1UhNVk8LB"), + user_token_out: pubkey!("J1aRY8W75LHRoTrQjKri9ZrnZWVwH6b9pMYAJYLCxQk1"), + token_x_mint: pubkey!("7VnT8zHzorYS92snKC4CZU2veigEVnVVBSxTw7G1pump"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + oracle: pubkey!("CS4LtXuwrM5Z7UcS1GsA9KdSzo6d2yzsaVcJ3YkUvwzj"), + host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user: pubkey!("6ZgXjkSmcAqV2ELiRv33D16CQV5GAkFpL8jmuBg5QfPY"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/swap_with_price_impact2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + SwapWithPriceImpact2::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_swap2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::Swap2(Swap2 { + amount_in: 217206901, + min_amount_out: 0, + remaining_accounts_info: RemainingAccountsInfo { slices: vec![] }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("5cuy7pMhTPhVZN9xuhgSbykRb986siGJb6vnEtkuBrSU"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("9wbTcHco8daQYxVPWn1eqDQe2YPY3ak3gPfQuYAcZ4PJ"), + false, + ), + AccountMeta::new( + pubkey!("Cpwo6h4koL8pC87R17g1dX8zfEQ6Pnv3AHXGPpNJqBuf"), + false, + ), + AccountMeta::new( + pubkey!("CPVAAuzZGX4nBk1o42qLVSZf9PQEVGdh6wcpxw8bF6Ar"), + false, + ), + AccountMeta::new( + pubkey!("53mNdjYekY37E5JQ9vXB57seaTxt2j6degVmcXLVr77r"), + false, + ), + AccountMeta::new_readonly( + pubkey!("27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4"), + false, + ), + AccountMeta::new_readonly( + pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + false, + ), + AccountMeta::new( + pubkey!("2NBaawB9aeYocWvyiECcDxSSwcyJd1B8oaHzpyEFbapc"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new( + pubkey!("AmZaQwdMRKNC5JzRUujZfrVFyjmoUuvrRmc6iKnQHEv6"), + true, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = Swap2InstructionAccounts { + lb_pair: pubkey!("5cuy7pMhTPhVZN9xuhgSbykRb986siGJb6vnEtkuBrSU"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + reserve_x: pubkey!("9wbTcHco8daQYxVPWn1eqDQe2YPY3ak3gPfQuYAcZ4PJ"), + reserve_y: pubkey!("Cpwo6h4koL8pC87R17g1dX8zfEQ6Pnv3AHXGPpNJqBuf"), + user_token_in: pubkey!("CPVAAuzZGX4nBk1o42qLVSZf9PQEVGdh6wcpxw8bF6Ar"), + user_token_out: pubkey!("53mNdjYekY37E5JQ9vXB57seaTxt2j6degVmcXLVr77r"), + token_x_mint: pubkey!("27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4"), + token_y_mint: pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), + oracle: pubkey!("2NBaawB9aeYocWvyiECcDxSSwcyJd1B8oaHzpyEFbapc"), + host_fee_in: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + user: pubkey!("AmZaQwdMRKNC5JzRUujZfrVFyjmoUuvrRmc6iKnQHEv6"), + token_x_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_y_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + Swap2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_update_base_fee_parameters_ix() { + // Arrange + let expected_ix = + MeteoraDlmmInstruction::UpdateBaseFeeParameters(UpdateBaseFeeParameters { + fee_parameter: BaseFeeParameter { + base_factor: 3125, + base_fee_power_factor: 0, + protocol_share: 2000, + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("4uPKbdiUTdLWjTMGwUQb2tiw1HYhy6FLSmZU5tx85vBZ"), + false, + ), + AccountMeta::new( + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + true, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = UpdateBaseFeeParametersInstructionAccounts { + lb_pair: pubkey!("4uPKbdiUTdLWjTMGwUQb2tiw1HYhy6FLSmZU5tx85vBZ"), + admin: pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction( + "tests/fixtures/update_base_fee_parameters_ix.json", + ) + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + UpdateBaseFeeParameters::arrange_accounts(&instruction.accounts) + .expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_claim_fee2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClaimFee2(ClaimFee2 { + max_bin_id: -3601, + min_bin_id: -3669, + remaining_accounts_info: RemainingAccountsInfo { + slices: vec![ + RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookX, + length: 0, + }, + RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookY, + length: 0, + }, + ], + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs"), + false, + ), + AccountMeta::new( + pubkey!("JBgwd6QqY1QANj5mY6ccBRuVxsfvoJkLVeSWDxvNT2bw"), + false, + ), + AccountMeta::new( + pubkey!("ACwQDp4FqpvMaYbCDQomDPYTawGbfi49cdZqUABjCqTm"), + true, + ), + AccountMeta::new( + pubkey!("DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8"), + false, + ), + AccountMeta::new( + pubkey!("6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc"), + false, + ), + AccountMeta::new( + pubkey!("CgB7w527GSoFjQc5p8E3jn93eVj7ByNb6TjTKArU45vs"), + false, + ), + AccountMeta::new( + pubkey!("EZizF1NkMtyQavZy4E5NK6SN8wnJFdukgPhMRVbpPZ6i"), + false, + ), + AccountMeta::new_readonly( + pubkey!("Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClaimFee2InstructionAccounts { + lb_pair: pubkey!("AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs"), + position: pubkey!("JBgwd6QqY1QANj5mY6ccBRuVxsfvoJkLVeSWDxvNT2bw"), + sender: pubkey!("ACwQDp4FqpvMaYbCDQomDPYTawGbfi49cdZqUABjCqTm"), + reserve_x: pubkey!("DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8"), + reserve_y: pubkey!("6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc"), + user_token_x: pubkey!("CgB7w527GSoFjQc5p8E3jn93eVj7ByNb6TjTKArU45vs"), + user_token_y: pubkey!("EZizF1NkMtyQavZy4E5NK6SN8wnJFdukgPhMRVbpPZ6i"), + token_x_mint: pubkey!("Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk"), + token_y_mint: pubkey!("So11111111111111111111111111111111111111112"), + token_program_x: pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"), + token_program_y: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = carbon_test_utils::read_instruction("tests/fixtures/claim_fee2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClaimFee2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_claim_reward2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::ClaimReward2(ClaimReward2 { + max_bin_id: 4, + min_bin_id: 4, + remaining_accounts_info: RemainingAccountsInfo { + slices: vec![RemainingAccountsSlice { + accounts_type: AccountsType::TransferHookReward, + length: 0, + }], + }, + reward_index: 0, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("4wM3eJMduZBFytW6VqV5DC2CaSovRrM2RJG8bJkroqLD"), + false, + ), + AccountMeta::new( + pubkey!("5qeKgwuWULUacKHQxeTyJH1hzr4xXEDS6PwCfuSC8ntf"), + false, + ), + AccountMeta::new( + pubkey!("GKELxnW2LL2aHXe61pCoCFyko2UjZKKwRgHg8kCyGNzv"), + true, + ), + AccountMeta::new( + pubkey!("DLuW6nRywCBG5BssbaFpLfLsMSoXoXRiuzUtH6VJb12c"), + false, + ), + AccountMeta::new_readonly( + pubkey!("AuQaustGiaqxRvj2gtCdrd22PBzTn8kM3kEPEkZCtuDw"), + false, + ), + AccountMeta::new( + pubkey!("Co1sWgvQ3KvTgsGcHZy9YNA9s7oNjDL6xH2RNJbWxDPC"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + false, + ), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = ClaimReward2InstructionAccounts { + lb_pair: pubkey!("4wM3eJMduZBFytW6VqV5DC2CaSovRrM2RJG8bJkroqLD"), + position: pubkey!("5qeKgwuWULUacKHQxeTyJH1hzr4xXEDS6PwCfuSC8ntf"), + sender: pubkey!("GKELxnW2LL2aHXe61pCoCFyko2UjZKKwRgHg8kCyGNzv"), + reward_vault: pubkey!("DLuW6nRywCBG5BssbaFpLfLsMSoXoXRiuzUtH6VJb12c"), + reward_mint: pubkey!("AuQaustGiaqxRvj2gtCdrd22PBzTn8kM3kEPEkZCtuDw"), + user_token_account: pubkey!("Co1sWgvQ3KvTgsGcHZy9YNA9s7oNjDL6xH2RNJbWxDPC"), + token_program: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + memo_program: pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/claim_reward2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + ClaimReward2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } + + #[test] + fn test_decode_initialize_lb_pair2_ix() { + // Arrange + let expected_ix = MeteoraDlmmInstruction::InitializeLbPair2(InitializeLbPair2 { + params: InitializeLbPair2Params { + active_id: -341, + padding: [0; 96], + }, + }); + let expected_accounts = vec![ + AccountMeta::new( + pubkey!("AythiR24hnGBjPq6FK6ADiVGqXHTbBpydkBPfNC1ndgg"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("B7zNKphr8fjczB71oi9uF9pCd5XSNJvBn78TVF7kpump"), + false, + ), + AccountMeta::new_readonly( + pubkey!("So11111111111111111111111111111111111111112"), + false, + ), + AccountMeta::new( + pubkey!("7PMC89FyUXvjoK5V1ZZJQWWGXbXt6h9n3qS4dBVg7Yn4"), + false, + ), + AccountMeta::new( + pubkey!("2EPCtbGKWKeFnpdevbRAthgGqpA6WRqYMSjfEBMZH5oZ"), + false, + ), + AccountMeta::new( + pubkey!("Dnfpn4ZCRSCxtoYFcbNowGP215dsed2N45SS693GTY5W"), + false, + ), + AccountMeta::new_readonly( + pubkey!("CrZUmJzkSs4TWg8GpCq5UGRX4ryRYHYYVQQ4dNMYo1GW"), + false, + ), + AccountMeta::new( + pubkey!("EaeLcEeKz3XoN9xn99kjJhmWZzdVx2dJ4uYxqRYxRWhG"), + true, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly( + pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + false, + ), + AccountMeta::new_readonly(pubkey!("11111111111111111111111111111111"), false), + AccountMeta::new_readonly( + pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + false, + ), + AccountMeta::new_readonly( + pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + false, + ), + ]; + let expected_arranged_accounts = InitializeLbPair2InstructionAccounts { + lb_pair: pubkey!("AythiR24hnGBjPq6FK6ADiVGqXHTbBpydkBPfNC1ndgg"), + bin_array_bitmap_extension: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_mint_x: pubkey!("B7zNKphr8fjczB71oi9uF9pCd5XSNJvBn78TVF7kpump"), + token_mint_y: pubkey!("So11111111111111111111111111111111111111112"), + reserve_x: pubkey!("7PMC89FyUXvjoK5V1ZZJQWWGXbXt6h9n3qS4dBVg7Yn4"), + reserve_y: pubkey!("2EPCtbGKWKeFnpdevbRAthgGqpA6WRqYMSjfEBMZH5oZ"), + oracle: pubkey!("Dnfpn4ZCRSCxtoYFcbNowGP215dsed2N45SS693GTY5W"), + preset_parameter: pubkey!("CrZUmJzkSs4TWg8GpCq5UGRX4ryRYHYYVQQ4dNMYo1GW"), + funder: pubkey!("EaeLcEeKz3XoN9xn99kjJhmWZzdVx2dJ4uYxqRYxRWhG"), + token_badge_x: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_badge_y: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + token_program_x: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + token_program_y: pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), + system_program: pubkey!("11111111111111111111111111111111"), + event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), + program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), + }; + + // Act + let decoder = MeteoraDlmmDecoder; + let instruction = + carbon_test_utils::read_instruction("tests/fixtures/initialize_lb_pair2_ix.json") + .expect("read fixture"); + let decoded = decoder + .decode_instruction(&instruction) + .expect("decode instruction"); + let decoded_arranged_accounts = + InitializeLbPair2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); + + // Assert + assert_eq!(decoded.data, expected_ix); + assert_eq!(decoded.accounts, expected_accounts); + assert_eq!(decoded.program_id, PROGRAM_ID); + assert_eq!(decoded_arranged_accounts, expected_arranged_accounts); + } } diff --git a/decoders/meteora-dlmm-decoder/tests/README.md b/decoders/meteora-dlmm-decoder/tests/README.md index 5924e8975..eb74174b8 100644 --- a/decoders/meteora-dlmm-decoder/tests/README.md +++ b/decoders/meteora-dlmm-decoder/tests/README.md @@ -1,10 +1,10 @@ # Meteora DLMM Decoder Tests ## Instructions + - [InitializeLbPair](https://solscan.io/tx/56zeqRP2pjAHPbub9ayteMy3PWunbaQCWbHrYULiQnhq1GvPe6njTyYyaqQupgNA9NYWBtDYFwos6hxJLVmLXw3U) - [InitializePermissionLbPair](https://solscan.io/tx/2bHYoha1NTNRSJtpLxoxz2kDcUkJtoT47dNECGJJ1MnaP7cb5a58YW2Wo3yoHqDxKLQk941o42hUHyYowwkfsRYL) - [InitializeCustomizablePermissionlessLbPair](https://solscan.io/tx/4cEZB1GzzN3J8UGSvfuv7C2wPEBT6Tu9xGBi8NSxUWXr3cB2V3Jtiuo1fyXZ8dhR3V87q2mF3LqjDk7xPPFmtP5H) -- [InitializeCustomizablePermissionlessLbPair2](https://solscan.io/tx/5juhYiMn1XieEHi93nFnWkuNLqQtjJqWR5cKVUBSi7EKazYt7apNz5nZGYwuJZJRftyR4bnPZ9yixT63Lna4uVQt) - [InitializeBinArrayBitmapExtension](https://solscan.io/tx/2b4xwjdYGZ51rKJEyNwKuExXVvHYQgsdfuT1BfHicN3dUfnCJsmAqMQk35Y4UqdvVsDCeiHaiMUzdcU4xSWwwboV) - [InitializeBinArray](https://solscan.io/tx/2n5bjg2rMaTMJroCaYuKYLRoKMd2nbrhAhSRcVKWZ5ST21SjGXRbgMN8FGQnu43n9eKnRsvrCfhTBdmHioUYQRYx) - [AddLiquidity](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) @@ -16,28 +16,74 @@ - [InitializePosition](https://solscan.io/tx/zrqVY1PNvqnPDfAnVAtKM7iiHs6sn6RogmhUzR6tH2bCZojsR4mRKMM76Azy7rkcEEMHfzdznoLhybkDkbnSPn3) - [InitializePositionPda](https://solscan.io/tx/3TQrSnFEAXcYPW7eeM1S6h5jKSHrfZkVSN7rBJENRzUxfhRamdhjbWpLoTRFkaA2FzaTLBUGcz2Hq2tWtSbZ1z5T) - [InitializePositionByOperator](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) -- [UpdatePositionOperator](https://solscan.io/tx/3AGve6b9pcS7kccSDqXA1FJEhPSoLuSo7r5aW446JmMFArZyEZNxFgtyWTvhBwt1vyGQdtNgHxPZ9rgx2pAPTowB) +- [UpdatePositionOperator]() - [Swap](https://solscan.io/tx/4J8uonoGnUeAoecArQpLoJixmygouDS8jZQ15aZymJTzFxfmWNbxGgv8LMqsgbuQ2NTD4vw2EzTnZ8PEDx6RHwt4) - [SwapExactOut](https://solscan.io/tx/1Ndo68TjDrqaBxAr7pAdhCcfqg6TdbfFMVjvs7mtBCbG7Yacw4SPxnjQtfN722EAy8QkjmkbDBr8xXy93dqud94) +- [SwapWithPriceImpact]() +- [WithdrawProtocolFee]() +- [InitializeReward]() +- [FundReward]() +- [UpdateRewardFunder]() +- [UpdateRewardDuration]() - [ClaimReward](https://solscan.io/tx/47De6LKmvLXnyF1LsbFenYGbbRPzsyXhrdiaMHyQUE6r8o1jJt9YGXJF9S11FWmSRHr5Tz1YVLwhxxiUNAG6RMTa) - [ClaimFee](https://solscan.io/tx/3oYQxHQFimNBmXoFe2kqoKLvEPWJhNbmSGMuyXJPZ6XviB2jeTfhtNUd16u7CCikNL5v1jfwkdh5GtA969tNQKrY) - [ClosePosition](https://solscan.io/tx/2yGLHktGYho1rQ4eiVvtAEfmfXJdMjPoLdaixjg4RvHp2LB9bFn1ZN2A16bibUQkSNgwyQGucRSZxTtGWDNEb2KD) +- [UpdateBaseFeeParameters](https://solscan.io/tx/4GRy75v2vAhT6AtyuAEkcAkgVZxqi6tQ86ektrzfo12AidCptFbU1L6ZTrhsHt1PDFQiE5f4UY9g6bdEtYGRufeC) +- [UpdateDynamicFeeParameters]() +- [IncreaseOracleLength]() +- [InitializePresetParameter]() +- [ClosePresetParameter]() +- [ClosePresetParameter2]() - [RemoveAllLiquidity](https://solscan.io/tx/45DLXSXVcogvrURaYa3rM5htZTh3VUGeHNsJ1AsmZH7NXtDBkbrNy58AyibkzLxLLoAeKY78xeyPUshjYPW3QEV6) +- [SetPairStatus](https://solscan.io/tx/24Z6GE6QGxmXAsbZ2ScMHH1oVkwwcZzq2Spjbj1PWfcE399EdGV3EznuNcj9716wbzo35DxZSh2AjxmRKgQdkZ7L) - [MigratePosition](https://solscan.io/tx/3B61kxDTC2a5rwW6CCVu83tQb8G6MLRBumeLEUFLCW264NgCEUefSpG5dEbWptC8W7BqM3HCsNbmLFHjoTVFMz11) +- [MigrateBinArray](https://solscan.io/tx/duv9e6HzNqMHiyGJqEWFfRGtaNcPQS525S667ZQN6xNKWTnQKRRyeXJEkptUcaxr1FRHsWJVjmnHDHRkALua6nR) +- [UpdateFeesAndRewards](https://solscan.io/tx/2fzD1qpTMpc1EGGKFgtfKCBMXUKBbk9QycKVfnTmDzjNj6mURFjeYeSEbZwQBJ9uqekgiNL5r6xqDGjqUan9Rdg7) +- [WithdrawIneligibleReward]() +- [SetActivationPoint](https://solscan.io/tx/2bHYoha1NTNRSJtpLxoxz2kDcUkJtoT47dNECGJJ1MnaP7cb5a58YW2Wo3yoHqDxKLQk941o42hUHyYowwkfsRYL) - [RemoveLiquidityByRange](https://solscan.io/tx/hmd7WZ2wnDYA4yWJLYD1URk3UQu5q18Ln7nR3QcXN7zSXuZPrv5QFgE5Jz9rsxgsi2dTu4yAPtdUKQGYLLvyqAB) - [AddLiquidityOneSidePrecise](https://solscan.io/tx/39URMKxPHuZyNQdDxTtxE2A5SHmEmcMDGM8Ee2dXtaR7btLqUMsXhJWRuLopN5rC9x1gd5VbcfeGUY11H1M9a3oe) - [GoToABin](https://solscan.io/tx/31VhsCV7ki9K97BWupQC4YkLsBgbuEvXvKMgL3fQY5aCTjXGTxktGJZtoC37zSLc4Lt3tHKsbdpAGr7BVXr6mJrz) -- [FundReward]() -- [InitializePresetParameter]() -- [InitializeReward]() -- [SwapWithPriceImpact]() -- [UpdateFeeParameters]() +- [SetPreActivationDuration](https://solscan.io/tx/2bHYoha1NTNRSJtpLxoxz2kDcUkJtoT47dNECGJJ1MnaP7cb5a58YW2Wo3yoHqDxKLQk941o42hUHyYowwkfsRYL) +- [SetPreActivationSwapAddress](https://solscan.io/tx/2bHYoha1NTNRSJtpLxoxz2kDcUkJtoT47dNECGJJ1MnaP7cb5a58YW2Wo3yoHqDxKLQk941o42hUHyYowwkfsRYL) +- [SetPairStatusPermissionless](https://solscan.io/tx/38NwwYPhJ9uRh2S8jgAvTB4jjRzctFkGggbSFesUc7JoVNk8RHxLx3Wsm7chaVdmKgx5QBt8Mdgnx2j1vnza66qy) +- [InitializeTokenBadge]() +- [CreateClaimProtocolFeeOperator]() +- [CloseClaimProtocolFeeOperator]() +- [InitializePresetParameter2]() +- [InitializeLbPair2](https://solscan.io/tx/2BUmuqDiKavSscF9YGNdpu4migRQcmju2tgfYPDTa1NLHNAQmJaKXbf2CQJvAuRzpzBtUiVj1WHYBFVfdxkJvjmm) +- [InitializeCustomizablePermissionlessLbPair2](https://solscan.io/tx/5juhYiMn1XieEHi93nFnWkuNLqQtjJqWR5cKVUBSi7EKazYt7apNz5nZGYwuJZJRftyR4bnPZ9yixT63Lna4uVQt) +- [ClaimFee2](https://solscan.io/tx/bCPYXctaqAzSPwwNHYMunfvuEYvhWQ2cz4DKmZAGvXizfo4CvemPwRAvUMtuPUEHS3gvhKL38Cz9xvdSuHX8sj3) +- [ClaimReward2](https://solscan.io/tx/6587VkDfdo1dBxu3c6YxVcHKzvotqsD5sHL3VSs6dpykFPdXrvkETnq2UjtUj2TQZDq5CHj8nk8obCrfkkTBewoT) +- [AddLiquidity2](https://solscan.io/tx/2MBEMMZHdfh7xkgY39k7h7hwL18opUQUVsW9ECxhDfpLjj1SEz33nUVJj55jw8RaPfXhVexjXzFQRfJweL2xnSUK) +- [AddLiquidityByStrategy2](https://solscan.io/tx/2aMUkD3qxKw1DvCCK8AWuP3Vxz2LEFbRhw1DToHo4q8JvrstNTtu86yp47MTKWopQgSLsB6JkwKbuP2czeBoyiMc) +- [AddLiquidityOneSidePrecise2](https://solscan.io/tx/4Nwd5V9ZAK1LbRo34qETHjWW4BpWw7515jgq6cm9ynbXZP891AhdhCJs9qz8DwAAewuKVBjUQbbHKW21hGL9w96o) +- [RemoveLiquidity2](https://solscan.io/tx/3nTQDQS8qfvvveNNtEjwzvsD31c7151DTZeAAN1PEJ7Tu83qxHoHwRraTsS6RgGA75KD7nxmdgA8csSH48GiJTst) +- [RemoveLiquidityByRange2](https://solscan.io/tx/3VwUQo7k54A8XkocER5XZBXDco1GBWHakKTGYvFz89HACj6TTc3EYX1zGtHBHW9cWyuZjUgPpZrRsuKa3t4FyGH5) +- [Swap2](https://solscan.io/tx/2S8qzdNhzLz285PFe7X1yjSAfjJxUXTxet5o6YD4VVHVvE59jq8hpkwkyQfBbBb9MhxeuCAmGnoypAJvh6a6zDKo) +- [SwapExactOut2](https://solscan.io/tx/3PK1fSBUaVfyngSncZdVCmrGQxbLA7yDrpKoqpdJB7Vj6Y3dinvQAL54YRf6n1ZS4LziYGQNom76pzxczGhzEDLz) +- [SwapWithPriceImpact2](https://solscan.io/tx/4RcdWjyZYZdvqeG4Rfrn8qHfXUitYEUkuRVEUhHQLH2caPTsUCkHdxPDM24p5RCRsCNFeU2v9rovcKja8q736Xov) +- [ClosePosition2](https://solscan.io/tx/zCKBMs7kHLzQ8gUzMmZgfNcC32ZHDFb57KkCNK1bxXnKffYRMwyUJK7EfTVVJsrmj58ro7XC8vBWZvAk6CQQNic) +- [UpdateFeesAndReward2]() +- [ClosePositionIfEmpty](https://solscan.io/tx/65Ejqb5xMh4kzmh87MxeiFmQ9AT45NqrjhFgNmqY5dfUCMuSi8uwmbfTe87M8HYYS5tvXgi5mW44Xrmmsu4CbmE3) + +- [CompositionFeeEvent]() +- [AddLiquidityEvent]() +- [RemoveLiquidityEvent]() +- [SwapEvent]() +- [ClaimRewardEvent]() +- [FundRewardEvent]() +- [InitializeRewardEvent]() +- [UpdateRewardDurationEvent]() - [UpdateRewardFunderEvent]() - [PositionCloseEvent]() - [ClaimFeeEvent]() - [LbPairCreateEvent]() - [PositionCreateEvent]() +- [IncreasePositionLengthEvent]() +- [DecreasePositionLengthEvent]() - [FeeParameterUpdateEvent]() +- [DynamicFeeParameterUpdateEvent]() - [IncreaseObservationEvent]() - [WithdrawIneligibleRewardEvent]() - [UpdatePositionOperatorEvent]() @@ -51,5 +97,8 @@ - [PresetParameter](https://solscan.io/account/F37fb46nFwBTK5Q5upDWjfkZetRyV7dqeUP9LfSvhi6c) - [BinArrayBitmapExtension]() - [BinArray]() -- [Oracle]() -- [PositionV2]() \ No newline at end of file +- [ClaimFeeOperator]() +- [Oracle](https://solscan.io/account/sUiZ2rXZyD2B5aGVZeK9XXrsgCAgvhNPedTuePVpkA2) +- [PositionV2]() +- [PresetParameter2]() +- [TokenBadge]() diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee2_ix.json new file mode 100644 index 000000000..a7126c0b6 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_fee2_ix.json @@ -0,0 +1,90 @@ +{ + "accounts": [ + { + "pubkey": "AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "JBgwd6QqY1QANj5mY6ccBRuVxsfvoJkLVeSWDxvNT2bw", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "ACwQDp4FqpvMaYbCDQomDPYTawGbfi49cdZqUABjCqTm", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "CgB7w527GSoFjQc5p8E3jn93eVj7ByNb6TjTKArU45vs", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "EZizF1NkMtyQavZy4E5NK6SN8wnJFdukgPhMRVbpPZ6i", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "is_signer": false, + "is_writable": false, + "label": "tokenProgramX" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgramY" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "70bf65ab1c907fbbabf1ffffeff1ffff0200000000000100", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward2_ix.json new file mode 100644 index 000000000..510d205a2 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/claim_reward2_ix.json @@ -0,0 +1,66 @@ +{ + "accounts": [ + { + "pubkey": "4wM3eJMduZBFytW6VqV5DC2CaSovRrM2RJG8bJkroqLD", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5qeKgwuWULUacKHQxeTyJH1hzr4xXEDS6PwCfuSC8ntf", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "GKELxnW2LL2aHXe61pCoCFyko2UjZKKwRgHg8kCyGNzv", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "DLuW6nRywCBG5BssbaFpLfLsMSoXoXRiuzUtH6VJb12c", + "is_signer": false, + "is_writable": true, + "label": "rewardVault" + }, + { + "pubkey": "AuQaustGiaqxRvj2gtCdrd22PBzTn8kM3kEPEkZCtuDw", + "is_signer": false, + "is_writable": false, + "label": "rewardMint" + }, + { + "pubkey": "Co1sWgvQ3KvTgsGcHZy9YNA9s7oNjDL6xH2RNJbWxDPC", + "is_signer": false, + "is_writable": true, + "label": "userTokenAccount" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgram" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "be037f77b2579db700000000000000000400000004000000010000000200", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/close_position2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/close_position2_ix.json new file mode 100644 index 000000000..155fac4aa --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/close_position2_ix.json @@ -0,0 +1,36 @@ +{ + "accounts": [ + { + "pubkey": "DYrwi3FjL9i87kRPq9Sex7i1qVBPTqwvjjCLJmR2fRGz", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "3Fki2gTbdT3YQQzGkE3nJA2djU3ijsfCw7EYprqroBGP", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "3Fki2gTbdT3YQQzGkE3nJA2djU3ijsfCw7EYprqroBGP", + "is_signer": true, + "is_writable": true, + "label": "rentReceiver" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "ae5a2373ba2893e2", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/close_position_if_empty_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/close_position_if_empty_ix.json new file mode 100644 index 000000000..527309c0d --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/close_position_if_empty_ix.json @@ -0,0 +1,36 @@ +{ + "accounts": [ + { + "pubkey": "5zasWBT9q3SxnY5nnCYXX6f95f35Jd99f7b6e41Ld8iQ", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "4R1YbARsv2PjznvXFfPG9tGzHXZnDjP9gHhGQuKGnXi1", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "4R1YbARsv2PjznvXFfPG9tGzHXZnDjP9gHhGQuKGnXi1", + "is_signer": true, + "is_writable": true, + "label": "rentReceiver" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "3b7cd4765b986e9d", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair2_ix.json new file mode 100644 index 000000000..21b63ff96 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/initialize_lb_pair2_ix.json @@ -0,0 +1,102 @@ +{ + "accounts": [ + { + "pubkey": "AythiR24hnGBjPq6FK6ADiVGqXHTbBpydkBPfNC1ndgg", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "B7zNKphr8fjczB71oi9uF9pCd5XSNJvBn78TVF7kpump", + "is_signer": false, + "is_writable": false, + "label": "tokenMintX" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenMintY" + }, + { + "pubkey": "7PMC89FyUXvjoK5V1ZZJQWWGXbXt6h9n3qS4dBVg7Yn4", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "2EPCtbGKWKeFnpdevbRAthgGqpA6WRqYMSjfEBMZH5oZ", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "Dnfpn4ZCRSCxtoYFcbNowGP215dsed2N45SS693GTY5W", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "CrZUmJzkSs4TWg8GpCq5UGRX4ryRYHYYVQQ4dNMYo1GW", + "is_signer": false, + "is_writable": false, + "label": "presetParameter" + }, + { + "pubkey": "EaeLcEeKz3XoN9xn99kjJhmWZzdVx2dJ4uYxqRYxRWhG", + "is_signer": true, + "is_writable": true, + "label": "funder" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "tokenBadgeX" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "tokenBadgeY" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgramX" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenProgramY" + }, + { + "pubkey": "11111111111111111111111111111111", + "is_signer": false, + "is_writable": false, + "label": "systemProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "493b2478ed536cc6abfeffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/migrate_bin_array_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/migrate_bin_array_ix.json new file mode 100644 index 000000000..b0a311b21 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/migrate_bin_array_ix.json @@ -0,0 +1,12 @@ +{ + "accounts": [ + { + "pubkey": "zNLqkEXHxVDAbyjSSA8E17e1ksw5XEGrAA2Jha6e3FH", + "is_signer": false, + "is_writable": false, + "label": "lbPair" + } + ], + "data": "11179fd365b829f1", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/oracle_account.json b/decoders/meteora-dlmm-decoder/tests/fixtures/oracle_account.json new file mode 100644 index 000000000..d2deb752e --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/oracle_account.json @@ -0,0 +1,8 @@ +{ + "data": "i8KDs4yz5fQAAAAAAAAAAAEAAAAAAAAAZAAAAAAAAADeQP//////////////////fQczaAAAAAB9BzNoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "executable": false, + "lamports": 23385600, + "owner": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "space": 3232, + "rent_epoch": 18446744073709551615 +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity2_ix.json new file mode 100644 index 000000000..1e43c8eea --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity2_ix.json @@ -0,0 +1,139 @@ +{ + "accounts": [ + { + "pubkey": "3gWKqojAWeJRgdSe3bPyzNwjAdjeyaYJuraTEbFkEn9x", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "FvgJNjvU1swX8roYZpJ3BpjwVDqcrM2tEt18nhTNLCfd", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "Eurd4K4mrUypp3EhXxvBPhUm3e9WLoLyAwkzNDXv4shW", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "EgJsiHQDTfxXH6EkNTqLE6jd1H9Q1GZJPRMzVDfZKPGn", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "2u8ZyhXETPLkTGFhgtFm3zjpD1PosF7VySFoc9PdQQ7K", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "4UN3pAUqsM1X73zPTG1iLaxAWxy5vzg8kspBbqfPEq2n", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "dHNnE3a7aJpwmfGhh5QssrPUj4gAMNdkaCvUwyTwest", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "9NQ5D4CjcTa4AsXZ37j7gAjEJiqjSgn5SSTftryMwest", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "e6d7527ff165e39201000000d0fdffff10270200000000000100", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "data_decoded": { + "binLiquidityRemoval": { + "type": { + "vec": { + "defined": "BinLiquidityReduction" + } + }, + "data": [ + { + "binId": -560, + "bpsToRemove": 10000 + } + ] + }, + "remainingAccountsInfo": { + "type": { + "defined": "RemainingAccountsInfo" + }, + "data": { + "slices": { + "type": { + "vec": { + "defined": "RemainingAccountsSlice" + } + }, + "data": [ + { + "accountsType": { + "transferHookX": {} + }, + "length": 0 + }, + { + "accountsType": { + "transferHookY": {} + }, + "length": 0 + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range2_ix.json new file mode 100644 index 000000000..4b06c3f63 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/remove_liquidity_by_range2_ix.json @@ -0,0 +1,138 @@ +{ + "accounts": [ + { + "pubkey": "Cz3nviU2HQofE4cnZGDPTgt9q3T6eMEQbmuaGZB9noXg", + "is_signer": false, + "is_writable": true, + "label": "position" + }, + { + "pubkey": "AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "2MEBV4deAZ8P2E9ZwKZji9RmQFh4y266hoDh7zRcGjcf", + "is_signer": false, + "is_writable": true, + "label": "userTokenX" + }, + { + "pubkey": "3EY5CVGgCKc5EEfdv5b1aVe2GMevERW69644nLJ4Er6K", + "is_signer": false, + "is_writable": true, + "label": "userTokenY" + }, + { + "pubkey": "DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "7urKMjRZKVt5z2vKRt6tV1xHFQWH3227g6KngnhkFidL", + "is_signer": true, + "is_writable": true, + "label": "sender" + }, + { + "pubkey": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "cc02c391359191cd11f2ffff55f2ffff10270200000000000100", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "data_decoded": { + "fromBinId": { + "type": "i32", + "data": "-3567" + }, + "toBinId": { + "type": "i32", + "data": "-3499" + }, + "bpsToRemove": { + "type": "u16", + "data": "10000" + }, + "remainingAccountsInfo": { + "type": { + "defined": "RemainingAccountsInfo" + }, + "data": { + "slices": { + "type": { + "vec": { + "defined": "RemainingAccountsSlice" + } + }, + "data": [ + { + "accountsType": { + "transferHookX": {} + }, + "length": 0 + }, + { + "accountsType": { + "transferHookY": {} + }, + "length": 0 + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/set_activation_point_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/set_activation_point_ix.json new file mode 100644 index 000000000..928cf5dff --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/set_activation_point_ix.json @@ -0,0 +1,18 @@ +{ + "accounts": [ + { + "pubkey": "Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + } + ], + "data": "5bf90fa51a81fe7d7c15336800000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_ix.json new file mode 100644 index 000000000..020d66311 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_ix.json @@ -0,0 +1,18 @@ +{ + "accounts": [ + { + "pubkey": "Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + } + ], + "data": "43f8e7899a95d9ae01", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_permissionless_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_permissionless_ix.json new file mode 100644 index 000000000..046029c0f --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pair_status_permissionless_ix.json @@ -0,0 +1,18 @@ +{ + "accounts": [ + { + "pubkey": "C6881xvUWFRBFgDX8TrdiuQzHf6gBrmrh6DRzGa5B3Ft", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "E4PmHc6Hmsf5soqFsz9ZjsGwTwNjkWd9pw5MZfRctP6e", + "is_signer": true, + "is_writable": true, + "label": "creator" + } + ], + "data": "4e3b98d346b72ed000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_duration_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_duration_ix.json new file mode 100644 index 000000000..3545509b2 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_duration_ix.json @@ -0,0 +1,18 @@ +{ + "accounts": [ + { + "pubkey": "Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "creator" + } + ], + "data": "a53dc9f4829f1664100e000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_swap_address_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_swap_address_ix.json new file mode 100644 index 000000000..ed02c2429 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/set_pre_activation_swap_address_ix.json @@ -0,0 +1,18 @@ +{ + "accounts": [ + { + "pubkey": "Ex3x6Two22ypWzvfXM8hdeJq6CWGG74k7wi4ZSafeyGj", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "creator" + } + ], + "data": "398b2f7bd850df0a720cd6d588cc299fd5a0d858512dc6f08113c9c6e3737287d107aa668feaec5d", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo" +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap2_ix.json new file mode 100644 index 000000000..d77299cc3 --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap2_ix.json @@ -0,0 +1,127 @@ +{ + "accounts": [ + { + "pubkey": "5cuy7pMhTPhVZN9xuhgSbykRb986siGJb6vnEtkuBrSU", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "9wbTcHco8daQYxVPWn1eqDQe2YPY3ak3gPfQuYAcZ4PJ", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "Cpwo6h4koL8pC87R17g1dX8zfEQ6Pnv3AHXGPpNJqBuf", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "CPVAAuzZGX4nBk1o42qLVSZf9PQEVGdh6wcpxw8bF6Ar", + "is_signer": false, + "is_writable": true, + "label": "userTokenIn" + }, + { + "pubkey": "53mNdjYekY37E5JQ9vXB57seaTxt2j6degVmcXLVr77r", + "is_signer": false, + "is_writable": true, + "label": "userTokenOut" + }, + { + "pubkey": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "2NBaawB9aeYocWvyiECcDxSSwcyJd1B8oaHzpyEFbapc", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "hostFeeIn" + }, + { + "pubkey": "AmZaQwdMRKNC5JzRUujZfrVFyjmoUuvrRmc6iKnQHEv6", + "is_signer": true, + "is_writable": true, + "label": "user" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "414b3f4ceb5b5b887550f20c00000000000000000000000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "data_decoded": { + "amountIn": { + "type": "u64", + "data": "217206901" + }, + "minAmountOut": { + "type": "u64", + "data": "0" + }, + "remainingAccountsInfo": { + "type": { + "defined": "RemainingAccountsInfo" + }, + "data": { + "slices": { + "type": { + "vec": { + "defined": "RemainingAccountsSlice" + } + }, + "data": [] + } + } + } + } +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out2_ix.json new file mode 100644 index 000000000..842b4fbfb --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_exact_out2_ix.json @@ -0,0 +1,127 @@ +{ + "accounts": [ + { + "pubkey": "AjM8Qn62EhR4ikJ1rvyeezB1NyvrSsb4zwJiFUFs9ycs", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "DfWWLJvVHDM9byp6y7Rpw5Rx4mGizSwB5GEoUMegi3z8", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "6qxaasNgXsfVp8tKkoJavp29hZYiDrcEirsS3oAsYCLc", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "GShxvtESt69624EjwvbLBTHmQYcBUn6KKce3Wm7fCqmL", + "is_signer": false, + "is_writable": true, + "label": "userTokenIn" + }, + { + "pubkey": "8y1KDhsqTqi9poaExmnGJ9mUaNa8K1Y5fi6M1LsXZwYi", + "is_signer": false, + "is_writable": true, + "label": "userTokenOut" + }, + { + "pubkey": "Ey59PH7Z4BFU4HjyKnyMdWt5GGN76KazTAwQihoUXRnk", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "AFH1UXkECQwYoWkkCSydxU8UGciH8jxqB9EebV1NJVHs", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "hostFeeIn" + }, + { + "pubkey": "G3ztVULQTspy6wBwKVtGHMfX3GBi1FtsfQHzz3RU2bon", + "is_signer": true, + "is_writable": true, + "label": "user" + }, + { + "pubkey": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "2bd7f784893cf351e18d10e400000000004e51c67204000000000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "data_decoded": { + "maxInAmount": { + "type": "u64", + "data": "3826290145" + }, + "outAmount": { + "type": "u64", + "data": "4891000000000" + }, + "remainingAccountsInfo": { + "type": { + "defined": "RemainingAccountsInfo" + }, + "data": { + "slices": { + "type": { + "vec": { + "defined": "RemainingAccountsSlice" + } + }, + "data": [] + } + } + } + } +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact2_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact2_ix.json new file mode 100644 index 000000000..ad268e0ed --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/swap_with_price_impact2_ix.json @@ -0,0 +1,133 @@ +{ + "accounts": [ + { + "pubkey": "D4ARLASjg2Suy7M6vQtHAvx5NZEECuR7SFzWXhp41hfY", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "binArrayBitmapExtension" + }, + { + "pubkey": "6RPeoQaz4aCCLY92qiF22eymiu8HtXfi6o96PCHro85R", + "is_signer": false, + "is_writable": true, + "label": "reserveX" + }, + { + "pubkey": "Eq7wrmK1m4DpvihrnGwzBPccbsdP8u4nxi3obZ4325MC", + "is_signer": false, + "is_writable": true, + "label": "reserveY" + }, + { + "pubkey": "2YGA6ogjCtCJGg5HaPpreiH7qeiQEWsboiV1UhNVk8LB", + "is_signer": false, + "is_writable": true, + "label": "userTokenIn" + }, + { + "pubkey": "J1aRY8W75LHRoTrQjKri9ZrnZWVwH6b9pMYAJYLCxQk1", + "is_signer": false, + "is_writable": true, + "label": "userTokenOut" + }, + { + "pubkey": "7VnT8zHzorYS92snKC4CZU2veigEVnVVBSxTw7G1pump", + "is_signer": false, + "is_writable": false, + "label": "tokenXMint" + }, + { + "pubkey": "So11111111111111111111111111111111111111112", + "is_signer": false, + "is_writable": false, + "label": "tokenYMint" + }, + { + "pubkey": "CS4LtXuwrM5Z7UcS1GsA9KdSzo6d2yzsaVcJ3YkUvwzj", + "is_signer": false, + "is_writable": true, + "label": "oracle" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "hostFeeIn" + }, + { + "pubkey": "6ZgXjkSmcAqV2ELiRv33D16CQV5GAkFpL8jmuBg5QfPY", + "is_signer": true, + "is_writable": true, + "label": "user" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenXProgram" + }, + { + "pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "is_signer": false, + "is_writable": false, + "label": "tokenYProgram" + }, + { + "pubkey": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", + "is_signer": false, + "is_writable": false, + "label": "memoProgram" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "4a62c0d6b1334b33c7e500000000000001ebfdffffe80300000000", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "data_decoded": { + "amountIn": { + "type": "u64", + "data": "58823" + }, + "activeId": { + "type": { + "option": "i32" + }, + "data": -533 + }, + "maxPriceImpactBps": { + "type": "u16", + "data": "1000" + }, + "remainingAccountsInfo": { + "type": { + "defined": "RemainingAccountsInfo" + }, + "data": { + "slices": { + "type": { + "vec": { + "defined": "RemainingAccountsSlice" + } + }, + "data": [] + } + } + } + } +} \ No newline at end of file diff --git a/decoders/meteora-dlmm-decoder/tests/fixtures/update_base_fee_parameters_ix.json b/decoders/meteora-dlmm-decoder/tests/fixtures/update_base_fee_parameters_ix.json new file mode 100644 index 000000000..184022a2d --- /dev/null +++ b/decoders/meteora-dlmm-decoder/tests/fixtures/update_base_fee_parameters_ix.json @@ -0,0 +1,51 @@ +{ + "accounts": [ + { + "pubkey": "4uPKbdiUTdLWjTMGwUQb2tiw1HYhy6FLSmZU5tx85vBZ", + "is_signer": false, + "is_writable": true, + "label": "lbPair" + }, + { + "pubkey": "5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi", + "is_signer": true, + "is_writable": true, + "label": "admin" + }, + { + "pubkey": "D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6", + "is_signer": false, + "is_writable": false, + "label": "eventAuthority" + }, + { + "pubkey": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "is_signer": false, + "is_writable": false, + "label": "program" + } + ], + "data": "4ba8dfa110c3032fd007350c00", + "program_id": "LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo", + "data_decoded": { + "feeParameter": { + "type": { + "defined": "BaseFeeParameter" + }, + "data": { + "protocolShare": { + "type": "u16", + "data": "2000" + }, + "baseFactor": { + "type": "u16", + "data": "3125" + }, + "baseFeePowerFactor": { + "type": "u8", + "data": 0 + } + } + } + } +} \ No newline at end of file