diff --git a/.github/actions/setup-anchor/action.yml b/.github/actions/setup-anchor/action.yml new file mode 100644 index 00000000..3d079359 --- /dev/null +++ b/.github/actions/setup-anchor/action.yml @@ -0,0 +1,10 @@ +name: "Setup anchor-cli" +description: "Setup node js and anchor cli" +runs: + using: "composite" + steps: + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION }} + - run: npm install -g @coral-xyz/anchor-cli@${{ env.ANCHOR_CLI_VERSION }} yarn + shell: bash diff --git a/.github/actions/setup-dep/action.yml b/.github/actions/setup-dep/action.yml new file mode 100644 index 00000000..fa998c5f --- /dev/null +++ b/.github/actions/setup-dep/action.yml @@ -0,0 +1,7 @@ +name: "Setup" +description: "Setup program dependencies" +runs: + using: "composite" + steps: + - run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev + shell: bash diff --git a/.github/actions/setup-solana/action.yml b/.github/actions/setup-solana/action.yml new file mode 100644 index 00000000..a0247ecc --- /dev/null +++ b/.github/actions/setup-solana/action.yml @@ -0,0 +1,21 @@ +name: "Setup Solana" +description: "Setup Solana" +runs: + using: "composite" + steps: + - uses: actions/cache@v2 + name: Cache Solana Tool Suite + id: cache-solana + with: + path: | + ~/.cache/solana/ + ~/.local/share/solana/ + key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_CLI_VERSION }} + - run: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_CLI_VERSION }}/install)" + shell: bash + - run: echo "$HOME/.local/share/solana/install/active_release/bin/" >> $GITHUB_PATH + shell: bash + - run: solana-keygen new --no-bip39-passphrase + shell: bash + - run: solana config set --url localhost + shell: bash diff --git a/.github/workflows/ci-pr-main-cli.yml b/.github/workflows/ci-pr-main-cli.yml new file mode 100644 index 00000000..d1b6dac6 --- /dev/null +++ b/.github/workflows/ci-pr-main-cli.yml @@ -0,0 +1,46 @@ +name: Lb Clmm Cli + +on: + pull_request: + branches: + - main + +env: + SOLANA_CLI_VERSION: 1.16.1 + NODE_VERSION: 18.14.2 + ANCHOR_CLI_VERSION: 0.28.0 + +jobs: + cli_changed_files: + runs-on: ubuntu-latest + outputs: + cli: ${{steps.changed-files-specific.outputs.any_changed}} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get specific changed files + id: changed-files-specific + uses: tj-actions/changed-files@v18.6 + with: + files: | + cli + + cli_build: + runs-on: ubuntu-latest + needs: cli_changed_files + if: needs.cli_changed_files.outputs.cli == 'true' + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup-solana + - uses: ./.github/actions/setup-dep + - uses: ./.github/actions/setup-anchor + # Install rust + toolchain + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + # Cache rust, cargo + - uses: Swatinem/rust-cache@v1 + - run: cargo build -p cli + shell: bash diff --git a/.github/workflows/ci-pr-main-market-making.yml b/.github/workflows/ci-pr-main-market-making.yml new file mode 100644 index 00000000..228e72b6 --- /dev/null +++ b/.github/workflows/ci-pr-main-market-making.yml @@ -0,0 +1,46 @@ +name: Lb Clmm Cli + +on: + pull_request: + branches: + - main + +env: + SOLANA_CLI_VERSION: 1.16.1 + NODE_VERSION: 18.14.2 + ANCHOR_CLI_VERSION: 0.28.0 + +jobs: + market_making_changed_files: + runs-on: ubuntu-latest + outputs: + market_making: ${{steps.changed-files-specific.outputs.any_changed}} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get specific changed files + id: changed-files-specific + uses: tj-actions/changed-files@v18.6 + with: + files: | + market_making + + market_making_build: + runs-on: ubuntu-latest + needs: market_making_changed_files + if: needs.market_making_changed_files.outputs.market_making == 'true' + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup-solana + - uses: ./.github/actions/setup-dep + - uses: ./.github/actions/setup-anchor + # Install rust + toolchain + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + # Cache rust, cargo + - uses: Swatinem/rust-cache@v1 + - run: cargo build -p market_making + shell: bash diff --git a/.github/workflows/ci-pr-main-program.yml b/.github/workflows/ci-pr-main-program.yml new file mode 100644 index 00000000..5b57d9b8 --- /dev/null +++ b/.github/workflows/ci-pr-main-program.yml @@ -0,0 +1,46 @@ +name: Lb Clmm Program + +on: + pull_request: + branches: + - main + +env: + SOLANA_CLI_VERSION: 1.16.1 + NODE_VERSION: 18.14.2 + ANCHOR_CLI_VERSION: 0.28.0 + +jobs: + program_changed_files: + runs-on: ubuntu-latest + outputs: + program: ${{steps.changed-files-specific.outputs.any_changed}} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get specific changed files + id: changed-files-specific + uses: tj-actions/changed-files@v18.6 + with: + files: | + programs/lb_clmm + + lb_clmm_anchor_build: + runs-on: ubuntu-latest + needs: program_changed_files + if: needs.program_changed_files.outputs.program == 'true' + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup-solana + - uses: ./.github/actions/setup-dep + - uses: ./.github/actions/setup-anchor + # Install rust + toolchain + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + # Cache rust, cargo + - uses: Swatinem/rust-cache@v1 + - run: anchor build + shell: bash diff --git a/.github/workflows/ci-pr-main-sdk.yml b/.github/workflows/ci-pr-main-sdk.yml new file mode 100644 index 00000000..fdf1bef7 --- /dev/null +++ b/.github/workflows/ci-pr-main-sdk.yml @@ -0,0 +1,54 @@ +name: Lb Clmm SDK + +on: + pull_request: + branches: + - main + +env: + SOLANA_CLI_VERSION: 1.16.1 + NODE_VERSION: 18.14.2 + ANCHOR_CLI_VERSION: 0.28.0 + +jobs: + sdk_changed_files: + runs-on: ubuntu-latest + outputs: + sdk: ${{steps.changed-files-specific.outputs.any_changed}} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get specific changed files + id: changed-files-specific + uses: tj-actions/changed-files@v18.6 + with: + files: | + ts-client + + sdk_test: + runs-on: ubuntu-latest + needs: sdk_changed_files + if: needs.sdk_changed_files.outputs.sdk == 'true' + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/setup-solana + - uses: ./.github/actions/setup-dep + - uses: ./.github/actions/setup-anchor + # Install rust + toolchain + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + # Cache node_modules + - uses: actions/cache@v2 + id: cache-node-modules + with: + path: ./ts-client/node_modules + key: ${{ runner.os }}-${{ hashFiles('./package-lock.json') }} + - run: anchor build -- --features localnet + shell: bash + - run: anchor localnet -- --features localnet & sleep 2 + shell: bash + - run: cd ts-client && npm install && npm run test + shell: bash diff --git a/cli/src/instructions/add_liquidity.rs b/cli/src/instructions/add_liquidity.rs index 8bbf803f..917dbdd4 100644 --- a/cli/src/instructions/add_liquidity.rs +++ b/cli/src/instructions/add_liquidity.rs @@ -87,7 +87,7 @@ pub fn add_liquidity + Clone>( reserve_y: lb_pair_state.reserve_y, token_x_mint: lb_pair_state.token_x_mint, token_y_mint: lb_pair_state.token_y_mint, - owner: program.payer(), + sender: program.payer(), user_token_x, user_token_y, // TODO: token 2022 diff --git a/cli/src/instructions/claim_fee.rs b/cli/src/instructions/claim_fee.rs index f1e6cecd..225e4ee2 100644 --- a/cli/src/instructions/claim_fee.rs +++ b/cli/src/instructions/claim_fee.rs @@ -39,7 +39,7 @@ pub fn claim_fee + Clone>( bin_array_lower, bin_array_upper, lb_pair: position_state.lb_pair, - owner: program.payer(), + sender: program.payer(), position, reserve_x: lb_pair_state.reserve_x, reserve_y: lb_pair_state.reserve_y, diff --git a/cli/src/instructions/claim_reward.rs b/cli/src/instructions/claim_reward.rs index cd3e3d40..1031804f 100644 --- a/cli/src/instructions/claim_reward.rs +++ b/cli/src/instructions/claim_reward.rs @@ -47,7 +47,7 @@ pub fn claim_reward + Clone>( token_program: anchor_spl::token::ID, position, user_token_account, - owner: program.payer(), + sender: program.payer(), event_authority, program: lb_clmm::ID, }; diff --git a/cli/src/instructions/close_position.rs b/cli/src/instructions/close_position.rs index e83404a2..a76c5ad3 100644 --- a/cli/src/instructions/close_position.rs +++ b/cli/src/instructions/close_position.rs @@ -26,7 +26,7 @@ pub fn close_position + Clone>( bin_array_lower, bin_array_upper, lb_pair: position_state.lb_pair, - owner: position_state.owner, + sender: position_state.owner, rent_receiver: position_state.owner, position, event_authority, diff --git a/cli/src/instructions/initialize_lb_pair.rs b/cli/src/instructions/initialize_lb_pair.rs index 3f4ba6ca..2cc91a38 100644 --- a/cli/src/instructions/initialize_lb_pair.rs +++ b/cli/src/instructions/initialize_lb_pair.rs @@ -1,6 +1,7 @@ use std::ops::Deref; use anchor_client::solana_client::rpc_config::RpcSendTransactionConfig; +use anchor_client::solana_sdk::signature::Keypair; use anchor_client::{solana_sdk::pubkey::Pubkey, solana_sdk::signer::Signer, Program}; use anchor_spl::token::Mint; @@ -62,7 +63,9 @@ pub fn initialize_lb_pair + Clone>( let (preset_parameter, _bump) = derive_preset_parameter_pda(bin_step); if permission { + let base_kp = Keypair::new(); let accounts = accounts::InitializePermissionLbPair { + base: base_kp.pubkey(), lb_pair, bin_array_bitmap_extension: None, reserve_x, @@ -70,7 +73,7 @@ pub fn initialize_lb_pair + Clone>( token_mint_x, token_mint_y, oracle, - funder: program.payer(), + admin: program.payer(), preset_parameter, rent: anchor_client::solana_sdk::sysvar::rent::ID, system_program: anchor_client::solana_sdk::system_program::ID, @@ -88,6 +91,7 @@ pub fn initialize_lb_pair + Clone>( let signature = request_builder .accounts(accounts) .args(ix) + .signer(&base_kp) .send_with_spinner_and_config(transaction_config); println!("Initialize Permission LB pair {lb_pair}. Signature: {signature:#?}"); diff --git a/cli/src/instructions/remove_liquidity.rs b/cli/src/instructions/remove_liquidity.rs index f58fae4e..910f52d3 100644 --- a/cli/src/instructions/remove_liquidity.rs +++ b/cli/src/instructions/remove_liquidity.rs @@ -74,7 +74,7 @@ pub fn remove_liquidity + Clone>( reserve_y: lb_pair_state.reserve_y, token_x_mint: lb_pair_state.token_x_mint, token_y_mint: lb_pair_state.token_y_mint, - owner: program.payer(), + sender: program.payer(), user_token_x, user_token_y, token_x_program: anchor_spl::token::ID, diff --git a/cli/src/instructions/remove_liquidity_by_price_range.rs b/cli/src/instructions/remove_liquidity_by_price_range.rs index 9594b250..0a79dd36 100644 --- a/cli/src/instructions/remove_liquidity_by_price_range.rs +++ b/cli/src/instructions/remove_liquidity_by_price_range.rs @@ -124,7 +124,7 @@ pub fn remove_liquidity_by_price_range + Clone>( reserve_y: lb_pair_state.reserve_y, token_x_mint: lb_pair_state.token_x_mint, token_y_mint: lb_pair_state.token_y_mint, - owner: program.payer(), + sender: program.payer(), user_token_x, user_token_y, token_x_program: anchor_spl::token::ID, @@ -141,7 +141,7 @@ pub fn remove_liquidity_by_price_range + Clone>( bin_array_lower, bin_array_upper, lb_pair, - owner: program.payer(), + sender: program.payer(), position, reserve_x: lb_pair_state.reserve_x, reserve_y: lb_pair_state.reserve_y, @@ -164,7 +164,7 @@ pub fn remove_liquidity_by_price_range + Clone>( bin_array_lower, bin_array_upper, rent_receiver: program.payer(), - owner: program.payer(), + sender: program.payer(), event_authority, program: lb_clmm::ID, } diff --git a/cli/src/instructions/seed_liquidity.rs b/cli/src/instructions/seed_liquidity.rs index e918f421..5bd57432 100644 --- a/cli/src/instructions/seed_liquidity.rs +++ b/cli/src/instructions/seed_liquidity.rs @@ -229,7 +229,7 @@ pub fn seed_liquidity + Clone>( bin_array_bitmap_extension: None, bin_array_lower, bin_array_upper, - owner: program.payer(), + sender: program.payer(), event_authority, program: lb_clmm::ID, reserve_x: lb_pair_state.reserve_x, @@ -289,7 +289,7 @@ pub fn seed_liquidity + Clone>( bin_array_bitmap_extension: None, bin_array_lower, bin_array_upper, - owner: program.payer(), + sender: program.payer(), event_authority, program: lb_clmm::ID, reserve_x: lb_pair_state.reserve_x, diff --git a/market_making/src/core.rs b/market_making/src/core.rs index f45f5f2e..81c0c347 100644 --- a/market_making/src/core.rs +++ b/market_making/src/core.rs @@ -232,7 +232,7 @@ impl Core { reserve_y: lb_pair_state.reserve_y, token_x_mint: lb_pair_state.token_x_mint, token_y_mint: lb_pair_state.token_y_mint, - owner: payer.pubkey(), + sender: payer.pubkey(), user_token_x, user_token_y, token_x_program: anchor_spl::token::ID, @@ -249,7 +249,7 @@ impl Core { bin_array_lower, bin_array_upper, lb_pair, - owner: payer.pubkey(), + sender: payer.pubkey(), position, reserve_x: lb_pair_state.reserve_x, reserve_y: lb_pair_state.reserve_y, @@ -272,7 +272,7 @@ impl Core { bin_array_lower, bin_array_upper, rent_receiver: payer.pubkey(), - owner: payer.pubkey(), + sender: payer.pubkey(), event_authority, program: lb_clmm::ID, } @@ -528,7 +528,7 @@ impl Core { bin_array_bitmap_extension, bin_array_lower, bin_array_upper, - owner: payer.pubkey(), + sender: payer.pubkey(), event_authority, program: lb_clmm::ID, reserve_x: lb_pair_state.reserve_x, diff --git a/programs/lb_clmm/src/events.rs b/programs/lb_clmm/src/events.rs index 5fbd7066..a01bce55 100644 --- a/programs/lb_clmm/src/events.rs +++ b/programs/lb_clmm/src/events.rs @@ -206,3 +206,13 @@ pub struct WithdrawIneligibleReward { // Amount of ineligible reward withdrawn pub amount: u64, } + +#[event] +pub struct UpdatePositionOperator { + // Position public key + pub position: Pubkey, + // Old operator + pub old_operator: Pubkey, + // New operator + pub new_operator: Pubkey, +} diff --git a/programs/lb_clmm/src/instructions/add_liquidity.rs b/programs/lb_clmm/src/instructions/add_liquidity.rs index 1e19b02f..9186c0e7 100644 --- a/programs/lb_clmm/src/instructions/add_liquidity.rs +++ b/programs/lb_clmm/src/instructions/add_liquidity.rs @@ -1,9 +1,16 @@ +use crate::authorize_modify_position; use crate::state::bin_array_bitmap_extension::BinArrayBitmapExtension; use crate::state::position::PositionV2; use crate::state::{bin::BinArray, lb_pair::LbPair}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +pub struct CompositeDepositInfo { + pub liquidity_share: u128, + pub protocol_token_x_fee_amount: u64, + pub protocol_token_y_fee_amount: u64, +} + #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug)] pub struct BinLiquidityDistribution { /// Define the bin ID wish to deposit to. @@ -30,7 +37,7 @@ pub struct ModifyLiquidity<'info> { #[account( mut, has_one = lb_pair, - has_one = owner + constraint = authorize_modify_position(&position, sender.key())? )] pub position: AccountLoader<'info, PositionV2>, @@ -79,7 +86,7 @@ pub struct ModifyLiquidity<'info> { )] pub bin_array_upper: AccountLoader<'info, BinArray>, - pub owner: Signer<'info>, + pub sender: Signer<'info>, pub token_x_program: Interface<'info, TokenInterface>, pub token_y_program: Interface<'info, TokenInterface>, } diff --git a/programs/lb_clmm/src/instructions/add_liquidity_by_strategy.rs b/programs/lb_clmm/src/instructions/add_liquidity_by_strategy.rs index fa00dcf9..ce52437a 100644 --- a/programs/lb_clmm/src/instructions/add_liquidity_by_strategy.rs +++ b/programs/lb_clmm/src/instructions/add_liquidity_by_strategy.rs @@ -1,6 +1,10 @@ -use crate::ModifyLiquidity; +use crate::errors::LBError; +use crate::instructions::add_liquidity_by_weight; +use crate::math::safe_math::SafeMath; +use crate::{BinLiquidityDistributionByWeight, LiquidityParameterByWeight, ModifyLiquidity}; use anchor_lang::prelude::*; +const PRECISION: i32 = 15000; // ~ i16 / 2 #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug, Default)] pub struct LiquidityParameterByStrategy { /// Amount of X token to deposit @@ -15,6 +19,21 @@ pub struct LiquidityParameterByStrategy { pub strategy_parameters: StrategyParameters, } +impl LiquidityParameterByStrategy { + pub fn to_liquidity_parameter_by_weight( + &self, + active_id: i32, + ) -> Result { + Ok(LiquidityParameterByWeight { + amount_x: self.amount_x, + amount_y: self.amount_y, + active_id: self.active_id, + max_active_bin_slippage: self.max_active_bin_slippage, + bin_liquidity_dist: self.strategy_parameters.to_weight_distribution(active_id)?, // TODO: should we use lb_pair.active_id? + }) + } +} + #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug)] pub struct StrategyParameters { /// min bin id @@ -30,9 +49,14 @@ pub struct StrategyParameters { //// https://www.desmos.com/calculator/mru5p9e75u #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug, Default)] pub struct ParabolicParameter { - /// amplification + /// amplification in ask side pub a_ask: i16, + /// amplification in bid side pub a_bid: i16, + /// amplification in active bin + pub a_active_bin: i16, + /// center bin id + pub center_bin_id: i32, } #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug, Default)] @@ -45,6 +69,74 @@ pub struct SpotParameter { pub weight_active_bin: u16, } +impl ParabolicParameter { + fn validate_curve(&self) -> Result<()> { + require!( + self.a_ask <= 0 && self.a_bid <= 0 && self.a_active_bin <= 0, + LBError::InvalidInput + ); + Ok(()) + } + + fn validate_bid_ask(&self) -> Result<()> { + require!( + self.a_ask >= 0 && self.a_bid >= 0 && self.a_active_bin >= 0, + LBError::InvalidInput + ); + Ok(()) + } + + fn get_curve_weight_at_bin_id( + &self, + center_bin_id: i32, + bin_id: i32, + b: i32, + active_id: i32, + ) -> Result { + let a: i32 = if bin_id < active_id { + self.a_bid.into() + } else if bin_id > active_id { + self.a_ask.into() + } else { + self.a_active_bin.into() + }; + + let bin_delta = bin_id.safe_sub(center_bin_id)?; + + let weight = (a + .safe_mul(bin_delta)? + .safe_mul(bin_delta)? + .safe_sub(a.safe_mul(b)?)?) + .safe_div(PRECISION)?; + + Ok(u16::try_from(weight.max(0)).map_err(|_| LBError::MathOverflow)?) + } + + fn get_bid_ask_weight_at_bin_id( + &self, + center_bin_id: i32, + bin_id: i32, + active_id: i32, + ) -> Result { + let a: i32 = if bin_id < active_id { + self.a_bid.into() + } else if bin_id > active_id { + self.a_ask.into() + } else { + self.a_active_bin.into() + }; + + let bin_delta = bin_id.safe_sub(center_bin_id)?; + + let weight = a + .safe_mul(bin_delta)? + .safe_mul(bin_delta)? + .safe_div(PRECISION)?; + + Ok(u16::try_from(weight.max(0)).map_err(|_| LBError::MathOverflow)?) + } +} + impl Default for StrategyParameters { fn default() -> Self { StrategyParameters { @@ -55,6 +147,94 @@ impl Default for StrategyParameters { } } } +impl StrategyParameters { + fn parse_spot_parameter(&self) -> Result { + Ok(SpotParameter::deserialize(&mut &self.parameteres[..])?) + } + fn parse_parabolic_parameter(&self) -> Result { + Ok(ParabolicParameter::deserialize(&mut &self.parameteres[..])?) + } + pub fn to_weight_distribution( + &self, + active_id: i32, + ) -> Result> { + if self.max_bin_id < self.min_bin_id { + return Err(LBError::InvalidInput.into()); + } + let mut bin_liquidity_dist = vec![]; + if self.max_bin_id == self.min_bin_id { + // only 1 bin + bin_liquidity_dist.push(BinLiquidityDistributionByWeight { + bin_id: self.max_bin_id, + weight: 1, + }); + } else { + match self.strategy_type { + StrategyType::Spot => { + let spot_parameters = self.parse_spot_parameter()?; + + for i in self.min_bin_id..=self.max_bin_id { + if i < active_id { + bin_liquidity_dist.push(BinLiquidityDistributionByWeight { + bin_id: i, + weight: spot_parameters.weight_bid, + }) + } + if i > active_id { + bin_liquidity_dist.push(BinLiquidityDistributionByWeight { + bin_id: i, + weight: spot_parameters.weight_ask, + }) + } + if i == active_id { + bin_liquidity_dist.push(BinLiquidityDistributionByWeight { + bin_id: i, + weight: spot_parameters.weight_active_bin, + }) + } + } + } + StrategyType::Curve => { + let curve_parameters = self.parse_parabolic_parameter()?; + curve_parameters.validate_curve()?; + let mid_bin_id = curve_parameters.center_bin_id; + let bin_width = self.max_bin_id.safe_sub(self.min_bin_id)?; + let b = bin_width.safe_mul(bin_width)?; + + for i in self.min_bin_id..=self.max_bin_id { + let weight = curve_parameters + .get_curve_weight_at_bin_id(mid_bin_id, i, b, active_id)?; + + // filter zero weight + if weight == 0 { + continue; + } + bin_liquidity_dist + .push(BinLiquidityDistributionByWeight { bin_id: i, weight }); + } + } + StrategyType::BidAsk => { + let curve_parameters = self.parse_parabolic_parameter()?; + curve_parameters.validate_bid_ask()?; + let mid_bin_id = curve_parameters.center_bin_id; + for i in self.min_bin_id..=self.max_bin_id { + let weight = curve_parameters + .get_bid_ask_weight_at_bin_id(mid_bin_id, i, active_id)?; + // filter zero weight + if weight == 0 { + continue; + } + + bin_liquidity_dist + .push(BinLiquidityDistributionByWeight { bin_id: i, weight }); + } + } + }; + } + + Ok(bin_liquidity_dist) + } +} #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug)] pub enum StrategyType { @@ -67,5 +247,9 @@ pub fn handle<'a, 'b, 'c, 'info>( ctx: Context<'a, 'b, 'c, 'info, ModifyLiquidity<'info>>, liquidity_parameter: &LiquidityParameterByStrategy, ) -> Result<()> { - Ok(()) + let active_id = ctx.accounts.lb_pair.load()?.active_id; + add_liquidity_by_weight::handle( + &ctx, + &liquidity_parameter.to_liquidity_parameter_by_weight(active_id)?, + ) } diff --git a/programs/lb_clmm/src/instructions/add_liquidity_by_strategy_one_side.rs b/programs/lb_clmm/src/instructions/add_liquidity_by_strategy_one_side.rs index c58b1f46..bd27b396 100644 --- a/programs/lb_clmm/src/instructions/add_liquidity_by_strategy_one_side.rs +++ b/programs/lb_clmm/src/instructions/add_liquidity_by_strategy_one_side.rs @@ -1,7 +1,9 @@ +use crate::instructions::add_liquidity_one_side; use crate::ModifyLiquidityOneSide; use anchor_lang::prelude::*; use super::add_liquidity_by_strategy::StrategyParameters; +use super::add_liquidity_one_side::LiquidityOneSideParameter; #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug, Default)] pub struct LiquidityParameterByStrategyOneSide { @@ -15,9 +17,27 @@ pub struct LiquidityParameterByStrategyOneSide { pub strategy_parameters: StrategyParameters, } +impl LiquidityParameterByStrategyOneSide { + fn to_liquidity_parameter_by_weight( + &self, + active_id: i32, + ) -> Result { + Ok(LiquidityOneSideParameter { + amount: self.amount, + active_id: self.active_id, + max_active_bin_slippage: self.max_active_bin_slippage, + bin_liquidity_dist: self.strategy_parameters.to_weight_distribution(active_id)?, + }) + } +} + pub fn handle<'a, 'b, 'c, 'info>( ctx: Context<'a, 'b, 'c, 'info, ModifyLiquidityOneSide<'info>>, liquidity_parameter: &LiquidityParameterByStrategyOneSide, ) -> Result<()> { - Ok(()) + let active_id = ctx.accounts.lb_pair.load()?.active_id; + add_liquidity_one_side::handle( + &ctx, + &liquidity_parameter.to_liquidity_parameter_by_weight(active_id)?, + ) } diff --git a/programs/lb_clmm/src/instructions/add_liquidity_by_weight.rs b/programs/lb_clmm/src/instructions/add_liquidity_by_weight.rs index ee137aae..cc2749b7 100644 --- a/programs/lb_clmm/src/instructions/add_liquidity_by_weight.rs +++ b/programs/lb_clmm/src/instructions/add_liquidity_by_weight.rs @@ -1,5 +1,14 @@ +use crate::constants::MAX_BIN_PER_POSITION; +use crate::errors::LBError; +use crate::math::price_math::get_price_from_id; +use crate::math::safe_math::SafeMath; +use crate::math::u64x64_math::SCALE_OFFSET; +use crate::math::utils_math::{ + safe_mul_div_cast_from_u256_to_u64, safe_mul_div_cast_from_u64_to_u64, +}; use crate::ModifyLiquidity; use anchor_lang::prelude::*; +use ruint::aliases::U256; #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug, Default)] pub struct BinLiquidityDistributionByWeight { @@ -23,6 +32,288 @@ pub struct LiquidityParameterByWeight { pub bin_liquidity_dist: Vec, } +impl LiquidityParameterByWeight { + fn bin_count(&self) -> u32 { + self.bin_liquidity_dist.len() as u32 + } + + fn validate<'a, 'info>(&'a self, active_id: i32) -> Result<()> { + let bin_count = self.bin_count(); + require!(bin_count > 0, LBError::InvalidInput); + + require!( + bin_count <= MAX_BIN_PER_POSITION as u32, + LBError::InvalidInput + ); + + let bin_shift = if active_id > self.active_id { + active_id - self.active_id + } else { + self.active_id - active_id + }; + + require!( + bin_shift <= self.max_active_bin_slippage.into(), + LBError::ExceededBinSlippageTolerance + ); + + // bin dist must be in consecutive order and weight is non-zero + for (i, val) in self.bin_liquidity_dist.iter().enumerate() { + require!(val.weight != 0, LBError::InvalidInput); + // bin id must in right order + if i != 0 { + require!( + val.bin_id > self.bin_liquidity_dist[i - 1].bin_id, + LBError::InvalidInput + ); + } + } + let first_bin_id = self.bin_liquidity_dist[0].bin_id; + let last_bin_id = self.bin_liquidity_dist[self.bin_liquidity_dist.len() - 1].bin_id; + + if first_bin_id > active_id { + require!(self.amount_x != 0, LBError::InvalidInput); + } + if last_bin_id < active_id { + require!(self.amount_y != 0, LBError::InvalidInput); + } + + Ok(()) + } + + fn get_active_bin_index(&self, active_id: i32) -> Option { + for (i, val) in self.bin_liquidity_dist.iter().enumerate() { + if val.bin_id == active_id { + return Some(i); + } + // bin_id is sorted, so no need to check if bin cross + if val.bin_id > active_id { + break; + } + } + return None; + } + + // require bin id to be sorted before doing this + pub fn to_amounts_into_bin<'a, 'info>( + &'a self, + active_id: i32, + bin_step: u16, + amount_x: u64, // amount x in active bin + amount_y: u64, // amount y in active bin + ) -> Result> { + // only bid side + if active_id > self.bin_liquidity_dist[self.bin_liquidity_dist.len() - 1].bin_id { + // get sum of weight + let mut total_weight = 0u64; + for dist in self.bin_liquidity_dist.iter() { + total_weight = total_weight.safe_add(dist.weight.into())?; + } + let mut amounts = vec![]; + for dist in self.bin_liquidity_dist.iter() { + amounts.push(( + 0, + safe_mul_div_cast_from_u64_to_u64( + dist.weight.into(), + self.amount_y, + total_weight, + )?, + )); + } + return Ok(amounts); + } + // only ask side + if active_id < self.bin_liquidity_dist[0].bin_id { + // get sum of weight + let mut total_weight = U256::ZERO; + let mut weight_per_prices = vec![U256::ZERO; self.bin_liquidity_dist.len()]; + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + let weight_per_price = U256::from(dist.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(U256::from(get_price_from_id(dist.bin_id, bin_step)?))?; + weight_per_prices[i] = weight_per_price; + total_weight = total_weight.safe_add(weight_per_price)?; + } + + let mut amounts = vec![]; + for &weight_per_price in weight_per_prices.iter() { + amounts.push(( + safe_mul_div_cast_from_u256_to_u64( + self.amount_x, + weight_per_price, + total_weight, + )?, + 0, + )); + } + return Ok(amounts); + } + + match self.get_active_bin_index(active_id) { + Some(index) => { + let active_bin = &self.bin_liquidity_dist[index]; + let p0 = U256::from(get_price_from_id(active_bin.bin_id, bin_step)?); + + let (wx0, wy0) = if amount_x == 0 && amount_y == 0 { + // equal ratio if both amount_x and amount_y is zero + let wx0 = U256::from(active_bin.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(p0.safe_mul(U256::from(2))?)?; + + let wy0 = U256::from(active_bin.weight) + .safe_shl(SCALE_OFFSET.into())? + .safe_div(U256::from(2))?; + (wx0, wy0) + } else { + let wx0 = if amount_x == 0 { + U256::ZERO + } else { + U256::from(active_bin.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div( + p0.safe_add( + U256::from(amount_y) + .safe_shl(SCALE_OFFSET.into())? + .safe_div(U256::from(amount_x))?, + )?, + )? + }; + let wy0 = if amount_y == 0 { + U256::ZERO + } else { + U256::from(active_bin.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div( + U256::from(1).safe_shl(SCALE_OFFSET.into())?.safe_add( + p0.safe_mul(U256::from(amount_x))? + .safe_div(U256::from(amount_y))?, + )?, + )? + }; + (wx0, wy0) + }; + + let mut total_weight_x = wx0; + let mut total_weight_y = wy0; + let mut weight_per_prices = vec![U256::ZERO; self.bin_liquidity_dist.len()]; + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + if dist.bin_id < active_id { + total_weight_y = total_weight_y + .safe_add(U256::from(dist.weight).safe_shl(SCALE_OFFSET.into())?)?; + continue; + } + if dist.bin_id > active_id { + let weight_per_price = U256::from(dist.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(U256::from(get_price_from_id(dist.bin_id, bin_step)?))?; + weight_per_prices[i] = weight_per_price; + total_weight_x = total_weight_x.safe_add(weight_per_price)?; + continue; + } + } + // find k + let ky = U256::from(self.amount_y) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(total_weight_y)?; + + let kx = U256::from(self.amount_x) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(total_weight_x)?; + let k = kx.min(ky); + let mut amounts = vec![]; + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + if dist.bin_id < active_id { + let (amount_y_in_bin, _) = k + .safe_mul(U256::from(dist.weight))? + .overflowing_shr(SCALE_OFFSET.into()); + amounts.push(( + 0, + u64::try_from(amount_y_in_bin).map_err(|_| LBError::TypeCastFailed)?, + )); + continue; + } + if dist.bin_id > active_id { + let (amount_x_in_bin, _) = k + .safe_mul(weight_per_prices[i])? + .overflowing_shr((SCALE_OFFSET * 2).into()); + + amounts.push(( + u64::try_from(amount_x_in_bin).map_err(|_| LBError::TypeCastFailed)?, + 0, + )); + continue; + } + // else we are in active id + let (amount_x_in_bin, _) = + k.safe_mul(wx0)?.overflowing_shr((SCALE_OFFSET * 2).into()); + let (amount_y_in_bin, _) = + k.safe_mul(wy0)?.overflowing_shr((SCALE_OFFSET * 2).into()); + + amounts.push(( + u64::try_from(amount_x_in_bin).map_err(|_| LBError::TypeCastFailed)?, + u64::try_from(amount_y_in_bin).map_err(|_| LBError::TypeCastFailed)?, + )); + } + return Ok(amounts); + } + None => { + let mut total_weight_x = U256::ZERO; + let mut total_weight_y = U256::ZERO; + let mut weight_per_prices = vec![U256::ZERO; self.bin_liquidity_dist.len()]; + + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + if dist.bin_id < active_id { + total_weight_y = total_weight_y + .safe_add(U256::from(dist.weight).safe_shl(SCALE_OFFSET.into())?)?; + continue; + } + if dist.bin_id > active_id { + let weight_per_price = U256::from(dist.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(U256::from(get_price_from_id(dist.bin_id, bin_step)?))?; + weight_per_prices[i] = weight_per_price; + total_weight_x = total_weight_x.safe_add(weight_per_price)?; + } + } + // find k + let ky = U256::from(self.amount_y) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(total_weight_y)?; + + let kx = U256::from(self.amount_x) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(total_weight_x)?; + let k = kx.min(ky); + + let mut amounts = vec![]; + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + if dist.bin_id < active_id { + let (amount_y_in_bin, _) = k + .safe_mul(U256::from(dist.weight))? + .overflowing_shr(SCALE_OFFSET.into()); + amounts.push(( + 0, + u64::try_from(amount_y_in_bin).map_err(|_| LBError::TypeCastFailed)?, + )); + continue; + } + if dist.bin_id > active_id { + let (amount_x_in_bin, _) = k + .safe_mul(weight_per_prices[i])? + .overflowing_shr((SCALE_OFFSET * 2).into()); + + amounts.push(( + u64::try_from(amount_x_in_bin).map_err(|_| LBError::TypeCastFailed)?, + 0, + )); + } + } + return Ok(amounts); + } + } + } +} + pub fn handle<'a, 'b, 'c, 'info>( ctx: &Context<'a, 'b, 'c, 'info, ModifyLiquidity<'info>>, liquidity_parameter: &LiquidityParameterByWeight, diff --git a/programs/lb_clmm/src/instructions/add_liquidity_one_side.rs b/programs/lb_clmm/src/instructions/add_liquidity_one_side.rs index c967e4f7..a0c14666 100644 --- a/programs/lb_clmm/src/instructions/add_liquidity_one_side.rs +++ b/programs/lb_clmm/src/instructions/add_liquidity_one_side.rs @@ -1,10 +1,22 @@ -use super::add_liquidity_by_weight::BinLiquidityDistributionByWeight; +use crate::authorize_modify_position; +use crate::errors::LBError; +use crate::math::price_math::get_price_from_id; +use crate::math::safe_math::SafeMath; +use crate::math::u64x64_math::SCALE_OFFSET; +use crate::math::utils_math::{ + safe_mul_div_cast_from_u256_to_u64, safe_mul_div_cast_from_u64_to_u64, +}; use crate::state::bin_array_bitmap_extension::BinArrayBitmapExtension; use crate::state::position::PositionV2; use crate::state::{bin::BinArray, lb_pair::LbPair}; -use anchor_lang::prelude::*; +use anchor_spl::token_2022::TransferChecked; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; +use anchor_lang::prelude::*; +use ruint::aliases::U256; + +use super::add_liquidity_by_weight::BinLiquidityDistributionByWeight; + #[derive(AnchorSerialize, AnchorDeserialize, Eq, PartialEq, Clone, Debug)] pub struct LiquidityOneSideParameter { /// Amount of X token or Y token to deposit @@ -17,13 +29,87 @@ pub struct LiquidityOneSideParameter { pub bin_liquidity_dist: Vec, } +impl LiquidityOneSideParameter { + // require bin id to be sorted before doing this + pub fn to_amounts_into_bin<'a, 'info>( + &'a self, + active_id: i32, + bin_step: u16, + deposit_for_y: bool, + ) -> Result> { + if deposit_for_y { + // get sum of weight + let mut total_weight = 0u64; + for dist in self.bin_liquidity_dist.iter() { + // skip all ask side + if dist.bin_id > active_id { + // break because bin_id is in ascending order + break; + } + total_weight = total_weight.safe_add(dist.weight.into())?; + } + if total_weight == 0 { + return Err(LBError::InvalidInput.into()); + } + let mut amounts = vec![]; + for dist in self.bin_liquidity_dist.iter() { + // skip all ask side + if dist.bin_id > active_id { + amounts.push(0); + } else { + amounts.push(safe_mul_div_cast_from_u64_to_u64( + dist.weight.into(), + self.amount, + total_weight, + )?); + } + } + Ok(amounts) + } else { + // get sum of weight + let mut total_weight = U256::ZERO; + let mut weight_per_prices = vec![U256::ZERO; self.bin_liquidity_dist.len()]; + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + // skip all bid side + if dist.bin_id < active_id { + continue; + } + let weight_per_price = U256::from(dist.weight) + .safe_shl((SCALE_OFFSET * 2).into())? + .safe_div(U256::from(get_price_from_id(dist.bin_id, bin_step)?))?; + weight_per_prices[i] = weight_per_price; + total_weight = total_weight.safe_add(weight_per_price)?; + } + + if total_weight == U256::ZERO { + return Err(LBError::InvalidInput.into()); + } + + let mut amounts = vec![]; + for (i, dist) in self.bin_liquidity_dist.iter().enumerate() { + // skip all bid side + if dist.bin_id < active_id { + amounts.push(0); + } else { + amounts.push(safe_mul_div_cast_from_u256_to_u64( + self.amount, + weight_per_prices[i], + total_weight, + )?); + } + } + Ok(amounts) + } + } +} + #[event_cpi] #[derive(Accounts)] pub struct ModifyLiquidityOneSide<'info> { #[account( mut, has_one = lb_pair, - has_one = owner + constraint = authorize_modify_position(&position, sender.key())? )] pub position: AccountLoader<'info, PositionV2>, @@ -55,7 +141,7 @@ pub struct ModifyLiquidityOneSide<'info> { )] pub bin_array_upper: AccountLoader<'info, BinArray>, - pub owner: Signer<'info>, + pub sender: Signer<'info>, pub token_program: Interface<'info, TokenInterface>, } diff --git a/programs/lb_clmm/src/instructions/claim_fee.rs b/programs/lb_clmm/src/instructions/claim_fee.rs index e98118ee..c909fb23 100644 --- a/programs/lb_clmm/src/instructions/claim_fee.rs +++ b/programs/lb_clmm/src/instructions/claim_fee.rs @@ -1,7 +1,7 @@ +use crate::authorize_modify_position; use crate::state::{bin::BinArray, lb_pair::LbPair, position::PositionV2}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; - #[event_cpi] #[derive(Accounts)] pub struct ClaimFee<'info> { @@ -17,7 +17,7 @@ pub struct ClaimFee<'info> { #[account( mut, has_one = lb_pair, - has_one = owner + constraint = authorize_modify_position(&position, sender.key())? )] pub position: AccountLoader<'info, PositionV2>, @@ -32,7 +32,7 @@ pub struct ClaimFee<'info> { )] pub bin_array_upper: AccountLoader<'info, BinArray>, - pub owner: Signer<'info>, + pub sender: Signer<'info>, #[account(mut)] pub reserve_x: Box>, diff --git a/programs/lb_clmm/src/instructions/claim_reward.rs b/programs/lb_clmm/src/instructions/claim_reward.rs index 2e72732f..ad94894b 100644 --- a/programs/lb_clmm/src/instructions/claim_reward.rs +++ b/programs/lb_clmm/src/instructions/claim_reward.rs @@ -1,3 +1,4 @@ +use crate::authorize_modify_position; use crate::state::{bin::BinArray, lb_pair::LbPair, position::PositionV2}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; @@ -12,7 +13,7 @@ pub struct ClaimReward<'info> { #[account( mut, has_one = lb_pair, - has_one = owner + constraint = authorize_modify_position(&position, sender.key())? )] pub position: AccountLoader<'info, PositionV2>, @@ -27,7 +28,7 @@ pub struct ClaimReward<'info> { )] pub bin_array_upper: AccountLoader<'info, BinArray>, - pub owner: Signer<'info>, + pub sender: Signer<'info>, #[account(mut)] pub reward_vault: Box>, @@ -39,6 +40,7 @@ pub struct ClaimReward<'info> { pub token_program: Interface<'info, TokenInterface>, } +// TODO: Should we pass in range of bin we are going to collect reward ? It could help us in heap / compute unit issue by chunking into multiple tx. pub fn handle(ctx: Context, index: u64) -> Result<()> { Ok(()) } diff --git a/programs/lb_clmm/src/instructions/close_position.rs b/programs/lb_clmm/src/instructions/close_position.rs index bdff918a..184b2e8c 100644 --- a/programs/lb_clmm/src/instructions/close_position.rs +++ b/programs/lb_clmm/src/instructions/close_position.rs @@ -1,5 +1,6 @@ use anchor_lang::prelude::*; +use crate::authorize_modify_position; use crate::state::{bin::BinArray, lb_pair::LbPair, position::PositionV2}; #[event_cpi] @@ -7,8 +8,8 @@ use crate::state::{bin::BinArray, lb_pair::LbPair, position::PositionV2}; pub struct ClosePosition<'info> { #[account( mut, - has_one = owner, has_one = lb_pair, + constraint = authorize_modify_position(&position, sender.key())?, close = rent_receiver )] pub position: AccountLoader<'info, PositionV2>, @@ -27,7 +28,7 @@ pub struct ClosePosition<'info> { )] pub bin_array_upper: AccountLoader<'info, BinArray>, - pub owner: Signer<'info>, + pub sender: Signer<'info>, /// CHECK: Account to receive closed account rental SOL #[account(mut)] diff --git a/programs/lb_clmm/src/instructions/close_preset_parameter.rs b/programs/lb_clmm/src/instructions/close_preset_parameter.rs index 7fd1c6c5..68edaf48 100644 --- a/programs/lb_clmm/src/instructions/close_preset_parameter.rs +++ b/programs/lb_clmm/src/instructions/close_preset_parameter.rs @@ -1,5 +1,5 @@ +use crate::assert_eq_admin; use crate::errors::LBError; -use crate::instructions::assert_eq_admin; use crate::state::preset_parameters::PresetParameter; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/initialize_permission_lb_pair.rs b/programs/lb_clmm/src/instructions/initialize_permission_lb_pair.rs index 8e1f253a..123e1ca8 100644 --- a/programs/lb_clmm/src/instructions/initialize_permission_lb_pair.rs +++ b/programs/lb_clmm/src/instructions/initialize_permission_lb_pair.rs @@ -1,3 +1,4 @@ +use crate::assert_eq_admin; use crate::constants::DEFAULT_OBSERVATION_LENGTH; use crate::errors::LBError; use crate::state::bin_array_bitmap_extension::BinArrayBitmapExtension; @@ -6,7 +7,6 @@ use crate::state::oracle::Oracle; use crate::state::preset_parameters::PresetParameter; use crate::utils::seeds::BIN_ARRAY_BITMAP_SEED; use crate::utils::seeds::ORACLE; -use crate::utils::seeds::PERMISSION as PERMISSION_SEED; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; use std::cmp::{max, min}; @@ -15,16 +15,18 @@ use std::cmp::{max, min}; #[derive(Accounts)] #[instruction(active_id: i32, bin_step: u16)] pub struct InitializePermissionLbPair<'info> { + pub base: Signer<'info>, + #[account( init, seeds = [ - PERMISSION_SEED, + base.key().as_ref(), min(token_mint_x.key(), token_mint_y.key()).as_ref(), max(token_mint_x.key(), token_mint_y.key()).as_ref(), &bin_step.to_le_bytes(), ], bump, - payer = funder, + payer = admin, space = 8 + LbPair::INIT_SPACE )] pub lb_pair: AccountLoader<'info, LbPair>, @@ -36,7 +38,7 @@ pub struct InitializePermissionLbPair<'info> { lb_pair.key().as_ref(), ], bump, - payer = funder, + payer = admin, space = 8 + BinArrayBitmapExtension::INIT_SPACE )] pub bin_array_bitmap_extension: Option>, @@ -52,7 +54,7 @@ pub struct InitializePermissionLbPair<'info> { token_mint_x.key().as_ref() ], bump, - payer = funder, + payer = admin, token::mint = token_mint_x, token::authority = lb_pair, )] @@ -64,7 +66,7 @@ pub struct InitializePermissionLbPair<'info> { token_mint_y.key().as_ref() ], bump, - payer = funder, + payer = admin, token::mint = token_mint_y, token::authority = lb_pair, )] @@ -77,7 +79,7 @@ pub struct InitializePermissionLbPair<'info> { lb_pair.key().as_ref() ], bump, - payer = funder, + payer = admin, space = Oracle::space(DEFAULT_OBSERVATION_LENGTH) )] pub oracle: AccountLoader<'info, Oracle>, @@ -87,8 +89,11 @@ pub struct InitializePermissionLbPair<'info> { )] pub preset_parameter: Account<'info, PresetParameter>, - #[account(mut)] - pub funder: Signer<'info>, + #[account( + mut, + constraint = assert_eq_admin(admin.key()) @ LBError::InvalidAdmin, + )] + pub admin: Signer<'info>, // #[account(address = Token2022::id())] pub token_program: Interface<'info, TokenInterface>, diff --git a/programs/lb_clmm/src/instructions/initialize_position_by_operator.rs b/programs/lb_clmm/src/instructions/initialize_position_by_operator.rs new file mode 100644 index 00000000..7d384f93 --- /dev/null +++ b/programs/lb_clmm/src/instructions/initialize_position_by_operator.rs @@ -0,0 +1,46 @@ +use crate::state::position::PositionV2; +use crate::state::{lb_pair::LbPair}; +use crate::utils::seeds; +use anchor_lang::prelude::*; + +#[event_cpi] +#[derive(Accounts)] +#[instruction(lower_bin_id: i32, width: i32)] +pub struct InitializePositionByOperator<'info> { + #[account(mut)] + pub payer: Signer<'info>, + + pub base: Signer<'info>, + #[account( + init, + seeds = [ + seeds::POSITION.as_ref(), + lb_pair.key().as_ref(), + base.key().as_ref(), + lower_bin_id.to_le_bytes().as_ref(), + width.to_le_bytes().as_ref(), + ], + bump, + payer = payer, + space = 8 + PositionV2::INIT_SPACE, + )] + pub position: AccountLoader<'info, PositionV2>, + + pub lb_pair: AccountLoader<'info, LbPair>, + + /// operator + pub operator: Signer<'info>, + + pub system_program: Program<'info, System>, + + pub rent: Sysvar<'info, Rent>, +} + + + +/// There is scenario that operator create and deposit position with non-valid owner +/// Then fund will be lost forever, so only whitelisted operators are able to perform this action +pub fn handle(ctx: Context, lower_bin_id: i32, width: i32, owner: Pubkey) -> Result<()> { + Ok(()) +} + diff --git a/programs/lb_clmm/src/instructions/initialize_position_pda.rs b/programs/lb_clmm/src/instructions/initialize_position_pda.rs index 5429e55a..c07b2341 100644 --- a/programs/lb_clmm/src/instructions/initialize_position_pda.rs +++ b/programs/lb_clmm/src/instructions/initialize_position_pda.rs @@ -1,5 +1,5 @@ use crate::state::position::PositionV2; -use crate::state::{lb_pair::LbPair}; +use crate::state::lb_pair::LbPair; use crate::utils::seeds; use anchor_lang::prelude::*; @@ -28,6 +28,7 @@ pub struct InitializePositionPda<'info> { pub lb_pair: AccountLoader<'info, LbPair>, + /// owner pub owner: Signer<'info>, pub system_program: Program<'info, System>, diff --git a/programs/lb_clmm/src/instructions/initialize_preset_parameters.rs b/programs/lb_clmm/src/instructions/initialize_preset_parameters.rs index d3729e41..7e6aef83 100644 --- a/programs/lb_clmm/src/instructions/initialize_preset_parameters.rs +++ b/programs/lb_clmm/src/instructions/initialize_preset_parameters.rs @@ -1,5 +1,5 @@ +use crate::assert_eq_admin; use crate::errors::LBError; -use crate::instructions::assert_eq_admin; use crate::state::preset_parameters::PresetParameter; use crate::utils::seeds::PRESET_PARAMETER; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/initialize_reward.rs b/programs/lb_clmm/src/instructions/initialize_reward.rs index baa20c7b..f577db3b 100644 --- a/programs/lb_clmm/src/instructions/initialize_reward.rs +++ b/programs/lb_clmm/src/instructions/initialize_reward.rs @@ -1,4 +1,4 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; use crate::errors::LBError; use crate::state::lb_pair::LbPair; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/migrate_bin_array.rs b/programs/lb_clmm/src/instructions/migrate_bin_array.rs index 117037c8..cd5bb75b 100644 --- a/programs/lb_clmm/src/instructions/migrate_bin_array.rs +++ b/programs/lb_clmm/src/instructions/migrate_bin_array.rs @@ -1,6 +1,5 @@ -use anchor_lang::prelude::*; - use crate::state::lb_pair::LbPair; +use anchor_lang::prelude::*; #[derive(Accounts)] pub struct MigrateBinArray<'info> { diff --git a/programs/lb_clmm/src/instructions/mod.rs b/programs/lb_clmm/src/instructions/mod.rs index 7ad3d545..e42723aa 100644 --- a/programs/lb_clmm/src/instructions/mod.rs +++ b/programs/lb_clmm/src/instructions/mod.rs @@ -1,5 +1,3 @@ -use anchor_lang::prelude::Pubkey; - pub mod add_liquidity; pub mod add_liquidity_by_strategy; pub mod add_liquidity_by_strategy_one_side; @@ -16,11 +14,13 @@ pub mod initialize_bin_array_bitmap_extension; pub mod initialize_lb_pair; pub mod initialize_permission_lb_pair; pub mod initialize_position; +pub mod initialize_position_by_operator; pub mod initialize_position_pda; pub mod initialize_preset_parameters; pub mod initialize_reward; pub mod migrate_bin_array; pub mod migrate_position; +pub mod position_authorize; pub mod remove_all_liquidity; pub mod remove_liquidity; pub mod swap; @@ -28,12 +28,9 @@ pub mod toggle_pair_status; pub mod update_fee_owner; pub mod update_fee_parameters; pub mod update_fees_and_rewards; +pub mod update_position_operator; pub mod update_reward_duration; pub mod update_reward_funder; pub mod update_whitelisted_wallet; pub mod withdraw_ineligible_reward; pub mod withdraw_protocol_fee; - -fn assert_eq_admin(admin: Pubkey) -> bool { - admin.eq(&crate::admin::ID) -} diff --git a/programs/lb_clmm/src/instructions/position_authorize.rs b/programs/lb_clmm/src/instructions/position_authorize.rs new file mode 100644 index 00000000..b1703433 --- /dev/null +++ b/programs/lb_clmm/src/instructions/position_authorize.rs @@ -0,0 +1,14 @@ +use crate::state::position::PositionV2; +use anchor_lang::prelude::*; + +pub fn authorize_modify_position<'info>( + position: &AccountLoader<'info, PositionV2>, + sender: Pubkey, +) -> Result { + let position = position.load()?; + return Ok(position.owner == sender || position.operator == sender); +} + +pub trait PositionLiquidityFlowValidator { + fn validate_outflow_to_ata_of_position_owner(&self, owner: Pubkey) -> Result<()>; +} diff --git a/programs/lb_clmm/src/instructions/remove_liquidity.rs b/programs/lb_clmm/src/instructions/remove_liquidity.rs index 76ec33a8..1df3d19d 100644 --- a/programs/lb_clmm/src/instructions/remove_liquidity.rs +++ b/programs/lb_clmm/src/instructions/remove_liquidity.rs @@ -1,11 +1,25 @@ use super::add_liquidity::ModifyLiquidity; +use crate::constants::BASIS_POINT_MAX; +use crate::{errors::LBError, math::safe_math::SafeMath, state::position::PositionV2}; use anchor_lang::prelude::*; +use ruint::aliases::U256; #[derive(AnchorSerialize, AnchorDeserialize, Debug, Clone)] pub struct BinLiquidityReduction { pub bin_id: i32, pub bps_to_remove: u16, } +pub fn calculate_shares_to_remove(bps: u16, bin_id: i32, position: &PositionV2) -> Result { + let share_in_bin = U256::from(position.get_liquidity_share_in_bin(bin_id)?); + + let share_to_remove: u128 = U256::from(bps) + .safe_mul(share_in_bin)? + .safe_div(U256::from(BASIS_POINT_MAX))? + .try_into() + .map_err(|_| LBError::TypeCastFailed)?; + Ok(share_to_remove) +} + pub fn handle<'a, 'b, 'c, 'info>( ctx: Context<'a, 'b, 'c, 'info, ModifyLiquidity<'info>>, bin_liquidity_reduction: Vec, diff --git a/programs/lb_clmm/src/instructions/swap.rs b/programs/lb_clmm/src/instructions/swap.rs index a89e1f75..adde6ce7 100644 --- a/programs/lb_clmm/src/instructions/swap.rs +++ b/programs/lb_clmm/src/instructions/swap.rs @@ -1,10 +1,9 @@ use crate::errors::LBError; use crate::state::bin_array_bitmap_extension::BinArrayBitmapExtension; +use crate::state::lb_pair::*; use crate::state::oracle::Oracle; -use crate::state::{bin::BinArray, lb_pair::*}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; -use std::cell::RefMut; #[event_cpi] #[derive(Accounts)] @@ -55,7 +54,6 @@ pub struct Swap<'info> { pub token_y_program: Interface<'info, TokenInterface>, } -/// BinArray needs to be passed in remaining accounts, refer CLI for swap tx pub fn handle<'a, 'b, 'c, 'info>( ctx: Context<'a, 'b, 'c, 'info, Swap<'info>>, amount_in: u64, diff --git a/programs/lb_clmm/src/instructions/toggle_pair_status.rs b/programs/lb_clmm/src/instructions/toggle_pair_status.rs index 05a23bc0..5a53485c 100644 --- a/programs/lb_clmm/src/instructions/toggle_pair_status.rs +++ b/programs/lb_clmm/src/instructions/toggle_pair_status.rs @@ -1,4 +1,4 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; use crate::errors::LBError; use crate::state::lb_pair::LbPair; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/update_fee_owner.rs b/programs/lb_clmm/src/instructions/update_fee_owner.rs index f6d7c87b..9e3ce2a0 100644 --- a/programs/lb_clmm/src/instructions/update_fee_owner.rs +++ b/programs/lb_clmm/src/instructions/update_fee_owner.rs @@ -1,4 +1,4 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; use crate::errors::LBError; use crate::state::lb_pair::LbPair; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/update_fee_parameters.rs b/programs/lb_clmm/src/instructions/update_fee_parameters.rs index e9ac2b51..85730c11 100644 --- a/programs/lb_clmm/src/instructions/update_fee_parameters.rs +++ b/programs/lb_clmm/src/instructions/update_fee_parameters.rs @@ -1,4 +1,4 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; use crate::errors::LBError; use crate::state::lb_pair::LbPair; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/update_fees_and_rewards.rs b/programs/lb_clmm/src/instructions/update_fees_and_rewards.rs index a2514a17..d436b231 100644 --- a/programs/lb_clmm/src/instructions/update_fees_and_rewards.rs +++ b/programs/lb_clmm/src/instructions/update_fees_and_rewards.rs @@ -1,3 +1,4 @@ +use crate::authorize_modify_position; use crate::state::{bin::BinArray, lb_pair::LbPair, position::PositionV2}; use anchor_lang::prelude::*; @@ -6,7 +7,7 @@ pub struct UpdateFeesAndRewards<'info> { #[account( mut, has_one = lb_pair, - has_one = owner + constraint = authorize_modify_position(&position, owner.key())? )] pub position: AccountLoader<'info, PositionV2>, diff --git a/programs/lb_clmm/src/instructions/update_position_operator.rs b/programs/lb_clmm/src/instructions/update_position_operator.rs new file mode 100644 index 00000000..d2333ea8 --- /dev/null +++ b/programs/lb_clmm/src/instructions/update_position_operator.rs @@ -0,0 +1,13 @@ +use crate::state::position::PositionV2; +use anchor_lang::prelude::*; +#[event_cpi] +#[derive(Accounts)] +pub struct UpdatePositionOperator<'info> { + #[account(mut, has_one = owner)] + pub position: AccountLoader<'info, PositionV2>, + pub owner: Signer<'info>, +} + +pub fn handle(ctx: Context, new_operator: Pubkey) -> Result<()> { + Ok(()) +} diff --git a/programs/lb_clmm/src/instructions/update_reward_duration.rs b/programs/lb_clmm/src/instructions/update_reward_duration.rs index 9fed473d..3e34b998 100644 --- a/programs/lb_clmm/src/instructions/update_reward_duration.rs +++ b/programs/lb_clmm/src/instructions/update_reward_duration.rs @@ -1,4 +1,4 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; use crate::errors::LBError; use crate::state::bin::BinArray; use crate::state::lb_pair::LbPair; diff --git a/programs/lb_clmm/src/instructions/update_reward_funder.rs b/programs/lb_clmm/src/instructions/update_reward_funder.rs index 866dec2e..f5b64bc9 100644 --- a/programs/lb_clmm/src/instructions/update_reward_funder.rs +++ b/programs/lb_clmm/src/instructions/update_reward_funder.rs @@ -1,4 +1,5 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; +use crate::constants::NUM_REWARDS; use crate::errors::LBError; use crate::state::lb_pair::LbPair; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/instructions/update_whitelisted_wallet.rs b/programs/lb_clmm/src/instructions/update_whitelisted_wallet.rs index ef87582b..e14753f2 100644 --- a/programs/lb_clmm/src/instructions/update_whitelisted_wallet.rs +++ b/programs/lb_clmm/src/instructions/update_whitelisted_wallet.rs @@ -1,4 +1,4 @@ -use super::assert_eq_admin; +use crate::assert_eq_admin; use crate::{errors::LBError, state::lb_pair::LbPair}; use anchor_lang::prelude::*; diff --git a/programs/lb_clmm/src/lib.rs b/programs/lb_clmm/src/lib.rs index 623ccfe7..3a168687 100644 --- a/programs/lb_clmm/src/lib.rs +++ b/programs/lb_clmm/src/lib.rs @@ -25,23 +25,25 @@ use instructions::initialize_bin_array_bitmap_extension::*; use instructions::initialize_lb_pair::*; use instructions::initialize_permission_lb_pair::*; use instructions::initialize_position::*; +use instructions::initialize_position_by_operator::*; use instructions::initialize_position_pda::*; use instructions::initialize_preset_parameters::*; use instructions::initialize_reward::*; use instructions::migrate_bin_array::*; use instructions::migrate_position::*; +use instructions::position_authorize::*; use instructions::remove_liquidity::*; use instructions::swap::*; use instructions::toggle_pair_status::*; use instructions::update_fee_owner::*; use instructions::update_fee_parameters::*; use instructions::update_fees_and_rewards::*; +use instructions::update_position_operator::*; use instructions::update_reward_duration::*; use instructions::update_reward_funder::*; use instructions::update_whitelisted_wallet::*; use instructions::withdraw_ineligible_reward::*; use instructions::withdraw_protocol_fee::*; - #[cfg(feature = "localnet")] declare_id!("LbVRzDTvBDEcrthxfZ4RL6yiq3uZw8bS6MwtdY6UhFQ"); @@ -50,6 +52,23 @@ declare_id!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"); pub mod admin { use super::*; + use anchor_lang::solana_program::pubkey; + + #[cfg(feature = "localnet")] + pub const ADMINS: [Pubkey; 1] = [pubkey!("bossj3JvwiNK7pvjr149DqdtJxf2gdygbcmEPTkb2F1")]; + + #[cfg(not(feature = "localnet"))] + pub const ADMINS: [Pubkey; 3] = [ + pubkey!("5unTfT2kssBuNvHPY6LbJfJpLqEcdMxGYLWHwShaeTLi"), + pubkey!("ChSAh3XXTxpp5n2EmgSCm6vVvVPoD1L9VrK3mcQkYz7m"), + pubkey!("DHLXnJdACTY83yKwnUkeoDjqi4QBbsYGa1v8tJL76ViX"), + ]; +} + +/// Authorized pubkey to withdraw protocol fee +pub mod fee_owner { + use super::*; + #[cfg(feature = "localnet")] declare_id!("bossj3JvwiNK7pvjr149DqdtJxf2gdygbcmEPTkb2F1"); @@ -57,6 +76,13 @@ pub mod admin { declare_id!("6WaLrrRfReGKBYUSkmx2K6AuT21ida4j8at2SUiZdXu8"); } +pub fn assert_eq_admin(admin: Pubkey) -> bool { + crate::admin::ADMINS + .iter() + .position(|predefined_admin| predefined_admin.eq(&admin)) + .is_some() +} + #[program] pub mod lb_clmm { @@ -145,6 +171,22 @@ pub mod lb_clmm { instructions::initialize_position_pda::handle(ctx, lower_bin_id, width) } + pub fn initialize_position_by_operator( + ctx: Context, + lower_bin_id: i32, + width: i32, + owner: Pubkey, + ) -> Result<()> { + instructions::initialize_position_by_operator::handle(ctx, lower_bin_id, width, owner) + } + + pub fn update_position_operator( + ctx: Context, + operator: Pubkey, + ) -> Result<()> { + instructions::update_position_operator::handle(ctx, operator) + } + pub fn swap<'a, 'b, 'c, 'info>( ctx: Context<'a, 'b, 'c, 'info, Swap<'info>>, amount_in: u64, diff --git a/programs/lb_clmm/src/state/lb_pair.rs b/programs/lb_clmm/src/state/lb_pair.rs index 4b84c7c8..67262855 100644 --- a/programs/lb_clmm/src/state/lb_pair.rs +++ b/programs/lb_clmm/src/state/lb_pair.rs @@ -2,6 +2,7 @@ use std::cmp::min; use super::bin::BinArray; use super::parameters::{StaticParameters, VariableParameters}; +use crate::assert_eq_admin; use crate::constants::{ BASIS_POINT_MAX, BIN_ARRAY_BITMAP_SIZE, FEE_PRECISION, MAX_BIN_ID, MAX_FEE_RATE, MAX_FEE_UPDATE_WINDOW, MIN_BIN_ID, @@ -11,7 +12,6 @@ use crate::math::u128x128_math::Rounding; use crate::math::u64x64_math::SCALE_OFFSET; use crate::math::utils_math::{one, safe_mul_div_cast, safe_mul_shr_cast, safe_shl_div_cast}; use crate::state::bin_array_bitmap_extension::BinArrayBitmapExtension; -use crate::utils::seeds::PERMISSION; use crate::{errors::LBError, math::safe_math::SafeMath}; use anchor_lang::prelude::*; use num_enum::{IntoPrimitive, TryFromPrimitive}; @@ -38,11 +38,15 @@ impl PairType { } } -#[derive(Debug, PartialEq, Eq, IntoPrimitive, TryFromPrimitive)] +#[derive( + AnchorSerialize, AnchorDeserialize, Debug, PartialEq, Eq, IntoPrimitive, TryFromPrimitive, +)] #[repr(u8)] /// Pair status. 0 = Enabled, 1 = Disabled. Putting 0 as enabled for backward compatibility. pub enum PairStatus { + // Fully enabled. Normal pool. Enabled, + // Similar as emergency mode. User can only withdraw (Only outflow). Except whitelisted wallet still have full privileges. Disabled, } @@ -91,7 +95,9 @@ pub struct LbPair { /// Last time the pool fee parameter was updated pub last_updated_at: i64, /// Whitelisted wallet - pub whitelisted_wallet: [Pubkey; 3], + pub whitelisted_wallet: [Pubkey; 2], + /// Base keypair. Only required for permission pair + pub base_key: Pubkey, /// Reserved space for future use pub _reserved: [u8; 88], } @@ -117,7 +123,8 @@ impl Default for LbPair { last_updated_at: 0, pair_type: PairType::Permissionless.into(), status: PairStatus::Enabled.into(), - whitelisted_wallet: [Pubkey::default(); 3], + whitelisted_wallet: [Pubkey::default(); 2], + base_key: Pubkey::default(), _padding1: [0u8; 5], _reserved: [0u8; 88], } @@ -154,7 +161,7 @@ impl RewardInfo { } pub fn is_valid_funder(&self, funder: Pubkey) -> bool { - funder.eq(&crate::admin::ID) || funder.eq(&self.funder) + assert_eq_admin(funder) || funder.eq(&self.funder) } pub fn init_reward( @@ -259,6 +266,7 @@ impl LbPair { static_parameter: StaticParameters, pair_type: u8, pair_status: u8, + base_key: Pubkey, ) -> Result<()> { self.parameters = static_parameter; self.active_id = active_id; @@ -267,12 +275,13 @@ impl LbPair { self.token_y_mint = token_mint_y; self.reserve_x = reserve_x; self.reserve_y = reserve_y; - self.fee_owner = crate::admin::ID; + self.fee_owner = crate::fee_owner::ID; self.bump_seed = [bump]; self.bin_step_seed = bin_step.to_le_bytes(); self.oracle = oracle; self.pair_type = pair_type; self.status = pair_status; + self.base_key = base_key; Ok(()) } @@ -323,13 +332,17 @@ impl LbPair { Ok(pair_type.eq(&PairType::Permission)) } - pub fn is_enabled(&self) -> Result { + pub fn status(&self) -> Result { let status: PairStatus = self .status .try_into() .map_err(|_| LBError::TypeCastFailed)?; - Ok(status.eq(&PairStatus::Enabled)) + Ok(status) + } + + pub fn is_enabled(&self) -> Result { + Ok(self.status()?.eq(&PairStatus::Enabled)) } pub fn is_deposit_allowed(&self, wallet: Pubkey) -> Result { @@ -340,6 +353,14 @@ impl LbPair { } } + pub fn is_whitelisted_address(&self, wallet: Pubkey) -> Result { + if self.is_permission_pair()? { + Ok(self.is_wallet_whitelisted(wallet)) + } else { + Ok(false) + } + } + pub fn update_fee_parameters(&mut self, parameter: &FeeParameter) -> Result<()> { let current_timestamp = Clock::get()?.unix_timestamp; if self.last_updated_at > 0 { @@ -366,7 +387,7 @@ impl LbPair { }; if self.is_permission_pair()? { Ok(vec![ - PERMISSION, + self.base_key.as_ref(), min_key_ref, max_key_ref, &self.bin_step_seed, diff --git a/programs/lb_clmm/src/state/position.rs b/programs/lb_clmm/src/state/position.rs index d8698637..4ab58bab 100644 --- a/programs/lb_clmm/src/state/position.rs +++ b/programs/lb_clmm/src/state/position.rs @@ -66,8 +66,10 @@ pub struct PositionV2 { pub total_claimed_fee_y_amount: u64, /// Total claimed rewards pub total_claimed_rewards: [u64; 2], + /// Operator of position + pub operator: Pubkey, /// Reserved space for future use - pub _reserved: [u8; 160], + pub _reserved: [u8; 128], } impl Default for PositionV2 { @@ -84,7 +86,8 @@ impl Default for PositionV2 { total_claimed_fee_x_amount: 0, total_claimed_fee_y_amount: 0, total_claimed_rewards: [0u64; 2], - _reserved: [0u8; 160], + operator: Pubkey::default(), + _reserved: [0u8; 128], } } } @@ -110,12 +113,14 @@ impl PositionV2 { &mut self, lb_pair: Pubkey, owner: Pubkey, + operator: Pubkey, lower_bin_id: i32, upper_bin_id: i32, current_time: i64, ) -> Result<()> { self.lb_pair = lb_pair; self.owner = owner; + self.operator = operator; self.lower_bin_id = lower_bin_id; self.upper_bin_id = upper_bin_id; diff --git a/target/idl/lb_clmm.json b/target/idl/lb_clmm.json index 9112b07d..566cbdbd 100644 --- a/target/idl/lb_clmm.json +++ b/target/idl/lb_clmm.json @@ -208,6 +208,11 @@ { "name": "initializePermissionLbPair", "accounts": [ + { + "name": "base", + "isMut": false, + "isSigner": true + }, { "name": "lbPair", "isMut": true, @@ -250,7 +255,7 @@ "isSigner": false }, { - "name": "funder", + "name": "admin", "isMut": true, "isSigner": true }, @@ -416,7 +421,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -510,7 +515,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -604,7 +609,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -683,7 +688,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -757,7 +762,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -846,7 +851,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -963,8 +968,74 @@ { "name": "owner", "isMut": false, + "isSigner": true, + "docs": [ + "owner" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "lowerBinId", + "type": "i32" + }, + { + "name": "width", + "type": "i32" + } + ] + }, + { + "name": "initializePositionByOperator", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "base", + "isMut": false, "isSigner": true }, + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "lbPair", + "isMut": false, + "isSigner": false + }, + { + "name": "operator", + "isMut": false, + "isSigner": true, + "docs": [ + "operator" + ] + }, { "name": "systemProgram", "isMut": false, @@ -994,6 +1065,41 @@ { "name": "width", "type": "i32" + }, + { + "name": "owner", + "type": "publicKey" + } + ] + }, + { + "name": "updatePositionOperator", + "accounts": [ + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": true + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "operator", + "type": "publicKey" } ] }, @@ -1402,7 +1508,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -1468,7 +1574,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -1544,7 +1650,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -1749,7 +1855,7 @@ "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -2235,10 +2341,17 @@ "type": { "array": [ "publicKey", - 3 + 2 ] } }, + { + "name": "baseKey", + "docs": [ + "Base keypair. Only required for permission pair" + ], + "type": "publicKey" + }, { "name": "reserved", "docs": [ @@ -2510,6 +2623,13 @@ ] } }, + { + "name": "operator", + "docs": [ + "Operator of position" + ], + "type": "publicKey" + }, { "name": "reserved", "docs": [ @@ -2518,7 +2638,7 @@ "type": { "array": [ "u8", - 160 + 128 ] } } @@ -2739,13 +2859,30 @@ { "name": "aAsk", "docs": [ - "amplification" + "amplification in ask side" ], "type": "i16" }, { "name": "aBid", + "docs": [ + "amplification in bid side" + ], "type": "i16" + }, + { + "name": "aActiveBin", + "docs": [ + "amplification in active bin" + ], + "type": "i16" + }, + { + "name": "centerBinId", + "docs": [ + "center bin id" + ], + "type": "i32" } ] } @@ -3982,6 +4119,26 @@ "index": false } ] + }, + { + "name": "UpdatePositionOperator", + "fields": [ + { + "name": "position", + "type": "publicKey", + "index": false + }, + { + "name": "oldOperator", + "type": "publicKey", + "index": false + }, + { + "name": "newOperator", + "type": "publicKey", + "index": false + } + ] } ], "errors": [ @@ -4225,8 +4382,5 @@ "name": "MustWithdrawnIneligibleReward", "msg": "Must withdraw ineligible reward" } - ], - "metadata": { - "address": "GrAkKfEpTKQuVHG2Y97Y2FF4i7y7Q5AHLK94JBy7Y5yv" - } + ] } \ No newline at end of file diff --git a/target/types/lb_clmm.ts b/target/types/lb_clmm.ts index 00408676..1a7d0457 100644 --- a/target/types/lb_clmm.ts +++ b/target/types/lb_clmm.ts @@ -208,6 +208,11 @@ export type LbClmm = { { "name": "initializePermissionLbPair", "accounts": [ + { + "name": "base", + "isMut": false, + "isSigner": true + }, { "name": "lbPair", "isMut": true, @@ -250,7 +255,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "funder", + "name": "admin", "isMut": true, "isSigner": true }, @@ -416,7 +421,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -510,7 +515,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -604,7 +609,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -683,7 +688,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -757,7 +762,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -846,7 +851,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -963,8 +968,74 @@ export type LbClmm = { { "name": "owner", "isMut": false, + "isSigner": true, + "docs": [ + "owner" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "lowerBinId", + "type": "i32" + }, + { + "name": "width", + "type": "i32" + } + ] + }, + { + "name": "initializePositionByOperator", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "base", + "isMut": false, "isSigner": true }, + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "lbPair", + "isMut": false, + "isSigner": false + }, + { + "name": "operator", + "isMut": false, + "isSigner": true, + "docs": [ + "operator" + ] + }, { "name": "systemProgram", "isMut": false, @@ -994,6 +1065,41 @@ export type LbClmm = { { "name": "width", "type": "i32" + }, + { + "name": "owner", + "type": "publicKey" + } + ] + }, + { + "name": "updatePositionOperator", + "accounts": [ + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": true + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "operator", + "type": "publicKey" } ] }, @@ -1402,7 +1508,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -1468,7 +1574,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -1544,7 +1650,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -1749,7 +1855,7 @@ export type LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -2235,10 +2341,17 @@ export type LbClmm = { "type": { "array": [ "publicKey", - 3 + 2 ] } }, + { + "name": "baseKey", + "docs": [ + "Base keypair. Only required for permission pair" + ], + "type": "publicKey" + }, { "name": "reserved", "docs": [ @@ -2510,6 +2623,13 @@ export type LbClmm = { ] } }, + { + "name": "operator", + "docs": [ + "Operator of position" + ], + "type": "publicKey" + }, { "name": "reserved", "docs": [ @@ -2518,7 +2638,7 @@ export type LbClmm = { "type": { "array": [ "u8", - 160 + 128 ] } } @@ -2739,13 +2859,30 @@ export type LbClmm = { { "name": "aAsk", "docs": [ - "amplification" + "amplification in ask side" ], "type": "i16" }, { "name": "aBid", + "docs": [ + "amplification in bid side" + ], "type": "i16" + }, + { + "name": "aActiveBin", + "docs": [ + "amplification in active bin" + ], + "type": "i16" + }, + { + "name": "centerBinId", + "docs": [ + "center bin id" + ], + "type": "i32" } ] } @@ -3982,6 +4119,26 @@ export type LbClmm = { "index": false } ] + }, + { + "name": "UpdatePositionOperator", + "fields": [ + { + "name": "position", + "type": "publicKey", + "index": false + }, + { + "name": "oldOperator", + "type": "publicKey", + "index": false + }, + { + "name": "newOperator", + "type": "publicKey", + "index": false + } + ] } ], "errors": [ @@ -4438,6 +4595,11 @@ export const IDL: LbClmm = { { "name": "initializePermissionLbPair", "accounts": [ + { + "name": "base", + "isMut": false, + "isSigner": true + }, { "name": "lbPair", "isMut": true, @@ -4480,7 +4642,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "funder", + "name": "admin", "isMut": true, "isSigner": true }, @@ -4646,7 +4808,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -4740,7 +4902,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -4834,7 +4996,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -4913,7 +5075,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -4987,7 +5149,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -5076,7 +5238,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -5193,8 +5355,74 @@ export const IDL: LbClmm = { { "name": "owner", "isMut": false, + "isSigner": true, + "docs": [ + "owner" + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "lowerBinId", + "type": "i32" + }, + { + "name": "width", + "type": "i32" + } + ] + }, + { + "name": "initializePositionByOperator", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "base", + "isMut": false, "isSigner": true }, + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "lbPair", + "isMut": false, + "isSigner": false + }, + { + "name": "operator", + "isMut": false, + "isSigner": true, + "docs": [ + "operator" + ] + }, { "name": "systemProgram", "isMut": false, @@ -5224,6 +5452,41 @@ export const IDL: LbClmm = { { "name": "width", "type": "i32" + }, + { + "name": "owner", + "type": "publicKey" + } + ] + }, + { + "name": "updatePositionOperator", + "accounts": [ + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": true + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "operator", + "type": "publicKey" } ] }, @@ -5632,7 +5895,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -5698,7 +5961,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -5774,7 +6037,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -5979,7 +6242,7 @@ export const IDL: LbClmm = { "isSigner": false }, { - "name": "owner", + "name": "sender", "isMut": false, "isSigner": true }, @@ -6465,10 +6728,17 @@ export const IDL: LbClmm = { "type": { "array": [ "publicKey", - 3 + 2 ] } }, + { + "name": "baseKey", + "docs": [ + "Base keypair. Only required for permission pair" + ], + "type": "publicKey" + }, { "name": "reserved", "docs": [ @@ -6740,6 +7010,13 @@ export const IDL: LbClmm = { ] } }, + { + "name": "operator", + "docs": [ + "Operator of position" + ], + "type": "publicKey" + }, { "name": "reserved", "docs": [ @@ -6748,7 +7025,7 @@ export const IDL: LbClmm = { "type": { "array": [ "u8", - 160 + 128 ] } } @@ -6969,13 +7246,30 @@ export const IDL: LbClmm = { { "name": "aAsk", "docs": [ - "amplification" + "amplification in ask side" ], "type": "i16" }, { "name": "aBid", + "docs": [ + "amplification in bid side" + ], "type": "i16" + }, + { + "name": "aActiveBin", + "docs": [ + "amplification in active bin" + ], + "type": "i16" + }, + { + "name": "centerBinId", + "docs": [ + "center bin id" + ], + "type": "i32" } ] } @@ -8212,6 +8506,26 @@ export const IDL: LbClmm = { "index": false } ] + }, + { + "name": "UpdatePositionOperator", + "fields": [ + { + "name": "position", + "type": "publicKey", + "index": false + }, + { + "name": "oldOperator", + "type": "publicKey", + "index": false + }, + { + "name": "newOperator", + "type": "publicKey", + "index": false + } + ] } ], "errors": [ diff --git a/ts-client/src/dlmm/idl.ts b/ts-client/src/dlmm/idl.ts index b98c04bf..1a7d0457 100644 --- a/ts-client/src/dlmm/idl.ts +++ b/ts-client/src/dlmm/idl.ts @@ -1,7946 +1,8773 @@ export type LbClmm = { - version: "0.5.0"; - name: "lb_clmm"; - constants: [ + "version": "0.5.0", + "name": "lb_clmm", + "constants": [ { - name: "BASIS_POINT_MAX"; - type: "i32"; - value: "10000"; + "name": "BASIS_POINT_MAX", + "type": "i32", + "value": "10000" }, { - name: "MAX_BIN_PER_ARRAY"; - type: { - defined: "usize"; - }; - value: "70"; + "name": "MAX_BIN_PER_ARRAY", + "type": { + "defined": "usize" + }, + "value": "70" }, { - name: "MAX_BIN_PER_POSITION"; - type: { - defined: "usize"; - }; - value: "70"; + "name": "MAX_BIN_PER_POSITION", + "type": { + "defined": "usize" + }, + "value": "70" }, { - name: "MIN_BIN_ID"; - type: "i32"; - value: "- 443636"; + "name": "MIN_BIN_ID", + "type": "i32", + "value": "- 443636" }, { - name: "MAX_BIN_ID"; - type: "i32"; - value: "443636"; + "name": "MAX_BIN_ID", + "type": "i32", + "value": "443636" }, { - name: "MAX_FEE_RATE"; - type: "u64"; - value: "100_000_000"; + "name": "MAX_FEE_RATE", + "type": "u64", + "value": "100_000_000" }, { - name: "FEE_PRECISION"; - type: "u64"; - value: "1_000_000_000"; + "name": "FEE_PRECISION", + "type": "u64", + "value": "1_000_000_000" }, { - name: "MAX_PROTOCOL_SHARE"; - type: "u16"; - value: "2_500"; + "name": "MAX_PROTOCOL_SHARE", + "type": "u16", + "value": "2_500" }, { - name: "HOST_FEE_BPS"; - type: "u16"; - value: "2_000"; + "name": "HOST_FEE_BPS", + "type": "u16", + "value": "2_000" }, { - name: "NUM_REWARDS"; - type: { - defined: "usize"; - }; - value: "2"; + "name": "NUM_REWARDS", + "type": { + "defined": "usize" + }, + "value": "2" }, { - name: "MIN_REWARD_DURATION"; - type: "u64"; - value: "1"; + "name": "MIN_REWARD_DURATION", + "type": "u64", + "value": "1" }, { - name: "MAX_REWARD_DURATION"; - type: "u64"; - value: "31536000"; + "name": "MAX_REWARD_DURATION", + "type": "u64", + "value": "31536000" }, { - name: "EXTENSION_BINARRAY_BITMAP_SIZE"; - type: { - defined: "usize"; - }; - value: "12"; + "name": "EXTENSION_BINARRAY_BITMAP_SIZE", + "type": { + "defined": "usize" + }, + "value": "12" }, { - name: "BIN_ARRAY_BITMAP_SIZE"; - type: "i32"; - value: "512"; + "name": "BIN_ARRAY_BITMAP_SIZE", + "type": "i32", + "value": "512" }, { - name: "MAX_REWARD_BIN_SPLIT"; - type: { - defined: "usize"; - }; - value: "15"; + "name": "MAX_REWARD_BIN_SPLIT", + "type": { + "defined": "usize" + }, + "value": "15" }, { - name: "BIN_ARRAY"; - type: "bytes"; - value: "[98, 105, 110, 95, 97, 114, 114, 97, 121]"; + "name": "BIN_ARRAY", + "type": "bytes", + "value": "[98, 105, 110, 95, 97, 114, 114, 97, 121]" }, { - name: "ORACLE"; - type: "bytes"; - value: "[111, 114, 97, 99, 108, 101]"; + "name": "ORACLE", + "type": "bytes", + "value": "[111, 114, 97, 99, 108, 101]" }, { - name: "BIN_ARRAY_BITMAP_SEED"; - type: "bytes"; - value: "[98, 105, 116, 109, 97, 112]"; + "name": "BIN_ARRAY_BITMAP_SEED", + "type": "bytes", + "value": "[98, 105, 116, 109, 97, 112]" }, { - name: "PRESET_PARAMETER"; - type: "bytes"; - value: "[112, 114, 101, 115, 101, 116, 95, 112, 97, 114, 97, 109, 101, 116, 101, 114]"; + "name": "PRESET_PARAMETER", + "type": "bytes", + "value": "[112, 114, 101, 115, 101, 116, 95, 112, 97, 114, 97, 109, 101, 116, 101, 114]" }, { - name: "PERMISSION"; - type: "bytes"; - value: "[112, 101, 114, 109, 105, 115, 115, 105, 111, 110]"; + "name": "PERMISSION", + "type": "bytes", + "value": "[112, 101, 114, 109, 105, 115, 115, 105, 111, 110]" }, { - name: "POSITION"; - type: "bytes"; - value: "[112, 111, 115, 105, 116, 105, 111, 110]"; + "name": "POSITION", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110]" } - ]; - instructions: [ + ], + "instructions": [ { - name: "initializeLbPair"; - accounts: [ + "name": "initializeLbPair", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "tokenMintX"; - isMut: false; - isSigner: false; + "name": "tokenMintX", + "isMut": false, + "isSigner": false }, { - name: "tokenMintY"; - isMut: false; - isSigner: false; + "name": "tokenMintY", + "isMut": false, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "oracle"; - isMut: true; - isSigner: false; + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "presetParameter"; - isMut: false; - isSigner: false; + "name": "presetParameter", + "isMut": false, + "isSigner": false }, { - name: "funder"; - isMut: true; - isSigner: true; + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "activeId"; - type: "i32"; + "name": "activeId", + "type": "i32" }, { - name: "binStep"; - type: "u16"; + "name": "binStep", + "type": "u16" } - ]; + ] }, { - name: "initializePermissionLbPair"; - accounts: [ + "name": "initializePermissionLbPair", + "accounts": [ + { + "name": "base", + "isMut": false, + "isSigner": true + }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "tokenMintX"; - isMut: false; - isSigner: false; + "name": "tokenMintX", + "isMut": false, + "isSigner": false }, { - name: "tokenMintY"; - isMut: false; - isSigner: false; + "name": "tokenMintY", + "isMut": false, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "oracle"; - isMut: true; - isSigner: false; + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "presetParameter"; - isMut: false; - isSigner: false; + "name": "presetParameter", + "isMut": false, + "isSigner": false }, { - name: "funder"; - isMut: true; - isSigner: true; + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "activeId"; - type: "i32"; + "name": "activeId", + "type": "i32" }, { - name: "binStep"; - type: "u16"; + "name": "binStep", + "type": "u16" } - ]; + ] }, { - name: "initializeBinArrayBitmapExtension"; - accounts: [ + "name": "initializeBinArrayBitmapExtension", + "accounts": [ { - name: "lbPair"; - isMut: false; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - docs: [ + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "docs": [ "Initialize an account to store if a bin array is initialized." - ]; + ] }, { - name: "funder"; - isMut: true; - isSigner: true; + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "initializeBinArray"; - accounts: [ + "name": "initializeBinArray", + "accounts": [ { - name: "lbPair"; - isMut: false; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "binArray"; - isMut: true; - isSigner: false; + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "funder"; - isMut: true; - isSigner: true; + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "index"; - type: "i64"; + "name": "index", + "type": "i64" } - ]; + ] }, { - name: "addLiquidity"; - accounts: [ + "name": "addLiquidity", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX"; - isMut: true; - isSigner: false; + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY"; - isMut: true; - isSigner: false; + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "liquidityParameter"; - type: { - defined: "LiquidityParameter"; - }; + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameter" + } } - ]; + ] }, { - name: "addLiquidityByWeight"; - accounts: [ + "name": "addLiquidityByWeight", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX"; - isMut: true; - isSigner: false; + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY"; - isMut: true; - isSigner: false; + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "liquidityParameter"; - type: { - defined: "LiquidityParameterByWeight"; - }; + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameterByWeight" + } } - ]; + ] }, { - name: "addLiquidityByStrategy"; - accounts: [ + "name": "addLiquidityByStrategy", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX"; - isMut: true; - isSigner: false; + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY"; - isMut: true; - isSigner: false; + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "liquidityParameter"; - type: { - defined: "LiquidityParameterByStrategy"; - }; + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameterByStrategy" + } } - ]; + ] }, { - name: "addLiquidityByStrategyOneSide"; - accounts: [ + "name": "addLiquidityByStrategyOneSide", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userToken"; - isMut: true; - isSigner: false; + "name": "userToken", + "isMut": true, + "isSigner": false }, { - name: "reserve"; - isMut: true; - isSigner: false; + "name": "reserve", + "isMut": true, + "isSigner": false }, { - name: "tokenMint"; - isMut: false; - isSigner: false; + "name": "tokenMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "liquidityParameter"; - type: { - defined: "LiquidityParameterByStrategyOneSide"; - }; + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameterByStrategyOneSide" + } } - ]; + ] }, { - name: "addLiquidityOneSide"; - accounts: [ + "name": "addLiquidityOneSide", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userToken"; - isMut: true; - isSigner: false; + "name": "userToken", + "isMut": true, + "isSigner": false }, { - name: "reserve"; - isMut: true; - isSigner: false; + "name": "reserve", + "isMut": true, + "isSigner": false }, { - name: "tokenMint"; - isMut: false; - isSigner: false; + "name": "tokenMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "liquidityParameter"; - type: { - defined: "LiquidityOneSideParameter"; - }; + "name": "liquidityParameter", + "type": { + "defined": "LiquidityOneSideParameter" + } } - ]; + ] }, { - name: "removeLiquidity"; - accounts: [ + "name": "removeLiquidity", + "accounts": [ + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "lbPair", + "isMut": true, + "isSigner": false + }, + { + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true + }, + { + "name": "userTokenX", + "isMut": true, + "isSigner": false + }, + { + "name": "userTokenY", + "isMut": true, + "isSigner": false + }, { - name: "position"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "userTokenX"; - isMut: true; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "userTokenY"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "binLiquidityRemoval", + "type": { + "vec": { + "defined": "BinLiquidityReduction" + } + } + } + ] + }, + { + "name": "initializePosition", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "position", + "isMut": true, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "owner", + "isMut": false, + "isSigner": true }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ + { + "name": "lowerBinId", + "type": "i32" + }, { - name: "binLiquidityRemoval"; - type: { - vec: { - defined: "BinLiquidityReduction"; - }; - }; + "name": "width", + "type": "i32" } - ]; + ] }, { - name: "initializePosition"; - accounts: [ + "name": "initializePositionPda", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true + }, { - name: "payer"; - isMut: true; - isSigner: true; + "name": "base", + "isMut": false, + "isSigner": true }, { - name: "position"; - isMut: true; - isSigner: true; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: false; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": [ + "owner" + ] }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "lowerBinId"; - type: "i32"; + "name": "lowerBinId", + "type": "i32" }, { - name: "width"; - type: "i32"; + "name": "width", + "type": "i32" } - ]; + ] }, { - name: "initializePositionPda"; - accounts: [ + "name": "initializePositionByOperator", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true + }, { - name: "payer"; - isMut: true; - isSigner: true; + "name": "base", + "isMut": false, + "isSigner": true }, { - name: "base"; - isMut: false; - isSigner: true; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "position"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "lbPair"; - isMut: false; - isSigner: false; + "name": "operator", + "isMut": false, + "isSigner": true, + "docs": [ + "operator" + ] }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "lowerBinId", + "type": "i32" }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "width", + "type": "i32" }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "owner", + "type": "publicKey" } - ]; - args: [ + ] + }, + { + "name": "updatePositionOperator", + "accounts": [ + { + "name": "position", + "isMut": true, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": true + }, { - name: "lowerBinId"; - type: "i32"; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "width"; - type: "i32"; + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "operator", + "type": "publicKey" } - ]; + ] }, { - name: "swap"; - accounts: [ + "name": "swap", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: false; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": false, + "isSigner": false, + "isOptional": true }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "userTokenIn"; - isMut: true; - isSigner: false; + "name": "userTokenIn", + "isMut": true, + "isSigner": false }, { - name: "userTokenOut"; - isMut: true; - isSigner: false; + "name": "userTokenOut", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "oracle"; - isMut: true; - isSigner: false; + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "hostFeeIn"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "hostFeeIn", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "user"; - isMut: false; - isSigner: true; + "name": "user", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "amountIn"; - type: "u64"; + "name": "amountIn", + "type": "u64" }, { - name: "minAmountOut"; - type: "u64"; + "name": "minAmountOut", + "type": "u64" } - ]; + ] }, { - name: "withdrawProtocolFee"; - accounts: [ + "name": "withdrawProtocolFee", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "receiverTokenX"; - isMut: true; - isSigner: false; + "name": "receiverTokenX", + "isMut": true, + "isSigner": false }, { - name: "receiverTokenY"; - isMut: true; - isSigner: false; + "name": "receiverTokenY", + "isMut": true, + "isSigner": false }, { - name: "feeOwner"; - isMut: false; - isSigner: true; + "name": "feeOwner", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "amountX"; - type: "u64"; + "name": "amountX", + "type": "u64" }, { - name: "amountY"; - type: "u64"; + "name": "amountY", + "type": "u64" } - ]; + ] }, { - name: "updateFeeOwner"; - accounts: [ + "name": "updateFeeOwner", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "newFeeOwner"; - isMut: false; - isSigner: false; + "name": "newFeeOwner", + "isMut": false, + "isSigner": false }, { - name: "admin"; - isMut: false; - isSigner: true; + "name": "admin", + "isMut": false, + "isSigner": true } - ]; - args: []; + ], + "args": [] }, { - name: "initializeReward"; - accounts: [ + "name": "initializeReward", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "rewardVault"; - isMut: true; - isSigner: false; + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint"; - isMut: false; - isSigner: false; + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "admin"; - isMut: true; - isSigner: true; + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "rewardIndex"; - type: "u64"; + "name": "rewardIndex", + "type": "u64" }, { - name: "rewardDuration"; - type: "u64"; + "name": "rewardDuration", + "type": "u64" }, { - name: "funder"; - type: "publicKey"; + "name": "funder", + "type": "publicKey" } - ]; + ] }, { - name: "fundReward"; - accounts: [ + "name": "fundReward", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "rewardVault"; - isMut: true; - isSigner: false; + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint"; - isMut: false; - isSigner: false; + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "funderTokenAccount"; - isMut: true; - isSigner: false; + "name": "funderTokenAccount", + "isMut": true, + "isSigner": false }, { - name: "funder"; - isMut: false; - isSigner: true; + "name": "funder", + "isMut": false, + "isSigner": true }, { - name: "binArray"; - isMut: true; - isSigner: false; + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "rewardIndex"; - type: "u64"; + "name": "rewardIndex", + "type": "u64" }, { - name: "amount"; - type: "u64"; + "name": "amount", + "type": "u64" }, { - name: "carryForward"; - type: "bool"; + "name": "carryForward", + "type": "bool" } - ]; + ] }, { - name: "updateRewardFunder"; - accounts: [ + "name": "updateRewardFunder", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: false; - isSigner: true; + "name": "admin", + "isMut": false, + "isSigner": true }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "rewardIndex"; - type: "u64"; + "name": "rewardIndex", + "type": "u64" }, { - name: "newFunder"; - type: "publicKey"; + "name": "newFunder", + "type": "publicKey" } - ]; + ] }, { - name: "updateRewardDuration"; - accounts: [ + "name": "updateRewardDuration", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: false; - isSigner: true; + "name": "admin", + "isMut": false, + "isSigner": true }, { - name: "binArray"; - isMut: true; - isSigner: false; + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "rewardIndex"; - type: "u64"; + "name": "rewardIndex", + "type": "u64" }, { - name: "newDuration"; - type: "u64"; + "name": "newDuration", + "type": "u64" } - ]; + ] }, { - name: "claimReward"; - accounts: [ + "name": "claimReward", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "rewardVault"; - isMut: true; - isSigner: false; + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint"; - isMut: false; - isSigner: false; + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "userTokenAccount"; - isMut: true; - isSigner: false; + "name": "userTokenAccount", + "isMut": true, + "isSigner": false }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "rewardIndex"; - type: "u64"; + "name": "rewardIndex", + "type": "u64" } - ]; + ] }, { - name: "claimFee"; - accounts: [ + "name": "claimFee", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "userTokenX"; - isMut: true; - isSigner: false; + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY"; - isMut: true; - isSigner: false; + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "closePosition"; - accounts: [ + "name": "closePosition", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "rentReceiver"; - isMut: true; - isSigner: false; + "name": "rentReceiver", + "isMut": true, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "updateFeeParameters"; - accounts: [ + "name": "updateFeeParameters", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: false; - isSigner: true; + "name": "admin", + "isMut": false, + "isSigner": true }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "feeParameter"; - type: { - defined: "FeeParameter"; - }; + "name": "feeParameter", + "type": { + "defined": "FeeParameter" + } } - ]; + ] }, { - name: "increaseOracleLength"; - accounts: [ + "name": "increaseOracleLength", + "accounts": [ { - name: "oracle"; - isMut: true; - isSigner: false; + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "funder"; - isMut: true; - isSigner: true; + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "lengthToAdd"; - type: "u64"; + "name": "lengthToAdd", + "type": "u64" } - ]; + ] }, { - name: "initializePresetParameter"; - accounts: [ + "name": "initializePresetParameter", + "accounts": [ { - name: "presetParameter"; - isMut: true; - isSigner: false; + "name": "presetParameter", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: true; - isSigner: true; + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent"; - isMut: false; - isSigner: false; + "name": "rent", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "ix"; - type: { - defined: "InitPresetParametersIx"; - }; + "name": "ix", + "type": { + "defined": "InitPresetParametersIx" + } } - ]; + ] }, { - name: "closePresetParameter"; - accounts: [ + "name": "closePresetParameter", + "accounts": [ { - name: "presetParameter"; - isMut: true; - isSigner: false; + "name": "presetParameter", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: true; - isSigner: true; + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "rentReceiver"; - isMut: true; - isSigner: false; + "name": "rentReceiver", + "isMut": true, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "removeAllLiquidity"; - accounts: [ + "name": "removeAllLiquidity", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension"; - isMut: true; - isSigner: false; - isOptional: true; + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX"; - isMut: true; - isSigner: false; + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY"; - isMut: true; - isSigner: false; + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX"; - isMut: true; - isSigner: false; + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY"; - isMut: true; - isSigner: false; + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint"; - isMut: false; - isSigner: false; + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint"; - isMut: false; - isSigner: false; + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram"; - isMut: false; - isSigner: false; + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram"; - isMut: false; - isSigner: false; + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "togglePairStatus"; - accounts: [ + "name": "togglePairStatus", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: false; - isSigner: true; + "name": "admin", + "isMut": false, + "isSigner": true } - ]; - args: []; + ], + "args": [] }, { - name: "updateWhitelistedWallet"; - accounts: [ + "name": "updateWhitelistedWallet", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin"; - isMut: false; - isSigner: true; + "name": "admin", + "isMut": false, + "isSigner": true } - ]; - args: [ + ], + "args": [ { - name: "idx"; - type: "u8"; + "name": "idx", + "type": "u8" }, { - name: "wallet"; - type: "publicKey"; + "name": "wallet", + "type": "publicKey" } - ]; + ] }, { - name: "migratePosition"; - accounts: [ + "name": "migratePosition", + "accounts": [ { - name: "positionV2"; - isMut: true; - isSigner: true; + "name": "positionV2", + "isMut": true, + "isSigner": true }, { - name: "positionV1"; - isMut: true; - isSigner: false; + "name": "positionV1", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: false; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: true; - isSigner: true; + "name": "owner", + "isMut": true, + "isSigner": true }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rentReceiver"; - isMut: true; - isSigner: false; + "name": "rentReceiver", + "isMut": true, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "migrateBinArray"; - accounts: [ + "name": "migrateBinArray", + "accounts": [ { - name: "lbPair"; - isMut: false; - isSigner: false; + "name": "lbPair", + "isMut": false, + "isSigner": false } - ]; - args: []; + ], + "args": [] }, { - name: "updateFeesAndRewards"; - accounts: [ + "name": "updateFeesAndRewards", + "accounts": [ { - name: "position"; - isMut: true; - isSigner: false; + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower"; - isMut: true; - isSigner: false; + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper"; - isMut: true; - isSigner: false; + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner"; - isMut: false; - isSigner: true; + "name": "owner", + "isMut": false, + "isSigner": true } - ]; - args: []; + ], + "args": [] }, { - name: "withdrawIneligibleReward"; - accounts: [ + "name": "withdrawIneligibleReward", + "accounts": [ { - name: "lbPair"; - isMut: true; - isSigner: false; + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "rewardVault"; - isMut: true; - isSigner: false; + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint"; - isMut: false; - isSigner: false; + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "funderTokenAccount"; - isMut: true; - isSigner: false; + "name": "funderTokenAccount", + "isMut": true, + "isSigner": false }, { - name: "funder"; - isMut: false; - isSigner: true; + "name": "funder", + "isMut": false, + "isSigner": true }, { - name: "binArray"; - isMut: true; - isSigner: false; + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program"; - isMut: false; - isSigner: false; + "name": "program", + "isMut": false, + "isSigner": false } - ]; - args: [ + ], + "args": [ { - name: "rewardIndex"; - type: "u64"; + "name": "rewardIndex", + "type": "u64" } - ]; + ] } - ]; - accounts: [ + ], + "accounts": [ { - name: "binArrayBitmapExtension"; - type: { - kind: "struct"; - fields: [ + "name": "binArrayBitmapExtension", + "type": { + "kind": "struct", + "fields": [ { - name: "lbPair"; - type: "publicKey"; + "name": "lbPair", + "type": "publicKey" }, { - name: "positiveBinArrayBitmap"; - docs: [ + "name": "positiveBinArrayBitmap", + "docs": [ "Packed initialized bin array state for start_bin_index is positive" - ]; - type: { - array: [ + ], + "type": { + "array": [ { - array: ["u64", 8]; + "array": [ + "u64", + 8 + ] }, 12 - ]; - }; + ] + } }, { - name: "negativeBinArrayBitmap"; - docs: [ + "name": "negativeBinArrayBitmap", + "docs": [ "Packed initialized bin array state for start_bin_index is negative" - ]; - type: { - array: [ + ], + "type": { + "array": [ { - array: ["u64", 8]; + "array": [ + "u64", + 8 + ] }, 12 - ]; - }; + ] + } } - ]; - }; + ] + } }, { - name: "binArray"; - docs: [ + "name": "binArray", + "docs": [ "An account to contain a range of bin. For example: Bin 100 <-> 200.", "For example:", "BinArray index: 0 contains bin 0 <-> 599", "index: 2 contains bin 600 <-> 1199, ..." - ]; - type: { - kind: "struct"; - fields: [ + ], + "type": { + "kind": "struct", + "fields": [ { - name: "index"; - type: "i64"; + "name": "index", + "type": "i64" }, { - name: "version"; - docs: ["Version of binArray"]; - type: "u8"; + "name": "version", + "docs": [ + "Version of binArray" + ], + "type": "u8" }, { - name: "padding"; - type: { - array: ["u8", 7]; - }; + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } }, { - name: "lbPair"; - type: "publicKey"; + "name": "lbPair", + "type": "publicKey" }, { - name: "bins"; - type: { - array: [ + "name": "bins", + "type": { + "array": [ { - defined: "Bin"; + "defined": "Bin" }, 70 - ]; - }; + ] + } } - ]; - }; + ] + } }, { - name: "lbPair"; - type: { - kind: "struct"; - fields: [ + "name": "lbPair", + "type": { + "kind": "struct", + "fields": [ { - name: "parameters"; - type: { - defined: "StaticParameters"; - }; + "name": "parameters", + "type": { + "defined": "StaticParameters" + } }, { - name: "vParameters"; - type: { - defined: "VariableParameters"; - }; + "name": "vParameters", + "type": { + "defined": "VariableParameters" + } }, { - name: "bumpSeed"; - type: { - array: ["u8", 1]; - }; + "name": "bumpSeed", + "type": { + "array": [ + "u8", + 1 + ] + } }, { - name: "binStepSeed"; - docs: ["Bin step signer seed"]; - type: { - array: ["u8", 2]; - }; + "name": "binStepSeed", + "docs": [ + "Bin step signer seed" + ], + "type": { + "array": [ + "u8", + 2 + ] + } }, { - name: "pairType"; - docs: ["Type of the pair"]; - type: "u8"; + "name": "pairType", + "docs": [ + "Type of the pair" + ], + "type": "u8" }, { - name: "activeId"; - docs: ["Active bin id"]; - type: "i32"; + "name": "activeId", + "docs": [ + "Active bin id" + ], + "type": "i32" }, { - name: "binStep"; - docs: ["Bin step. Represent the price increment / decrement."]; - type: "u16"; + "name": "binStep", + "docs": [ + "Bin step. Represent the price increment / decrement." + ], + "type": "u16" }, { - name: "status"; - docs: ["Status of the pair"]; - type: "u8"; + "name": "status", + "docs": [ + "Status of the pair" + ], + "type": "u8" }, { - name: "padding1"; - type: { - array: ["u8", 5]; - }; + "name": "padding1", + "type": { + "array": [ + "u8", + 5 + ] + } }, { - name: "tokenXMint"; - docs: ["Token X mint"]; - type: "publicKey"; + "name": "tokenXMint", + "docs": [ + "Token X mint" + ], + "type": "publicKey" }, { - name: "tokenYMint"; - docs: ["Token Y mint"]; - type: "publicKey"; + "name": "tokenYMint", + "docs": [ + "Token Y mint" + ], + "type": "publicKey" }, { - name: "reserveX"; - docs: ["LB token X vault"]; - type: "publicKey"; + "name": "reserveX", + "docs": [ + "LB token X vault" + ], + "type": "publicKey" }, { - name: "reserveY"; - docs: ["LB token Y vault"]; - type: "publicKey"; + "name": "reserveY", + "docs": [ + "LB token Y vault" + ], + "type": "publicKey" }, { - name: "protocolFee"; - docs: ["Uncollected protocol fee"]; - type: { - defined: "ProtocolFee"; - }; + "name": "protocolFee", + "docs": [ + "Uncollected protocol fee" + ], + "type": { + "defined": "ProtocolFee" + } }, { - name: "feeOwner"; - docs: ["Protocol fee owner,"]; - type: "publicKey"; + "name": "feeOwner", + "docs": [ + "Protocol fee owner," + ], + "type": "publicKey" }, { - name: "rewardInfos"; - docs: ["Farming reward information"]; - type: { - array: [ + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ { - defined: "RewardInfo"; + "defined": "RewardInfo" }, 2 - ]; - }; + ] + } + }, + { + "name": "oracle", + "docs": [ + "Oracle pubkey" + ], + "type": "publicKey" }, { - name: "oracle"; - docs: ["Oracle pubkey"]; - type: "publicKey"; + "name": "binArrayBitmap", + "docs": [ + "Packed initialized bin array state" + ], + "type": { + "array": [ + "u64", + 16 + ] + } }, { - name: "binArrayBitmap"; - docs: ["Packed initialized bin array state"]; - type: { - array: ["u64", 16]; - }; + "name": "lastUpdatedAt", + "docs": [ + "Last time the pool fee parameter was updated" + ], + "type": "i64" }, { - name: "lastUpdatedAt"; - docs: ["Last time the pool fee parameter was updated"]; - type: "i64"; + "name": "whitelistedWallet", + "docs": [ + "Whitelisted wallet" + ], + "type": { + "array": [ + "publicKey", + 2 + ] + } }, { - name: "whitelistedWallet"; - docs: ["Whitelisted wallet"]; - type: { - array: ["publicKey", 3]; - }; + "name": "baseKey", + "docs": [ + "Base keypair. Only required for permission pair" + ], + "type": "publicKey" }, { - name: "reserved"; - docs: ["Reserved space for future use"]; - type: { - array: ["u8", 88]; - }; + "name": "reserved", + "docs": [ + "Reserved space for future use" + ], + "type": { + "array": [ + "u8", + 88 + ] + } } - ]; - }; + ] + } }, { - name: "oracle"; - type: { - kind: "struct"; - fields: [ + "name": "oracle", + "type": { + "kind": "struct", + "fields": [ { - name: "idx"; - docs: ["Index of latest observation slot"]; - type: "u64"; + "name": "idx", + "docs": [ + "Index of latest observation slot" + ], + "type": "u64" }, { - name: "activeSize"; - docs: [ + "name": "activeSize", + "docs": [ "Size of active sample. Active sample is initialized observation." - ]; - type: "u64"; + ], + "type": "u64" }, { - name: "length"; - docs: ["Number of observations"]; - type: "u64"; + "name": "length", + "docs": [ + "Number of observations" + ], + "type": "u64" } - ]; - }; + ] + } }, { - name: "position"; - type: { - kind: "struct"; - fields: [ + "name": "position", + "type": { + "kind": "struct", + "fields": [ { - name: "lbPair"; - docs: ["The LB pair of this position"]; - type: "publicKey"; + "name": "lbPair", + "docs": [ + "The LB pair of this position" + ], + "type": "publicKey" }, { - name: "owner"; - docs: [ + "name": "owner", + "docs": [ "Owner of the position. Client rely on this to to fetch their positions." - ]; - type: "publicKey"; + ], + "type": "publicKey" }, { - name: "liquidityShares"; - docs: [ + "name": "liquidityShares", + "docs": [ "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept." - ]; - type: { - array: ["u64", 70]; - }; + ], + "type": { + "array": [ + "u64", + 70 + ] + } }, { - name: "rewardInfos"; - docs: ["Farming reward information"]; - type: { - array: [ + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ { - defined: "UserRewardInfo"; + "defined": "UserRewardInfo" }, 70 - ]; - }; + ] + } }, { - name: "feeInfos"; - docs: ["Swap fee to claim information"]; - type: { - array: [ + "name": "feeInfos", + "docs": [ + "Swap fee to claim information" + ], + "type": { + "array": [ { - defined: "FeeInfo"; + "defined": "FeeInfo" }, 70 - ]; - }; + ] + } }, { - name: "lowerBinId"; - docs: ["Lower bin ID"]; - type: "i32"; + "name": "lowerBinId", + "docs": [ + "Lower bin ID" + ], + "type": "i32" }, { - name: "upperBinId"; - docs: ["Upper bin ID"]; - type: "i32"; + "name": "upperBinId", + "docs": [ + "Upper bin ID" + ], + "type": "i32" }, { - name: "lastUpdatedAt"; - docs: ["Last updated timestamp"]; - type: "i64"; + "name": "lastUpdatedAt", + "docs": [ + "Last updated timestamp" + ], + "type": "i64" }, { - name: "totalClaimedFeeXAmount"; - docs: ["Total claimed token fee X"]; - type: "u64"; + "name": "totalClaimedFeeXAmount", + "docs": [ + "Total claimed token fee X" + ], + "type": "u64" }, { - name: "totalClaimedFeeYAmount"; - docs: ["Total claimed token fee Y"]; - type: "u64"; + "name": "totalClaimedFeeYAmount", + "docs": [ + "Total claimed token fee Y" + ], + "type": "u64" }, { - name: "totalClaimedRewards"; - docs: ["Total claimed rewards"]; - type: { - array: ["u64", 2]; - }; + "name": "totalClaimedRewards", + "docs": [ + "Total claimed rewards" + ], + "type": { + "array": [ + "u64", + 2 + ] + } }, { - name: "reserved"; - docs: ["Reserved space for future use"]; - type: { - array: ["u8", 160]; - }; + "name": "reserved", + "docs": [ + "Reserved space for future use" + ], + "type": { + "array": [ + "u8", + 160 + ] + } } - ]; - }; + ] + } }, { - name: "positionV2"; - type: { - kind: "struct"; - fields: [ + "name": "positionV2", + "type": { + "kind": "struct", + "fields": [ { - name: "lbPair"; - docs: ["The LB pair of this position"]; - type: "publicKey"; + "name": "lbPair", + "docs": [ + "The LB pair of this position" + ], + "type": "publicKey" }, { - name: "owner"; - docs: [ + "name": "owner", + "docs": [ "Owner of the position. Client rely on this to to fetch their positions." - ]; - type: "publicKey"; + ], + "type": "publicKey" }, { - name: "liquidityShares"; - docs: [ + "name": "liquidityShares", + "docs": [ "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept." - ]; - type: { - array: ["u128", 70]; - }; + ], + "type": { + "array": [ + "u128", + 70 + ] + } }, { - name: "rewardInfos"; - docs: ["Farming reward information"]; - type: { - array: [ + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ { - defined: "UserRewardInfo"; + "defined": "UserRewardInfo" }, 70 - ]; - }; + ] + } }, { - name: "feeInfos"; - docs: ["Swap fee to claim information"]; - type: { - array: [ + "name": "feeInfos", + "docs": [ + "Swap fee to claim information" + ], + "type": { + "array": [ { - defined: "FeeInfo"; + "defined": "FeeInfo" }, 70 - ]; - }; + ] + } + }, + { + "name": "lowerBinId", + "docs": [ + "Lower bin ID" + ], + "type": "i32" }, { - name: "lowerBinId"; - docs: ["Lower bin ID"]; - type: "i32"; + "name": "upperBinId", + "docs": [ + "Upper bin ID" + ], + "type": "i32" }, { - name: "upperBinId"; - docs: ["Upper bin ID"]; - type: "i32"; + "name": "lastUpdatedAt", + "docs": [ + "Last updated timestamp" + ], + "type": "i64" }, { - name: "lastUpdatedAt"; - docs: ["Last updated timestamp"]; - type: "i64"; + "name": "totalClaimedFeeXAmount", + "docs": [ + "Total claimed token fee X" + ], + "type": "u64" }, { - name: "totalClaimedFeeXAmount"; - docs: ["Total claimed token fee X"]; - type: "u64"; + "name": "totalClaimedFeeYAmount", + "docs": [ + "Total claimed token fee Y" + ], + "type": "u64" }, { - name: "totalClaimedFeeYAmount"; - docs: ["Total claimed token fee Y"]; - type: "u64"; + "name": "totalClaimedRewards", + "docs": [ + "Total claimed rewards" + ], + "type": { + "array": [ + "u64", + 2 + ] + } }, { - name: "totalClaimedRewards"; - docs: ["Total claimed rewards"]; - type: { - array: ["u64", 2]; - }; + "name": "operator", + "docs": [ + "Operator of position" + ], + "type": "publicKey" }, { - name: "reserved"; - docs: ["Reserved space for future use"]; - type: { - array: ["u8", 160]; - }; + "name": "reserved", + "docs": [ + "Reserved space for future use" + ], + "type": { + "array": [ + "u8", + 128 + ] + } } - ]; - }; + ] + } }, { - name: "presetParameter"; - type: { - kind: "struct"; - fields: [ + "name": "presetParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "binStep"; - docs: ["Bin step. Represent the price increment / decrement."]; - type: "u16"; + "name": "binStep", + "docs": [ + "Bin step. Represent the price increment / decrement." + ], + "type": "u16" }, { - name: "baseFactor"; - docs: [ + "name": "baseFactor", + "docs": [ "Used for base fee calculation. base_fee_rate = base_factor * bin_step" - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "filterPeriod"; - docs: [ + "name": "filterPeriod", + "docs": [ "Filter period determine high frequency trading time window." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "decayPeriod"; - docs: [ + "name": "decayPeriod", + "docs": [ "Decay period determine when the volatile fee start decay / decrease." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "reductionFactor"; - docs: [ + "name": "reductionFactor", + "docs": [ "Reduction factor controls the volatile fee rate decrement rate." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "variableFeeControl"; - docs: [ + "name": "variableFeeControl", + "docs": [ "Used to scale the variable fee component depending on the dynamic of the market" - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "maxVolatilityAccumulator"; - docs: [ + "name": "maxVolatilityAccumulator", + "docs": [ "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "minBinId"; - docs: [ + "name": "minBinId", + "docs": [ "Min bin id supported by the pool based on the configured bin step." - ]; - type: "i32"; + ], + "type": "i32" }, { - name: "maxBinId"; - docs: [ + "name": "maxBinId", + "docs": [ "Max bin id supported by the pool based on the configured bin step." - ]; - type: "i32"; + ], + "type": "i32" }, { - name: "protocolShare"; - docs: [ + "name": "protocolShare", + "docs": [ "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ]; - type: "u16"; + ], + "type": "u16" } - ]; - }; + ] + } } - ]; - types: [ + ], + "types": [ { - name: "LiquidityParameterByStrategyOneSide"; - type: { - kind: "struct"; - fields: [ + "name": "LiquidityParameterByStrategyOneSide", + "type": { + "kind": "struct", + "fields": [ { - name: "amount"; - docs: ["Amount of X token or Y token to deposit"]; - type: "u64"; + "name": "amount", + "docs": [ + "Amount of X token or Y token to deposit" + ], + "type": "u64" }, { - name: "activeId"; - docs: ["Active bin that integrator observe off-chain"]; - type: "i32"; + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage"; - docs: ["max active bin slippage allowed"]; - type: "i32"; + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "strategyParameters"; - docs: ["strategy parameters"]; - type: { - defined: "StrategyParameters"; - }; + "name": "strategyParameters", + "docs": [ + "strategy parameters" + ], + "type": { + "defined": "StrategyParameters" + } } - ]; - }; + ] + } }, { - name: "LiquidityParameterByStrategy"; - type: { - kind: "struct"; - fields: [ + "name": "LiquidityParameterByStrategy", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX"; - docs: ["Amount of X token to deposit"]; - type: "u64"; + "name": "amountX", + "docs": [ + "Amount of X token to deposit" + ], + "type": "u64" }, { - name: "amountY"; - docs: ["Amount of Y token to deposit"]; - type: "u64"; + "name": "amountY", + "docs": [ + "Amount of Y token to deposit" + ], + "type": "u64" }, { - name: "activeId"; - docs: ["Active bin that integrator observe off-chain"]; - type: "i32"; + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage"; - docs: ["max active bin slippage allowed"]; - type: "i32"; + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "strategyParameters"; - docs: ["strategy parameters"]; - type: { - defined: "StrategyParameters"; - }; + "name": "strategyParameters", + "docs": [ + "strategy parameters" + ], + "type": { + "defined": "StrategyParameters" + } } - ]; - }; + ] + } }, { - name: "StrategyParameters"; - type: { - kind: "struct"; - fields: [ + "name": "StrategyParameters", + "type": { + "kind": "struct", + "fields": [ { - name: "minBinId"; - docs: ["min bin id"]; - type: "i32"; + "name": "minBinId", + "docs": [ + "min bin id" + ], + "type": "i32" }, { - name: "maxBinId"; - docs: ["max bin id"]; - type: "i32"; + "name": "maxBinId", + "docs": [ + "max bin id" + ], + "type": "i32" }, { - name: "strategyType"; - docs: ["strategy type"]; - type: { - defined: "StrategyType"; - }; + "name": "strategyType", + "docs": [ + "strategy type" + ], + "type": { + "defined": "StrategyType" + } }, { - name: "parameteres"; - docs: ["parameters"]; - type: { - array: ["u8", 64]; - }; + "name": "parameteres", + "docs": [ + "parameters" + ], + "type": { + "array": [ + "u8", + 64 + ] + } } - ]; - }; + ] + } }, { - name: "ParabolicParameter"; - type: { - kind: "struct"; - fields: [ + "name": "ParabolicParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "aAsk"; - docs: ["amplification in ask side"]; - type: "i16"; + "name": "aAsk", + "docs": [ + "amplification in ask side" + ], + "type": "i16" }, { - name: "aBid"; - docs: ["amplification in bid side"]; - type: "i16"; + "name": "aBid", + "docs": [ + "amplification in bid side" + ], + "type": "i16" }, { - name: "aActiveBin"; - docs: ["amplification in active bin"]; - type: "i16"; + "name": "aActiveBin", + "docs": [ + "amplification in active bin" + ], + "type": "i16" }, { - name: "centerBinId"; - docs: ["center bin id"]; - type: "i32"; + "name": "centerBinId", + "docs": [ + "center bin id" + ], + "type": "i32" } - ]; - }; + ] + } }, { - name: "SpotParameter"; - type: { - kind: "struct"; - fields: [ + "name": "SpotParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "weightAsk"; - docs: ["weight in ask side"]; - type: "u16"; + "name": "weightAsk", + "docs": [ + "weight in ask side" + ], + "type": "u16" }, { - name: "weightBid"; - docs: ["weight in bid side"]; - type: "u16"; + "name": "weightBid", + "docs": [ + "weight in bid side" + ], + "type": "u16" }, { - name: "weightActiveBin"; - docs: ["weight in active bin"]; - type: "u16"; + "name": "weightActiveBin", + "docs": [ + "weight in active bin" + ], + "type": "u16" } - ]; - }; + ] + } }, { - name: "BinLiquidityDistributionByWeight"; - type: { - kind: "struct"; - fields: [ + "name": "BinLiquidityDistributionByWeight", + "type": { + "kind": "struct", + "fields": [ { - name: "binId"; - docs: ["Define the bin ID wish to deposit to."]; - type: "i32"; + "name": "binId", + "docs": [ + "Define the bin ID wish to deposit to." + ], + "type": "i32" }, { - name: "weight"; - docs: ["weight of liquidity distributed for this bin id"]; - type: "u16"; + "name": "weight", + "docs": [ + "weight of liquidity distributed for this bin id" + ], + "type": "u16" } - ]; - }; + ] + } }, { - name: "LiquidityParameterByWeight"; - type: { - kind: "struct"; - fields: [ + "name": "LiquidityParameterByWeight", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX"; - docs: ["Amount of X token to deposit"]; - type: "u64"; + "name": "amountX", + "docs": [ + "Amount of X token to deposit" + ], + "type": "u64" }, { - name: "amountY"; - docs: ["Amount of Y token to deposit"]; - type: "u64"; + "name": "amountY", + "docs": [ + "Amount of Y token to deposit" + ], + "type": "u64" }, { - name: "activeId"; - docs: ["Active bin that integrator observe off-chain"]; - type: "i32"; + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage"; - docs: ["max active bin slippage allowed"]; - type: "i32"; + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "binLiquidityDist"; - docs: ["Liquidity distribution to each bins"]; - type: { - vec: { - defined: "BinLiquidityDistributionByWeight"; - }; - }; + "name": "binLiquidityDist", + "docs": [ + "Liquidity distribution to each bins" + ], + "type": { + "vec": { + "defined": "BinLiquidityDistributionByWeight" + } + } } - ]; - }; + ] + } }, { - name: "LiquidityOneSideParameter"; - type: { - kind: "struct"; - fields: [ + "name": "LiquidityOneSideParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "amount"; - docs: ["Amount of X token or Y token to deposit"]; - type: "u64"; + "name": "amount", + "docs": [ + "Amount of X token or Y token to deposit" + ], + "type": "u64" }, { - name: "activeId"; - docs: ["Active bin that integrator observe off-chain"]; - type: "i32"; + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage"; - docs: ["max active bin slippage allowed"]; - type: "i32"; + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "binLiquidityDist"; - docs: ["Liquidity distribution to each bins"]; - type: { - vec: { - defined: "BinLiquidityDistributionByWeight"; - }; - }; + "name": "binLiquidityDist", + "docs": [ + "Liquidity distribution to each bins" + ], + "type": { + "vec": { + "defined": "BinLiquidityDistributionByWeight" + } + } } - ]; - }; + ] + } }, { - name: "BinLiquidityDistribution"; - type: { - kind: "struct"; - fields: [ + "name": "BinLiquidityDistribution", + "type": { + "kind": "struct", + "fields": [ { - name: "binId"; - docs: ["Define the bin ID wish to deposit to."]; - type: "i32"; + "name": "binId", + "docs": [ + "Define the bin ID wish to deposit to." + ], + "type": "i32" }, { - name: "distributionX"; - docs: [ + "name": "distributionX", + "docs": [ "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "distributionY"; - docs: [ + "name": "distributionY", + "docs": [ "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin." - ]; - type: "u16"; + ], + "type": "u16" } - ]; - }; + ] + } }, { - name: "LiquidityParameter"; - type: { - kind: "struct"; - fields: [ + "name": "LiquidityParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX"; - docs: ["Amount of X token to deposit"]; - type: "u64"; + "name": "amountX", + "docs": [ + "Amount of X token to deposit" + ], + "type": "u64" }, { - name: "amountY"; - docs: ["Amount of Y token to deposit"]; - type: "u64"; + "name": "amountY", + "docs": [ + "Amount of Y token to deposit" + ], + "type": "u64" }, { - name: "binLiquidityDist"; - docs: ["Liquidity distribution to each bins"]; - type: { - vec: { - defined: "BinLiquidityDistribution"; - }; - }; + "name": "binLiquidityDist", + "docs": [ + "Liquidity distribution to each bins" + ], + "type": { + "vec": { + "defined": "BinLiquidityDistribution" + } + } } - ]; - }; + ] + } }, { - name: "InitPresetParametersIx"; - type: { - kind: "struct"; - fields: [ + "name": "InitPresetParametersIx", + "type": { + "kind": "struct", + "fields": [ { - name: "binStep"; - docs: ["Bin step. Represent the price increment / decrement."]; - type: "u16"; + "name": "binStep", + "docs": [ + "Bin step. Represent the price increment / decrement." + ], + "type": "u16" }, { - name: "baseFactor"; - docs: [ + "name": "baseFactor", + "docs": [ "Used for base fee calculation. base_fee_rate = base_factor * bin_step" - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "filterPeriod"; - docs: [ + "name": "filterPeriod", + "docs": [ "Filter period determine high frequency trading time window." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "decayPeriod"; - docs: [ + "name": "decayPeriod", + "docs": [ "Decay period determine when the volatile fee start decay / decrease." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "reductionFactor"; - docs: [ + "name": "reductionFactor", + "docs": [ "Reduction factor controls the volatile fee rate decrement rate." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "variableFeeControl"; - docs: [ + "name": "variableFeeControl", + "docs": [ "Used to scale the variable fee component depending on the dynamic of the market" - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "maxVolatilityAccumulator"; - docs: [ + "name": "maxVolatilityAccumulator", + "docs": [ "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "minBinId"; - docs: [ + "name": "minBinId", + "docs": [ "Min bin id supported by the pool based on the configured bin step." - ]; - type: "i32"; + ], + "type": "i32" }, { - name: "maxBinId"; - docs: [ + "name": "maxBinId", + "docs": [ "Max bin id supported by the pool based on the configured bin step." - ]; - type: "i32"; + ], + "type": "i32" }, { - name: "protocolShare"; - docs: [ + "name": "protocolShare", + "docs": [ "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ]; - type: "u16"; + ], + "type": "u16" } - ]; - }; + ] + } }, { - name: "BinLiquidityReduction"; - type: { - kind: "struct"; - fields: [ + "name": "BinLiquidityReduction", + "type": { + "kind": "struct", + "fields": [ { - name: "binId"; - type: "i32"; + "name": "binId", + "type": "i32" }, { - name: "bpsToRemove"; - type: "u16"; + "name": "bpsToRemove", + "type": "u16" } - ]; - }; + ] + } }, { - name: "FeeParameter"; - type: { - kind: "struct"; - fields: [ + "name": "FeeParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "protocolShare"; - docs: [ + "name": "protocolShare", + "docs": [ "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "baseFactor"; - docs: ["Base factor for base fee rate"]; - type: "u16"; + "name": "baseFactor", + "docs": [ + "Base factor for base fee rate" + ], + "type": "u16" } - ]; - }; + ] + } }, { - name: "Bin"; - type: { - kind: "struct"; - fields: [ + "name": "Bin", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX"; - docs: [ + "name": "amountX", + "docs": [ "Amount of token X in the bin. This already excluded protocol fees." - ]; - type: "u64"; + ], + "type": "u64" }, { - name: "amountY"; - docs: [ + "name": "amountY", + "docs": [ "Amount of token Y in the bin. This already excluded protocol fees." - ]; - type: "u64"; + ], + "type": "u64" }, { - name: "price"; - docs: ["Bin price"]; - type: "u128"; + "name": "price", + "docs": [ + "Bin price" + ], + "type": "u128" }, { - name: "liquiditySupply"; - docs: [ + "name": "liquiditySupply", + "docs": [ "Liquidities of the bin. This is the same as LP mint supply. q-number" - ]; - type: "u128"; + ], + "type": "u128" }, { - name: "rewardPerTokenStored"; - docs: ["reward_a_per_token_stored"]; - type: { - array: ["u128", 2]; - }; + "name": "rewardPerTokenStored", + "docs": [ + "reward_a_per_token_stored" + ], + "type": { + "array": [ + "u128", + 2 + ] + } }, { - name: "feeAmountXPerTokenStored"; - docs: ["Swap fee amount of token X per liquidity deposited."]; - type: "u128"; + "name": "feeAmountXPerTokenStored", + "docs": [ + "Swap fee amount of token X per liquidity deposited." + ], + "type": "u128" }, { - name: "feeAmountYPerTokenStored"; - docs: ["Swap fee amount of token Y per liquidity deposited."]; - type: "u128"; + "name": "feeAmountYPerTokenStored", + "docs": [ + "Swap fee amount of token Y per liquidity deposited." + ], + "type": "u128" }, { - name: "amountXIn"; - docs: [ + "name": "amountXIn", + "docs": [ "Total token X swap into the bin. Only used for tracking purpose." - ]; - type: "u128"; + ], + "type": "u128" }, { - name: "amountYIn"; - docs: [ + "name": "amountYIn", + "docs": [ "Total token Y swap into he bin. Only used for tracking purpose." - ]; - type: "u128"; + ], + "type": "u128" } - ]; - }; + ] + } }, { - name: "ProtocolFee"; - type: { - kind: "struct"; - fields: [ + "name": "ProtocolFee", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX"; - type: "u64"; + "name": "amountX", + "type": "u64" }, { - name: "amountY"; - type: "u64"; + "name": "amountY", + "type": "u64" } - ]; - }; + ] + } }, { - name: "RewardInfo"; - docs: ["Stores the state relevant for tracking liquidity mining rewards"]; - type: { - kind: "struct"; - fields: [ + "name": "RewardInfo", + "docs": [ + "Stores the state relevant for tracking liquidity mining rewards" + ], + "type": { + "kind": "struct", + "fields": [ { - name: "mint"; - docs: ["Reward token mint."]; - type: "publicKey"; + "name": "mint", + "docs": [ + "Reward token mint." + ], + "type": "publicKey" }, { - name: "vault"; - docs: ["Reward vault token account."]; - type: "publicKey"; + "name": "vault", + "docs": [ + "Reward vault token account." + ], + "type": "publicKey" }, { - name: "funder"; - docs: ["Authority account that allows to fund rewards"]; - type: "publicKey"; + "name": "funder", + "docs": [ + "Authority account that allows to fund rewards" + ], + "type": "publicKey" }, { - name: "rewardDuration"; - docs: ["TODO check whether we need to store it in pool"]; - type: "u64"; + "name": "rewardDuration", + "docs": [ + "TODO check whether we need to store it in pool" + ], + "type": "u64" }, { - name: "rewardDurationEnd"; - docs: ["TODO check whether we need to store it in pool"]; - type: "u64"; + "name": "rewardDurationEnd", + "docs": [ + "TODO check whether we need to store it in pool" + ], + "type": "u64" }, { - name: "rewardRate"; - docs: ["TODO check whether we need to store it in pool"]; - type: "u128"; + "name": "rewardRate", + "docs": [ + "TODO check whether we need to store it in pool" + ], + "type": "u128" }, { - name: "lastUpdateTime"; - docs: ["The last time reward states were updated."]; - type: "u64"; + "name": "lastUpdateTime", + "docs": [ + "The last time reward states were updated." + ], + "type": "u64" }, { - name: "cumulativeSecondsWithEmptyLiquidityReward"; - docs: [ + "name": "cumulativeSecondsWithEmptyLiquidityReward", + "docs": [ "Accumulated seconds where when farm distribute rewards, but the bin is empty. The reward will be accumulated for next reward time window." - ]; - type: "u64"; + ], + "type": "u64" } - ]; - }; + ] + } }, { - name: "Observation"; - type: { - kind: "struct"; - fields: [ + "name": "Observation", + "type": { + "kind": "struct", + "fields": [ { - name: "cumulativeActiveBinId"; - docs: ["Cumulative active bin ID"]; - type: "i128"; + "name": "cumulativeActiveBinId", + "docs": [ + "Cumulative active bin ID" + ], + "type": "i128" }, { - name: "createdAt"; - docs: ["Observation sample created timestamp"]; - type: "i64"; + "name": "createdAt", + "docs": [ + "Observation sample created timestamp" + ], + "type": "i64" }, { - name: "lastUpdatedAt"; - docs: ["Observation sample last updated timestamp"]; - type: "i64"; + "name": "lastUpdatedAt", + "docs": [ + "Observation sample last updated timestamp" + ], + "type": "i64" } - ]; - }; + ] + } }, { - name: "StaticParameters"; - docs: ["Parameter that set by the protocol"]; - type: { - kind: "struct"; - fields: [ + "name": "StaticParameters", + "docs": [ + "Parameter that set by the protocol" + ], + "type": { + "kind": "struct", + "fields": [ { - name: "baseFactor"; - docs: [ + "name": "baseFactor", + "docs": [ "Used for base fee calculation. base_fee_rate = base_factor * bin_step" - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "filterPeriod"; - docs: [ + "name": "filterPeriod", + "docs": [ "Filter period determine high frequency trading time window." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "decayPeriod"; - docs: [ + "name": "decayPeriod", + "docs": [ "Decay period determine when the volatile fee start decay / decrease." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "reductionFactor"; - docs: [ + "name": "reductionFactor", + "docs": [ "Reduction factor controls the volatile fee rate decrement rate." - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "variableFeeControl"; - docs: [ + "name": "variableFeeControl", + "docs": [ "Used to scale the variable fee component depending on the dynamic of the market" - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "maxVolatilityAccumulator"; - docs: [ + "name": "maxVolatilityAccumulator", + "docs": [ "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "minBinId"; - docs: [ + "name": "minBinId", + "docs": [ "Min bin id supported by the pool based on the configured bin step." - ]; - type: "i32"; + ], + "type": "i32" }, { - name: "maxBinId"; - docs: [ + "name": "maxBinId", + "docs": [ "Max bin id supported by the pool based on the configured bin step." - ]; - type: "i32"; + ], + "type": "i32" }, { - name: "protocolShare"; - docs: [ + "name": "protocolShare", + "docs": [ "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" - ]; - type: "u16"; + ], + "type": "u16" }, { - name: "padding"; - docs: ["Padding for bytemuck safe alignment"]; - type: { - array: ["u8", 6]; - }; + "name": "padding", + "docs": [ + "Padding for bytemuck safe alignment" + ], + "type": { + "array": [ + "u8", + 6 + ] + } } - ]; - }; + ] + } }, { - name: "VariableParameters"; - docs: ["Parameters that changes based on dynamic of the market"]; - type: { - kind: "struct"; - fields: [ + "name": "VariableParameters", + "docs": [ + "Parameters that changes based on dynamic of the market" + ], + "type": { + "kind": "struct", + "fields": [ { - name: "volatilityAccumulator"; - docs: [ + "name": "volatilityAccumulator", + "docs": [ "Volatility accumulator measure the number of bin crossed since reference bin ID. Normally (without filter period taken into consideration), reference bin ID is the active bin of last swap.", "It affects the variable fee rate" - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "volatilityReference"; - docs: [ + "name": "volatilityReference", + "docs": [ "Volatility reference is decayed volatility accumulator. It is always <= volatility_accumulator" - ]; - type: "u32"; + ], + "type": "u32" }, { - name: "indexReference"; - docs: ["Active bin id of last swap."]; - type: "i32"; + "name": "indexReference", + "docs": [ + "Active bin id of last swap." + ], + "type": "i32" }, { - name: "padding"; - docs: ["Padding for bytemuck safe alignment"]; - type: { - array: ["u8", 4]; - }; + "name": "padding", + "docs": [ + "Padding for bytemuck safe alignment" + ], + "type": { + "array": [ + "u8", + 4 + ] + } }, { - name: "lastUpdateTimestamp"; - docs: ["Last timestamp the variable parameters was updated"]; - type: "i64"; + "name": "lastUpdateTimestamp", + "docs": [ + "Last timestamp the variable parameters was updated" + ], + "type": "i64" }, { - name: "padding1"; - docs: ["Padding for bytemuck safe alignment"]; - type: { - array: ["u8", 8]; - }; + "name": "padding1", + "docs": [ + "Padding for bytemuck safe alignment" + ], + "type": { + "array": [ + "u8", + 8 + ] + } } - ]; - }; + ] + } }, { - name: "FeeInfo"; - type: { - kind: "struct"; - fields: [ + "name": "FeeInfo", + "type": { + "kind": "struct", + "fields": [ { - name: "feeXPerTokenComplete"; - type: "u128"; + "name": "feeXPerTokenComplete", + "type": "u128" }, { - name: "feeYPerTokenComplete"; - type: "u128"; + "name": "feeYPerTokenComplete", + "type": "u128" }, { - name: "feeXPending"; - type: "u64"; + "name": "feeXPending", + "type": "u64" }, { - name: "feeYPending"; - type: "u64"; + "name": "feeYPending", + "type": "u64" } - ]; - }; + ] + } }, { - name: "UserRewardInfo"; - type: { - kind: "struct"; - fields: [ + "name": "UserRewardInfo", + "type": { + "kind": "struct", + "fields": [ { - name: "rewardPerTokenCompletes"; - type: { - array: ["u128", 2]; - }; + "name": "rewardPerTokenCompletes", + "type": { + "array": [ + "u128", + 2 + ] + } }, { - name: "rewardPendings"; - type: { - array: ["u64", 2]; - }; + "name": "rewardPendings", + "type": { + "array": [ + "u64", + 2 + ] + } } - ]; - }; + ] + } }, { - name: "StrategyType"; - type: { - kind: "enum"; - variants: [ + "name": "StrategyType", + "type": { + "kind": "enum", + "variants": [ { - name: "Spot"; + "name": "Spot" }, { - name: "Curve"; + "name": "Curve" }, { - name: "BidAsk"; + "name": "BidAsk" } - ]; - }; + ] + } }, { - name: "Rounding"; - type: { - kind: "enum"; - variants: [ + "name": "Rounding", + "type": { + "kind": "enum", + "variants": [ { - name: "Up"; + "name": "Up" }, { - name: "Down"; + "name": "Down" } - ]; - }; + ] + } }, { - name: "LayoutVersion"; - docs: ["Layout version"]; - type: { - kind: "enum"; - variants: [ + "name": "LayoutVersion", + "docs": [ + "Layout version" + ], + "type": { + "kind": "enum", + "variants": [ { - name: "V0"; + "name": "V0" }, { - name: "V1"; + "name": "V1" } - ]; - }; + ] + } }, { - name: "PairType"; - docs: [ + "name": "PairType", + "docs": [ "Type of the Pair. 0 = Permissionless, 1 = Permission. Putting 0 as permissionless for backward compatibility." - ]; - type: { - kind: "enum"; - variants: [ + ], + "type": { + "kind": "enum", + "variants": [ { - name: "Permissionless"; + "name": "Permissionless" }, { - name: "Permission"; + "name": "Permission" } - ]; - }; + ] + } }, { - name: "PairStatus"; - docs: [ + "name": "PairStatus", + "docs": [ "Pair status. 0 = Enabled, 1 = Disabled. Putting 0 as enabled for backward compatibility." - ]; - type: { - kind: "enum"; - variants: [ + ], + "type": { + "kind": "enum", + "variants": [ { - name: "Enabled"; + "name": "Enabled" }, { - name: "Disabled"; + "name": "Disabled" } - ]; - }; + ] + } } - ]; - events: [ + ], + "events": [ { - name: "CompositionFee"; - fields: [ + "name": "CompositionFee", + "fields": [ { - name: "from"; - type: "publicKey"; - index: false; + "name": "from", + "type": "publicKey", + "index": false }, { - name: "binId"; - type: "i16"; - index: false; + "name": "binId", + "type": "i16", + "index": false }, { - name: "tokenXFeeAmount"; - type: "u64"; - index: false; + "name": "tokenXFeeAmount", + "type": "u64", + "index": false }, { - name: "tokenYFeeAmount"; - type: "u64"; - index: false; + "name": "tokenYFeeAmount", + "type": "u64", + "index": false }, { - name: "protocolTokenXFeeAmount"; - type: "u64"; - index: false; + "name": "protocolTokenXFeeAmount", + "type": "u64", + "index": false }, { - name: "protocolTokenYFeeAmount"; - type: "u64"; - index: false; + "name": "protocolTokenYFeeAmount", + "type": "u64", + "index": false } - ]; + ] }, { - name: "AddLiquidity"; - fields: [ + "name": "AddLiquidity", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "from"; - type: "publicKey"; - index: false; + "name": "from", + "type": "publicKey", + "index": false }, { - name: "position"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "amounts"; - type: { - array: ["u64", 2]; - }; - index: false; + "name": "amounts", + "type": { + "array": [ + "u64", + 2 + ] + }, + "index": false }, { - name: "activeBinId"; - type: "i32"; - index: false; + "name": "activeBinId", + "type": "i32", + "index": false } - ]; + ] }, { - name: "RemoveLiquidity"; - fields: [ + "name": "RemoveLiquidity", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "from"; - type: "publicKey"; - index: false; + "name": "from", + "type": "publicKey", + "index": false }, { - name: "position"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "amounts"; - type: { - array: ["u64", 2]; - }; - index: false; + "name": "amounts", + "type": { + "array": [ + "u64", + 2 + ] + }, + "index": false }, { - name: "activeBinId"; - type: "i32"; - index: false; + "name": "activeBinId", + "type": "i32", + "index": false } - ]; + ] }, { - name: "Swap"; - fields: [ + "name": "Swap", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "from"; - type: "publicKey"; - index: false; + "name": "from", + "type": "publicKey", + "index": false }, { - name: "startBinId"; - type: "i32"; - index: false; + "name": "startBinId", + "type": "i32", + "index": false }, { - name: "endBinId"; - type: "i32"; - index: false; + "name": "endBinId", + "type": "i32", + "index": false }, { - name: "amountIn"; - type: "u64"; - index: false; + "name": "amountIn", + "type": "u64", + "index": false }, { - name: "amountOut"; - type: "u64"; - index: false; + "name": "amountOut", + "type": "u64", + "index": false }, { - name: "swapForY"; - type: "bool"; - index: false; + "name": "swapForY", + "type": "bool", + "index": false }, { - name: "fee"; - type: "u64"; - index: false; + "name": "fee", + "type": "u64", + "index": false }, { - name: "protocolFee"; - type: "u64"; - index: false; + "name": "protocolFee", + "type": "u64", + "index": false }, { - name: "feeBps"; - type: "u128"; - index: false; + "name": "feeBps", + "type": "u128", + "index": false }, { - name: "hostFee"; - type: "u64"; - index: false; + "name": "hostFee", + "type": "u64", + "index": false } - ]; + ] }, { - name: "ClaimReward"; - fields: [ + "name": "ClaimReward", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "position"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner"; - type: "publicKey"; - index: false; + "name": "owner", + "type": "publicKey", + "index": false }, { - name: "rewardIndex"; - type: "u64"; - index: false; + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "totalReward"; - type: "u64"; - index: false; + "name": "totalReward", + "type": "u64", + "index": false } - ]; + ] }, { - name: "FundReward"; - fields: [ + "name": "FundReward", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "funder"; - type: "publicKey"; - index: false; + "name": "funder", + "type": "publicKey", + "index": false }, { - name: "rewardIndex"; - type: "u64"; - index: false; + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "amount"; - type: "u64"; - index: false; + "name": "amount", + "type": "u64", + "index": false } - ]; + ] }, { - name: "InitializeReward"; - fields: [ + "name": "InitializeReward", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "rewardMint"; - type: "publicKey"; - index: false; + "name": "rewardMint", + "type": "publicKey", + "index": false }, { - name: "funder"; - type: "publicKey"; - index: false; + "name": "funder", + "type": "publicKey", + "index": false }, { - name: "rewardIndex"; - type: "u64"; - index: false; + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "rewardDuration"; - type: "u64"; - index: false; + "name": "rewardDuration", + "type": "u64", + "index": false } - ]; + ] }, { - name: "UpdateRewardDuration"; - fields: [ + "name": "UpdateRewardDuration", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "rewardIndex"; - type: "u64"; - index: false; + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "oldRewardDuration"; - type: "u64"; - index: false; + "name": "oldRewardDuration", + "type": "u64", + "index": false }, { - name: "newRewardDuration"; - type: "u64"; - index: false; + "name": "newRewardDuration", + "type": "u64", + "index": false } - ]; + ] }, { - name: "UpdateRewardFunder"; - fields: [ + "name": "UpdateRewardFunder", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "rewardIndex"; - type: "u64"; - index: false; + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "oldFunder"; - type: "publicKey"; - index: false; + "name": "oldFunder", + "type": "publicKey", + "index": false }, { - name: "newFunder"; - type: "publicKey"; - index: false; + "name": "newFunder", + "type": "publicKey", + "index": false } - ]; + ] }, { - name: "PositionClose"; - fields: [ + "name": "PositionClose", + "fields": [ { - name: "position"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner"; - type: "publicKey"; - index: false; + "name": "owner", + "type": "publicKey", + "index": false } - ]; + ] }, { - name: "ClaimFee"; - fields: [ + "name": "ClaimFee", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "position"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner"; - type: "publicKey"; - index: false; + "name": "owner", + "type": "publicKey", + "index": false }, { - name: "feeX"; - type: "u64"; - index: false; + "name": "feeX", + "type": "u64", + "index": false }, { - name: "feeY"; - type: "u64"; - index: false; + "name": "feeY", + "type": "u64", + "index": false } - ]; + ] }, { - name: "LbPairCreate"; - fields: [ + "name": "LbPairCreate", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "binStep"; - type: "u16"; - index: false; + "name": "binStep", + "type": "u16", + "index": false }, { - name: "tokenX"; - type: "publicKey"; - index: false; + "name": "tokenX", + "type": "publicKey", + "index": false }, { - name: "tokenY"; - type: "publicKey"; - index: false; + "name": "tokenY", + "type": "publicKey", + "index": false } - ]; + ] }, { - name: "PositionCreate"; - fields: [ + "name": "PositionCreate", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "position"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner"; - type: "publicKey"; - index: false; + "name": "owner", + "type": "publicKey", + "index": false } - ]; + ] }, { - name: "FeeParameterUpdate"; - fields: [ + "name": "FeeParameterUpdate", + "fields": [ + { + "name": "lbPair", + "type": "publicKey", + "index": false + }, { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "protocolShare", + "type": "u16", + "index": false }, { - name: "protocolShare"; - type: "u16"; - index: false; + "name": "baseFactor", + "type": "u16", + "index": false + } + ] + }, + { + "name": "IncreaseObservation", + "fields": [ + { + "name": "oracle", + "type": "publicKey", + "index": false }, { - name: "baseFactor"; - type: "u16"; - index: false; + "name": "newObservationLength", + "type": "u64", + "index": false } - ]; + ] }, { - name: "IncreaseObservation"; - fields: [ + "name": "WithdrawIneligibleReward", + "fields": [ { - name: "oracle"; - type: "publicKey"; - index: false; + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "newObservationLength"; - type: "u64"; - index: false; + "name": "rewardMint", + "type": "publicKey", + "index": false + }, + { + "name": "amount", + "type": "u64", + "index": false } - ]; + ] }, { - name: "WithdrawIneligibleReward"; - fields: [ + "name": "UpdatePositionOperator", + "fields": [ { - name: "lbPair"; - type: "publicKey"; - index: false; + "name": "position", + "type": "publicKey", + "index": false }, { - name: "rewardMint"; - type: "publicKey"; - index: false; + "name": "oldOperator", + "type": "publicKey", + "index": false }, { - name: "amount"; - type: "u64"; - index: false; + "name": "newOperator", + "type": "publicKey", + "index": false } - ]; + ] } - ]; - errors: [ + ], + "errors": [ { - code: 6000; - name: "InvalidStartBinIndex"; - msg: "Invalid start bin index"; + "code": 6000, + "name": "InvalidStartBinIndex", + "msg": "Invalid start bin index" }, { - code: 6001; - name: "InvalidBinId"; - msg: "Invalid bin id"; + "code": 6001, + "name": "InvalidBinId", + "msg": "Invalid bin id" }, { - code: 6002; - name: "InvalidInput"; - msg: "Invalid input data"; + "code": 6002, + "name": "InvalidInput", + "msg": "Invalid input data" }, { - code: 6003; - name: "ExceededAmountSlippageTolerance"; - msg: "Exceeded amount slippage tolerance"; + "code": 6003, + "name": "ExceededAmountSlippageTolerance", + "msg": "Exceeded amount slippage tolerance" }, { - code: 6004; - name: "ExceededBinSlippageTolerance"; - msg: "Exceeded bin slippage tolerance"; + "code": 6004, + "name": "ExceededBinSlippageTolerance", + "msg": "Exceeded bin slippage tolerance" }, { - code: 6005; - name: "CompositionFactorFlawed"; - msg: "Composition factor flawed"; + "code": 6005, + "name": "CompositionFactorFlawed", + "msg": "Composition factor flawed" }, { - code: 6006; - name: "NonPresetBinStep"; - msg: "Non preset bin step"; + "code": 6006, + "name": "NonPresetBinStep", + "msg": "Non preset bin step" }, { - code: 6007; - name: "ZeroLiquidity"; - msg: "Zero liquidity"; + "code": 6007, + "name": "ZeroLiquidity", + "msg": "Zero liquidity" }, { - code: 6008; - name: "InvalidPosition"; - msg: "Invalid position"; + "code": 6008, + "name": "InvalidPosition", + "msg": "Invalid position" }, { - code: 6009; - name: "BinArrayNotFound"; - msg: "Bin array not found"; + "code": 6009, + "name": "BinArrayNotFound", + "msg": "Bin array not found" }, { - code: 6010; - name: "InvalidTokenMint"; - msg: "Invalid token mint"; + "code": 6010, + "name": "InvalidTokenMint", + "msg": "Invalid token mint" }, { - code: 6011; - name: "InvalidAccountForSingleDeposit"; - msg: "Invalid account for single deposit"; + "code": 6011, + "name": "InvalidAccountForSingleDeposit", + "msg": "Invalid account for single deposit" }, { - code: 6012; - name: "PairInsufficientLiquidity"; - msg: "Pair insufficient liquidity"; + "code": 6012, + "name": "PairInsufficientLiquidity", + "msg": "Pair insufficient liquidity" }, { - code: 6013; - name: "InvalidFeeOwner"; - msg: "Invalid fee owner"; + "code": 6013, + "name": "InvalidFeeOwner", + "msg": "Invalid fee owner" }, { - code: 6014; - name: "InvalidFeeWithdrawAmount"; - msg: "Invalid fee withdraw amount"; + "code": 6014, + "name": "InvalidFeeWithdrawAmount", + "msg": "Invalid fee withdraw amount" }, { - code: 6015; - name: "InvalidAdmin"; - msg: "Invalid admin"; + "code": 6015, + "name": "InvalidAdmin", + "msg": "Invalid admin" }, { - code: 6016; - name: "IdenticalFeeOwner"; - msg: "Identical fee owner"; + "code": 6016, + "name": "IdenticalFeeOwner", + "msg": "Identical fee owner" }, { - code: 6017; - name: "InvalidBps"; - msg: "Invalid basis point"; + "code": 6017, + "name": "InvalidBps", + "msg": "Invalid basis point" }, { - code: 6018; - name: "MathOverflow"; - msg: "Math operation overflow"; + "code": 6018, + "name": "MathOverflow", + "msg": "Math operation overflow" }, { - code: 6019; - name: "TypeCastFailed"; - msg: "Type cast error"; + "code": 6019, + "name": "TypeCastFailed", + "msg": "Type cast error" }, { - code: 6020; - name: "InvalidRewardIndex"; - msg: "Invalid reward index"; + "code": 6020, + "name": "InvalidRewardIndex", + "msg": "Invalid reward index" }, { - code: 6021; - name: "InvalidRewardDuration"; - msg: "Invalid reward duration"; + "code": 6021, + "name": "InvalidRewardDuration", + "msg": "Invalid reward duration" }, { - code: 6022; - name: "RewardInitialized"; - msg: "Reward already initialized"; + "code": 6022, + "name": "RewardInitialized", + "msg": "Reward already initialized" }, { - code: 6023; - name: "RewardUninitialized"; - msg: "Reward not initialized"; + "code": 6023, + "name": "RewardUninitialized", + "msg": "Reward not initialized" }, { - code: 6024; - name: "IdenticalFunder"; - msg: "Identical funder"; + "code": 6024, + "name": "IdenticalFunder", + "msg": "Identical funder" }, { - code: 6025; - name: "RewardCampaignInProgress"; - msg: "Reward campaign in progress"; + "code": 6025, + "name": "RewardCampaignInProgress", + "msg": "Reward campaign in progress" }, { - code: 6026; - name: "IdenticalRewardDuration"; - msg: "Reward duration is the same"; + "code": 6026, + "name": "IdenticalRewardDuration", + "msg": "Reward duration is the same" }, { - code: 6027; - name: "InvalidBinArray"; - msg: "Invalid bin array"; + "code": 6027, + "name": "InvalidBinArray", + "msg": "Invalid bin array" }, { - code: 6028; - name: "NonContinuousBinArrays"; - msg: "Bin arrays must be continuous"; + "code": 6028, + "name": "NonContinuousBinArrays", + "msg": "Bin arrays must be continuous" }, { - code: 6029; - name: "InvalidRewardVault"; - msg: "Invalid reward vault"; + "code": 6029, + "name": "InvalidRewardVault", + "msg": "Invalid reward vault" }, { - code: 6030; - name: "NonEmptyPosition"; - msg: "Position is not empty"; + "code": 6030, + "name": "NonEmptyPosition", + "msg": "Position is not empty" }, { - code: 6031; - name: "UnauthorizedAlphaAccess"; - msg: "Unauthorized alpha access"; + "code": 6031, + "name": "UnauthorizedAlphaAccess", + "msg": "Unauthorized alpha access" }, { - code: 6032; - name: "InvalidFeeParameter"; - msg: "Invalid fee parameter"; + "code": 6032, + "name": "InvalidFeeParameter", + "msg": "Invalid fee parameter" }, { - code: 6033; - name: "MissingOracle"; - msg: "Missing oracle account"; + "code": 6033, + "name": "MissingOracle", + "msg": "Missing oracle account" }, { - code: 6034; - name: "InsufficientSample"; - msg: "Insufficient observation sample"; + "code": 6034, + "name": "InsufficientSample", + "msg": "Insufficient observation sample" }, { - code: 6035; - name: "InvalidLookupTimestamp"; - msg: "Invalid lookup timestamp"; + "code": 6035, + "name": "InvalidLookupTimestamp", + "msg": "Invalid lookup timestamp" }, { - code: 6036; - name: "BitmapExtensionAccountIsNotProvided"; - msg: "Bitmap extension account is not provided"; + "code": 6036, + "name": "BitmapExtensionAccountIsNotProvided", + "msg": "Bitmap extension account is not provided" }, { - code: 6037; - name: "CannotFindNonZeroLiquidityBinArrayId"; - msg: "Cannot find non-zero liquidity binArrayId"; + "code": 6037, + "name": "CannotFindNonZeroLiquidityBinArrayId", + "msg": "Cannot find non-zero liquidity binArrayId" }, { - code: 6038; - name: "BinIdOutOfBound"; - msg: "Bin id out of bound"; + "code": 6038, + "name": "BinIdOutOfBound", + "msg": "Bin id out of bound" }, { - code: 6039; - name: "InsufficientOutAmount"; - msg: "Insufficient amount in for minimum out"; + "code": 6039, + "name": "InsufficientOutAmount", + "msg": "Insufficient amount in for minimum out" }, { - code: 6040; - name: "InvalidPositionWidth"; - msg: "Invalid position width"; + "code": 6040, + "name": "InvalidPositionWidth", + "msg": "Invalid position width" }, { - code: 6041; - name: "ExcessiveFeeUpdate"; - msg: "Excessive fee update"; + "code": 6041, + "name": "ExcessiveFeeUpdate", + "msg": "Excessive fee update" }, { - code: 6042; - name: "PoolDisabled"; - msg: "Pool disabled"; + "code": 6042, + "name": "PoolDisabled", + "msg": "Pool disabled" }, { - code: 6043; - name: "InvalidPoolType"; - msg: "Invalid pool type"; + "code": 6043, + "name": "InvalidPoolType", + "msg": "Invalid pool type" }, { - code: 6044; - name: "ExceedMaxWhitelist"; - msg: "Whitelist for wallet is full"; + "code": 6044, + "name": "ExceedMaxWhitelist", + "msg": "Whitelist for wallet is full" }, { - code: 6045; - name: "InvalidIndex"; - msg: "Invalid index"; + "code": 6045, + "name": "InvalidIndex", + "msg": "Invalid index" }, { - code: 6046; - name: "RewardNotEnded"; - msg: "Reward not ended"; + "code": 6046, + "name": "RewardNotEnded", + "msg": "Reward not ended" }, { - code: 6047; - name: "MustWithdrawnIneligibleReward"; - msg: "Must withdraw ineligible reward"; + "code": 6047, + "name": "MustWithdrawnIneligibleReward", + "msg": "Must withdraw ineligible reward" } - ]; + ] }; export const IDL: LbClmm = { - version: "0.5.0", - name: "lb_clmm", - constants: [ + "version": "0.5.0", + "name": "lb_clmm", + "constants": [ { - name: "BASIS_POINT_MAX", - type: "i32", - value: "10000", + "name": "BASIS_POINT_MAX", + "type": "i32", + "value": "10000" }, { - name: "MAX_BIN_PER_ARRAY", - type: { - defined: "usize", + "name": "MAX_BIN_PER_ARRAY", + "type": { + "defined": "usize" }, - value: "70", + "value": "70" }, { - name: "MAX_BIN_PER_POSITION", - type: { - defined: "usize", + "name": "MAX_BIN_PER_POSITION", + "type": { + "defined": "usize" }, - value: "70", + "value": "70" }, { - name: "MIN_BIN_ID", - type: "i32", - value: "- 443636", + "name": "MIN_BIN_ID", + "type": "i32", + "value": "- 443636" }, { - name: "MAX_BIN_ID", - type: "i32", - value: "443636", + "name": "MAX_BIN_ID", + "type": "i32", + "value": "443636" }, { - name: "MAX_FEE_RATE", - type: "u64", - value: "100_000_000", + "name": "MAX_FEE_RATE", + "type": "u64", + "value": "100_000_000" }, { - name: "FEE_PRECISION", - type: "u64", - value: "1_000_000_000", + "name": "FEE_PRECISION", + "type": "u64", + "value": "1_000_000_000" }, { - name: "MAX_PROTOCOL_SHARE", - type: "u16", - value: "2_500", + "name": "MAX_PROTOCOL_SHARE", + "type": "u16", + "value": "2_500" }, { - name: "HOST_FEE_BPS", - type: "u16", - value: "2_000", + "name": "HOST_FEE_BPS", + "type": "u16", + "value": "2_000" }, { - name: "NUM_REWARDS", - type: { - defined: "usize", + "name": "NUM_REWARDS", + "type": { + "defined": "usize" }, - value: "2", + "value": "2" }, { - name: "MIN_REWARD_DURATION", - type: "u64", - value: "1", + "name": "MIN_REWARD_DURATION", + "type": "u64", + "value": "1" }, { - name: "MAX_REWARD_DURATION", - type: "u64", - value: "31536000", + "name": "MAX_REWARD_DURATION", + "type": "u64", + "value": "31536000" }, { - name: "EXTENSION_BINARRAY_BITMAP_SIZE", - type: { - defined: "usize", + "name": "EXTENSION_BINARRAY_BITMAP_SIZE", + "type": { + "defined": "usize" }, - value: "12", + "value": "12" }, { - name: "BIN_ARRAY_BITMAP_SIZE", - type: "i32", - value: "512", + "name": "BIN_ARRAY_BITMAP_SIZE", + "type": "i32", + "value": "512" }, { - name: "MAX_REWARD_BIN_SPLIT", - type: { - defined: "usize", + "name": "MAX_REWARD_BIN_SPLIT", + "type": { + "defined": "usize" }, - value: "15", + "value": "15" }, { - name: "BIN_ARRAY", - type: "bytes", - value: "[98, 105, 110, 95, 97, 114, 114, 97, 121]", + "name": "BIN_ARRAY", + "type": "bytes", + "value": "[98, 105, 110, 95, 97, 114, 114, 97, 121]" }, { - name: "ORACLE", - type: "bytes", - value: "[111, 114, 97, 99, 108, 101]", + "name": "ORACLE", + "type": "bytes", + "value": "[111, 114, 97, 99, 108, 101]" }, { - name: "BIN_ARRAY_BITMAP_SEED", - type: "bytes", - value: "[98, 105, 116, 109, 97, 112]", + "name": "BIN_ARRAY_BITMAP_SEED", + "type": "bytes", + "value": "[98, 105, 116, 109, 97, 112]" }, { - name: "PRESET_PARAMETER", - type: "bytes", - value: - "[112, 114, 101, 115, 101, 116, 95, 112, 97, 114, 97, 109, 101, 116, 101, 114]", + "name": "PRESET_PARAMETER", + "type": "bytes", + "value": "[112, 114, 101, 115, 101, 116, 95, 112, 97, 114, 97, 109, 101, 116, 101, 114]" }, { - name: "PERMISSION", - type: "bytes", - value: "[112, 101, 114, 109, 105, 115, 115, 105, 111, 110]", + "name": "PERMISSION", + "type": "bytes", + "value": "[112, 101, 114, 109, 105, 115, 115, 105, 111, 110]" }, { - name: "POSITION", - type: "bytes", - value: "[112, 111, 115, 105, 116, 105, 111, 110]", - }, + "name": "POSITION", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110]" + } ], - instructions: [ + "instructions": [ { - name: "initializeLbPair", - accounts: [ + "name": "initializeLbPair", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "tokenMintX", - isMut: false, - isSigner: false, + "name": "tokenMintX", + "isMut": false, + "isSigner": false }, { - name: "tokenMintY", - isMut: false, - isSigner: false, + "name": "tokenMintY", + "isMut": false, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "oracle", - isMut: true, - isSigner: false, + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "presetParameter", - isMut: false, - isSigner: false, + "name": "presetParameter", + "isMut": false, + "isSigner": false }, { - name: "funder", - isMut: true, - isSigner: true, + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent", - isMut: false, - isSigner: false, + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "activeId", - type: "i32", + "name": "activeId", + "type": "i32" }, { - name: "binStep", - type: "u16", - }, - ], + "name": "binStep", + "type": "u16" + } + ] }, { - name: "initializePermissionLbPair", - accounts: [ + "name": "initializePermissionLbPair", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "base", + "isMut": false, + "isSigner": true }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "tokenMintX", - isMut: false, - isSigner: false, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "tokenMintY", - isMut: false, - isSigner: false, + "name": "tokenMintX", + "isMut": false, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "tokenMintY", + "isMut": false, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "oracle", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "presetParameter", - isMut: false, - isSigner: false, + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "funder", - isMut: true, - isSigner: true, + "name": "presetParameter", + "isMut": false, + "isSigner": false }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "rent", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, + { + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "activeId", - type: "i32", + "name": "activeId", + "type": "i32" }, { - name: "binStep", - type: "u16", - }, - ], + "name": "binStep", + "type": "u16" + } + ] }, { - name: "initializeBinArrayBitmapExtension", - accounts: [ + "name": "initializeBinArrayBitmapExtension", + "accounts": [ { - name: "lbPair", - isMut: false, - isSigner: false, + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - docs: [ - "Initialize an account to store if a bin array is initialized.", - ], + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "docs": [ + "Initialize an account to store if a bin array is initialized." + ] }, { - name: "funder", - isMut: true, - isSigner: true, + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent", - isMut: false, - isSigner: false, - }, + "name": "rent", + "isMut": false, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "initializeBinArray", - accounts: [ + "name": "initializeBinArray", + "accounts": [ { - name: "lbPair", - isMut: false, - isSigner: false, + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "binArray", - isMut: true, - isSigner: false, + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "funder", - isMut: true, - isSigner: true, + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "systemProgram", - isMut: false, - isSigner: false, - }, + "name": "systemProgram", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "index", - type: "i64", - }, - ], + "name": "index", + "type": "i64" + } + ] }, { - name: "addLiquidity", - accounts: [ + "name": "addLiquidity", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX", - isMut: true, - isSigner: false, + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY", - isMut: true, - isSigner: false, + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "liquidityParameter", - type: { - defined: "LiquidityParameter", - }, - }, - ], + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameter" + } + } + ] }, { - name: "addLiquidityByWeight", - accounts: [ + "name": "addLiquidityByWeight", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX", - isMut: true, - isSigner: false, + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY", - isMut: true, - isSigner: false, + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "liquidityParameter", - type: { - defined: "LiquidityParameterByWeight", - }, - }, - ], + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameterByWeight" + } + } + ] }, { - name: "addLiquidityByStrategy", - accounts: [ + "name": "addLiquidityByStrategy", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX", - isMut: true, - isSigner: false, + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY", - isMut: true, - isSigner: false, + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "liquidityParameter", - type: { - defined: "LiquidityParameterByStrategy", - }, - }, - ], + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameterByStrategy" + } + } + ] }, { - name: "addLiquidityByStrategyOneSide", - accounts: [ + "name": "addLiquidityByStrategyOneSide", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userToken", - isMut: true, - isSigner: false, + "name": "userToken", + "isMut": true, + "isSigner": false }, { - name: "reserve", - isMut: true, - isSigner: false, + "name": "reserve", + "isMut": true, + "isSigner": false }, { - name: "tokenMint", - isMut: false, - isSigner: false, + "name": "tokenMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "liquidityParameter", - type: { - defined: "LiquidityParameterByStrategyOneSide", - }, - }, - ], + "name": "liquidityParameter", + "type": { + "defined": "LiquidityParameterByStrategyOneSide" + } + } + ] }, { - name: "addLiquidityOneSide", - accounts: [ + "name": "addLiquidityOneSide", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userToken", - isMut: true, - isSigner: false, + "name": "userToken", + "isMut": true, + "isSigner": false }, { - name: "reserve", - isMut: true, - isSigner: false, + "name": "reserve", + "isMut": true, + "isSigner": false }, { - name: "tokenMint", - isMut: false, - isSigner: false, + "name": "tokenMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "liquidityParameter", - type: { - defined: "LiquidityOneSideParameter", - }, - }, - ], + "name": "liquidityParameter", + "type": { + "defined": "LiquidityOneSideParameter" + } + } + ] }, { - name: "removeLiquidity", - accounts: [ + "name": "removeLiquidity", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX", - isMut: true, - isSigner: false, + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY", - isMut: true, - isSigner: false, + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "binLiquidityRemoval", - type: { - vec: { - defined: "BinLiquidityReduction", - }, - }, + "name": "binLiquidityRemoval", + "type": { + "vec": { + "defined": "BinLiquidityReduction" + } + } + } + ] + }, + { + "name": "initializePosition", + "accounts": [ + { + "name": "payer", + "isMut": true, + "isSigner": true + }, + { + "name": "position", + "isMut": true, + "isSigner": true + }, + { + "name": "lbPair", + "isMut": false, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": true }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "eventAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "program", + "isMut": false, + "isSigner": false + } ], + "args": [ + { + "name": "lowerBinId", + "type": "i32" + }, + { + "name": "width", + "type": "i32" + } + ] }, { - name: "initializePosition", - accounts: [ + "name": "initializePositionPda", + "accounts": [ { - name: "payer", - isMut: true, - isSigner: true, + "name": "payer", + "isMut": true, + "isSigner": true }, { - name: "position", - isMut: true, - isSigner: true, + "name": "base", + "isMut": false, + "isSigner": true }, { - name: "lbPair", - isMut: false, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": [ + "owner" + ] }, { - name: "rent", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, + { + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "lowerBinId", - type: "i32", + "name": "lowerBinId", + "type": "i32" }, { - name: "width", - type: "i32", - }, - ], + "name": "width", + "type": "i32" + } + ] }, { - name: "initializePositionPda", - accounts: [ + "name": "initializePositionByOperator", + "accounts": [ { - name: "payer", - isMut: true, - isSigner: true, + "name": "payer", + "isMut": true, + "isSigner": true }, { - name: "base", - isMut: false, - isSigner: true, + "name": "base", + "isMut": false, + "isSigner": true }, { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: false, - isSigner: false, + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "operator", + "isMut": false, + "isSigner": true, + "docs": [ + "operator" + ] }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent", - isMut: false, - isSigner: false, + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "lowerBinId", - type: "i32", + "name": "lowerBinId", + "type": "i32" }, { - name: "width", - type: "i32", + "name": "width", + "type": "i32" }, - ], + { + "name": "owner", + "type": "publicKey" + } + ] }, { - name: "swap", - accounts: [ + "name": "updatePositionOperator", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: false, - isSigner: false, - isOptional: true, + "name": "owner", + "isMut": false, + "isSigner": true }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "program", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "operator", + "type": "publicKey" + } + ] + }, + { + "name": "swap", + "accounts": [ + { + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "userTokenIn", - isMut: true, - isSigner: false, + "name": "binArrayBitmapExtension", + "isMut": false, + "isSigner": false, + "isOptional": true }, { - name: "userTokenOut", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "userTokenIn", + "isMut": true, + "isSigner": false }, { - name: "oracle", - isMut: true, - isSigner: false, + "name": "userTokenOut", + "isMut": true, + "isSigner": false }, { - name: "hostFeeIn", - isMut: true, - isSigner: false, - isOptional: true, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "user", - isMut: false, - isSigner: true, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, + "name": "hostFeeIn", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "user", + "isMut": false, + "isSigner": true }, { - name: "program", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, - ], - args: [ { - name: "amountIn", - type: "u64", + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "minAmountOut", - type: "u64", + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, + { + "name": "program", + "isMut": false, + "isSigner": false + } ], + "args": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minAmountOut", + "type": "u64" + } + ] }, { - name: "withdrawProtocolFee", - accounts: [ + "name": "withdrawProtocolFee", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "receiverTokenX", - isMut: true, - isSigner: false, + "name": "receiverTokenX", + "isMut": true, + "isSigner": false }, { - name: "receiverTokenY", - isMut: true, - isSigner: false, + "name": "receiverTokenY", + "isMut": true, + "isSigner": false }, { - name: "feeOwner", - isMut: false, - isSigner: true, + "name": "feeOwner", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, - }, + "name": "tokenYProgram", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "amountX", - type: "u64", + "name": "amountX", + "type": "u64" }, { - name: "amountY", - type: "u64", - }, - ], + "name": "amountY", + "type": "u64" + } + ] }, { - name: "updateFeeOwner", - accounts: [ + "name": "updateFeeOwner", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "newFeeOwner", - isMut: false, - isSigner: false, + "name": "newFeeOwner", + "isMut": false, + "isSigner": false }, { - name: "admin", - isMut: false, - isSigner: true, - }, + "name": "admin", + "isMut": false, + "isSigner": true + } ], - args: [], + "args": [] }, { - name: "initializeReward", - accounts: [ + "name": "initializeReward", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "rewardVault", - isMut: true, - isSigner: false, + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint", - isMut: false, - isSigner: false, + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "admin", - isMut: true, - isSigner: true, + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent", - isMut: false, - isSigner: false, + "name": "rent", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "rewardIndex", - type: "u64", + "name": "rewardIndex", + "type": "u64" }, { - name: "rewardDuration", - type: "u64", + "name": "rewardDuration", + "type": "u64" }, { - name: "funder", - type: "publicKey", - }, - ], + "name": "funder", + "type": "publicKey" + } + ] }, { - name: "fundReward", - accounts: [ + "name": "fundReward", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "rewardVault", - isMut: true, - isSigner: false, + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint", - isMut: false, - isSigner: false, + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "funderTokenAccount", - isMut: true, - isSigner: false, + "name": "funderTokenAccount", + "isMut": true, + "isSigner": false }, { - name: "funder", - isMut: false, - isSigner: true, + "name": "funder", + "isMut": false, + "isSigner": true }, { - name: "binArray", - isMut: true, - isSigner: false, + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "rewardIndex", - type: "u64", + "name": "rewardIndex", + "type": "u64" }, { - name: "amount", - type: "u64", + "name": "amount", + "type": "u64" }, { - name: "carryForward", - type: "bool", - }, - ], + "name": "carryForward", + "type": "bool" + } + ] }, { - name: "updateRewardFunder", - accounts: [ + "name": "updateRewardFunder", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: false, - isSigner: true, + "name": "admin", + "isMut": false, + "isSigner": true }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "rewardIndex", - type: "u64", + "name": "rewardIndex", + "type": "u64" }, { - name: "newFunder", - type: "publicKey", - }, - ], + "name": "newFunder", + "type": "publicKey" + } + ] }, { - name: "updateRewardDuration", - accounts: [ + "name": "updateRewardDuration", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: false, - isSigner: true, + "name": "admin", + "isMut": false, + "isSigner": true }, { - name: "binArray", - isMut: true, - isSigner: false, + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "rewardIndex", - type: "u64", + "name": "rewardIndex", + "type": "u64" }, { - name: "newDuration", - type: "u64", - }, - ], + "name": "newDuration", + "type": "u64" + } + ] }, { - name: "claimReward", - accounts: [ + "name": "claimReward", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "rewardVault", - isMut: true, - isSigner: false, + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint", - isMut: false, - isSigner: false, + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "userTokenAccount", - isMut: true, - isSigner: false, + "name": "userTokenAccount", + "isMut": true, + "isSigner": false }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "rewardIndex", - type: "u64", - }, - ], + "name": "rewardIndex", + "type": "u64" + } + ] }, { - name: "claimFee", - accounts: [ + "name": "claimFee", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "userTokenX", - isMut: true, - isSigner: false, + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY", - isMut: true, - isSigner: false, + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "closePosition", - accounts: [ + "name": "closePosition", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "rentReceiver", - isMut: true, - isSigner: false, + "name": "rentReceiver", + "isMut": true, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "updateFeeParameters", - accounts: [ + "name": "updateFeeParameters", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: false, - isSigner: true, + "name": "admin", + "isMut": false, + "isSigner": true }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "feeParameter", - type: { - defined: "FeeParameter", - }, - }, - ], + "name": "feeParameter", + "type": { + "defined": "FeeParameter" + } + } + ] }, { - name: "increaseOracleLength", - accounts: [ + "name": "increaseOracleLength", + "accounts": [ { - name: "oracle", - isMut: true, - isSigner: false, + "name": "oracle", + "isMut": true, + "isSigner": false }, { - name: "funder", - isMut: true, - isSigner: true, + "name": "funder", + "isMut": true, + "isSigner": true }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "lengthToAdd", - type: "u64", - }, - ], + "name": "lengthToAdd", + "type": "u64" + } + ] }, { - name: "initializePresetParameter", - accounts: [ + "name": "initializePresetParameter", + "accounts": [ { - name: "presetParameter", - isMut: true, - isSigner: false, + "name": "presetParameter", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: true, - isSigner: true, + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rent", - isMut: false, - isSigner: false, - }, + "name": "rent", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "ix", - type: { - defined: "InitPresetParametersIx", - }, - }, - ], + "name": "ix", + "type": { + "defined": "InitPresetParametersIx" + } + } + ] }, { - name: "closePresetParameter", - accounts: [ + "name": "closePresetParameter", + "accounts": [ { - name: "presetParameter", - isMut: true, - isSigner: false, + "name": "presetParameter", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: true, - isSigner: true, + "name": "admin", + "isMut": true, + "isSigner": true }, { - name: "rentReceiver", - isMut: true, - isSigner: false, - }, + "name": "rentReceiver", + "isMut": true, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "removeAllLiquidity", - accounts: [ + "name": "removeAllLiquidity", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayBitmapExtension", - isMut: true, - isSigner: false, - isOptional: true, + "name": "binArrayBitmapExtension", + "isMut": true, + "isSigner": false, + "isOptional": true }, { - name: "userTokenX", - isMut: true, - isSigner: false, + "name": "userTokenX", + "isMut": true, + "isSigner": false }, { - name: "userTokenY", - isMut: true, - isSigner: false, + "name": "userTokenY", + "isMut": true, + "isSigner": false }, { - name: "reserveX", - isMut: true, - isSigner: false, + "name": "reserveX", + "isMut": true, + "isSigner": false }, { - name: "reserveY", - isMut: true, - isSigner: false, + "name": "reserveY", + "isMut": true, + "isSigner": false }, { - name: "tokenXMint", - isMut: false, - isSigner: false, + "name": "tokenXMint", + "isMut": false, + "isSigner": false }, { - name: "tokenYMint", - isMut: false, - isSigner: false, + "name": "tokenYMint", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, + "name": "sender", + "isMut": false, + "isSigner": true }, { - name: "tokenXProgram", - isMut: false, - isSigner: false, + "name": "tokenXProgram", + "isMut": false, + "isSigner": false }, { - name: "tokenYProgram", - isMut: false, - isSigner: false, + "name": "tokenYProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "togglePairStatus", - accounts: [ + "name": "togglePairStatus", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: false, - isSigner: true, - }, + "name": "admin", + "isMut": false, + "isSigner": true + } ], - args: [], + "args": [] }, { - name: "updateWhitelistedWallet", - accounts: [ + "name": "updateWhitelistedWallet", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "admin", - isMut: false, - isSigner: true, - }, + "name": "admin", + "isMut": false, + "isSigner": true + } ], - args: [ + "args": [ { - name: "idx", - type: "u8", + "name": "idx", + "type": "u8" }, { - name: "wallet", - type: "publicKey", - }, - ], + "name": "wallet", + "type": "publicKey" + } + ] }, { - name: "migratePosition", - accounts: [ + "name": "migratePosition", + "accounts": [ { - name: "positionV2", - isMut: true, - isSigner: true, + "name": "positionV2", + "isMut": true, + "isSigner": true }, { - name: "positionV1", - isMut: true, - isSigner: false, + "name": "positionV1", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: false, - isSigner: false, + "name": "lbPair", + "isMut": false, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: true, - isSigner: true, + "name": "owner", + "isMut": true, + "isSigner": true }, { - name: "systemProgram", - isMut: false, - isSigner: false, + "name": "systemProgram", + "isMut": false, + "isSigner": false }, { - name: "rentReceiver", - isMut: true, - isSigner: false, + "name": "rentReceiver", + "isMut": true, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "migrateBinArray", - accounts: [ + "name": "migrateBinArray", + "accounts": [ { - name: "lbPair", - isMut: false, - isSigner: false, - }, + "name": "lbPair", + "isMut": false, + "isSigner": false + } ], - args: [], + "args": [] }, { - name: "updateFeesAndRewards", - accounts: [ + "name": "updateFeesAndRewards", + "accounts": [ { - name: "position", - isMut: true, - isSigner: false, + "name": "position", + "isMut": true, + "isSigner": false }, { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "binArrayLower", - isMut: true, - isSigner: false, + "name": "binArrayLower", + "isMut": true, + "isSigner": false }, { - name: "binArrayUpper", - isMut: true, - isSigner: false, + "name": "binArrayUpper", + "isMut": true, + "isSigner": false }, { - name: "owner", - isMut: false, - isSigner: true, - }, + "name": "owner", + "isMut": false, + "isSigner": true + } ], - args: [], + "args": [] }, { - name: "withdrawIneligibleReward", - accounts: [ + "name": "withdrawIneligibleReward", + "accounts": [ { - name: "lbPair", - isMut: true, - isSigner: false, + "name": "lbPair", + "isMut": true, + "isSigner": false }, { - name: "rewardVault", - isMut: true, - isSigner: false, + "name": "rewardVault", + "isMut": true, + "isSigner": false }, { - name: "rewardMint", - isMut: false, - isSigner: false, + "name": "rewardMint", + "isMut": false, + "isSigner": false }, { - name: "funderTokenAccount", - isMut: true, - isSigner: false, + "name": "funderTokenAccount", + "isMut": true, + "isSigner": false }, { - name: "funder", - isMut: false, - isSigner: true, + "name": "funder", + "isMut": false, + "isSigner": true }, { - name: "binArray", - isMut: true, - isSigner: false, + "name": "binArray", + "isMut": true, + "isSigner": false }, { - name: "tokenProgram", - isMut: false, - isSigner: false, + "name": "tokenProgram", + "isMut": false, + "isSigner": false }, { - name: "eventAuthority", - isMut: false, - isSigner: false, + "name": "eventAuthority", + "isMut": false, + "isSigner": false }, { - name: "program", - isMut: false, - isSigner: false, - }, + "name": "program", + "isMut": false, + "isSigner": false + } ], - args: [ + "args": [ { - name: "rewardIndex", - type: "u64", - }, - ], - }, + "name": "rewardIndex", + "type": "u64" + } + ] + } ], - accounts: [ + "accounts": [ { - name: "binArrayBitmapExtension", - type: { - kind: "struct", - fields: [ + "name": "binArrayBitmapExtension", + "type": { + "kind": "struct", + "fields": [ { - name: "lbPair", - type: "publicKey", + "name": "lbPair", + "type": "publicKey" }, { - name: "positiveBinArrayBitmap", - docs: [ - "Packed initialized bin array state for start_bin_index is positive", + "name": "positiveBinArrayBitmap", + "docs": [ + "Packed initialized bin array state for start_bin_index is positive" ], - type: { - array: [ + "type": { + "array": [ { - array: ["u64", 8], + "array": [ + "u64", + 8 + ] }, - 12, - ], - }, + 12 + ] + } }, { - name: "negativeBinArrayBitmap", - docs: [ - "Packed initialized bin array state for start_bin_index is negative", + "name": "negativeBinArrayBitmap", + "docs": [ + "Packed initialized bin array state for start_bin_index is negative" ], - type: { - array: [ + "type": { + "array": [ { - array: ["u64", 8], + "array": [ + "u64", + 8 + ] }, - 12, - ], - }, - }, - ], - }, + 12 + ] + } + } + ] + } }, { - name: "binArray", - docs: [ + "name": "binArray", + "docs": [ "An account to contain a range of bin. For example: Bin 100 <-> 200.", "For example:", "BinArray index: 0 contains bin 0 <-> 599", - "index: 2 contains bin 600 <-> 1199, ...", + "index: 2 contains bin 600 <-> 1199, ..." ], - type: { - kind: "struct", - fields: [ + "type": { + "kind": "struct", + "fields": [ { - name: "index", - type: "i64", + "name": "index", + "type": "i64" }, { - name: "version", - docs: ["Version of binArray"], - type: "u8", + "name": "version", + "docs": [ + "Version of binArray" + ], + "type": "u8" }, { - name: "padding", - type: { - array: ["u8", 7], - }, + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } }, { - name: "lbPair", - type: "publicKey", + "name": "lbPair", + "type": "publicKey" }, { - name: "bins", - type: { - array: [ + "name": "bins", + "type": { + "array": [ { - defined: "Bin", + "defined": "Bin" }, - 70, - ], - }, - }, - ], - }, + 70 + ] + } + } + ] + } }, { - name: "lbPair", - type: { - kind: "struct", - fields: [ + "name": "lbPair", + "type": { + "kind": "struct", + "fields": [ { - name: "parameters", - type: { - defined: "StaticParameters", - }, + "name": "parameters", + "type": { + "defined": "StaticParameters" + } }, { - name: "vParameters", - type: { - defined: "VariableParameters", - }, + "name": "vParameters", + "type": { + "defined": "VariableParameters" + } }, { - name: "bumpSeed", - type: { - array: ["u8", 1], - }, + "name": "bumpSeed", + "type": { + "array": [ + "u8", + 1 + ] + } }, { - name: "binStepSeed", - docs: ["Bin step signer seed"], - type: { - array: ["u8", 2], - }, + "name": "binStepSeed", + "docs": [ + "Bin step signer seed" + ], + "type": { + "array": [ + "u8", + 2 + ] + } }, { - name: "pairType", - docs: ["Type of the pair"], - type: "u8", + "name": "pairType", + "docs": [ + "Type of the pair" + ], + "type": "u8" }, { - name: "activeId", - docs: ["Active bin id"], - type: "i32", + "name": "activeId", + "docs": [ + "Active bin id" + ], + "type": "i32" }, { - name: "binStep", - docs: ["Bin step. Represent the price increment / decrement."], - type: "u16", + "name": "binStep", + "docs": [ + "Bin step. Represent the price increment / decrement." + ], + "type": "u16" }, { - name: "status", - docs: ["Status of the pair"], - type: "u8", + "name": "status", + "docs": [ + "Status of the pair" + ], + "type": "u8" }, { - name: "padding1", - type: { - array: ["u8", 5], - }, + "name": "padding1", + "type": { + "array": [ + "u8", + 5 + ] + } }, { - name: "tokenXMint", - docs: ["Token X mint"], - type: "publicKey", + "name": "tokenXMint", + "docs": [ + "Token X mint" + ], + "type": "publicKey" }, { - name: "tokenYMint", - docs: ["Token Y mint"], - type: "publicKey", + "name": "tokenYMint", + "docs": [ + "Token Y mint" + ], + "type": "publicKey" }, { - name: "reserveX", - docs: ["LB token X vault"], - type: "publicKey", + "name": "reserveX", + "docs": [ + "LB token X vault" + ], + "type": "publicKey" }, { - name: "reserveY", - docs: ["LB token Y vault"], - type: "publicKey", + "name": "reserveY", + "docs": [ + "LB token Y vault" + ], + "type": "publicKey" }, { - name: "protocolFee", - docs: ["Uncollected protocol fee"], - type: { - defined: "ProtocolFee", - }, + "name": "protocolFee", + "docs": [ + "Uncollected protocol fee" + ], + "type": { + "defined": "ProtocolFee" + } }, { - name: "feeOwner", - docs: ["Protocol fee owner,"], - type: "publicKey", + "name": "feeOwner", + "docs": [ + "Protocol fee owner," + ], + "type": "publicKey" }, { - name: "rewardInfos", - docs: ["Farming reward information"], - type: { - array: [ + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ { - defined: "RewardInfo", + "defined": "RewardInfo" }, - 2, - ], - }, + 2 + ] + } }, { - name: "oracle", - docs: ["Oracle pubkey"], - type: "publicKey", + "name": "oracle", + "docs": [ + "Oracle pubkey" + ], + "type": "publicKey" }, { - name: "binArrayBitmap", - docs: ["Packed initialized bin array state"], - type: { - array: ["u64", 16], - }, + "name": "binArrayBitmap", + "docs": [ + "Packed initialized bin array state" + ], + "type": { + "array": [ + "u64", + 16 + ] + } }, { - name: "lastUpdatedAt", - docs: ["Last time the pool fee parameter was updated"], - type: "i64", + "name": "lastUpdatedAt", + "docs": [ + "Last time the pool fee parameter was updated" + ], + "type": "i64" }, { - name: "whitelistedWallet", - docs: ["Whitelisted wallet"], - type: { - array: ["publicKey", 3], - }, + "name": "whitelistedWallet", + "docs": [ + "Whitelisted wallet" + ], + "type": { + "array": [ + "publicKey", + 2 + ] + } }, { - name: "reserved", - docs: ["Reserved space for future use"], - type: { - array: ["u8", 88], - }, + "name": "baseKey", + "docs": [ + "Base keypair. Only required for permission pair" + ], + "type": "publicKey" }, - ], - }, + { + "name": "reserved", + "docs": [ + "Reserved space for future use" + ], + "type": { + "array": [ + "u8", + 88 + ] + } + } + ] + } }, { - name: "oracle", - type: { - kind: "struct", - fields: [ + "name": "oracle", + "type": { + "kind": "struct", + "fields": [ { - name: "idx", - docs: ["Index of latest observation slot"], - type: "u64", + "name": "idx", + "docs": [ + "Index of latest observation slot" + ], + "type": "u64" }, { - name: "activeSize", - docs: [ - "Size of active sample. Active sample is initialized observation.", + "name": "activeSize", + "docs": [ + "Size of active sample. Active sample is initialized observation." ], - type: "u64", + "type": "u64" }, { - name: "length", - docs: ["Number of observations"], - type: "u64", - }, - ], - }, + "name": "length", + "docs": [ + "Number of observations" + ], + "type": "u64" + } + ] + } }, { - name: "position", - type: { - kind: "struct", - fields: [ + "name": "position", + "type": { + "kind": "struct", + "fields": [ { - name: "lbPair", - docs: ["The LB pair of this position"], - type: "publicKey", + "name": "lbPair", + "docs": [ + "The LB pair of this position" + ], + "type": "publicKey" }, { - name: "owner", - docs: [ - "Owner of the position. Client rely on this to to fetch their positions.", + "name": "owner", + "docs": [ + "Owner of the position. Client rely on this to to fetch their positions." ], - type: "publicKey", + "type": "publicKey" }, { - name: "liquidityShares", - docs: [ - "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept.", + "name": "liquidityShares", + "docs": [ + "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept." ], - type: { - array: ["u64", 70], - }, + "type": { + "array": [ + "u64", + 70 + ] + } }, { - name: "rewardInfos", - docs: ["Farming reward information"], - type: { - array: [ + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ { - defined: "UserRewardInfo", + "defined": "UserRewardInfo" }, - 70, - ], - }, + 70 + ] + } }, { - name: "feeInfos", - docs: ["Swap fee to claim information"], - type: { - array: [ + "name": "feeInfos", + "docs": [ + "Swap fee to claim information" + ], + "type": { + "array": [ { - defined: "FeeInfo", + "defined": "FeeInfo" }, - 70, - ], - }, + 70 + ] + } }, { - name: "lowerBinId", - docs: ["Lower bin ID"], - type: "i32", + "name": "lowerBinId", + "docs": [ + "Lower bin ID" + ], + "type": "i32" }, { - name: "upperBinId", - docs: ["Upper bin ID"], - type: "i32", + "name": "upperBinId", + "docs": [ + "Upper bin ID" + ], + "type": "i32" }, { - name: "lastUpdatedAt", - docs: ["Last updated timestamp"], - type: "i64", + "name": "lastUpdatedAt", + "docs": [ + "Last updated timestamp" + ], + "type": "i64" }, { - name: "totalClaimedFeeXAmount", - docs: ["Total claimed token fee X"], - type: "u64", + "name": "totalClaimedFeeXAmount", + "docs": [ + "Total claimed token fee X" + ], + "type": "u64" }, { - name: "totalClaimedFeeYAmount", - docs: ["Total claimed token fee Y"], - type: "u64", + "name": "totalClaimedFeeYAmount", + "docs": [ + "Total claimed token fee Y" + ], + "type": "u64" }, { - name: "totalClaimedRewards", - docs: ["Total claimed rewards"], - type: { - array: ["u64", 2], - }, + "name": "totalClaimedRewards", + "docs": [ + "Total claimed rewards" + ], + "type": { + "array": [ + "u64", + 2 + ] + } }, { - name: "reserved", - docs: ["Reserved space for future use"], - type: { - array: ["u8", 160], - }, - }, - ], - }, - }, + "name": "reserved", + "docs": [ + "Reserved space for future use" + ], + "type": { + "array": [ + "u8", + 160 + ] + } + } + ] + } + }, { - name: "positionV2", - type: { - kind: "struct", - fields: [ + "name": "positionV2", + "type": { + "kind": "struct", + "fields": [ { - name: "lbPair", - docs: ["The LB pair of this position"], - type: "publicKey", + "name": "lbPair", + "docs": [ + "The LB pair of this position" + ], + "type": "publicKey" }, { - name: "owner", - docs: [ - "Owner of the position. Client rely on this to to fetch their positions.", + "name": "owner", + "docs": [ + "Owner of the position. Client rely on this to to fetch their positions." ], - type: "publicKey", + "type": "publicKey" }, { - name: "liquidityShares", - docs: [ - "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept.", + "name": "liquidityShares", + "docs": [ + "Liquidity shares of this position in bins (lower_bin_id <-> upper_bin_id). This is the same as LP concept." ], - type: { - array: ["u128", 70], - }, + "type": { + "array": [ + "u128", + 70 + ] + } }, { - name: "rewardInfos", - docs: ["Farming reward information"], - type: { - array: [ + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ { - defined: "UserRewardInfo", + "defined": "UserRewardInfo" }, - 70, - ], - }, + 70 + ] + } }, { - name: "feeInfos", - docs: ["Swap fee to claim information"], - type: { - array: [ + "name": "feeInfos", + "docs": [ + "Swap fee to claim information" + ], + "type": { + "array": [ { - defined: "FeeInfo", + "defined": "FeeInfo" }, - 70, - ], - }, + 70 + ] + } }, { - name: "lowerBinId", - docs: ["Lower bin ID"], - type: "i32", + "name": "lowerBinId", + "docs": [ + "Lower bin ID" + ], + "type": "i32" }, { - name: "upperBinId", - docs: ["Upper bin ID"], - type: "i32", + "name": "upperBinId", + "docs": [ + "Upper bin ID" + ], + "type": "i32" }, { - name: "lastUpdatedAt", - docs: ["Last updated timestamp"], - type: "i64", + "name": "lastUpdatedAt", + "docs": [ + "Last updated timestamp" + ], + "type": "i64" }, { - name: "totalClaimedFeeXAmount", - docs: ["Total claimed token fee X"], - type: "u64", + "name": "totalClaimedFeeXAmount", + "docs": [ + "Total claimed token fee X" + ], + "type": "u64" }, { - name: "totalClaimedFeeYAmount", - docs: ["Total claimed token fee Y"], - type: "u64", + "name": "totalClaimedFeeYAmount", + "docs": [ + "Total claimed token fee Y" + ], + "type": "u64" }, { - name: "totalClaimedRewards", - docs: ["Total claimed rewards"], - type: { - array: ["u64", 2], - }, + "name": "totalClaimedRewards", + "docs": [ + "Total claimed rewards" + ], + "type": { + "array": [ + "u64", + 2 + ] + } }, { - name: "reserved", - docs: ["Reserved space for future use"], - type: { - array: ["u8", 160], - }, + "name": "operator", + "docs": [ + "Operator of position" + ], + "type": "publicKey" }, - ], - }, + { + "name": "reserved", + "docs": [ + "Reserved space for future use" + ], + "type": { + "array": [ + "u8", + 128 + ] + } + } + ] + } }, { - name: "presetParameter", - type: { - kind: "struct", - fields: [ + "name": "presetParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "binStep", - docs: ["Bin step. Represent the price increment / decrement."], - type: "u16", + "name": "binStep", + "docs": [ + "Bin step. Represent the price increment / decrement." + ], + "type": "u16" }, { - name: "baseFactor", - docs: [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step", + "name": "baseFactor", + "docs": [ + "Used for base fee calculation. base_fee_rate = base_factor * bin_step" ], - type: "u16", + "type": "u16" }, { - name: "filterPeriod", - docs: [ - "Filter period determine high frequency trading time window.", + "name": "filterPeriod", + "docs": [ + "Filter period determine high frequency trading time window." ], - type: "u16", + "type": "u16" }, { - name: "decayPeriod", - docs: [ - "Decay period determine when the volatile fee start decay / decrease.", + "name": "decayPeriod", + "docs": [ + "Decay period determine when the volatile fee start decay / decrease." ], - type: "u16", + "type": "u16" }, { - name: "reductionFactor", - docs: [ - "Reduction factor controls the volatile fee rate decrement rate.", + "name": "reductionFactor", + "docs": [ + "Reduction factor controls the volatile fee rate decrement rate." ], - type: "u16", + "type": "u16" }, { - name: "variableFeeControl", - docs: [ - "Used to scale the variable fee component depending on the dynamic of the market", + "name": "variableFeeControl", + "docs": [ + "Used to scale the variable fee component depending on the dynamic of the market" ], - type: "u32", + "type": "u32" }, { - name: "maxVolatilityAccumulator", - docs: [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate.", + "name": "maxVolatilityAccumulator", + "docs": [ + "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." ], - type: "u32", + "type": "u32" }, { - name: "minBinId", - docs: [ - "Min bin id supported by the pool based on the configured bin step.", + "name": "minBinId", + "docs": [ + "Min bin id supported by the pool based on the configured bin step." ], - type: "i32", + "type": "i32" }, { - name: "maxBinId", - docs: [ - "Max bin id supported by the pool based on the configured bin step.", + "name": "maxBinId", + "docs": [ + "Max bin id supported by the pool based on the configured bin step." ], - type: "i32", + "type": "i32" }, { - name: "protocolShare", - docs: [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee", + "name": "protocolShare", + "docs": [ + "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" ], - type: "u16", - }, - ], - }, - }, + "type": "u16" + } + ] + } + } ], - types: [ + "types": [ { - name: "LiquidityParameterByStrategyOneSide", - type: { - kind: "struct", - fields: [ + "name": "LiquidityParameterByStrategyOneSide", + "type": { + "kind": "struct", + "fields": [ { - name: "amount", - docs: ["Amount of X token or Y token to deposit"], - type: "u64", + "name": "amount", + "docs": [ + "Amount of X token or Y token to deposit" + ], + "type": "u64" }, { - name: "activeId", - docs: ["Active bin that integrator observe off-chain"], - type: "i32", + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage", - docs: ["max active bin slippage allowed"], - type: "i32", + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "strategyParameters", - docs: ["strategy parameters"], - type: { - defined: "StrategyParameters", - }, - }, - ], - }, + "name": "strategyParameters", + "docs": [ + "strategy parameters" + ], + "type": { + "defined": "StrategyParameters" + } + } + ] + } }, { - name: "LiquidityParameterByStrategy", - type: { - kind: "struct", - fields: [ + "name": "LiquidityParameterByStrategy", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX", - docs: ["Amount of X token to deposit"], - type: "u64", + "name": "amountX", + "docs": [ + "Amount of X token to deposit" + ], + "type": "u64" }, { - name: "amountY", - docs: ["Amount of Y token to deposit"], - type: "u64", + "name": "amountY", + "docs": [ + "Amount of Y token to deposit" + ], + "type": "u64" }, { - name: "activeId", - docs: ["Active bin that integrator observe off-chain"], - type: "i32", + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage", - docs: ["max active bin slippage allowed"], - type: "i32", + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "strategyParameters", - docs: ["strategy parameters"], - type: { - defined: "StrategyParameters", - }, - }, - ], - }, + "name": "strategyParameters", + "docs": [ + "strategy parameters" + ], + "type": { + "defined": "StrategyParameters" + } + } + ] + } }, { - name: "StrategyParameters", - type: { - kind: "struct", - fields: [ + "name": "StrategyParameters", + "type": { + "kind": "struct", + "fields": [ { - name: "minBinId", - docs: ["min bin id"], - type: "i32", + "name": "minBinId", + "docs": [ + "min bin id" + ], + "type": "i32" }, { - name: "maxBinId", - docs: ["max bin id"], - type: "i32", + "name": "maxBinId", + "docs": [ + "max bin id" + ], + "type": "i32" }, { - name: "strategyType", - docs: ["strategy type"], - type: { - defined: "StrategyType", - }, + "name": "strategyType", + "docs": [ + "strategy type" + ], + "type": { + "defined": "StrategyType" + } }, { - name: "parameteres", - docs: ["parameters"], - type: { - array: ["u8", 64], - }, - }, - ], - }, + "name": "parameteres", + "docs": [ + "parameters" + ], + "type": { + "array": [ + "u8", + 64 + ] + } + } + ] + } }, { - name: "ParabolicParameter", - type: { - kind: "struct", - fields: [ + "name": "ParabolicParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "aAsk", - docs: ["amplification in ask side"], - type: "i16", + "name": "aAsk", + "docs": [ + "amplification in ask side" + ], + "type": "i16" }, { - name: "aBid", - docs: ["amplification in bid side"], - type: "i16", + "name": "aBid", + "docs": [ + "amplification in bid side" + ], + "type": "i16" }, { - name: "aActiveBin", - docs: ["amplification in active bin"], - type: "i16", + "name": "aActiveBin", + "docs": [ + "amplification in active bin" + ], + "type": "i16" }, { - name: "centerBinId", - docs: ["center bin id"], - type: "i32", - }, - ], - }, + "name": "centerBinId", + "docs": [ + "center bin id" + ], + "type": "i32" + } + ] + } }, { - name: "SpotParameter", - type: { - kind: "struct", - fields: [ + "name": "SpotParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "weightAsk", - docs: ["weight in ask side"], - type: "u16", + "name": "weightAsk", + "docs": [ + "weight in ask side" + ], + "type": "u16" }, { - name: "weightBid", - docs: ["weight in bid side"], - type: "u16", + "name": "weightBid", + "docs": [ + "weight in bid side" + ], + "type": "u16" }, { - name: "weightActiveBin", - docs: ["weight in active bin"], - type: "u16", - }, - ], - }, + "name": "weightActiveBin", + "docs": [ + "weight in active bin" + ], + "type": "u16" + } + ] + } }, { - name: "BinLiquidityDistributionByWeight", - type: { - kind: "struct", - fields: [ + "name": "BinLiquidityDistributionByWeight", + "type": { + "kind": "struct", + "fields": [ { - name: "binId", - docs: ["Define the bin ID wish to deposit to."], - type: "i32", + "name": "binId", + "docs": [ + "Define the bin ID wish to deposit to." + ], + "type": "i32" }, { - name: "weight", - docs: ["weight of liquidity distributed for this bin id"], - type: "u16", - }, - ], - }, + "name": "weight", + "docs": [ + "weight of liquidity distributed for this bin id" + ], + "type": "u16" + } + ] + } }, { - name: "LiquidityParameterByWeight", - type: { - kind: "struct", - fields: [ + "name": "LiquidityParameterByWeight", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX", - docs: ["Amount of X token to deposit"], - type: "u64", + "name": "amountX", + "docs": [ + "Amount of X token to deposit" + ], + "type": "u64" }, { - name: "amountY", - docs: ["Amount of Y token to deposit"], - type: "u64", + "name": "amountY", + "docs": [ + "Amount of Y token to deposit" + ], + "type": "u64" }, { - name: "activeId", - docs: ["Active bin that integrator observe off-chain"], - type: "i32", + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage", - docs: ["max active bin slippage allowed"], - type: "i32", + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "binLiquidityDist", - docs: ["Liquidity distribution to each bins"], - type: { - vec: { - defined: "BinLiquidityDistributionByWeight", - }, - }, - }, - ], - }, + "name": "binLiquidityDist", + "docs": [ + "Liquidity distribution to each bins" + ], + "type": { + "vec": { + "defined": "BinLiquidityDistributionByWeight" + } + } + } + ] + } }, { - name: "LiquidityOneSideParameter", - type: { - kind: "struct", - fields: [ + "name": "LiquidityOneSideParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "amount", - docs: ["Amount of X token or Y token to deposit"], - type: "u64", + "name": "amount", + "docs": [ + "Amount of X token or Y token to deposit" + ], + "type": "u64" }, { - name: "activeId", - docs: ["Active bin that integrator observe off-chain"], - type: "i32", + "name": "activeId", + "docs": [ + "Active bin that integrator observe off-chain" + ], + "type": "i32" }, { - name: "maxActiveBinSlippage", - docs: ["max active bin slippage allowed"], - type: "i32", + "name": "maxActiveBinSlippage", + "docs": [ + "max active bin slippage allowed" + ], + "type": "i32" }, { - name: "binLiquidityDist", - docs: ["Liquidity distribution to each bins"], - type: { - vec: { - defined: "BinLiquidityDistributionByWeight", - }, - }, - }, - ], - }, + "name": "binLiquidityDist", + "docs": [ + "Liquidity distribution to each bins" + ], + "type": { + "vec": { + "defined": "BinLiquidityDistributionByWeight" + } + } + } + ] + } }, { - name: "BinLiquidityDistribution", - type: { - kind: "struct", - fields: [ + "name": "BinLiquidityDistribution", + "type": { + "kind": "struct", + "fields": [ { - name: "binId", - docs: ["Define the bin ID wish to deposit to."], - type: "i32", + "name": "binId", + "docs": [ + "Define the bin ID wish to deposit to." + ], + "type": "i32" }, { - name: "distributionX", - docs: [ - "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin.", + "name": "distributionX", + "docs": [ + "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin." ], - type: "u16", + "type": "u16" }, { - name: "distributionY", - docs: [ - "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin.", + "name": "distributionY", + "docs": [ + "DistributionX (or distributionY) is the percentages of amountX (or amountY) you want to add to each bin." ], - type: "u16", - }, - ], - }, + "type": "u16" + } + ] + } }, { - name: "LiquidityParameter", - type: { - kind: "struct", - fields: [ + "name": "LiquidityParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX", - docs: ["Amount of X token to deposit"], - type: "u64", + "name": "amountX", + "docs": [ + "Amount of X token to deposit" + ], + "type": "u64" }, { - name: "amountY", - docs: ["Amount of Y token to deposit"], - type: "u64", + "name": "amountY", + "docs": [ + "Amount of Y token to deposit" + ], + "type": "u64" }, { - name: "binLiquidityDist", - docs: ["Liquidity distribution to each bins"], - type: { - vec: { - defined: "BinLiquidityDistribution", - }, - }, - }, - ], - }, + "name": "binLiquidityDist", + "docs": [ + "Liquidity distribution to each bins" + ], + "type": { + "vec": { + "defined": "BinLiquidityDistribution" + } + } + } + ] + } }, { - name: "InitPresetParametersIx", - type: { - kind: "struct", - fields: [ + "name": "InitPresetParametersIx", + "type": { + "kind": "struct", + "fields": [ { - name: "binStep", - docs: ["Bin step. Represent the price increment / decrement."], - type: "u16", + "name": "binStep", + "docs": [ + "Bin step. Represent the price increment / decrement." + ], + "type": "u16" }, { - name: "baseFactor", - docs: [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step", + "name": "baseFactor", + "docs": [ + "Used for base fee calculation. base_fee_rate = base_factor * bin_step" ], - type: "u16", + "type": "u16" }, { - name: "filterPeriod", - docs: [ - "Filter period determine high frequency trading time window.", + "name": "filterPeriod", + "docs": [ + "Filter period determine high frequency trading time window." ], - type: "u16", + "type": "u16" }, { - name: "decayPeriod", - docs: [ - "Decay period determine when the volatile fee start decay / decrease.", + "name": "decayPeriod", + "docs": [ + "Decay period determine when the volatile fee start decay / decrease." ], - type: "u16", + "type": "u16" }, { - name: "reductionFactor", - docs: [ - "Reduction factor controls the volatile fee rate decrement rate.", + "name": "reductionFactor", + "docs": [ + "Reduction factor controls the volatile fee rate decrement rate." ], - type: "u16", + "type": "u16" }, { - name: "variableFeeControl", - docs: [ - "Used to scale the variable fee component depending on the dynamic of the market", + "name": "variableFeeControl", + "docs": [ + "Used to scale the variable fee component depending on the dynamic of the market" ], - type: "u32", + "type": "u32" }, { - name: "maxVolatilityAccumulator", - docs: [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate.", + "name": "maxVolatilityAccumulator", + "docs": [ + "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." ], - type: "u32", + "type": "u32" }, { - name: "minBinId", - docs: [ - "Min bin id supported by the pool based on the configured bin step.", + "name": "minBinId", + "docs": [ + "Min bin id supported by the pool based on the configured bin step." ], - type: "i32", + "type": "i32" }, { - name: "maxBinId", - docs: [ - "Max bin id supported by the pool based on the configured bin step.", + "name": "maxBinId", + "docs": [ + "Max bin id supported by the pool based on the configured bin step." ], - type: "i32", + "type": "i32" }, { - name: "protocolShare", - docs: [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee", + "name": "protocolShare", + "docs": [ + "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" ], - type: "u16", - }, - ], - }, + "type": "u16" + } + ] + } }, { - name: "BinLiquidityReduction", - type: { - kind: "struct", - fields: [ + "name": "BinLiquidityReduction", + "type": { + "kind": "struct", + "fields": [ { - name: "binId", - type: "i32", + "name": "binId", + "type": "i32" }, { - name: "bpsToRemove", - type: "u16", - }, - ], - }, + "name": "bpsToRemove", + "type": "u16" + } + ] + } }, { - name: "FeeParameter", - type: { - kind: "struct", - fields: [ + "name": "FeeParameter", + "type": { + "kind": "struct", + "fields": [ { - name: "protocolShare", - docs: [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee", + "name": "protocolShare", + "docs": [ + "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" ], - type: "u16", + "type": "u16" }, { - name: "baseFactor", - docs: ["Base factor for base fee rate"], - type: "u16", - }, - ], - }, + "name": "baseFactor", + "docs": [ + "Base factor for base fee rate" + ], + "type": "u16" + } + ] + } }, { - name: "Bin", - type: { - kind: "struct", - fields: [ + "name": "Bin", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX", - docs: [ - "Amount of token X in the bin. This already excluded protocol fees.", + "name": "amountX", + "docs": [ + "Amount of token X in the bin. This already excluded protocol fees." ], - type: "u64", + "type": "u64" }, { - name: "amountY", - docs: [ - "Amount of token Y in the bin. This already excluded protocol fees.", + "name": "amountY", + "docs": [ + "Amount of token Y in the bin. This already excluded protocol fees." ], - type: "u64", + "type": "u64" }, { - name: "price", - docs: ["Bin price"], - type: "u128", + "name": "price", + "docs": [ + "Bin price" + ], + "type": "u128" }, { - name: "liquiditySupply", - docs: [ - "Liquidities of the bin. This is the same as LP mint supply. q-number", + "name": "liquiditySupply", + "docs": [ + "Liquidities of the bin. This is the same as LP mint supply. q-number" ], - type: "u128", + "type": "u128" }, { - name: "rewardPerTokenStored", - docs: ["reward_a_per_token_stored"], - type: { - array: ["u128", 2], - }, + "name": "rewardPerTokenStored", + "docs": [ + "reward_a_per_token_stored" + ], + "type": { + "array": [ + "u128", + 2 + ] + } }, { - name: "feeAmountXPerTokenStored", - docs: ["Swap fee amount of token X per liquidity deposited."], - type: "u128", + "name": "feeAmountXPerTokenStored", + "docs": [ + "Swap fee amount of token X per liquidity deposited." + ], + "type": "u128" }, { - name: "feeAmountYPerTokenStored", - docs: ["Swap fee amount of token Y per liquidity deposited."], - type: "u128", + "name": "feeAmountYPerTokenStored", + "docs": [ + "Swap fee amount of token Y per liquidity deposited." + ], + "type": "u128" }, { - name: "amountXIn", - docs: [ - "Total token X swap into the bin. Only used for tracking purpose.", + "name": "amountXIn", + "docs": [ + "Total token X swap into the bin. Only used for tracking purpose." ], - type: "u128", + "type": "u128" }, { - name: "amountYIn", - docs: [ - "Total token Y swap into he bin. Only used for tracking purpose.", + "name": "amountYIn", + "docs": [ + "Total token Y swap into he bin. Only used for tracking purpose." ], - type: "u128", - }, - ], - }, + "type": "u128" + } + ] + } }, { - name: "ProtocolFee", - type: { - kind: "struct", - fields: [ + "name": "ProtocolFee", + "type": { + "kind": "struct", + "fields": [ { - name: "amountX", - type: "u64", + "name": "amountX", + "type": "u64" }, { - name: "amountY", - type: "u64", - }, - ], - }, + "name": "amountY", + "type": "u64" + } + ] + } }, { - name: "RewardInfo", - docs: ["Stores the state relevant for tracking liquidity mining rewards"], - type: { - kind: "struct", - fields: [ + "name": "RewardInfo", + "docs": [ + "Stores the state relevant for tracking liquidity mining rewards" + ], + "type": { + "kind": "struct", + "fields": [ { - name: "mint", - docs: ["Reward token mint."], - type: "publicKey", + "name": "mint", + "docs": [ + "Reward token mint." + ], + "type": "publicKey" }, { - name: "vault", - docs: ["Reward vault token account."], - type: "publicKey", + "name": "vault", + "docs": [ + "Reward vault token account." + ], + "type": "publicKey" }, { - name: "funder", - docs: ["Authority account that allows to fund rewards"], - type: "publicKey", + "name": "funder", + "docs": [ + "Authority account that allows to fund rewards" + ], + "type": "publicKey" }, { - name: "rewardDuration", - docs: ["TODO check whether we need to store it in pool"], - type: "u64", + "name": "rewardDuration", + "docs": [ + "TODO check whether we need to store it in pool" + ], + "type": "u64" }, { - name: "rewardDurationEnd", - docs: ["TODO check whether we need to store it in pool"], - type: "u64", + "name": "rewardDurationEnd", + "docs": [ + "TODO check whether we need to store it in pool" + ], + "type": "u64" }, { - name: "rewardRate", - docs: ["TODO check whether we need to store it in pool"], - type: "u128", + "name": "rewardRate", + "docs": [ + "TODO check whether we need to store it in pool" + ], + "type": "u128" }, { - name: "lastUpdateTime", - docs: ["The last time reward states were updated."], - type: "u64", + "name": "lastUpdateTime", + "docs": [ + "The last time reward states were updated." + ], + "type": "u64" }, { - name: "cumulativeSecondsWithEmptyLiquidityReward", - docs: [ - "Accumulated seconds where when farm distribute rewards, but the bin is empty. The reward will be accumulated for next reward time window.", + "name": "cumulativeSecondsWithEmptyLiquidityReward", + "docs": [ + "Accumulated seconds where when farm distribute rewards, but the bin is empty. The reward will be accumulated for next reward time window." ], - type: "u64", - }, - ], - }, + "type": "u64" + } + ] + } }, { - name: "Observation", - type: { - kind: "struct", - fields: [ + "name": "Observation", + "type": { + "kind": "struct", + "fields": [ { - name: "cumulativeActiveBinId", - docs: ["Cumulative active bin ID"], - type: "i128", + "name": "cumulativeActiveBinId", + "docs": [ + "Cumulative active bin ID" + ], + "type": "i128" }, { - name: "createdAt", - docs: ["Observation sample created timestamp"], - type: "i64", + "name": "createdAt", + "docs": [ + "Observation sample created timestamp" + ], + "type": "i64" }, { - name: "lastUpdatedAt", - docs: ["Observation sample last updated timestamp"], - type: "i64", - }, - ], - }, + "name": "lastUpdatedAt", + "docs": [ + "Observation sample last updated timestamp" + ], + "type": "i64" + } + ] + } }, { - name: "StaticParameters", - docs: ["Parameter that set by the protocol"], - type: { - kind: "struct", - fields: [ + "name": "StaticParameters", + "docs": [ + "Parameter that set by the protocol" + ], + "type": { + "kind": "struct", + "fields": [ { - name: "baseFactor", - docs: [ - "Used for base fee calculation. base_fee_rate = base_factor * bin_step", + "name": "baseFactor", + "docs": [ + "Used for base fee calculation. base_fee_rate = base_factor * bin_step" ], - type: "u16", + "type": "u16" }, { - name: "filterPeriod", - docs: [ - "Filter period determine high frequency trading time window.", + "name": "filterPeriod", + "docs": [ + "Filter period determine high frequency trading time window." ], - type: "u16", + "type": "u16" }, { - name: "decayPeriod", - docs: [ - "Decay period determine when the volatile fee start decay / decrease.", + "name": "decayPeriod", + "docs": [ + "Decay period determine when the volatile fee start decay / decrease." ], - type: "u16", + "type": "u16" }, { - name: "reductionFactor", - docs: [ - "Reduction factor controls the volatile fee rate decrement rate.", + "name": "reductionFactor", + "docs": [ + "Reduction factor controls the volatile fee rate decrement rate." ], - type: "u16", + "type": "u16" }, { - name: "variableFeeControl", - docs: [ - "Used to scale the variable fee component depending on the dynamic of the market", + "name": "variableFeeControl", + "docs": [ + "Used to scale the variable fee component depending on the dynamic of the market" ], - type: "u32", + "type": "u32" }, { - name: "maxVolatilityAccumulator", - docs: [ - "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate.", + "name": "maxVolatilityAccumulator", + "docs": [ + "Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate." ], - type: "u32", + "type": "u32" }, { - name: "minBinId", - docs: [ - "Min bin id supported by the pool based on the configured bin step.", + "name": "minBinId", + "docs": [ + "Min bin id supported by the pool based on the configured bin step." ], - type: "i32", + "type": "i32" }, { - name: "maxBinId", - docs: [ - "Max bin id supported by the pool based on the configured bin step.", + "name": "maxBinId", + "docs": [ + "Max bin id supported by the pool based on the configured bin step." ], - type: "i32", + "type": "i32" }, { - name: "protocolShare", - docs: [ - "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee", + "name": "protocolShare", + "docs": [ + "Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee" ], - type: "u16", + "type": "u16" }, { - name: "padding", - docs: ["Padding for bytemuck safe alignment"], - type: { - array: ["u8", 6], - }, - }, - ], - }, + "name": "padding", + "docs": [ + "Padding for bytemuck safe alignment" + ], + "type": { + "array": [ + "u8", + 6 + ] + } + } + ] + } }, { - name: "VariableParameters", - docs: ["Parameters that changes based on dynamic of the market"], - type: { - kind: "struct", - fields: [ + "name": "VariableParameters", + "docs": [ + "Parameters that changes based on dynamic of the market" + ], + "type": { + "kind": "struct", + "fields": [ { - name: "volatilityAccumulator", - docs: [ + "name": "volatilityAccumulator", + "docs": [ "Volatility accumulator measure the number of bin crossed since reference bin ID. Normally (without filter period taken into consideration), reference bin ID is the active bin of last swap.", - "It affects the variable fee rate", + "It affects the variable fee rate" ], - type: "u32", + "type": "u32" }, { - name: "volatilityReference", - docs: [ - "Volatility reference is decayed volatility accumulator. It is always <= volatility_accumulator", + "name": "volatilityReference", + "docs": [ + "Volatility reference is decayed volatility accumulator. It is always <= volatility_accumulator" ], - type: "u32", + "type": "u32" }, { - name: "indexReference", - docs: ["Active bin id of last swap."], - type: "i32", + "name": "indexReference", + "docs": [ + "Active bin id of last swap." + ], + "type": "i32" }, { - name: "padding", - docs: ["Padding for bytemuck safe alignment"], - type: { - array: ["u8", 4], - }, + "name": "padding", + "docs": [ + "Padding for bytemuck safe alignment" + ], + "type": { + "array": [ + "u8", + 4 + ] + } }, { - name: "lastUpdateTimestamp", - docs: ["Last timestamp the variable parameters was updated"], - type: "i64", + "name": "lastUpdateTimestamp", + "docs": [ + "Last timestamp the variable parameters was updated" + ], + "type": "i64" }, { - name: "padding1", - docs: ["Padding for bytemuck safe alignment"], - type: { - array: ["u8", 8], - }, - }, - ], - }, + "name": "padding1", + "docs": [ + "Padding for bytemuck safe alignment" + ], + "type": { + "array": [ + "u8", + 8 + ] + } + } + ] + } }, { - name: "FeeInfo", - type: { - kind: "struct", - fields: [ + "name": "FeeInfo", + "type": { + "kind": "struct", + "fields": [ { - name: "feeXPerTokenComplete", - type: "u128", + "name": "feeXPerTokenComplete", + "type": "u128" }, { - name: "feeYPerTokenComplete", - type: "u128", + "name": "feeYPerTokenComplete", + "type": "u128" }, { - name: "feeXPending", - type: "u64", + "name": "feeXPending", + "type": "u64" }, { - name: "feeYPending", - type: "u64", - }, - ], - }, + "name": "feeYPending", + "type": "u64" + } + ] + } }, { - name: "UserRewardInfo", - type: { - kind: "struct", - fields: [ + "name": "UserRewardInfo", + "type": { + "kind": "struct", + "fields": [ { - name: "rewardPerTokenCompletes", - type: { - array: ["u128", 2], - }, + "name": "rewardPerTokenCompletes", + "type": { + "array": [ + "u128", + 2 + ] + } }, { - name: "rewardPendings", - type: { - array: ["u64", 2], - }, - }, - ], - }, + "name": "rewardPendings", + "type": { + "array": [ + "u64", + 2 + ] + } + } + ] + } }, { - name: "StrategyType", - type: { - kind: "enum", - variants: [ + "name": "StrategyType", + "type": { + "kind": "enum", + "variants": [ { - name: "Spot", + "name": "Spot" }, { - name: "Curve", + "name": "Curve" }, { - name: "BidAsk", - }, - ], - }, + "name": "BidAsk" + } + ] + } }, { - name: "Rounding", - type: { - kind: "enum", - variants: [ + "name": "Rounding", + "type": { + "kind": "enum", + "variants": [ { - name: "Up", + "name": "Up" }, { - name: "Down", - }, - ], - }, + "name": "Down" + } + ] + } }, { - name: "LayoutVersion", - docs: ["Layout version"], - type: { - kind: "enum", - variants: [ + "name": "LayoutVersion", + "docs": [ + "Layout version" + ], + "type": { + "kind": "enum", + "variants": [ { - name: "V0", + "name": "V0" }, { - name: "V1", - }, - ], - }, + "name": "V1" + } + ] + } }, { - name: "PairType", - docs: [ - "Type of the Pair. 0 = Permissionless, 1 = Permission. Putting 0 as permissionless for backward compatibility.", + "name": "PairType", + "docs": [ + "Type of the Pair. 0 = Permissionless, 1 = Permission. Putting 0 as permissionless for backward compatibility." ], - type: { - kind: "enum", - variants: [ + "type": { + "kind": "enum", + "variants": [ { - name: "Permissionless", + "name": "Permissionless" }, { - name: "Permission", - }, - ], - }, + "name": "Permission" + } + ] + } }, { - name: "PairStatus", - docs: [ - "Pair status. 0 = Enabled, 1 = Disabled. Putting 0 as enabled for backward compatibility.", + "name": "PairStatus", + "docs": [ + "Pair status. 0 = Enabled, 1 = Disabled. Putting 0 as enabled for backward compatibility." ], - type: { - kind: "enum", - variants: [ + "type": { + "kind": "enum", + "variants": [ { - name: "Enabled", + "name": "Enabled" }, { - name: "Disabled", - }, - ], - }, - }, + "name": "Disabled" + } + ] + } + } ], - events: [ + "events": [ { - name: "CompositionFee", - fields: [ + "name": "CompositionFee", + "fields": [ { - name: "from", - type: "publicKey", - index: false, + "name": "from", + "type": "publicKey", + "index": false }, { - name: "binId", - type: "i16", - index: false, + "name": "binId", + "type": "i16", + "index": false }, { - name: "tokenXFeeAmount", - type: "u64", - index: false, + "name": "tokenXFeeAmount", + "type": "u64", + "index": false }, { - name: "tokenYFeeAmount", - type: "u64", - index: false, + "name": "tokenYFeeAmount", + "type": "u64", + "index": false }, { - name: "protocolTokenXFeeAmount", - type: "u64", - index: false, + "name": "protocolTokenXFeeAmount", + "type": "u64", + "index": false }, { - name: "protocolTokenYFeeAmount", - type: "u64", - index: false, - }, - ], + "name": "protocolTokenYFeeAmount", + "type": "u64", + "index": false + } + ] }, { - name: "AddLiquidity", - fields: [ + "name": "AddLiquidity", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "from", - type: "publicKey", - index: false, + "name": "from", + "type": "publicKey", + "index": false }, { - name: "position", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "amounts", - type: { - array: ["u64", 2], + "name": "amounts", + "type": { + "array": [ + "u64", + 2 + ] }, - index: false, + "index": false }, { - name: "activeBinId", - type: "i32", - index: false, - }, - ], + "name": "activeBinId", + "type": "i32", + "index": false + } + ] }, { - name: "RemoveLiquidity", - fields: [ + "name": "RemoveLiquidity", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "from", - type: "publicKey", - index: false, + "name": "from", + "type": "publicKey", + "index": false }, { - name: "position", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "amounts", - type: { - array: ["u64", 2], + "name": "amounts", + "type": { + "array": [ + "u64", + 2 + ] }, - index: false, + "index": false }, { - name: "activeBinId", - type: "i32", - index: false, - }, - ], + "name": "activeBinId", + "type": "i32", + "index": false + } + ] }, { - name: "Swap", - fields: [ + "name": "Swap", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "from", - type: "publicKey", - index: false, + "name": "from", + "type": "publicKey", + "index": false }, { - name: "startBinId", - type: "i32", - index: false, + "name": "startBinId", + "type": "i32", + "index": false }, { - name: "endBinId", - type: "i32", - index: false, + "name": "endBinId", + "type": "i32", + "index": false }, { - name: "amountIn", - type: "u64", - index: false, + "name": "amountIn", + "type": "u64", + "index": false }, { - name: "amountOut", - type: "u64", - index: false, + "name": "amountOut", + "type": "u64", + "index": false }, { - name: "swapForY", - type: "bool", - index: false, + "name": "swapForY", + "type": "bool", + "index": false }, { - name: "fee", - type: "u64", - index: false, + "name": "fee", + "type": "u64", + "index": false }, { - name: "protocolFee", - type: "u64", - index: false, + "name": "protocolFee", + "type": "u64", + "index": false }, { - name: "feeBps", - type: "u128", - index: false, + "name": "feeBps", + "type": "u128", + "index": false }, { - name: "hostFee", - type: "u64", - index: false, - }, - ], + "name": "hostFee", + "type": "u64", + "index": false + } + ] }, { - name: "ClaimReward", - fields: [ + "name": "ClaimReward", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "position", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner", - type: "publicKey", - index: false, + "name": "owner", + "type": "publicKey", + "index": false }, { - name: "rewardIndex", - type: "u64", - index: false, + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "totalReward", - type: "u64", - index: false, - }, - ], + "name": "totalReward", + "type": "u64", + "index": false + } + ] }, { - name: "FundReward", - fields: [ + "name": "FundReward", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "funder", - type: "publicKey", - index: false, + "name": "funder", + "type": "publicKey", + "index": false }, { - name: "rewardIndex", - type: "u64", - index: false, + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "amount", - type: "u64", - index: false, - }, - ], + "name": "amount", + "type": "u64", + "index": false + } + ] }, { - name: "InitializeReward", - fields: [ + "name": "InitializeReward", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "rewardMint", - type: "publicKey", - index: false, + "name": "rewardMint", + "type": "publicKey", + "index": false }, { - name: "funder", - type: "publicKey", - index: false, + "name": "funder", + "type": "publicKey", + "index": false }, { - name: "rewardIndex", - type: "u64", - index: false, + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "rewardDuration", - type: "u64", - index: false, - }, - ], + "name": "rewardDuration", + "type": "u64", + "index": false + } + ] }, { - name: "UpdateRewardDuration", - fields: [ + "name": "UpdateRewardDuration", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "rewardIndex", - type: "u64", - index: false, + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "oldRewardDuration", - type: "u64", - index: false, + "name": "oldRewardDuration", + "type": "u64", + "index": false }, { - name: "newRewardDuration", - type: "u64", - index: false, - }, - ], + "name": "newRewardDuration", + "type": "u64", + "index": false + } + ] }, { - name: "UpdateRewardFunder", - fields: [ + "name": "UpdateRewardFunder", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "rewardIndex", - type: "u64", - index: false, + "name": "rewardIndex", + "type": "u64", + "index": false }, { - name: "oldFunder", - type: "publicKey", - index: false, + "name": "oldFunder", + "type": "publicKey", + "index": false }, { - name: "newFunder", - type: "publicKey", - index: false, - }, - ], + "name": "newFunder", + "type": "publicKey", + "index": false + } + ] }, { - name: "PositionClose", - fields: [ + "name": "PositionClose", + "fields": [ { - name: "position", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner", - type: "publicKey", - index: false, - }, - ], + "name": "owner", + "type": "publicKey", + "index": false + } + ] }, { - name: "ClaimFee", - fields: [ + "name": "ClaimFee", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "position", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner", - type: "publicKey", - index: false, + "name": "owner", + "type": "publicKey", + "index": false }, { - name: "feeX", - type: "u64", - index: false, + "name": "feeX", + "type": "u64", + "index": false }, { - name: "feeY", - type: "u64", - index: false, - }, - ], + "name": "feeY", + "type": "u64", + "index": false + } + ] }, { - name: "LbPairCreate", - fields: [ + "name": "LbPairCreate", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "binStep", - type: "u16", - index: false, + "name": "binStep", + "type": "u16", + "index": false }, { - name: "tokenX", - type: "publicKey", - index: false, + "name": "tokenX", + "type": "publicKey", + "index": false }, { - name: "tokenY", - type: "publicKey", - index: false, - }, - ], + "name": "tokenY", + "type": "publicKey", + "index": false + } + ] }, { - name: "PositionCreate", - fields: [ + "name": "PositionCreate", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "position", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "owner", - type: "publicKey", - index: false, - }, - ], + "name": "owner", + "type": "publicKey", + "index": false + } + ] }, { - name: "FeeParameterUpdate", - fields: [ + "name": "FeeParameterUpdate", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "protocolShare", - type: "u16", - index: false, + "name": "protocolShare", + "type": "u16", + "index": false }, { - name: "baseFactor", - type: "u16", - index: false, + "name": "baseFactor", + "type": "u16", + "index": false + } + ] + }, + { + "name": "IncreaseObservation", + "fields": [ + { + "name": "oracle", + "type": "publicKey", + "index": false }, - ], + { + "name": "newObservationLength", + "type": "u64", + "index": false + } + ] }, { - name: "IncreaseObservation", - fields: [ + "name": "WithdrawIneligibleReward", + "fields": [ { - name: "oracle", - type: "publicKey", - index: false, + "name": "lbPair", + "type": "publicKey", + "index": false }, { - name: "newObservationLength", - type: "u64", - index: false, + "name": "rewardMint", + "type": "publicKey", + "index": false }, - ], + { + "name": "amount", + "type": "u64", + "index": false + } + ] }, { - name: "WithdrawIneligibleReward", - fields: [ + "name": "UpdatePositionOperator", + "fields": [ { - name: "lbPair", - type: "publicKey", - index: false, + "name": "position", + "type": "publicKey", + "index": false }, { - name: "rewardMint", - type: "publicKey", - index: false, + "name": "oldOperator", + "type": "publicKey", + "index": false }, { - name: "amount", - type: "u64", - index: false, - }, - ], - }, + "name": "newOperator", + "type": "publicKey", + "index": false + } + ] + } ], - errors: [ + "errors": [ { - code: 6000, - name: "InvalidStartBinIndex", - msg: "Invalid start bin index", + "code": 6000, + "name": "InvalidStartBinIndex", + "msg": "Invalid start bin index" }, { - code: 6001, - name: "InvalidBinId", - msg: "Invalid bin id", + "code": 6001, + "name": "InvalidBinId", + "msg": "Invalid bin id" }, { - code: 6002, - name: "InvalidInput", - msg: "Invalid input data", + "code": 6002, + "name": "InvalidInput", + "msg": "Invalid input data" }, { - code: 6003, - name: "ExceededAmountSlippageTolerance", - msg: "Exceeded amount slippage tolerance", + "code": 6003, + "name": "ExceededAmountSlippageTolerance", + "msg": "Exceeded amount slippage tolerance" }, { - code: 6004, - name: "ExceededBinSlippageTolerance", - msg: "Exceeded bin slippage tolerance", + "code": 6004, + "name": "ExceededBinSlippageTolerance", + "msg": "Exceeded bin slippage tolerance" }, { - code: 6005, - name: "CompositionFactorFlawed", - msg: "Composition factor flawed", + "code": 6005, + "name": "CompositionFactorFlawed", + "msg": "Composition factor flawed" }, { - code: 6006, - name: "NonPresetBinStep", - msg: "Non preset bin step", + "code": 6006, + "name": "NonPresetBinStep", + "msg": "Non preset bin step" }, { - code: 6007, - name: "ZeroLiquidity", - msg: "Zero liquidity", + "code": 6007, + "name": "ZeroLiquidity", + "msg": "Zero liquidity" }, { - code: 6008, - name: "InvalidPosition", - msg: "Invalid position", + "code": 6008, + "name": "InvalidPosition", + "msg": "Invalid position" }, { - code: 6009, - name: "BinArrayNotFound", - msg: "Bin array not found", + "code": 6009, + "name": "BinArrayNotFound", + "msg": "Bin array not found" }, { - code: 6010, - name: "InvalidTokenMint", - msg: "Invalid token mint", + "code": 6010, + "name": "InvalidTokenMint", + "msg": "Invalid token mint" }, { - code: 6011, - name: "InvalidAccountForSingleDeposit", - msg: "Invalid account for single deposit", + "code": 6011, + "name": "InvalidAccountForSingleDeposit", + "msg": "Invalid account for single deposit" }, { - code: 6012, - name: "PairInsufficientLiquidity", - msg: "Pair insufficient liquidity", + "code": 6012, + "name": "PairInsufficientLiquidity", + "msg": "Pair insufficient liquidity" }, { - code: 6013, - name: "InvalidFeeOwner", - msg: "Invalid fee owner", + "code": 6013, + "name": "InvalidFeeOwner", + "msg": "Invalid fee owner" }, { - code: 6014, - name: "InvalidFeeWithdrawAmount", - msg: "Invalid fee withdraw amount", + "code": 6014, + "name": "InvalidFeeWithdrawAmount", + "msg": "Invalid fee withdraw amount" }, { - code: 6015, - name: "InvalidAdmin", - msg: "Invalid admin", + "code": 6015, + "name": "InvalidAdmin", + "msg": "Invalid admin" }, { - code: 6016, - name: "IdenticalFeeOwner", - msg: "Identical fee owner", + "code": 6016, + "name": "IdenticalFeeOwner", + "msg": "Identical fee owner" }, { - code: 6017, - name: "InvalidBps", - msg: "Invalid basis point", + "code": 6017, + "name": "InvalidBps", + "msg": "Invalid basis point" }, { - code: 6018, - name: "MathOverflow", - msg: "Math operation overflow", + "code": 6018, + "name": "MathOverflow", + "msg": "Math operation overflow" }, { - code: 6019, - name: "TypeCastFailed", - msg: "Type cast error", + "code": 6019, + "name": "TypeCastFailed", + "msg": "Type cast error" }, { - code: 6020, - name: "InvalidRewardIndex", - msg: "Invalid reward index", + "code": 6020, + "name": "InvalidRewardIndex", + "msg": "Invalid reward index" }, { - code: 6021, - name: "InvalidRewardDuration", - msg: "Invalid reward duration", + "code": 6021, + "name": "InvalidRewardDuration", + "msg": "Invalid reward duration" }, { - code: 6022, - name: "RewardInitialized", - msg: "Reward already initialized", + "code": 6022, + "name": "RewardInitialized", + "msg": "Reward already initialized" }, { - code: 6023, - name: "RewardUninitialized", - msg: "Reward not initialized", + "code": 6023, + "name": "RewardUninitialized", + "msg": "Reward not initialized" }, { - code: 6024, - name: "IdenticalFunder", - msg: "Identical funder", + "code": 6024, + "name": "IdenticalFunder", + "msg": "Identical funder" }, { - code: 6025, - name: "RewardCampaignInProgress", - msg: "Reward campaign in progress", + "code": 6025, + "name": "RewardCampaignInProgress", + "msg": "Reward campaign in progress" }, { - code: 6026, - name: "IdenticalRewardDuration", - msg: "Reward duration is the same", + "code": 6026, + "name": "IdenticalRewardDuration", + "msg": "Reward duration is the same" }, { - code: 6027, - name: "InvalidBinArray", - msg: "Invalid bin array", + "code": 6027, + "name": "InvalidBinArray", + "msg": "Invalid bin array" }, { - code: 6028, - name: "NonContinuousBinArrays", - msg: "Bin arrays must be continuous", + "code": 6028, + "name": "NonContinuousBinArrays", + "msg": "Bin arrays must be continuous" }, { - code: 6029, - name: "InvalidRewardVault", - msg: "Invalid reward vault", + "code": 6029, + "name": "InvalidRewardVault", + "msg": "Invalid reward vault" }, { - code: 6030, - name: "NonEmptyPosition", - msg: "Position is not empty", + "code": 6030, + "name": "NonEmptyPosition", + "msg": "Position is not empty" }, { - code: 6031, - name: "UnauthorizedAlphaAccess", - msg: "Unauthorized alpha access", + "code": 6031, + "name": "UnauthorizedAlphaAccess", + "msg": "Unauthorized alpha access" }, { - code: 6032, - name: "InvalidFeeParameter", - msg: "Invalid fee parameter", + "code": 6032, + "name": "InvalidFeeParameter", + "msg": "Invalid fee parameter" }, { - code: 6033, - name: "MissingOracle", - msg: "Missing oracle account", + "code": 6033, + "name": "MissingOracle", + "msg": "Missing oracle account" }, { - code: 6034, - name: "InsufficientSample", - msg: "Insufficient observation sample", + "code": 6034, + "name": "InsufficientSample", + "msg": "Insufficient observation sample" }, { - code: 6035, - name: "InvalidLookupTimestamp", - msg: "Invalid lookup timestamp", + "code": 6035, + "name": "InvalidLookupTimestamp", + "msg": "Invalid lookup timestamp" }, { - code: 6036, - name: "BitmapExtensionAccountIsNotProvided", - msg: "Bitmap extension account is not provided", + "code": 6036, + "name": "BitmapExtensionAccountIsNotProvided", + "msg": "Bitmap extension account is not provided" }, { - code: 6037, - name: "CannotFindNonZeroLiquidityBinArrayId", - msg: "Cannot find non-zero liquidity binArrayId", + "code": 6037, + "name": "CannotFindNonZeroLiquidityBinArrayId", + "msg": "Cannot find non-zero liquidity binArrayId" }, { - code: 6038, - name: "BinIdOutOfBound", - msg: "Bin id out of bound", + "code": 6038, + "name": "BinIdOutOfBound", + "msg": "Bin id out of bound" }, { - code: 6039, - name: "InsufficientOutAmount", - msg: "Insufficient amount in for minimum out", + "code": 6039, + "name": "InsufficientOutAmount", + "msg": "Insufficient amount in for minimum out" }, { - code: 6040, - name: "InvalidPositionWidth", - msg: "Invalid position width", + "code": 6040, + "name": "InvalidPositionWidth", + "msg": "Invalid position width" }, { - code: 6041, - name: "ExcessiveFeeUpdate", - msg: "Excessive fee update", + "code": 6041, + "name": "ExcessiveFeeUpdate", + "msg": "Excessive fee update" }, { - code: 6042, - name: "PoolDisabled", - msg: "Pool disabled", + "code": 6042, + "name": "PoolDisabled", + "msg": "Pool disabled" }, { - code: 6043, - name: "InvalidPoolType", - msg: "Invalid pool type", + "code": 6043, + "name": "InvalidPoolType", + "msg": "Invalid pool type" }, { - code: 6044, - name: "ExceedMaxWhitelist", - msg: "Whitelist for wallet is full", + "code": 6044, + "name": "ExceedMaxWhitelist", + "msg": "Whitelist for wallet is full" }, { - code: 6045, - name: "InvalidIndex", - msg: "Invalid index", + "code": 6045, + "name": "InvalidIndex", + "msg": "Invalid index" }, { - code: 6046, - name: "RewardNotEnded", - msg: "Reward not ended", + "code": 6046, + "name": "RewardNotEnded", + "msg": "Reward not ended" }, { - code: 6047, - name: "MustWithdrawnIneligibleReward", - msg: "Must withdraw ineligible reward", - }, - ], + "code": 6047, + "name": "MustWithdrawnIneligibleReward", + "msg": "Must withdraw ineligible reward" + } + ] }; diff --git a/ts-client/src/dlmm/index.ts b/ts-client/src/dlmm/index.ts index deca9247..f66a3a9d 100644 --- a/ts-client/src/dlmm/index.ts +++ b/ts-client/src/dlmm/index.ts @@ -103,7 +103,7 @@ export class DLMM { public tokenX: TokenReserve, public tokenY: TokenReserve, private opt?: Opt - ) {} + ) { } /** Static public method */ @@ -510,13 +510,13 @@ export class DLMM { let i = binArrayPubkeyArray.length + lbPairArray.length; i < binArrayPubkeyArray.length + - lbPairArray.length + - binArrayPubkeyArrayV2.length; + lbPairArray.length + + binArrayPubkeyArrayV2.length; i++ ) { const binArrayPubkey = binArrayPubkeyArrayV2[ - i - (binArrayPubkeyArray.length + lbPairArray.length) + i - (binArrayPubkeyArray.length + lbPairArray.length) ]; const binArrayAccInfoBufferV2 = binArraysAccInfo[i]; if (!binArrayAccInfoBufferV2) @@ -541,10 +541,10 @@ export class DLMM { ) { const lbPairPubkey = lbPairArrayV2[ - i - - (binArrayPubkeyArray.length + - lbPairArray.length + - binArrayPubkeyArrayV2.length) + i - + (binArrayPubkeyArray.length + + lbPairArray.length + + binArrayPubkeyArrayV2.length) ]; const lbPairAccInfoBufferV2 = binArraysAccInfo[i]; if (!lbPairAccInfoBufferV2) @@ -1509,7 +1509,7 @@ export class DLMM { binArrayLower, binArrayUpper, binArrayBitmapExtension, - owner: user, + sender: user, tokenXProgram: TOKEN_PROGRAM_ID, tokenYProgram: TOKEN_PROGRAM_ID, }; @@ -1526,7 +1526,7 @@ export class DLMM { binArrayUpper, lbPair: this.pubkey, binArrayBitmapExtension: null, - owner: user, + sender: user, position: positionPubKey, reserve: totalXAmount.isZero() ? this.lbPair.reserveY @@ -1769,7 +1769,7 @@ export class DLMM { binArrayLower, binArrayUpper, binArrayBitmapExtension, - owner: user, + sender: user, tokenXProgram: TOKEN_PROGRAM_ID, tokenYProgram: TOKEN_PROGRAM_ID, }; @@ -1786,7 +1786,7 @@ export class DLMM { binArrayUpper, lbPair: this.pubkey, binArrayBitmapExtension: null, - owner: user, + sender: user, position: positionPubKey, reserve: totalXAmount.isZero() ? this.lbPair.reserveY @@ -1942,7 +1942,7 @@ export class DLMM { binArrayLower, binArrayUpper, lbPair: this.pubkey, - owner: user, + sender: user, position, reserveX, reserveY, @@ -1970,7 +1970,7 @@ export class DLMM { .claimReward(new BN(i)) .accounts({ lbPair: this.pubkey, - owner: user, + sender: user, position, binArrayLower, binArrayUpper, @@ -1991,7 +1991,7 @@ export class DLMM { rentReceiver: user, position, lbPair: this.pubkey, - owner: user, + sender: user, }) .instruction(); if (secondTransactionsIx.length) { @@ -2050,7 +2050,7 @@ export class DLMM { binArrayBitmapExtension, tokenXProgram: TOKEN_PROGRAM_ID, tokenYProgram: TOKEN_PROGRAM_ID, - owner: user, + sender: user, }) .preInstructions(preInstructions) .postInstructions(postInstructions) @@ -2121,7 +2121,7 @@ export class DLMM { rentReceiver: owner, position: position.publicKey, lbPair: this.pubkey, - owner, + sender: owner, }) .transaction(); @@ -3124,7 +3124,7 @@ export class DLMM { if (elapsed < sParameter.decayPeriod) { const decayedVolatilityReference = Math.floor( (vParameter.volatilityAccumulator * sParameter.reductionFactor) / - BASIS_POINT_MAX + BASIS_POINT_MAX ); vParameter.volatilityReference = decayedVolatilityReference; } else { @@ -3174,7 +3174,7 @@ export class DLMM { .claimReward(new BN(i)) .accounts({ lbPair: this.pubkey, - owner, + sender: owner, position: position.publicKey, binArrayLower, binArrayUpper, @@ -3269,7 +3269,7 @@ export class DLMM { binArrayLower, binArrayUpper, lbPair: this.pubkey, - owner, + sender: owner, position: position.publicKey, reserveX, reserveY,