From 05ac079d6d74f5e8958e0e84975a0eb84947f069 Mon Sep 17 00:00:00 2001 From: 0xfnzero <0xfnzero@users.noreply.github.com> Date: Sat, 16 May 2026 06:42:50 +0800 Subject: [PATCH] release: update DEX protocol support for v4.0.9 Sync supported DEX IDLs from bitquery/solana-idl-lib, upgrade protocol builders, and keep trade submission hot paths free of RPC query calls. Include exact-output coverage, token-account setup fixes for WSOL and stable pairs, and low-latency transaction build improvements. --- Cargo.toml | 2 +- README.md | 4 +- README_CN.md | 5 +- docs/TRADING_PARAMETERS.md | 4 +- docs/TRADING_PARAMETERS_CN.md | 4 +- examples/address_lookup/src/main.rs | 3 +- examples/bonk_copy_trading/src/main.rs | 5 +- examples/bonk_sniper_trading/src/main.rs | 5 +- examples/cli_trading/src/main.rs | 45 +- .../src/main.rs | 5 +- examples/middleware_system/src/main.rs | 3 +- examples/nonce_cache/src/main.rs | 3 +- examples/pumpfun_copy_trading/src/main.rs | 5 +- examples/pumpfun_sniper_trading/src/main.rs | 5 +- examples/pumpswap_direct_trading/src/main.rs | 5 +- examples/pumpswap_trading/src/main.rs | 9 +- examples/raydium_amm_v4_trading/src/main.rs | 41 +- examples/raydium_cpmm_trading/src/main.rs | 5 +- examples/seed_trading/src/main.rs | 5 +- examples/trading_client/src/main.rs | 2 +- idl/README.md | 14 + idl/bitquery/meteora/cp_amm_016.json | 2697 ++++++++ idl/bitquery/pumpfun/pump.json | 3564 ++++++++++ idl/bitquery/pumpswap/amm.json | 3433 ++++++++++ idl/bitquery/raydium/launchpad.json | 5783 +++++++++++++++++ idl/bitquery/raydium/raydium_amm.json | 2401 +++++++ idl/bitquery/raydium/raydium_cp.json | 1093 ++++ idl/bonk.json | 5783 +++++++++++++++++ idl/meteora_damm_v2.json | 2697 ++++++++ idl/raydium_amm_v4.json | 2401 +++++++ idl/raydium_cpmm.json | 1093 ++++ src/client/mod.rs | 6 +- src/common/fast_timing.rs | 6 +- src/common/types.rs | 2 +- src/instruction/bonk.rs | 216 +- src/instruction/meteora_damm_v2.rs | 358 +- src/instruction/mod.rs | 1 + src/instruction/pumpfun.rs | 292 +- src/instruction/pumpfun_ix_data.rs | 22 +- src/instruction/pumpswap.rs | 249 +- src/instruction/raydium_amm_v4.rs | 363 +- src/instruction/raydium_cpmm.rs | 339 +- src/instruction/token_account_setup.rs | 47 + src/instruction/utils/bonk.rs | 2 + src/instruction/utils/meteora_damm_v2.rs | 12 + src/instruction/utils/pumpswap.rs | 14 +- src/instruction/utils/raydium_amm_v4.rs | 26 +- src/instruction/utils/raydium_amm_v4_types.rs | 35 + src/perf/compiler_optimization.rs | 5 +- src/perf/hardware_optimizations.rs | 15 +- src/perf/syscall_bypass.rs | 7 +- src/trading/common/transaction_builder.rs | 12 +- src/trading/core/async_executor.rs | 14 +- src/trading/core/executor.rs | 5 +- src/trading/core/params/dex_swap.rs | 2 + src/trading/core/params/meteora_damm_v2.rs | 26 + src/trading/core/params/raydium_amm_v4.rs | 87 +- 57 files changed, 32699 insertions(+), 588 deletions(-) create mode 100644 idl/README.md create mode 100644 idl/bitquery/meteora/cp_amm_016.json create mode 100644 idl/bitquery/pumpfun/pump.json create mode 100644 idl/bitquery/pumpswap/amm.json create mode 100644 idl/bitquery/raydium/launchpad.json create mode 100644 idl/bitquery/raydium/raydium_amm.json create mode 100644 idl/bitquery/raydium/raydium_cp.json create mode 100644 idl/bonk.json create mode 100644 idl/meteora_damm_v2.json create mode 100644 idl/raydium_amm_v4.json create mode 100644 idl/raydium_cpmm.json create mode 100644 src/instruction/token_account_setup.rs diff --git a/Cargo.toml b/Cargo.toml index 9072b32..1006589 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "4.0.8" +version = "4.0.9" edition = "2021" authors = [ "William ", diff --git a/README.md b/README.md index 06c6a45..b637a89 100644 --- a/README.md +++ b/README.md @@ -108,14 +108,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.8" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.9" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "4.0.8" +sol-trade-sdk = "4.0.9" ``` ## 🛠️ Usage Examples diff --git a/README_CN.md b/README_CN.md index d714818..a8797e1 100755 --- a/README_CN.md +++ b/README_CN.md @@ -108,14 +108,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.8" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.9" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "4.0.8" +sol-trade-sdk = "4.0.9" ``` ## 🛠️ 使用示例 @@ -446,4 +446,3 @@ MIT 许可证 3. 注意滑点设置避免交易失败 4. 监控余额和交易费用 5. 遵循相关法律法规 - diff --git a/docs/TRADING_PARAMETERS.md b/docs/TRADING_PARAMETERS.md index 1f0f863..b1f3983 100644 --- a/docs/TRADING_PARAMETERS.md +++ b/docs/TRADING_PARAMETERS.md @@ -35,7 +35,7 @@ The `TradeBuyParams` struct contains all parameters required for executing buy o | `close_input_token_ata` | `bool` | ✅ | Whether to close input token ATA after transaction | | `create_mint_ata` | `bool` | ✅ | Whether to create token mint ATA | | `durable_nonce` | `Option` | ❌ | Durable nonce information containing nonce account and current nonce value | -| `fixed_output_token_amount` | `Option` | ❌ | Optional fixed output token amount. If set, this value will be directly assigned to the output amount instead of being calculated (required for Meteora DAMM V2) | +| `fixed_output_token_amount` | `Option` | ❌ | Optional fixed output token amount. On exact-out capable DEXes, this uses the exact-out instruction and treats input_token_amount as the max input budget (required for Meteora DAMM V2) | | `gas_fee_strategy` | `GasFeeStrategy` | ✅ | Gas fee strategy instance for controlling transaction fees and priorities | | `simulate` | `bool` | ✅ | Whether to simulate the transaction instead of executing it. When true, the transaction will be simulated via RPC to validate and show detailed logs, compute units consumed, and potential errors without actually submitting to the blockchain | @@ -67,7 +67,7 @@ The `TradeSellParams` struct contains all parameters required for executing sell | `close_output_token_ata` | `bool` | ✅ | Whether to close output token ATA after transaction | | `durable_nonce` | `Option` | ❌ | Durable nonce information containing nonce account and current nonce value | | `gas_fee_strategy` | `GasFeeStrategy` | ✅ | Gas fee strategy instance for controlling transaction fees and priorities | -| `fixed_output_token_amount` | `Option` | ❌ | Optional fixed output token amount. If set, this value will be directly assigned to the output amount instead of being calculated (required for Meteora DAMM V2) | +| `fixed_output_token_amount` | `Option` | ❌ | Optional fixed output token amount. On exact-out capable DEXes, this uses the exact-out instruction and treats input_token_amount as the max input budget (required for Meteora DAMM V2) | | `simulate` | `bool` | ✅ | Whether to simulate the transaction instead of executing it. When true, the transaction will be simulated via RPC to validate and show detailed logs, compute units consumed, and potential errors without actually submitting to the blockchain | diff --git a/docs/TRADING_PARAMETERS_CN.md b/docs/TRADING_PARAMETERS_CN.md index f87d126..f644329 100644 --- a/docs/TRADING_PARAMETERS_CN.md +++ b/docs/TRADING_PARAMETERS_CN.md @@ -35,7 +35,7 @@ | `close_input_token_ata` | `bool` | ✅ | 交易后是否关闭输入代币 ATA | | `create_mint_ata` | `bool` | ✅ | 是否创建代币 mint ATA | | `durable_nonce` | `Option` | ❌ | 持久 nonce 信息,包含 nonce 账户和当前 nonce 值 | -| `fixed_output_token_amount` | `Option` | ❌ | 可选的固定输出代币数量。如果设置,此值将直接分配给输出数量而不是通过计算得出(Meteora DAMM V2 必需) | +| `fixed_output_token_amount` | `Option` | ❌ | 可选的固定输出代币数量。对于支持 exact-out 的 DEX,会使用 exact-out 指令,并将 input_token_amount 作为最大输入预算(Meteora DAMM V2 必需) | | `gas_fee_strategy` | `GasFeeStrategy` | ✅ | Gas fee 策略实例,用于控制交易费用和优先级 | | `simulate` | `bool` | ✅ | 是否模拟交易而不实际执行。当为 true 时,将通过 RPC 模拟交易以验证并显示详细日志、计算单元消耗和潜在错误,而不会实际提交到区块链 | @@ -67,7 +67,7 @@ | `close_output_token_ata` | `bool` | ✅ | 交易后是否关闭输出代币 ATA | | `durable_nonce` | `Option` | ❌ | 持久 nonce 信息,包含 nonce 账户和当前 nonce 值 | | `gas_fee_strategy` | `GasFeeStrategy` | ✅ | Gas fee 策略实例,用于控制交易费用和优先级 | -| `fixed_output_token_amount` | `Option` | ❌ | 可选的固定输出代币数量。如果设置,此值将直接分配给输出数量而不是通过计算得出(Meteora DAMM V2 必需) | +| `fixed_output_token_amount` | `Option` | ❌ | 可选的固定输出代币数量。对于支持 exact-out 的 DEX,会使用 exact-out 指令,并将 input_token_amount 作为最大输入预算(Meteora DAMM V2 必需) | | `simulate` | `bool` | ✅ | 是否模拟交易而不实际执行。当为 true 时,将通过 RPC 模拟交易以验证并显示详细日志、计算单元消耗和潜在错误,而不会实际提交到区块链 | diff --git a/examples/address_lookup/src/main.rs b/examples/address_lookup/src/main.rs index 8038519..87060a4 100644 --- a/examples/address_lookup/src/main.rs +++ b/examples/address_lookup/src/main.rs @@ -167,7 +167,7 @@ async fn pumpfun_copy_trade_with_grpc( Some(trade_info.mayhem_mode), )), address_lookup_table_account, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: false, close_input_token_ata: false, create_mint_ata: true, @@ -176,7 +176,6 @@ async fn pumpfun_copy_trade_with_grpc( gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/bonk_copy_trading/src/main.rs b/examples/bonk_copy_trading/src/main.rs index 834be9b..72b3b86 100644 --- a/examples/bonk_copy_trading/src/main.rs +++ b/examples/bonk_copy_trading/src/main.rs @@ -170,7 +170,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> trade_info.global_config, )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: false, create_mint_ata: true, @@ -179,7 +179,6 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -222,7 +221,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()> trade_info.global_config, )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, with_tip: false, durable_nonce: None, create_output_token_ata: false, diff --git a/examples/bonk_sniper_trading/src/main.rs b/examples/bonk_sniper_trading/src/main.rs index 4fe0c2a..bd2f012 100644 --- a/examples/bonk_sniper_trading/src/main.rs +++ b/examples/bonk_sniper_trading/src/main.rs @@ -138,7 +138,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< trade_info.global_config, )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: true, create_mint_ata: true, @@ -147,7 +147,6 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -183,7 +182,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult< trade_info.global_config, )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: true, close_mint_token_ata: false, diff --git a/examples/cli_trading/src/main.rs b/examples/cli_trading/src/main.rs index e57ded9..a3d514f 100644 --- a/examples/cli_trading/src/main.rs +++ b/examples/cli_trading/src/main.rs @@ -627,7 +627,7 @@ async fn handle_buy_pumpfun( recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::PumpFun(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: false, close_input_token_ata: false, create_mint_ata: create_mint_ata, @@ -636,11 +636,10 @@ async fn handle_buy_pumpfun( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully bought tokens from PumpFun!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -684,7 +683,7 @@ async fn handle_buy_pumpswap( recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::PumpSwap(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: false, create_mint_ata: create_mint_ata, @@ -693,11 +692,10 @@ async fn handle_buy_pumpswap( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully bought tokens from PumpSwap!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -741,7 +739,7 @@ async fn handle_buy_bonk( recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::Bonk(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: false, create_mint_ata: create_mint_ata, @@ -750,11 +748,10 @@ async fn handle_buy_bonk( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully bought tokens from Bonk!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -802,7 +799,7 @@ async fn handle_buy_raydium_v4( recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::RaydiumAmmV4(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: false, create_mint_ata: create_mint_ata, @@ -811,11 +808,10 @@ async fn handle_buy_raydium_v4( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully bought tokens from Raydium V4!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -864,7 +860,7 @@ async fn handle_buy_raydium_cpmm( recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::RaydiumCpmm(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: false, create_mint_ata: create_mint_ata, @@ -873,11 +869,10 @@ async fn handle_buy_raydium_cpmm( gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; match client.buy(buy_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully bought tokens from Raydium CPMM!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -1035,7 +1030,7 @@ async fn handle_sell_pumpfun( with_tip: false, extension_params: DexParamEnum::PumpFun(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: false, close_mint_token_ata: false, @@ -1047,7 +1042,7 @@ async fn handle_sell_pumpfun( }; match client.sell(sell_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully sold tokens from PumpFun!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -1094,7 +1089,7 @@ async fn handle_sell_pumpswap( with_tip: false, extension_params: DexParamEnum::PumpSwap(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: false, close_mint_token_ata: false, @@ -1105,7 +1100,7 @@ async fn handle_sell_pumpswap( grpc_recv_us: None, }; match client.sell(sell_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully sold tokens from PumpSwap!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -1153,7 +1148,7 @@ async fn handle_sell_bonk( with_tip: false, extension_params: DexParamEnum::Bonk(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: false, close_mint_token_ata: false, @@ -1164,7 +1159,7 @@ async fn handle_sell_bonk( grpc_recv_us: None, }; match client.sell(sell_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully sold tokens from Bonk!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -1215,7 +1210,7 @@ async fn handle_sell_raydium_v4( with_tip: false, extension_params: DexParamEnum::RaydiumAmmV4(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: false, close_mint_token_ata: false, @@ -1226,7 +1221,7 @@ async fn handle_sell_raydium_v4( grpc_recv_us: None, }; match client.sell(sell_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully sold tokens from Raydium V4!"); println!(" ✅ Transaction Signature: {:?}", signature); } @@ -1278,7 +1273,7 @@ async fn handle_sell_raydium_cpmm( with_tip: false, extension_params: DexParamEnum::RaydiumCpmm(param), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: false, close_mint_token_ata: false, @@ -1289,7 +1284,7 @@ async fn handle_sell_raydium_cpmm( grpc_recv_us: None, }; match client.sell(sell_params).await { - Ok((_, signature, _)) => { + Ok((_, signature, _, _)) => { println!(" ✅ Successfully sold tokens from Raydium CPMM!"); println!(" ✅ Transaction Signature: {:?}", signature); } diff --git a/examples/meteora_damm_v2_direct_trading/src/main.rs b/examples/meteora_damm_v2_direct_trading/src/main.rs index 6c38f3d..1a5b65e 100644 --- a/examples/meteora_damm_v2_direct_trading/src/main.rs +++ b/examples/meteora_damm_v2_direct_trading/src/main.rs @@ -42,7 +42,7 @@ async fn main() -> Result<(), Box> { .await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: false, //if input token is SOL/WSOL,set to true,if input token is USDC,set to false. close_input_token_ata: false, //if input token is SOL/WSOL,set to true,if input token is USDC,set to false. create_mint_ata: true, @@ -51,7 +51,6 @@ async fn main() -> Result<(), Box> { gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -84,7 +83,7 @@ async fn main() -> Result<(), Box> { .await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: false, //if output token is SOL/WSOL,set to true,if output token is USDC,set to false. close_output_token_ata: false, //if output token is SOL/WSOL,set to true,if output token is USDC,set to false. close_mint_token_ata: false, diff --git a/examples/middleware_system/src/main.rs b/examples/middleware_system/src/main.rs index 7c02e94..1693185 100644 --- a/examples/middleware_system/src/main.rs +++ b/examples/middleware_system/src/main.rs @@ -103,7 +103,7 @@ async fn test_middleware() -> AnyResult<()> { .await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: true, create_mint_ata: true, @@ -112,7 +112,6 @@ async fn test_middleware() -> AnyResult<()> { gas_fee_strategy: gas_fee_strategy, simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/nonce_cache/src/main.rs b/examples/nonce_cache/src/main.rs index 456249c..e6dc33f 100644 --- a/examples/nonce_cache/src/main.rs +++ b/examples/nonce_cache/src/main.rs @@ -163,7 +163,7 @@ async fn pumpfun_copy_trade_with_grpc( Some(trade_info.mayhem_mode), )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: false, close_input_token_ata: false, create_mint_ata: true, @@ -172,7 +172,6 @@ async fn pumpfun_copy_trade_with_grpc( gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; diff --git a/examples/pumpfun_copy_trading/src/main.rs b/examples/pumpfun_copy_trading/src/main.rs index df3836c..e28ccd8 100644 --- a/examples/pumpfun_copy_trading/src/main.rs +++ b/examples/pumpfun_copy_trading/src/main.rs @@ -160,7 +160,7 @@ async fn pumpfun_copy_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent) Some(e.mayhem_mode), )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: false, close_input_token_ata: false, create_mint_ata: true, @@ -169,7 +169,6 @@ async fn pumpfun_copy_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent) gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -211,7 +210,7 @@ async fn pumpfun_copy_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent) Some(e.mayhem_mode), )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: false, close_output_token_ata: false, close_mint_token_ata: false, diff --git a/examples/pumpfun_sniper_trading/src/main.rs b/examples/pumpfun_sniper_trading/src/main.rs index 1d4912d..6c0d5e8 100644 --- a/examples/pumpfun_sniper_trading/src/main.rs +++ b/examples/pumpfun_sniper_trading/src/main.rs @@ -150,7 +150,7 @@ async fn pumpfun_sniper_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent Some(e.mayhem_mode), )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: true, create_mint_ata: true, @@ -159,7 +159,6 @@ async fn pumpfun_sniper_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -195,7 +194,7 @@ async fn pumpfun_sniper_trade(e: sol_parser_sdk::core::events::PumpFunTradeEvent Some(e.mayhem_mode), )), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: true, close_mint_token_ata: false, diff --git a/examples/pumpswap_direct_trading/src/main.rs b/examples/pumpswap_direct_trading/src/main.rs index 9760600..7c18ce7 100644 --- a/examples/pumpswap_direct_trading/src/main.rs +++ b/examples/pumpswap_direct_trading/src/main.rs @@ -41,7 +41,7 @@ async fn main() -> Result<(), Box> { PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: true, create_mint_ata: true, @@ -50,7 +50,6 @@ async fn main() -> Result<(), Box> { gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -81,7 +80,7 @@ async fn main() -> Result<(), Box> { PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: true, close_mint_token_ata: false, diff --git a/examples/pumpswap_trading/src/main.rs b/examples/pumpswap_trading/src/main.rs index 54b0a1a..a19b663 100644 --- a/examples/pumpswap_trading/src/main.rs +++ b/examples/pumpswap_trading/src/main.rs @@ -164,7 +164,7 @@ async fn pumpswap_trade_with_grpc_buy_event(trade_info: PumpSwapBuyEvent) -> Any trade_info.protocol_fee_recipient, pool_data.coin_creator, pool_data.is_cashback_coin, - trade_info.cashback_fee_basis_points, + 0, ); let mint = if trade_info.base_mint == sol_trade_sdk::constants::USDC_TOKEN_ACCOUNT || trade_info.base_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT @@ -195,7 +195,7 @@ async fn pumpswap_trade_with_grpc_sell_event(trade_info: PumpSwapSellEvent) -> A trade_info.protocol_fee_recipient, pool_data.coin_creator, pool_data.is_cashback_coin, - trade_info.cashback_fee_basis_points, + 0, ); let mint = if trade_info.base_mint == sol_trade_sdk::constants::USDC_TOKEN_ACCOUNT || trade_info.base_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT @@ -235,7 +235,7 @@ async fn pumpswap_trade_with_grpc( recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::PumpSwap(params.clone()), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: is_sol, close_input_token_ata: is_sol, create_mint_ata: true, @@ -244,7 +244,6 @@ async fn pumpswap_trade_with_grpc( gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -277,7 +276,7 @@ async fn pumpswap_trade_with_grpc( with_tip: false, extension_params: DexParamEnum::PumpSwap(params.clone()), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: is_sol, close_output_token_ata: is_sol, close_mint_token_ata: false, diff --git a/examples/raydium_amm_v4_trading/src/main.rs b/examples/raydium_amm_v4_trading/src/main.rs index ee3dd39..712d5c7 100644 --- a/examples/raydium_amm_v4_trading/src/main.rs +++ b/examples/raydium_amm_v4_trading/src/main.rs @@ -8,10 +8,7 @@ use sol_trade_sdk::{ }, SolanaTrade, }; -use sol_trade_sdk::{ - common::TradeConfig, instruction::utils::raydium_amm_v4::fetch_amm_info, - trading::common::get_multi_token_balances, TradeTokenType, -}; +use sol_trade_sdk::{common::TradeConfig, TradeTokenType}; use solana_commitment_config::CommitmentConfig; use solana_sdk::signature::Keypair; use solana_sdk::signer::Signer; @@ -131,29 +128,16 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) let slippage_basis_points = Some(100); let recent_blockhash = client.infrastructure.rpc.get_latest_blockhash().await?; - let amm_info = fetch_amm_info(&client.infrastructure.rpc, trade_info.amm).await?; - let (coin_reserve, pc_reserve) = get_multi_token_balances( - &client.infrastructure.rpc, - &amm_info.token_coin, - &amm_info.token_pc, - ) - .await?; - let mint_pubkey = if amm_info.pc_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT - || amm_info.pc_mint == sol_trade_sdk::constants::USDC_TOKEN_ACCOUNT + let params = + RaydiumAmmV4Params::from_amm_address_by_rpc(&client.infrastructure.rpc, trade_info.amm) + .await?; + let mint_pubkey = if params.pc_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT + || params.pc_mint == sol_trade_sdk::constants::USDC_TOKEN_ACCOUNT { - amm_info.coin_mint + params.coin_mint } else { - amm_info.pc_mint + params.pc_mint }; - let params = RaydiumAmmV4Params::new( - trade_info.amm, - amm_info.coin_mint, - amm_info.pc_mint, - amm_info.token_coin, - amm_info.token_pc, - coin_reserve, - pc_reserve, - ); let gas_fee_strategy = sol_trade_sdk::common::GasFeeStrategy::new(); gas_fee_strategy.set_global_fee_strategy(150000, 150000, 500000, 500000, 0.001, 0.001); @@ -161,8 +145,8 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) // Buy tokens println!("Buying tokens from Raydium_amm_v4..."); let input_token_amount = 100_000; - let is_wsol = amm_info.pc_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT - || amm_info.coin_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT; + let is_wsol = params.pc_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT + || params.coin_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT; let buy_params = sol_trade_sdk::TradeBuyParams { dex_type: DexType::RaydiumAmmV4, input_token_type: if is_wsol { TradeTokenType::WSOL } else { TradeTokenType::USDC }, @@ -172,7 +156,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::RaydiumAmmV4(params), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: is_wsol, close_input_token_ata: is_wsol, create_mint_ata: true, @@ -181,7 +165,6 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -215,7 +198,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent) with_tip: false, extension_params: DexParamEnum::RaydiumAmmV4(params), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: is_wsol, close_output_token_ata: is_wsol, close_mint_token_ata: false, diff --git a/examples/raydium_cpmm_trading/src/main.rs b/examples/raydium_cpmm_trading/src/main.rs index 9f4fbc2..4b4df8b 100644 --- a/examples/raydium_cpmm_trading/src/main.rs +++ b/examples/raydium_cpmm_trading/src/main.rs @@ -160,7 +160,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> recent_blockhash: Some(recent_blockhash), extension_params: DexParamEnum::RaydiumCpmm(buy_params), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: is_wsol, close_input_token_ata: is_wsol, create_mint_ata: true, @@ -169,7 +169,6 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -201,7 +200,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) -> with_tip: false, extension_params: DexParamEnum::RaydiumCpmm(sell_params), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: is_wsol, close_output_token_ata: is_wsol, close_mint_token_ata: false, diff --git a/examples/seed_trading/src/main.rs b/examples/seed_trading/src/main.rs index 863236a..2af964c 100644 --- a/examples/seed_trading/src/main.rs +++ b/examples/seed_trading/src/main.rs @@ -41,7 +41,7 @@ async fn main() -> Result<(), Box> { PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_input_token_ata: true, close_input_token_ata: true, create_mint_ata: true, @@ -50,7 +50,6 @@ async fn main() -> Result<(), Box> { gas_fee_strategy: gas_fee_strategy.clone(), simulate: false, use_exact_sol_amount: None, - use_pumpfun_v2: false, grpc_recv_us: None, }; client.buy(buy_params).await?; @@ -84,7 +83,7 @@ async fn main() -> Result<(), Box> { PumpSwapParams::from_pool_address_by_rpc(&client.infrastructure.rpc, &pool).await?, ), address_lookup_table_account: None, - wait_transaction_confirmed: true, + wait_tx_confirmed: true, create_output_token_ata: true, close_output_token_ata: true, close_mint_token_ata: false, diff --git a/examples/trading_client/src/main.rs b/examples/trading_client/src/main.rs index 839e7ea..811c14e 100644 --- a/examples/trading_client/src/main.rs +++ b/examples/trading_client/src/main.rs @@ -47,7 +47,7 @@ async fn create_trading_client_simple() -> AnyResult { SwqosConfig::Temporal("your_api_token".to_string(), SwqosRegion::Frankfurt, None), SwqosConfig::FlashBlock("your_api_token".to_string(), SwqosRegion::Frankfurt, None), SwqosConfig::Node1("your_api_token".to_string(), SwqosRegion::Frankfurt, None, None), - SwqosConfig::BlockRazor("your_api_token".to_string(), SwqosRegion::Frankfurt, None), + SwqosConfig::BlockRazor("your_api_token".to_string(), SwqosRegion::Frankfurt, None, None), SwqosConfig::Astralane( "your_api_token".to_string(), SwqosRegion::Frankfurt, diff --git a/idl/README.md b/idl/README.md new file mode 100644 index 0000000..78c0bdf --- /dev/null +++ b/idl/README.md @@ -0,0 +1,14 @@ +# IDL sources + +Bitquery IDLs synced from `bitquery/solana-idl-lib` commit `f804b17`. + +| SDK protocol | Root IDL | Bitquery source | +| --- | --- | --- | +| Bonk / Raydium Launchpad | `bonk.json` | `bitquery/raydium/launchpad.json` | +| Raydium CPMM | `raydium_cpmm.json` | `bitquery/raydium/raydium_cp.json` | +| Raydium AMM v4 | `raydium_amm_v4.json` | `bitquery/raydium/raydium_amm.json` | +| Meteora DAMM v2 | `meteora_damm_v2.json` | `bitquery/meteora/cp_amm_016.json` | +| PumpFun | `pump.json` | `bitquery/pumpfun/pump.json` | +| PumpSwap | `pump_amm.json` | `bitquery/pumpswap/amm.json` | + +The root PumpFun/PumpSwap IDLs remain the newer local copies used for cashback and v2 instruction parity. The Bitquery snapshots are kept under `idl/bitquery/` for source comparison. diff --git a/idl/bitquery/meteora/cp_amm_016.json b/idl/bitquery/meteora/cp_amm_016.json new file mode 100644 index 0000000..3425ca2 --- /dev/null +++ b/idl/bitquery/meteora/cp_amm_016.json @@ -0,0 +1,2697 @@ +{ + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG", + "metadata": { "name": "cp_amm", "version": "0.1.6", "spec": "0.1.0", "description": "Created with Anchor" }, + "instructions": [ + { + "name": "add_liquidity", + "discriminator": [181, 157, 89, 67, 143, 182, 52, 72], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "AddLiquidityParameters" } } }] + }, + { + "name": "claim_partner_fee", + "discriminator": [97, 206, 39, 105, 94, 94, 126, 148], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { "name": "token_a_account", "docs": ["The treasury token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The treasury token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "partner", "signer": true, "relations": ["pool"] }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "max_amount_a", "type": "u64" }, + { "name": "max_amount_b", "type": "u64" } + ] + }, + { + "name": "claim_position_fee", + "discriminator": [180, 38, 154, 17, 133, 33, 162, 211], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "claim_protocol_fee", + "discriminator": [165, 228, 133, 48, 99, 249, 255, 33], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { + "name": "token_a_account", + "docs": ["The treasury token a account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 48, 9, 89, 123, 106, 114, 131, 251, 50, 173, 254, 250, 10, 80, 160, 84, 143, 100, + 81, 249, 134, 112, 30, 213, 50, 166, 239, 78, 53, 175, 188, 85 + ] + }, + { "kind": "account", "path": "token_a_program" }, + { "kind": "account", "path": "token_a_mint" } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "token_b_account", + "docs": ["The treasury token b account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 48, 9, 89, 123, 106, 114, 131, 251, 50, 173, 254, 250, 10, 80, 160, 84, 143, 100, + 81, 249, 134, 112, 30, 213, 50, 166, 239, 78, 53, 175, 188, 85 + ] + }, + { "kind": "account", "path": "token_b_program" }, + { "kind": "account", "path": "token_b_mint" } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { "name": "operator", "docs": ["Claim fee operator"] }, + { "name": "whitelisted_address", "docs": ["Operator"], "signer": true, "relations": ["operator"] }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "max_amount_a", "type": "u64" }, + { "name": "max_amount_b", "type": "u64" } + ] + }, + { + "name": "claim_reward", + "discriminator": [149, 95, 181, 242, 94, 90, 158, 162], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "reward_vault", "docs": ["The vault token account for reward token"], "writable": true }, + { "name": "reward_mint" }, + { "name": "user_token_account", "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_program" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "skip_reward", "type": "u8" } + ] + }, + { + "name": "close_config", + "discriminator": [145, 9, 72, 157, 95, 125, 61, 85], + "accounts": [ + { "name": "config", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "rent_receiver", "writable": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "close_operator_account", + "discriminator": [171, 9, 213, 74, 120, 23, 3, 29], + "accounts": [ + { "name": "operator", "writable": true }, + { "name": "admin", "signer": true }, + { "name": "rent_receiver", "writable": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "close_position", + "discriminator": [123, 134, 81, 0, 49, 68, 98, 98], + "accounts": [ + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"], "writable": true }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "rent_receiver", "writable": true }, + { "name": "owner", "docs": ["Owner of position"], "signer": true }, + { + "name": "token_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "close_token_badge", + "discriminator": [108, 146, 86, 110, 179, 254, 10, 104], + "accounts": [ + { "name": "token_badge", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "rent_receiver", "writable": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "create_config", + "docs": ["OPERATOR FUNCTIONS /////"], + "discriminator": [201, 207, 243, 114, 75, 111, 47, 189], + "accounts": [ + { + "name": "config", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [99, 111, 110, 102, 105, 103] }, + { "kind": "arg", "path": "index" } + ] + } + }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "index", "type": "u64" }, + { "name": "config_parameters", "type": { "defined": { "name": "StaticConfigParameters" } } } + ] + }, + { + "name": "create_dynamic_config", + "discriminator": [81, 251, 122, 78, 66, 57, 208, 82], + "accounts": [ + { + "name": "config", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [99, 111, 110, 102, 105, 103] }, + { "kind": "arg", "path": "index" } + ] + } + }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "index", "type": "u64" }, + { "name": "config_parameters", "type": { "defined": { "name": "DynamicConfigParameters" } } } + ] + }, + { + "name": "create_operator_account", + "docs": ["ADMIN FUNCTIONS /////"], + "discriminator": [221, 64, 246, 149, 240, 153, 229, 163], + "accounts": [ + { + "name": "operator", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [111, 112, 101, 114, 97, 116, 111, 114] }, + { "kind": "account", "path": "whitelisted_address" } + ] + } + }, + { "name": "whitelisted_address" }, + { "name": "admin", "signer": true }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "permission", "type": "u128" }] + }, + { + "name": "create_position", + "discriminator": [48, 215, 197, 153, 96, 203, 180, 133], + "accounts": [ + { "name": "owner" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "pool", "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { + "name": "payer", + "docs": ["Address paying to create the position. Can be anyone"], + "writable": true, + "signer": true + }, + { + "name": "token_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "create_token_badge", + "discriminator": [88, 206, 0, 91, 60, 175, 151, 118], + "accounts": [ + { + "name": "token_badge", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 98, 97, 100, 103, 101] }, + { "kind": "account", "path": "token_mint" } + ] + } + }, + { "name": "token_mint" }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "dummy_ix", + "discriminator": [234, 95, 176, 185, 7, 42, 35, 159], + "accounts": [ + { "name": "pod_aligned_fee_time_scheduler" }, + { "name": "pod_aligned_fee_rate_limiter" }, + { "name": "pod_aligned_fee_market_cap_scheduler" } + ], + "args": [{ "name": "_ixs", "type": { "defined": { "name": "DummyParams" } } }] + }, + { + "name": "fund_reward", + "discriminator": [188, 50, 249, 165, 93, 151, 38, 63], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "reward_vault", "writable": true }, + { "name": "reward_mint" }, + { "name": "funder_token_account", "writable": true }, + { "name": "funder", "signer": true }, + { "name": "token_program" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "amount", "type": "u64" }, + { "name": "carry_forward", "type": "bool" } + ] + }, + { + "name": "initialize_customizable_pool", + "discriminator": [20, 161, 241, 24, 189, 221, 180, 2], + "accounts": [ + { "name": "creator" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { + "name": "payer", + "docs": ["Address paying to create the pool. Can be anyone"], + "writable": true, + "signer": true + }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Initialize an account to store the pool state"], "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "token_a_mint", "docs": ["Token a mint"] }, + { "name": "token_b_mint", "docs": ["Token b mint"] }, + { + "name": "token_a_vault", + "docs": ["Token a vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_a_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { + "name": "token_b_vault", + "docs": ["Token b vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_b_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { "name": "payer_token_a", "docs": ["payer token a account"], "writable": true }, + { "name": "payer_token_b", "docs": ["creator token b account"], "writable": true }, + { "name": "token_a_program", "docs": ["Program to create mint account and mint tokens"] }, + { "name": "token_b_program", "docs": ["Program to create mint account and mint tokens"] }, + { + "name": "token_2022_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "InitializeCustomizablePoolParameters" } } }] + }, + { + "name": "initialize_pool", + "docs": ["USER FUNCTIONS ////"], + "discriminator": [95, 180, 10, 172, 84, 174, 232, 40], + "accounts": [ + { "name": "creator" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { + "name": "payer", + "docs": ["Address paying to create the pool. Can be anyone"], + "writable": true, + "signer": true + }, + { "name": "config", "docs": ["Which config the pool belongs to."] }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Initialize an account to store the pool state"], "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "token_a_mint", "docs": ["Token a mint"] }, + { "name": "token_b_mint", "docs": ["Token b mint"] }, + { + "name": "token_a_vault", + "docs": ["Token a vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_a_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { + "name": "token_b_vault", + "docs": ["Token b vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_b_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { "name": "payer_token_a", "docs": ["payer token a account"], "writable": true }, + { "name": "payer_token_b", "docs": ["creator token b account"], "writable": true }, + { "name": "token_a_program", "docs": ["Program to create mint account and mint tokens"] }, + { "name": "token_b_program", "docs": ["Program to create mint account and mint tokens"] }, + { + "name": "token_2022_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "InitializePoolParameters" } } }] + }, + { + "name": "initialize_pool_with_dynamic_config", + "discriminator": [149, 82, 72, 197, 253, 252, 68, 15], + "accounts": [ + { "name": "creator" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { + "name": "payer", + "docs": ["Address paying to create the pool. Can be anyone"], + "writable": true, + "signer": true + }, + { "name": "pool_creator_authority", "signer": true, "relations": ["config"] }, + { "name": "config", "docs": ["Which config the pool belongs to."] }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Initialize an account to store the pool state"], "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "token_a_mint", "docs": ["Token a mint"] }, + { "name": "token_b_mint", "docs": ["Token b mint"] }, + { + "name": "token_a_vault", + "docs": ["Token a vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_a_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { + "name": "token_b_vault", + "docs": ["Token b vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_b_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { "name": "payer_token_a", "docs": ["payer token a account"], "writable": true }, + { "name": "payer_token_b", "docs": ["creator token b account"], "writable": true }, + { "name": "token_a_program", "docs": ["Program to create mint account and mint tokens"] }, + { "name": "token_b_program", "docs": ["Program to create mint account and mint tokens"] }, + { + "name": "token_2022_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "InitializeCustomizablePoolParameters" } } }] + }, + { + "name": "initialize_reward", + "discriminator": [95, 135, 192, 196, 242, 129, 230, 68], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { + "name": "reward_vault", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "pool" }, + { "kind": "arg", "path": "reward_index" } + ] + } + }, + { "name": "reward_mint" }, + { "name": "signer", "signer": true }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "token_program" }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "reward_duration", "type": "u64" }, + { "name": "funder", "type": "pubkey" } + ] + }, + { + "name": "lock_position", + "discriminator": [227, 62, 2, 252, 247, 10, 171, 185], + "accounts": [ + { "name": "pool", "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "vesting", "writable": true, "signer": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "VestingParameters" } } }] + }, + { + "name": "permanent_lock_position", + "discriminator": [165, 176, 125, 6, 231, 171, 186, 213], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "permanent_lock_liquidity", "type": "u128" }] + }, + { + "name": "refresh_vesting", + "discriminator": [9, 94, 216, 14, 116, 204, 247, 0], + "accounts": [ + { "name": "pool", "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner" } + ], + "args": [] + }, + { + "name": "remove_all_liquidity", + "discriminator": [10, 51, 61, 35, 112, 105, 24, 85], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "token_a_amount_threshold", "type": "u64" }, + { "name": "token_b_amount_threshold", "type": "u64" } + ] + }, + { + "name": "remove_liquidity", + "discriminator": [80, 85, 209, 72, 24, 206, 177, 108], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "RemoveLiquidityParameters" } } }] + }, + { + "name": "set_pool_status", + "discriminator": [112, 87, 135, 223, 83, 204, 132, 53], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "status", "type": "u8" }] + }, + { + "name": "split_position", + "discriminator": [172, 241, 221, 138, 161, 29, 253, 42], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["first_position", "second_position"] }, + { "name": "first_position", "docs": ["The first position"], "writable": true }, + { "name": "first_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "second_position", "docs": ["The second position"], "writable": true }, + { "name": "second_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "first_owner", "docs": ["Owner of first position"], "signer": true }, + { "name": "second_owner", "docs": ["Owner of second position"], "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "SplitPositionParameters" } } }] + }, + { + "name": "split_position2", + "discriminator": [221, 147, 228, 207, 140, 212, 17, 119], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["first_position", "second_position"] }, + { "name": "first_position", "docs": ["The first position"], "writable": true }, + { "name": "first_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "second_position", "docs": ["The second position"], "writable": true }, + { "name": "second_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "first_owner", "docs": ["Owner of first position"], "signer": true }, + { "name": "second_owner", "docs": ["Owner of second position"], "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "numerator", "type": "u32" }] + }, + { + "name": "swap", + "discriminator": [248, 198, 158, 145, 225, 117, 135, 200], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Pool account"], "writable": true }, + { "name": "input_token_account", "docs": ["The user token account for input token"], "writable": true }, + { + "name": "output_token_account", + "docs": ["The user token account for output token"], + "writable": true + }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"] }, + { "name": "payer", "docs": ["The user performing the swap"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "referral_token_account", + "docs": ["referral token account"], + "writable": true, + "optional": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "_params", "type": { "defined": { "name": "SwapParameters" } } }] + }, + { + "name": "swap2", + "discriminator": [65, 75, 63, 76, 235, 91, 91, 136], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Pool account"], "writable": true }, + { "name": "input_token_account", "docs": ["The user token account for input token"], "writable": true }, + { + "name": "output_token_account", + "docs": ["The user token account for output token"], + "writable": true + }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"] }, + { "name": "payer", "docs": ["The user performing the swap"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "referral_token_account", + "docs": ["referral token account"], + "writable": true, + "optional": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "_params", "type": { "defined": { "name": "SwapParameters2" } } }] + }, + { + "name": "update_pool_fees", + "discriminator": [118, 217, 203, 179, 60, 8, 70, 89], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "UpdatePoolFeesParameters" } } }] + }, + { + "name": "update_reward_duration", + "discriminator": [138, 174, 196, 169, 213, 235, 254, 107], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "signer", "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "new_duration", "type": "u64" } + ] + }, + { + "name": "update_reward_funder", + "discriminator": [211, 28, 48, 32, 215, 160, 35, 23], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "signer", "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "new_funder", "type": "pubkey" } + ] + }, + { + "name": "withdraw_ineligible_reward", + "discriminator": [148, 206, 42, 195, 247, 49, 103, 8], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { "name": "reward_vault", "writable": true }, + { "name": "reward_mint" }, + { "name": "funder_token_account", "writable": true }, + { "name": "funder", "signer": true }, + { "name": "token_program" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "reward_index", "type": "u8" }] + } + ], + "accounts": [ + { "name": "Config", "discriminator": [155, 12, 170, 224, 30, 250, 204, 130] }, + { "name": "Operator", "discriminator": [219, 31, 188, 145, 69, 139, 204, 117] }, + { "name": "PodAlignedFeeMarketCapScheduler", "discriminator": [251, 130, 208, 253, 245, 27, 145, 203] }, + { "name": "PodAlignedFeeRateLimiter", "discriminator": [160, 219, 8, 251, 179, 7, 16, 117] }, + { "name": "PodAlignedFeeTimeScheduler", "discriminator": [239, 132, 138, 213, 67, 154, 130, 70] }, + { "name": "Pool", "discriminator": [241, 154, 109, 4, 17, 177, 109, 188] }, + { "name": "Position", "discriminator": [170, 188, 143, 228, 122, 64, 247, 208] }, + { "name": "TokenBadge", "discriminator": [116, 219, 204, 229, 249, 116, 255, 150] }, + { "name": "Vesting", "discriminator": [100, 149, 66, 138, 95, 200, 128, 241] } + ], + "events": [ + { "name": "EvtClaimPartnerFee", "discriminator": [118, 99, 77, 10, 226, 1, 1, 87] }, + { "name": "EvtClaimPositionFee", "discriminator": [198, 182, 183, 52, 97, 12, 49, 56] }, + { "name": "EvtClaimProtocolFee", "discriminator": [186, 244, 75, 251, 188, 13, 25, 33] }, + { "name": "EvtClaimReward", "discriminator": [218, 86, 147, 200, 235, 188, 215, 231] }, + { "name": "EvtCloseConfig", "discriminator": [36, 30, 239, 45, 58, 132, 14, 5] }, + { "name": "EvtClosePosition", "discriminator": [20, 145, 144, 68, 143, 142, 214, 178] }, + { "name": "EvtCreateConfig", "discriminator": [131, 207, 180, 174, 180, 73, 165, 54] }, + { "name": "EvtCreateDynamicConfig", "discriminator": [231, 197, 13, 164, 248, 213, 133, 152] }, + { "name": "EvtCreatePosition", "discriminator": [156, 15, 119, 198, 29, 181, 221, 55] }, + { "name": "EvtCreateTokenBadge", "discriminator": [141, 120, 134, 116, 34, 28, 114, 160] }, + { "name": "EvtFundReward", "discriminator": [104, 233, 237, 122, 199, 191, 121, 85] }, + { "name": "EvtInitializePool", "discriminator": [228, 50, 246, 85, 203, 66, 134, 37] }, + { "name": "EvtInitializeReward", "discriminator": [129, 91, 188, 3, 246, 52, 185, 249] }, + { "name": "EvtLiquidityChange", "discriminator": [197, 171, 78, 127, 224, 211, 87, 13] }, + { "name": "EvtLockPosition", "discriminator": [168, 63, 108, 83, 219, 82, 2, 200] }, + { "name": "EvtPermanentLockPosition", "discriminator": [145, 143, 162, 218, 218, 80, 67, 11] }, + { "name": "EvtSetPoolStatus", "discriminator": [100, 213, 74, 3, 95, 91, 228, 146] }, + { "name": "EvtSplitPosition2", "discriminator": [165, 32, 203, 174, 72, 100, 233, 103] }, + { "name": "EvtSwap2", "discriminator": [189, 66, 51, 168, 38, 80, 117, 153] }, + { "name": "EvtUpdatePoolFees", "discriminator": [76, 165, 246, 102, 102, 217, 156, 44] }, + { "name": "EvtUpdateRewardDuration", "discriminator": [149, 135, 65, 231, 129, 153, 65, 57] }, + { "name": "EvtUpdateRewardFunder", "discriminator": [76, 154, 208, 13, 40, 115, 246, 146] }, + { "name": "EvtWithdrawIneligibleReward", "discriminator": [248, 215, 184, 78, 31, 180, 179, 168] } + ], + "errors": [ + { "code": 6000, "name": "MathOverflow", "msg": "Math operation overflow" }, + { "code": 6001, "name": "InvalidFee", "msg": "Invalid fee setup" }, + { "code": 6002, "name": "ExceededSlippage", "msg": "Exceeded slippage tolerance" }, + { "code": 6003, "name": "PoolDisabled", "msg": "Pool disabled" }, + { "code": 6004, "name": "ExceedMaxFeeBps", "msg": "Exceeded max fee bps" }, + { "code": 6005, "name": "InvalidAdmin", "msg": "Invalid admin" }, + { "code": 6006, "name": "AmountIsZero", "msg": "Amount is zero" }, + { "code": 6007, "name": "TypeCastFailed", "msg": "Type cast error" }, + { "code": 6008, "name": "UnableToModifyActivationPoint", "msg": "Unable to modify activation point" }, + { "code": 6009, "name": "InvalidAuthorityToCreateThePool", "msg": "Invalid authority to create the pool" }, + { "code": 6010, "name": "InvalidActivationType", "msg": "Invalid activation type" }, + { "code": 6011, "name": "InvalidActivationPoint", "msg": "Invalid activation point" }, + { "code": 6012, "name": "InvalidQuoteMint", "msg": "Quote token must be SOL,USDC" }, + { "code": 6013, "name": "InvalidFeeCurve", "msg": "Invalid fee curve" }, + { "code": 6014, "name": "InvalidPriceRange", "msg": "Invalid Price Range" }, + { "code": 6015, "name": "PriceRangeViolation", "msg": "Trade is over price range" }, + { "code": 6016, "name": "InvalidParameters", "msg": "Invalid parameters" }, + { "code": 6017, "name": "InvalidCollectFeeMode", "msg": "Invalid collect fee mode" }, + { "code": 6018, "name": "InvalidInput", "msg": "Invalid input" }, + { + "code": 6019, + "name": "CannotCreateTokenBadgeOnSupportedMint", + "msg": "Cannot create token badge on supported mint" + }, + { "code": 6020, "name": "InvalidTokenBadge", "msg": "Invalid token badge" }, + { "code": 6021, "name": "InvalidMinimumLiquidity", "msg": "Invalid minimum liquidity" }, + { "code": 6022, "name": "InvalidVestingInfo", "msg": "Invalid vesting information" }, + { "code": 6023, "name": "InsufficientLiquidity", "msg": "Insufficient liquidity" }, + { "code": 6024, "name": "InvalidVestingAccount", "msg": "Invalid vesting account" }, + { "code": 6025, "name": "InvalidPoolStatus", "msg": "Invalid pool status" }, + { "code": 6026, "name": "UnsupportNativeMintToken2022", "msg": "Unsupported native mint token2022" }, + { "code": 6027, "name": "InvalidRewardIndex", "msg": "Invalid reward index" }, + { "code": 6028, "name": "InvalidRewardDuration", "msg": "Invalid reward duration" }, + { "code": 6029, "name": "RewardInitialized", "msg": "Reward already initialized" }, + { "code": 6030, "name": "RewardUninitialized", "msg": "Reward not initialized" }, + { "code": 6031, "name": "InvalidRewardVault", "msg": "Invalid reward vault" }, + { "code": 6032, "name": "MustWithdrawnIneligibleReward", "msg": "Must withdraw ineligible reward" }, + { "code": 6033, "name": "IdenticalRewardDuration", "msg": "Reward duration is the same" }, + { "code": 6034, "name": "RewardCampaignInProgress", "msg": "Reward campaign in progress" }, + { "code": 6035, "name": "IdenticalFunder", "msg": "Identical funder" }, + { "code": 6036, "name": "InvalidFunder", "msg": "Invalid funder" }, + { "code": 6037, "name": "RewardNotEnded", "msg": "Reward not ended" }, + { "code": 6038, "name": "FeeInverseIsIncorrect", "msg": "Fee inverse is incorrect" }, + { "code": 6039, "name": "PositionIsNotEmpty", "msg": "Position is not empty" }, + { "code": 6040, "name": "InvalidPoolCreatorAuthority", "msg": "Invalid pool creator authority" }, + { "code": 6041, "name": "InvalidConfigType", "msg": "Invalid config type" }, + { "code": 6042, "name": "InvalidPoolCreator", "msg": "Invalid pool creator" }, + { + "code": 6043, + "name": "RewardVaultFrozenSkipRequired", + "msg": "Reward vault is frozen, must skip reward to proceed" + }, + { "code": 6044, "name": "InvalidSplitPositionParameters", "msg": "Invalid parameters for split position" }, + { + "code": 6045, + "name": "UnsupportPositionHasVestingLock", + "msg": "Unsupported split position has vesting lock" + }, + { "code": 6046, "name": "SamePosition", "msg": "Same position" }, + { "code": 6047, "name": "InvalidBaseFeeMode", "msg": "Invalid base fee mode" }, + { "code": 6048, "name": "InvalidFeeRateLimiter", "msg": "Invalid fee rate limiter" }, + { + "code": 6049, + "name": "FailToValidateSingleSwapInstruction", + "msg": "Fail to validate single swap instruction in rate limiter" + }, + { "code": 6050, "name": "InvalidFeeTimeScheduler", "msg": "Invalid fee scheduler" }, + { "code": 6051, "name": "UndeterminedError", "msg": "Undetermined error" }, + { "code": 6052, "name": "InvalidPoolVersion", "msg": "Invalid pool version" }, + { "code": 6053, "name": "InvalidAuthority", "msg": "Invalid authority to do that action" }, + { "code": 6054, "name": "InvalidPermission", "msg": "Invalid permission" }, + { "code": 6055, "name": "InvalidFeeMarketCapScheduler", "msg": "Invalid fee market cap scheduler" }, + { "code": 6056, "name": "CannotUpdateBaseFee", "msg": "Cannot update base fee" }, + { "code": 6057, "name": "InvalidDynamicFeeParameters", "msg": "Invalid dynamic fee parameters" }, + { "code": 6058, "name": "InvalidUpdatePoolFeesParameters", "msg": "Invalid update pool fees parameters" }, + { "code": 6059, "name": "MissingOperatorAccount", "msg": "Missing operator account" } + ], + "types": [ + { + "name": "AddLiquidityParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity_delta", "docs": ["delta liquidity"], "type": "u128" }, + { "name": "token_a_amount_threshold", "docs": ["maximum token a amount"], "type": "u64" }, + { "name": "token_b_amount_threshold", "docs": ["maximum token b amount"], "type": "u64" } + ] + } + }, + { + "name": "BaseFeeInfo", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { "kind": "struct", "fields": [{ "name": "data", "type": { "array": ["u8", 32] } }] } + }, + { + "name": "BaseFeeParameters", + "type": { "kind": "struct", "fields": [{ "name": "data", "type": { "array": ["u8", 30] } }] } + }, + { + "name": "BaseFeeStruct", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "base_fee_info", "type": { "defined": { "name": "BaseFeeInfo" } } }, + { "name": "padding_1", "type": "u64" } + ] + } + }, + { + "name": "BorshFeeMarketCapScheduler", + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "number_of_period", "type": "u16" }, + { "name": "sqrt_price_step_bps", "type": "u32" }, + { "name": "scheduler_expiration_duration", "type": "u32" }, + { "name": "reduction_factor", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 3] } } + ] + } + }, + { + "name": "BorshFeeRateLimiter", + "docs": [ + "we denote reference_amount = x0, cliff_fee_numerator = c, fee_increment = i", + "if input_amount <= x0, then fee = input_amount * c", + "", + "if input_amount > x0, then input_amount = x0 + (a * x0 + b)", + "if a < max_index", + "then fee = x0 * c + x0 * (c + i) + .... + x0 * (c + i*a) + b * (c + i * (a+1))", + "then fee = x0 * (c + c*a + i*a*(a+1)/2) + b * (c + i * (a+1))", + "", + "if a >= max_index", + "if a = max_index + d, input_amount = x0 + max_index * x0 + (d * x0 + b)", + "then fee = x0 * (c + c*max_index + i*max_index*(max_index+1)/2) + (d * x0 + b) * MAX_FEE" + ], + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "fee_increment_bps", "type": "u16" }, + { "name": "max_limiter_duration", "type": "u32" }, + { "name": "max_fee_bps", "type": "u32" }, + { "name": "reference_amount", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 3] } } + ] + } + }, + { + "name": "BorshFeeTimeScheduler", + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "number_of_period", "type": "u16" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "reduction_factor", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 3] } } + ] + } + }, + { + "name": "Config", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "vault_config_key", "docs": ["Vault config key"], "type": "pubkey" }, + { + "name": "pool_creator_authority", + "docs": [ + "Only pool_creator_authority can use the current config to initialize new pool. When it's Pubkey::default, it's a public config." + ], + "type": "pubkey" + }, + { "name": "pool_fees", "docs": ["Pool fee"], "type": { "defined": { "name": "PoolFeesConfig" } } }, + { "name": "activation_type", "docs": ["Activation type"], "type": "u8" }, + { "name": "collect_fee_mode", "docs": ["Collect fee mode"], "type": "u8" }, + { "name": "config_type", "docs": ["Config type mode, 0 for static, 1 for dynamic"], "type": "u8" }, + { "name": "_padding_0", "docs": ["padding 0"], "type": { "array": ["u8", 5] } }, + { "name": "index", "docs": ["config index"], "type": "u64" }, + { "name": "sqrt_min_price", "docs": ["sqrt min price"], "type": "u128" }, + { "name": "sqrt_max_price", "docs": ["sqrt max price"], "type": "u128" }, + { + "name": "_padding_1", + "docs": ["Fee curve point", "Padding for further use"], + "type": { "array": ["u64", 10] } + } + ] + } + }, + { + "name": "DummyParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "borsh_fee_time_scheduler_params", + "type": { "defined": { "name": "BorshFeeTimeScheduler" } } + }, + { + "name": "borsh_fee_rate_limiter_params", + "type": { "defined": { "name": "BorshFeeRateLimiter" } } + }, + { + "name": "borsh_fee_market_cap_scheduler_params", + "type": { "defined": { "name": "BorshFeeMarketCapScheduler" } } + } + ] + } + }, + { + "name": "DynamicConfigParameters", + "type": { "kind": "struct", "fields": [{ "name": "pool_creator_authority", "type": "pubkey" }] } + }, + { + "name": "DynamicFeeConfig", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "initialized", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 7] } }, + { "name": "max_volatility_accumulator", "type": "u32" }, + { "name": "variable_fee_control", "type": "u32" }, + { "name": "bin_step", "type": "u16" }, + { "name": "filter_period", "type": "u16" }, + { "name": "decay_period", "type": "u16" }, + { "name": "reduction_factor", "type": "u16" }, + { "name": "padding_1", "type": { "array": ["u8", 8] } }, + { "name": "bin_step_u128", "type": "u128" } + ] + } + }, + { + "name": "DynamicFeeParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "bin_step", "type": "u16" }, + { "name": "bin_step_u128", "type": "u128" }, + { "name": "filter_period", "type": "u16" }, + { "name": "decay_period", "type": "u16" }, + { "name": "reduction_factor", "type": "u16" }, + { "name": "max_volatility_accumulator", "type": "u32" }, + { "name": "variable_fee_control", "type": "u32" } + ] + } + }, + { + "name": "DynamicFeeStruct", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "initialized", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 7] } }, + { "name": "max_volatility_accumulator", "type": "u32" }, + { "name": "variable_fee_control", "type": "u32" }, + { "name": "bin_step", "type": "u16" }, + { "name": "filter_period", "type": "u16" }, + { "name": "decay_period", "type": "u16" }, + { "name": "reduction_factor", "type": "u16" }, + { "name": "last_update_timestamp", "type": "u64" }, + { "name": "bin_step_u128", "type": "u128" }, + { "name": "sqrt_price_reference", "type": "u128" }, + { "name": "volatility_accumulator", "type": "u128" }, + { "name": "volatility_reference", "type": "u128" } + ] + } + }, + { + "name": "EvtClaimPartnerFee", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" } + ] + } + }, + { + "name": "EvtClaimPositionFee", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "fee_a_claimed", "type": "u64" }, + { "name": "fee_b_claimed", "type": "u64" } + ] + } + }, + { + "name": "EvtClaimProtocolFee", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" } + ] + } + }, + { + "name": "EvtClaimReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "mint_reward", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "total_reward", "type": "u64" } + ] + } + }, + { + "name": "EvtCloseConfig", + "docs": ["Close config"], + "type": { + "kind": "struct", + "fields": [ + { "name": "config", "docs": ["Config pubkey"], "type": "pubkey" }, + { "name": "admin", "docs": ["admin pk"], "type": "pubkey" } + ] + } + }, + { + "name": "EvtClosePosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "position_nft_mint", "type": "pubkey" } + ] + } + }, + { + "name": "EvtCreateConfig", + "docs": ["Create static config"], + "type": { + "kind": "struct", + "fields": [ + { "name": "pool_fees", "type": { "defined": { "name": "PoolFeeParameters" } } }, + { "name": "vault_config_key", "type": "pubkey" }, + { "name": "pool_creator_authority", "type": "pubkey" }, + { "name": "activation_type", "type": "u8" }, + { "name": "sqrt_min_price", "type": "u128" }, + { "name": "sqrt_max_price", "type": "u128" }, + { "name": "collect_fee_mode", "type": "u8" }, + { "name": "index", "type": "u64" }, + { "name": "config", "type": "pubkey" } + ] + } + }, + { + "name": "EvtCreateDynamicConfig", + "docs": ["Create dynamic config"], + "type": { + "kind": "struct", + "fields": [ + { "name": "config", "type": "pubkey" }, + { "name": "pool_creator_authority", "type": "pubkey" }, + { "name": "index", "type": "u64" } + ] + } + }, + { + "name": "EvtCreatePosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "position_nft_mint", "type": "pubkey" } + ] + } + }, + { + "name": "EvtCreateTokenBadge", + "docs": ["Create token badge"], + "type": { "kind": "struct", "fields": [{ "name": "token_mint", "type": "pubkey" }] } + }, + { + "name": "EvtFundReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "funder", "type": "pubkey" }, + { "name": "mint_reward", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "amount", "type": "u64" }, + { "name": "transfer_fee_excluded_amount_in", "type": "u64" }, + { "name": "reward_duration_end", "type": "u64" }, + { "name": "pre_reward_rate", "type": "u128" }, + { "name": "post_reward_rate", "type": "u128" } + ] + } + }, + { + "name": "EvtInitializePool", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "token_a_mint", "type": "pubkey" }, + { "name": "token_b_mint", "type": "pubkey" }, + { "name": "creator", "type": "pubkey" }, + { "name": "payer", "type": "pubkey" }, + { "name": "alpha_vault", "type": "pubkey" }, + { "name": "pool_fees", "type": { "defined": { "name": "PoolFeeParameters" } } }, + { "name": "sqrt_min_price", "type": "u128" }, + { "name": "sqrt_max_price", "type": "u128" }, + { "name": "activation_type", "type": "u8" }, + { "name": "collect_fee_mode", "type": "u8" }, + { "name": "liquidity", "type": "u128" }, + { "name": "sqrt_price", "type": "u128" }, + { "name": "activation_point", "type": "u64" }, + { "name": "token_a_flag", "type": "u8" }, + { "name": "token_b_flag", "type": "u8" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" }, + { "name": "total_amount_a", "type": "u64" }, + { "name": "total_amount_b", "type": "u64" }, + { "name": "pool_type", "type": "u8" } + ] + } + }, + { + "name": "EvtInitializeReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_mint", "type": "pubkey" }, + { "name": "funder", "type": "pubkey" }, + { "name": "creator", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "reward_duration", "type": "u64" } + ] + } + }, + { + "name": "EvtLiquidityChange", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" }, + { "name": "transfer_fee_included_token_a_amount", "type": "u64" }, + { "name": "transfer_fee_included_token_b_amount", "type": "u64" }, + { "name": "reserve_a_amount", "type": "u64" }, + { "name": "reserve_b_amount", "type": "u64" }, + { "name": "liquidity_delta", "type": "u128" }, + { "name": "token_a_amount_threshold", "type": "u64" }, + { "name": "token_b_amount_threshold", "type": "u64" }, + { "name": "change_type", "type": "u8" } + ] + } + }, + { + "name": "EvtLockPosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "vesting", "type": "pubkey" }, + { "name": "cliff_point", "type": "u64" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "cliff_unlock_liquidity", "type": "u128" }, + { "name": "liquidity_per_period", "type": "u128" }, + { "name": "number_of_period", "type": "u16" } + ] + } + }, + { + "name": "EvtPermanentLockPosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "lock_liquidity_amount", "type": "u128" }, + { "name": "total_permanent_locked_liquidity", "type": "u128" } + ] + } + }, + { + "name": "EvtSetPoolStatus", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "status", "type": "u8" } + ] + } + }, + { + "name": "EvtSplitPosition2", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "first_owner", "type": "pubkey" }, + { "name": "second_owner", "type": "pubkey" }, + { "name": "first_position", "type": "pubkey" }, + { "name": "second_position", "type": "pubkey" }, + { "name": "current_sqrt_price", "type": "u128" }, + { "name": "amount_splits", "type": { "defined": { "name": "SplitAmountInfo" } } }, + { "name": "first_position_info", "type": { "defined": { "name": "SplitPositionInfo" } } }, + { "name": "second_position_info", "type": { "defined": { "name": "SplitPositionInfo" } } }, + { + "name": "split_position_parameters", + "type": { "defined": { "name": "SplitPositionParameters2" } } + } + ] + } + }, + { + "name": "EvtSwap2", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "trade_direction", "type": "u8" }, + { "name": "collect_fee_mode", "type": "u8" }, + { "name": "has_referral", "type": "bool" }, + { "name": "params", "type": { "defined": { "name": "SwapParameters2" } } }, + { "name": "swap_result", "type": { "defined": { "name": "SwapResult2" } } }, + { "name": "included_transfer_fee_amount_in", "type": "u64" }, + { "name": "included_transfer_fee_amount_out", "type": "u64" }, + { "name": "excluded_transfer_fee_amount_out", "type": "u64" }, + { "name": "current_timestamp", "type": "u64" }, + { "name": "reserve_a_amount", "type": "u64" }, + { "name": "reserve_b_amount", "type": "u64" } + ] + } + }, + { + "name": "EvtUpdatePoolFees", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "operator", "type": "pubkey" }, + { "name": "params", "type": { "defined": { "name": "UpdatePoolFeesParameters" } } } + ] + } + }, + { + "name": "EvtUpdateRewardDuration", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "old_reward_duration", "type": "u64" }, + { "name": "new_reward_duration", "type": "u64" } + ] + } + }, + { + "name": "EvtUpdateRewardFunder", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "old_funder", "type": "pubkey" }, + { "name": "new_funder", "type": "pubkey" } + ] + } + }, + { + "name": "EvtWithdrawIneligibleReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_mint", "type": "pubkey" }, + { "name": "amount", "type": "u64" } + ] + } + }, + { + "name": "InitializeCustomizablePoolParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_fees", + "docs": ["pool fees"], + "type": { "defined": { "name": "PoolFeeParameters" } } + }, + { "name": "sqrt_min_price", "docs": ["sqrt min price"], "type": "u128" }, + { "name": "sqrt_max_price", "docs": ["sqrt max price"], "type": "u128" }, + { "name": "has_alpha_vault", "docs": ["has alpha vault"], "type": "bool" }, + { "name": "liquidity", "docs": ["initialize liquidity"], "type": "u128" }, + { + "name": "sqrt_price", + "docs": [ + "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value. Market cap fee scheduler minimum price will be derived from this value" + ], + "type": "u128" + }, + { "name": "activation_type", "docs": ["activation type"], "type": "u8" }, + { "name": "collect_fee_mode", "docs": ["collect fee mode"], "type": "u8" }, + { "name": "activation_point", "docs": ["activation point"], "type": { "option": "u64" } } + ] + } + }, + { + "name": "InitializePoolParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity", "docs": ["initialize liquidity"], "type": "u128" }, + { + "name": "sqrt_price", + "docs": ["The init price of the pool as a sqrt(token_b/token_a) Q64.64 value"], + "type": "u128" + }, + { "name": "activation_point", "docs": ["activation point"], "type": { "option": "u64" } } + ] + } + }, + { + "name": "Operator", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "whitelisted_address", "type": "pubkey" }, + { "name": "permission", "type": "u128" }, + { "name": "padding", "type": { "array": ["u64", 2] } } + ] + } + }, + { + "name": "PodAlignedFeeMarketCapScheduler", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 5] } }, + { "name": "number_of_period", "type": "u16" }, + { "name": "sqrt_price_step_bps", "type": "u32" }, + { "name": "scheduler_expiration_duration", "type": "u32" }, + { "name": "reduction_factor", "type": "u64" } + ] + } + }, + { + "name": "PodAlignedFeeRateLimiter", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 5] } }, + { "name": "fee_increment_bps", "type": "u16" }, + { "name": "max_limiter_duration", "type": "u32" }, + { "name": "max_fee_bps", "type": "u32" }, + { "name": "reference_amount", "type": "u64" } + ] + } + }, + { + "name": "PodAlignedFeeTimeScheduler", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 5] } }, + { "name": "number_of_period", "type": "u16" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "reduction_factor", "type": "u64" } + ] + } + }, + { + "name": "Pool", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "pool_fees", "docs": ["Pool fee"], "type": { "defined": { "name": "PoolFeesStruct" } } }, + { "name": "token_a_mint", "docs": ["token a mint"], "type": "pubkey" }, + { "name": "token_b_mint", "docs": ["token b mint"], "type": "pubkey" }, + { "name": "token_a_vault", "docs": ["token a vault"], "type": "pubkey" }, + { "name": "token_b_vault", "docs": ["token b vault"], "type": "pubkey" }, + { + "name": "whitelisted_vault", + "docs": ["Whitelisted vault to be able to buy pool before activation_point"], + "type": "pubkey" + }, + { "name": "partner", "docs": ["partner"], "type": "pubkey" }, + { "name": "liquidity", "docs": ["liquidity share"], "type": "u128" }, + { + "name": "_padding", + "docs": ["padding, previous reserve amount, be careful to use that field"], + "type": "u128" + }, + { "name": "protocol_a_fee", "docs": ["protocol a fee"], "type": "u64" }, + { "name": "protocol_b_fee", "docs": ["protocol b fee"], "type": "u64" }, + { "name": "partner_a_fee", "docs": ["partner a fee"], "type": "u64" }, + { "name": "partner_b_fee", "docs": ["partner b fee"], "type": "u64" }, + { "name": "sqrt_min_price", "docs": ["min price"], "type": "u128" }, + { "name": "sqrt_max_price", "docs": ["max price"], "type": "u128" }, + { "name": "sqrt_price", "docs": ["current price"], "type": "u128" }, + { + "name": "activation_point", + "docs": ["Activation point, can be slot or timestamp"], + "type": "u64" + }, + { + "name": "activation_type", + "docs": ["Activation type, 0 means by slot, 1 means by timestamp"], + "type": "u8" + }, + { "name": "pool_status", "docs": ["pool status, 0: enable, 1 disable"], "type": "u8" }, + { "name": "token_a_flag", "docs": ["token a flag"], "type": "u8" }, + { "name": "token_b_flag", "docs": ["token b flag"], "type": "u8" }, + { + "name": "collect_fee_mode", + "docs": ["0 is collect fee in both token, 1 only collect fee only in token b"], + "type": "u8" + }, + { "name": "pool_type", "docs": ["pool type"], "type": "u8" }, + { + "name": "version", + "docs": ["pool version, 0: max_fee is still capped at 50%, 1: max_fee is capped at 99%"], + "type": "u8" + }, + { "name": "_padding_0", "docs": ["padding"], "type": "u8" }, + { "name": "fee_a_per_liquidity", "docs": ["cumulative"], "type": { "array": ["u8", 32] } }, + { "name": "fee_b_per_liquidity", "docs": ["cumulative"], "type": { "array": ["u8", 32] } }, + { "name": "permanent_lock_liquidity", "type": "u128" }, + { "name": "metrics", "docs": ["metrics"], "type": { "defined": { "name": "PoolMetrics" } } }, + { "name": "creator", "docs": ["pool creator"], "type": "pubkey" }, + { "name": "_padding_1", "docs": ["Padding for further use"], "type": { "array": ["u64", 6] } }, + { + "name": "reward_infos", + "docs": ["Farming reward information"], + "type": { "array": [{ "defined": { "name": "RewardInfo" } }, 2] } + } + ] + } + }, + { + "name": "PoolFeeParameters", + "docs": ["Information regarding fee charges"], + "type": { + "kind": "struct", + "fields": [ + { + "name": "base_fee", + "docs": ["Base fee"], + "type": { "defined": { "name": "BaseFeeParameters" } } + }, + { + "name": "dynamic_fee", + "docs": ["dynamic fee"], + "type": { "option": { "defined": { "name": "DynamicFeeParameters" } } } + } + ] + } + }, + { + "name": "PoolFeesConfig", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "base_fee", "type": { "defined": { "name": "BaseFeeInfo" } } }, + { "name": "dynamic_fee", "type": { "defined": { "name": "DynamicFeeConfig" } } }, + { "name": "protocol_fee_percent", "type": "u8" }, + { "name": "partner_fee_percent", "type": "u8" }, + { "name": "referral_fee_percent", "type": "u8" }, + { "name": "padding_0", "type": { "array": ["u8", 5] } }, + { "name": "padding_1", "type": { "array": ["u64", 5] } } + ] + } + }, + { + "name": "PoolFeesStruct", + "docs": [ + "Information regarding fee charges", + "trading_fee = amount * trade_fee_numerator / denominator", + "protocol_fee = trading_fee * protocol_fee_percentage / 100", + "referral_fee = protocol_fee * referral_percentage / 100", + "partner_fee = (protocol_fee - referral_fee) * partner_fee_percentage / denominator" + ], + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "base_fee", + "docs": [ + "Trade fees are extra token amounts that are held inside the token", + "accounts during a trade, making the value of liquidity tokens rise.", + "Trade fee numerator" + ], + "type": { "defined": { "name": "BaseFeeStruct" } } + }, + { + "name": "protocol_fee_percent", + "docs": [ + "Protocol trading fees are extra token amounts that are held inside the token", + "accounts during a trade, with the equivalent in pool tokens minted to", + "the protocol of the program.", + "Protocol trade fee numerator" + ], + "type": "u8" + }, + { "name": "partner_fee_percent", "docs": ["partner fee"], "type": "u8" }, + { "name": "referral_fee_percent", "docs": ["referral fee"], "type": "u8" }, + { "name": "padding_0", "docs": ["padding"], "type": { "array": ["u8", 5] } }, + { + "name": "dynamic_fee", + "docs": ["dynamic fee"], + "type": { "defined": { "name": "DynamicFeeStruct" } } + }, + { "name": "init_sqrt_price", "type": "u128" } + ] + } + }, + { + "name": "PoolMetrics", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "total_lp_a_fee", "type": "u128" }, + { "name": "total_lp_b_fee", "type": "u128" }, + { "name": "total_protocol_a_fee", "type": "u64" }, + { "name": "total_protocol_b_fee", "type": "u64" }, + { "name": "total_partner_a_fee", "type": "u64" }, + { "name": "total_partner_b_fee", "type": "u64" }, + { "name": "total_position", "type": "u64" }, + { "name": "padding", "type": "u64" } + ] + } + }, + { + "name": "Position", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "nft_mint", "docs": ["nft mint"], "type": "pubkey" }, + { + "name": "fee_a_per_token_checkpoint", + "docs": ["fee a checkpoint"], + "type": { "array": ["u8", 32] } + }, + { + "name": "fee_b_per_token_checkpoint", + "docs": ["fee b checkpoint"], + "type": { "array": ["u8", 32] } + }, + { "name": "fee_a_pending", "docs": ["fee a pending"], "type": "u64" }, + { "name": "fee_b_pending", "docs": ["fee b pending"], "type": "u64" }, + { "name": "unlocked_liquidity", "docs": ["unlock liquidity"], "type": "u128" }, + { "name": "vested_liquidity", "docs": ["vesting liquidity"], "type": "u128" }, + { "name": "permanent_locked_liquidity", "docs": ["permanent locked liquidity"], "type": "u128" }, + { "name": "metrics", "docs": ["metrics"], "type": { "defined": { "name": "PositionMetrics" } } }, + { + "name": "reward_infos", + "docs": ["Farming reward information"], + "type": { "array": [{ "defined": { "name": "UserRewardInfo" } }, 2] } + }, + { "name": "padding", "docs": ["padding for future usage"], "type": { "array": ["u128", 6] } } + ] + } + }, + { + "name": "PositionMetrics", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "total_claimed_a_fee", "type": "u64" }, + { "name": "total_claimed_b_fee", "type": "u64" } + ] + } + }, + { + "name": "RemoveLiquidityParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity_delta", "docs": ["delta liquidity"], "type": "u128" }, + { "name": "token_a_amount_threshold", "docs": ["minimum token a amount"], "type": "u64" }, + { "name": "token_b_amount_threshold", "docs": ["minimum token b amount"], "type": "u64" } + ] + } + }, + { + "name": "RewardInfo", + "docs": ["Stores the state relevant for tracking liquidity mining rewards"], + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "initialized", "docs": ["Indicates if the reward has been initialized"], "type": "u8" }, + { "name": "reward_token_flag", "docs": ["reward token flag"], "type": "u8" }, + { "name": "_padding_0", "docs": ["padding"], "type": { "array": ["u8", 6] } }, + { + "name": "_padding_1", + "docs": ["Padding to ensure `reward_rate: u128` is 16-byte aligned"], + "type": { "array": ["u8", 8] } + }, + { "name": "mint", "docs": ["Reward token mint."], "type": "pubkey" }, + { "name": "vault", "docs": ["Reward vault token account."], "type": "pubkey" }, + { "name": "funder", "docs": ["Authority account that allows to fund rewards"], "type": "pubkey" }, + { "name": "reward_duration", "docs": ["reward duration"], "type": "u64" }, + { "name": "reward_duration_end", "docs": ["reward duration end"], "type": "u64" }, + { "name": "reward_rate", "docs": ["reward rate"], "type": "u128" }, + { + "name": "reward_per_token_stored", + "docs": ["Reward per token stored"], + "type": { "array": ["u8", 32] } + }, + { + "name": "last_update_time", + "docs": ["The last time reward states were updated."], + "type": "u64" + }, + { + "name": "cumulative_seconds_with_empty_liquidity_reward", + "docs": [ + "Accumulated seconds when the farm distributed rewards but the bin was empty.", + "These rewards will be carried over to the next reward time window." + ], + "type": "u64" + } + ] + } + }, + { + "name": "SplitAmountInfo", + "type": { + "kind": "struct", + "fields": [ + { "name": "permanent_locked_liquidity", "type": "u128" }, + { "name": "unlocked_liquidity", "type": "u128" }, + { "name": "fee_a", "type": "u64" }, + { "name": "fee_b", "type": "u64" }, + { "name": "reward_0", "type": "u64" }, + { "name": "reward_1", "type": "u64" } + ] + } + }, + { + "name": "SplitPositionInfo", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity", "type": "u128" }, + { "name": "fee_a", "type": "u64" }, + { "name": "fee_b", "type": "u64" }, + { "name": "reward_0", "type": "u64" }, + { "name": "reward_1", "type": "u64" } + ] + } + }, + { + "name": "SplitPositionParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "unlocked_liquidity_percentage", + "docs": ["Percentage of unlocked liquidity to split to the second position"], + "type": "u8" + }, + { + "name": "permanent_locked_liquidity_percentage", + "docs": ["Percentage of permanent locked liquidity to split to the second position"], + "type": "u8" + }, + { + "name": "fee_a_percentage", + "docs": ["Percentage of fee A pending to split to the second position"], + "type": "u8" + }, + { + "name": "fee_b_percentage", + "docs": ["Percentage of fee B pending to split to the second position"], + "type": "u8" + }, + { + "name": "reward_0_percentage", + "docs": ["Percentage of reward 0 pending to split to the second position"], + "type": "u8" + }, + { + "name": "reward_1_percentage", + "docs": ["Percentage of reward 1 pending to split to the second position"], + "type": "u8" + }, + { "name": "padding", "docs": ["padding for future"], "type": { "array": ["u8", 16] } } + ] + } + }, + { + "name": "SplitPositionParameters2", + "type": { + "kind": "struct", + "fields": [ + { "name": "unlocked_liquidity_numerator", "type": "u32" }, + { "name": "permanent_locked_liquidity_numerator", "type": "u32" }, + { "name": "fee_a_numerator", "type": "u32" }, + { "name": "fee_b_numerator", "type": "u32" }, + { "name": "reward_0_numerator", "type": "u32" }, + { "name": "reward_1_numerator", "type": "u32" } + ] + } + }, + { + "name": "StaticConfigParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool_fees", "type": { "defined": { "name": "PoolFeeParameters" } } }, + { "name": "sqrt_min_price", "type": "u128" }, + { "name": "sqrt_max_price", "type": "u128" }, + { "name": "vault_config_key", "type": "pubkey" }, + { "name": "pool_creator_authority", "type": "pubkey" }, + { "name": "activation_type", "type": "u8" }, + { "name": "collect_fee_mode", "type": "u8" } + ] + } + }, + { + "name": "SwapParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "amount_in", "type": "u64" }, + { "name": "minimum_amount_out", "type": "u64" } + ] + } + }, + { + "name": "SwapParameters2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_0", + "docs": [ + "When it's exact in, partial fill, this will be amount_in. When it's exact out, this will be amount_out" + ], + "type": "u64" + }, + { + "name": "amount_1", + "docs": [ + "When it's exact in, partial fill, this will be minimum_amount_out. When it's exact out, this will be maximum_amount_in" + ], + "type": "u64" + }, + { "name": "swap_mode", "docs": ["Swap mode, refer [SwapMode]"], "type": "u8" } + ] + } + }, + { + "name": "SwapResult2", + "type": { + "kind": "struct", + "fields": [ + { "name": "included_fee_input_amount", "type": "u64" }, + { "name": "excluded_fee_input_amount", "type": "u64" }, + { "name": "amount_left", "type": "u64" }, + { "name": "output_amount", "type": "u64" }, + { "name": "next_sqrt_price", "type": "u128" }, + { "name": "trading_fee", "type": "u64" }, + { "name": "protocol_fee", "type": "u64" }, + { "name": "partner_fee", "type": "u64" }, + { "name": "referral_fee", "type": "u64" } + ] + } + }, + { + "name": "TokenBadge", + "docs": ["Parameter that set by the protocol"], + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "token_mint", "docs": ["token mint"], "type": "pubkey" }, + { "name": "_padding", "docs": ["Reserve"], "type": { "array": ["u8", 128] } } + ] + } + }, + { + "name": "UpdatePoolFeesParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliff_fee_numerator", + "docs": [ + "Base fee update mode:", + "- None: skip base fee update", + "- Some: update new cliff_fee_numerator if base fee is static" + ], + "type": { "option": "u64" } + }, + { + "name": "dynamic_fee", + "docs": [ + "Dynamic fee update mode:", + "- None: skip dynamic fee update", + "- Some(with default value): disable dynamic fee", + "- Some(with non default value): enable dynamic fee if disabled or update dynamic fee if enabled" + ], + "type": { "option": { "defined": { "name": "DynamicFeeParameters" } } } + } + ] + } + }, + { + "name": "UserRewardInfo", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "reward_per_token_checkpoint", + "docs": ["The latest update reward checkpoint"], + "type": { "array": ["u8", 32] } + }, + { "name": "reward_pendings", "docs": ["Current pending rewards"], "type": "u64" }, + { "name": "total_claimed_rewards", "docs": ["Total claimed rewards"], "type": "u64" } + ] + } + }, + { + "name": "Vesting", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "position", "type": "pubkey" }, + { "name": "cliff_point", "type": "u64" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "cliff_unlock_liquidity", "type": "u128" }, + { "name": "liquidity_per_period", "type": "u128" }, + { "name": "total_released_liquidity", "type": "u128" }, + { "name": "number_of_period", "type": "u16" }, + { "name": "padding", "type": { "array": ["u8", 14] } }, + { "name": "padding2", "type": { "array": ["u128", 4] } } + ] + } + }, + { + "name": "VestingParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_point", "type": { "option": "u64" } }, + { "name": "period_frequency", "type": "u64" }, + { "name": "cliff_unlock_liquidity", "type": "u128" }, + { "name": "liquidity_per_period", "type": "u128" }, + { "name": "number_of_period", "type": "u16" } + ] + } + } + ], + "constants": [ + { "name": "BIN_STEP_BPS_DEFAULT", "type": "u16", "value": "1" }, + { + "name": "BIN_STEP_U128_DEFAULT_LE_BYTES", + "type": { "array": ["u8", 16] }, + "value": "[203, 16, 199, 186, 184, 141, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { "name": "CUSTOMIZABLE_POOL_PREFIX", "type": "bytes", "value": "[99, 112, 111, 111, 108]" }, + { + "name": "FEE_DENOMINATOR", + "docs": [ + "Default fee denominator. DO NOT simply update it as it will break logic that depends on it as default value." + ], + "type": "u64", + "value": "1000000000" + }, + { "name": "MAX_BASIS_POINT", "docs": ["Max basis point. 100% in pct"], "type": "u64", "value": "10000" }, + { + "name": "MAX_SQRT_PRICE_LE_BYTES", + "type": { "array": ["u8", 16] }, + "value": "[155, 87, 105, 78, 169, 26, 92, 132, 177, 196, 254, 255, 0, 0, 0, 0]" + }, + { + "name": "MIN_SQRT_PRICE_LE_BYTES", + "type": { "array": ["u8", 16] }, + "value": "[80, 59, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { + "name": "POOL_AUTHORITY_PREFIX", + "type": "bytes", + "value": "[112, 111, 111, 108, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]" + }, + { "name": "POOL_PREFIX", "type": "bytes", "value": "[112, 111, 111, 108]" }, + { + "name": "POSITION_NFT_ACCOUNT_PREFIX", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, 110, 116]" + }, + { "name": "POSITION_PREFIX", "type": "bytes", "value": "[112, 111, 115, 105, 116, 105, 111, 110]" }, + { "name": "SPLIT_POSITION_DENOMINATOR", "type": "u32", "value": "1000000000" }, + { + "name": "TOKEN_VAULT_PREFIX", + "type": "bytes", + "value": "[116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116]" + } + ] +} diff --git a/idl/bitquery/pumpfun/pump.json b/idl/bitquery/pumpfun/pump.json new file mode 100644 index 0000000..2af9f4c --- /dev/null +++ b/idl/bitquery/pumpfun/pump.json @@ -0,0 +1,3564 @@ +{ + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", + "metadata": { + "name": "pump", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "admin_set_creator", + "docs": ["Allows Global::admin_set_creator_authority to override the bonding curve creator"], + "discriminator": [69, 25, 171, 142, 57, 239, 13, 4], + "accounts": [ + { + "name": "admin_set_creator_authority", + "signer": true, + "relations": ["global"] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "creator", + "type": "pubkey" + } + ] + }, + { + "name": "admin_set_idl_authority", + "discriminator": [8, 217, 96, 231, 144, 104, 192, 5], + "accounts": [ + { + "name": "authority", + "signer": true, + "relations": ["global"] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "idl_account", + "writable": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "program_signer", + "pda": { + "seeds": [] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "idl_authority", + "type": "pubkey" + } + ] + }, + { + "name": "admin_update_token_incentives", + "discriminator": [209, 11, 115, 87, 213, 23, 124, 204], + "accounts": [ + { + "name": "authority", + "writable": true, + "signer": true, + "relations": ["global"] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "day_number", + "type": "u64" + }, + { + "name": "pump_token_supply_per_day", + "type": "u64" + } + ] + }, + { + "name": "buy", + "docs": ["Buys tokens from a bonding curve."], + "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "associated_user", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "bonding_curve.creator", + "account": "BondingCurve" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] + }, + { + "kind": "const", + "value": [ + 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, + 203, 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "max_sol_cost", + "type": "u64" + } + ] + }, + { + "name": "buy_exact_sol_in", + "docs": [ + "Given a budget of spendable SOL, buy at least min_tokens_out", + "Account creation and fees will be deducted from the spendable SOL", + "", + "f(sol) = tokens, where tokens >= min_tokens_out and sol > rent + fees", + "", + "max_slippage = min_tokens_out = 1", + "", + "Make sure the sol budget is enough to cover creation of the following accounts (unless already created):", + "- creator_vault: rent.minimum_balance(SystemAccount::LEN)", + "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)" + ], + "discriminator": [56, 252, 116, 8, 158, 223, 205, 95], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "associated_user", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "bonding_curve.creator", + "account": "BondingCurve" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] + }, + { + "kind": "const", + "value": [ + 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, + 203, 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "spendable_sol_in", + "type": "u64" + }, + { + "name": "min_tokens_out", + "type": "u64" + } + ] + }, + { + "name": "claim_token_incentives", + "discriminator": [16, 4, 71, 28, 204, 1, 40, 27], + "accounts": [ + { + "name": "user" + }, + { + "name": "user_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "mint", + "relations": ["global_volume_accumulator"] + }, + { + "name": "token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "payer", + "writable": true, + "signer": true + } + ], + "args": [] + }, + { + "name": "close_user_volume_accumulator", + "discriminator": [249, 69, 164, 218, 150, 103, 84, 138], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_creator_fee", + "docs": ["Collects creator_fee from creator_vault to the coin creator account"], + "discriminator": [20, 22, 86, 123, 198, 28, 219, 132], + "accounts": [ + { + "name": "creator", + "writable": true + }, + { + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "creator" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "create", + "docs": ["Creates a new coin and bonding curve."], + "discriminator": [24, 30, 200, 40, 5, 28, 7, 119], + "accounts": [ + { + "name": "mint", + "writable": true, + "signer": true + }, + { + "name": "mint_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 105, 110, 116, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121] + } + ] + } + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "const", + "value": [ + 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, + 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "mpl_token_metadata", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 101, 116, 97, 100, 97, 116, 97] + }, + { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, + 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "account", + "path": "mpl_token_metadata" + } + } + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + }, + { + "name": "create_v2", + "docs": ["Creates a new spl-22 coin and bonding curve."], + "discriminator": [214, 144, 76, 236, 95, 139, 49, 180], + "accounts": [ + { + "name": "mint", + "writable": true, + "signer": true + }, + { + "name": "mint_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 105, 110, 116, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121] + } + ] + } + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "mayhem_program_id", + "writable": true, + "address": "MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e" + }, + { + "name": "global_params", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108, 45, 112, 97, 114, 97, 109, 115] + } + ], + "program": { + "kind": "const", + "value": [ + 5, 42, 229, 215, 167, 218, 167, 36, 166, 234, 176, 167, 41, 84, 145, 133, 90, 212, 160, + 103, 22, 96, 103, 76, 78, 3, 69, 89, 128, 61, 101, 163 + ] + } + } + }, + { + "name": "sol_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [115, 111, 108, 45, 118, 97, 117, 108, 116] + } + ], + "program": { + "kind": "const", + "value": [ + 5, 42, 229, 215, 167, 218, 167, 36, 166, 234, 176, 167, 41, 84, 145, 133, 90, 212, 160, + 103, 22, 96, 103, 76, 78, 3, 69, 89, 128, 61, 101, 163 + ] + } + } + }, + { + "name": "mayhem_state", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 97, 121, 104, 101, 109, 45, 115, 116, 97, 116, 101] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 5, 42, 229, 215, 167, 218, 167, 36, 166, 234, 176, 167, 41, 84, 145, 133, 90, 212, 160, + 103, 22, 96, 103, 76, 78, 3, 69, 89, 128, 61, 101, 163 + ] + } + } + }, + { + "name": "mayhem_token_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "sol_vault" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + }, + { + "name": "extend_account", + "docs": ["Extends the size of program-owned accounts"], + "discriminator": [234, 102, 194, 203, 150, 72, 62, 229], + "accounts": [ + { + "name": "account", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "init_user_volume_accumulator", + "discriminator": [94, 6, 202, 115, 255, 96, 232, 183], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "user" + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize", + "docs": ["Creates the global state."], + "discriminator": [175, 175, 109, 31, 13, 152, 155, 237], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "migrate", + "docs": ["Migrates liquidity to pump_amm if the bonding curve is complete"], + "discriminator": [155, 234, 231, 146, 236, 158, 162, 30], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "withdraw_authority", + "writable": true, + "relations": ["global"] + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "pump_amm", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "pool", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [112, 111, 111, 108] + }, + { + "kind": "const", + "value": [0, 0] + }, + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "wsol_mint" + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "pool_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [112, 111, 111, 108, 45, 97, 117, 116, 104, 111, 114, 105, 116, 121] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "pool_authority_mint_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_authority_wsol_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "wsol_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "amm_global_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103] + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "wsol_mint", + "address": "So11111111111111111111111111111111111111112" + }, + { + "name": "lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [112, 111, 111, 108, 95, 108, 112, 95, 109, 105, 110, 116] + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "user_pool_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool_authority" + }, + { + "kind": "account", + "path": "token_2022_program" + }, + { + "kind": "account", + "path": "lp_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_base_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "pool_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "wsol_mint" + } + ], + "program": { + "kind": "account", + "path": "associated_token_program" + } + } + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "pump_amm_event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ], + "program": { + "kind": "account", + "path": "pump_amm" + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "sell", + "docs": ["Sells tokens into a bonding curve."], + "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], + "accounts": [ + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "fee_recipient", + "writable": true + }, + { + "name": "mint" + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "associated_bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bonding_curve" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "associated_user", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "creator_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 45, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "bonding_curve.creator", + "account": "BondingCurve" + } + ] + } + }, + { + "name": "token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] + }, + { + "kind": "const", + "value": [ + 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, + 203, 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "min_sol_output", + "type": "u64" + } + ] + }, + { + "name": "set_creator", + "docs": [ + "Allows Global::set_creator_authority to set the bonding curve creator from Metaplex metadata or input argument" + ], + "discriminator": [254, 148, 255, 112, 207, 142, 170, 165], + "accounts": [ + { + "name": "set_creator_authority", + "signer": true, + "relations": ["global"] + }, + { + "name": "global", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "metadata", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 101, 116, 97, 100, 97, 116, 97] + }, + { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, + 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, + 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + } + } + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "creator", + "type": "pubkey" + } + ] + }, + { + "name": "set_metaplex_creator", + "docs": ["Syncs the bonding curve creator with the Metaplex metadata creator if it exists"], + "discriminator": [138, 96, 174, 217, 48, 85, 197, 246], + "accounts": [ + { + "name": "mint" + }, + { + "name": "metadata", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 101, 116, 97, 100, 97, 116, 97] + }, + { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, + 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, + 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + } + } + }, + { + "name": "bonding_curve", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_params", + "docs": ["Sets the global state parameters."], + "discriminator": [27, 234, 178, 52, 147, 2, 187, 141], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": ["global"] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "initial_virtual_token_reserves", + "type": "u64" + }, + { + "name": "initial_virtual_sol_reserves", + "type": "u64" + }, + { + "name": "initial_real_token_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "withdraw_authority", + "type": "pubkey" + }, + { + "name": "enable_migrate", + "type": "bool" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "set_creator_authority", + "type": "pubkey" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + } + ] + }, + { + "name": "set_reserved_fee_recipient", + "discriminator": [207, 189, 178, 71, 167, 122, 68, 180], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": ["global"] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "whitelist_pda", + "type": "pubkey" + } + ] + }, + { + "name": "sync_user_volume_accumulator", + "discriminator": [86, 31, 192, 87, 163, 87, 79, 238], + "accounts": [ + { + "name": "user" + }, + { + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "toggle_create_v2", + "discriminator": [28, 255, 230, 240, 172, 107, 203, 171], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": ["global"] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "toggle_mayhem_mode", + "discriminator": [1, 9, 111, 208, 100, 31, 255, 163], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "authority", + "writable": true, + "signer": true, + "relations": ["global"] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "update_global_authority", + "discriminator": [227, 181, 74, 196, 208, 21, 97, 213], + "accounts": [ + { + "name": "global", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108] + } + ] + } + }, + { + "name": "authority", + "signer": true, + "relations": ["global"] + }, + { + "name": "new_authority" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "BondingCurve", + "discriminator": [23, 183, 248, 55, 96, 216, 172, 96] + }, + { + "name": "FeeConfig", + "discriminator": [143, 52, 146, 187, 219, 123, 76, 155] + }, + { + "name": "Global", + "discriminator": [167, 232, 232, 177, 200, 108, 114, 127] + }, + { + "name": "GlobalVolumeAccumulator", + "discriminator": [202, 42, 246, 43, 142, 190, 30, 255] + }, + { + "name": "UserVolumeAccumulator", + "discriminator": [86, 255, 112, 14, 102, 53, 154, 250] + } + ], + "events": [ + { + "name": "AdminSetCreatorEvent", + "discriminator": [64, 69, 192, 104, 29, 30, 25, 107] + }, + { + "name": "AdminSetIdlAuthorityEvent", + "discriminator": [245, 59, 70, 34, 75, 185, 109, 92] + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "discriminator": [147, 250, 108, 120, 247, 29, 67, 222] + }, + { + "name": "ClaimTokenIncentivesEvent", + "discriminator": [79, 172, 246, 49, 205, 91, 206, 232] + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "discriminator": [146, 159, 189, 172, 146, 88, 56, 244] + }, + { + "name": "CollectCreatorFeeEvent", + "discriminator": [122, 2, 127, 1, 14, 191, 12, 175] + }, + { + "name": "CompleteEvent", + "discriminator": [95, 114, 97, 156, 212, 46, 152, 8] + }, + { + "name": "CompletePumpAmmMigrationEvent", + "discriminator": [189, 233, 93, 185, 92, 148, 234, 148] + }, + { + "name": "CreateEvent", + "discriminator": [27, 114, 169, 77, 222, 235, 99, 118] + }, + { + "name": "ExtendAccountEvent", + "discriminator": [97, 97, 215, 144, 93, 146, 22, 124] + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "discriminator": [134, 36, 13, 72, 232, 101, 130, 216] + }, + { + "name": "SetCreatorEvent", + "discriminator": [237, 52, 123, 37, 245, 251, 72, 210] + }, + { + "name": "SetMetaplexCreatorEvent", + "discriminator": [142, 203, 6, 32, 127, 105, 191, 162] + }, + { + "name": "SetParamsEvent", + "discriminator": [223, 195, 159, 246, 62, 48, 143, 131] + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "discriminator": [197, 122, 167, 124, 116, 81, 91, 255] + }, + { + "name": "TradeEvent", + "discriminator": [189, 219, 127, 211, 78, 230, 97, 238] + }, + { + "name": "UpdateGlobalAuthorityEvent", + "discriminator": [182, 195, 137, 42, 35, 206, 207, 247] + } + ], + "errors": [ + { + "code": 6000, + "name": "NotAuthorized", + "msg": "The given account is not authorized to execute this instruction." + }, + { + "code": 6001, + "name": "AlreadyInitialized", + "msg": "The program is already initialized." + }, + { + "code": 6002, + "name": "TooMuchSolRequired", + "msg": "slippage: Too much SOL required to buy the given amount of tokens." + }, + { + "code": 6003, + "name": "TooLittleSolReceived", + "msg": "slippage: Too little SOL received to sell the given amount of tokens." + }, + { + "code": 6004, + "name": "MintDoesNotMatchBondingCurve", + "msg": "The mint does not match the bonding curve." + }, + { + "code": 6005, + "name": "BondingCurveComplete", + "msg": "The bonding curve has completed and liquidity migrated to raydium." + }, + { + "code": 6006, + "name": "BondingCurveNotComplete", + "msg": "The bonding curve has not completed." + }, + { + "code": 6007, + "name": "NotInitialized", + "msg": "The program is not initialized." + }, + { + "code": 6008, + "name": "WithdrawTooFrequent", + "msg": "Withdraw too frequent" + }, + { + "code": 6009, + "name": "NewSizeShouldBeGreaterThanCurrentSize", + "msg": "new_size should be > current_size" + }, + { + "code": 6010, + "name": "AccountTypeNotSupported", + "msg": "Account type not supported" + }, + { + "code": 6011, + "name": "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply", + "msg": "initial_real_token_reserves should be less than token_total_supply" + }, + { + "code": 6012, + "name": "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves", + "msg": "initial_virtual_token_reserves should be greater than initial_real_token_reserves" + }, + { + "code": 6013, + "name": "FeeBasisPointsGreaterThanMaximum", + "msg": "fee_basis_points greater than maximum" + }, + { + "code": 6014, + "name": "AllZerosWithdrawAuthority", + "msg": "Withdraw authority cannot be set to System Program ID" + }, + { + "code": 6015, + "name": "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves", + "msg": "pool_migration_fee should be less than final_real_sol_reserves" + }, + { + "code": 6016, + "name": "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees", + "msg": "pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES" + }, + { + "code": 6017, + "name": "DisabledWithdraw", + "msg": "Migrate instruction is disabled" + }, + { + "code": 6018, + "name": "DisabledMigrate", + "msg": "Migrate instruction is disabled" + }, + { + "code": 6019, + "name": "InvalidCreator", + "msg": "Invalid creator pubkey" + }, + { + "code": 6020, + "name": "BuyZeroAmount", + "msg": "Buy zero amount" + }, + { + "code": 6021, + "name": "NotEnoughTokensToBuy", + "msg": "Not enough tokens to buy" + }, + { + "code": 6022, + "name": "SellZeroAmount", + "msg": "Sell zero amount" + }, + { + "code": 6023, + "name": "NotEnoughTokensToSell", + "msg": "Not enough tokens to sell" + }, + { + "code": 6024, + "name": "Overflow", + "msg": "Overflow" + }, + { + "code": 6025, + "name": "Truncation", + "msg": "Truncation" + }, + { + "code": 6026, + "name": "DivisionByZero", + "msg": "Division by zero" + }, + { + "code": 6027, + "name": "NotEnoughRemainingAccounts", + "msg": "Not enough remaining accounts" + }, + { + "code": 6028, + "name": "AllFeeRecipientsShouldBeNonZero", + "msg": "All fee recipients should be non-zero" + }, + { + "code": 6029, + "name": "UnsortedNotUniqueFeeRecipients", + "msg": "Unsorted or not unique fee recipients" + }, + { + "code": 6030, + "name": "CreatorShouldNotBeZero", + "msg": "Creator should not be zero" + }, + { + "code": 6031, + "name": "StartTimeInThePast" + }, + { + "code": 6032, + "name": "EndTimeInThePast" + }, + { + "code": 6033, + "name": "EndTimeBeforeStartTime" + }, + { + "code": 6034, + "name": "TimeRangeTooLarge" + }, + { + "code": 6035, + "name": "EndTimeBeforeCurrentDay" + }, + { + "code": 6036, + "name": "SupplyUpdateForFinishedRange" + }, + { + "code": 6037, + "name": "DayIndexAfterEndIndex" + }, + { + "code": 6038, + "name": "DayInActiveRange" + }, + { + "code": 6039, + "name": "InvalidIncentiveMint" + }, + { + "code": 6040, + "name": "BuyNotEnoughSolToCoverRent", + "msg": "Buy: Not enough SOL to cover for rent exemption." + }, + { + "code": 6041, + "name": "BuyNotEnoughSolToCoverFees", + "msg": "Buy: Not enough SOL to cover for fees." + }, + { + "code": 6042, + "name": "BuySlippageBelowMinTokensOut", + "msg": "Slippage: Would buy less tokens than expected min_tokens_out" + }, + { + "code": 6043, + "name": "NameTooLong" + }, + { + "code": 6044, + "name": "SymbolTooLong" + }, + { + "code": 6045, + "name": "UriTooLong" + }, + { + "code": 6046, + "name": "CreateV2Disabled" + }, + { + "code": 6047, + "name": "CpitializeMayhemFailed" + }, + { + "code": 6048, + "name": "MayhemModeDisabled" + } + ], + "types": [ + { + "name": "AdminSetCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "old_creator", + "type": "pubkey" + }, + { + "name": "new_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminSetIdlAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "idl_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "day_number", + "type": "u64" + }, + { + "name": "token_supply_per_day", + "type": "u64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "BondingCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "real_sol_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "complete", + "type": "bool" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "ClaimTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + } + ] + } + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "CollectCreatorFeeEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "creator_fee", + "type": "u64" + } + ] + } + }, + { + "name": "CompleteEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "CompletePumpAmmMigrationEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "mint_amount", + "type": "u64" + }, + { + "name": "sol_amount", + "type": "u64" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "pool", + "type": "pubkey" + } + ] + } + }, + { + "name": "CreateEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "token_program", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "ExtendAccountEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "account", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "current_size", + "type": "u64" + }, + { + "name": "new_size", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "FeeConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "flat_fees", + "type": { + "defined": { + "name": "Fees" + } + } + }, + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + } + ] + } + }, + { + "name": "FeeTier", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market_cap_lamports_threshold", + "type": "u128" + }, + { + "name": "fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_fee_bps", + "type": "u64" + }, + { + "name": "protocol_fee_bps", + "type": "u64" + }, + { + "name": "creator_fee_bps", + "type": "u64" + } + ] + } + }, + { + "name": "Global", + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "docs": ["Unused"], + "type": "bool" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "fee_recipient", + "type": "pubkey" + }, + { + "name": "initial_virtual_token_reserves", + "type": "u64" + }, + { + "name": "initial_virtual_sol_reserves", + "type": "u64" + }, + { + "name": "initial_real_token_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "withdraw_authority", + "type": "pubkey" + }, + { + "name": "enable_migrate", + "docs": ["Unused"], + "type": "bool" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "fee_recipients", + "type": { + "array": ["pubkey", 7] + } + }, + { + "name": "set_creator_authority", + "type": "pubkey" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + }, + { + "name": "create_v2_enabled", + "type": "bool" + }, + { + "name": "whitelist_pda", + "type": "pubkey" + }, + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "mayhem_mode_enabled", + "type": "bool" + } + ] + } + }, + { + "name": "GlobalVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "total_token_supply", + "type": { + "array": ["u64", 30] + } + }, + { + "name": "sol_volumes", + "type": { + "array": ["u64", 30] + } + } + ] + } + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "payer", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "SetCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetMetaplexCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "metadata", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetParamsEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "initial_virtual_token_reserves", + "type": "u64" + }, + { + "name": "initial_virtual_sol_reserves", + "type": "u64" + }, + { + "name": "initial_real_token_reserves", + "type": "u64" + }, + { + "name": "final_real_sol_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "withdraw_authority", + "type": "pubkey" + }, + { + "name": "enable_migrate", + "type": "bool" + }, + { + "name": "pool_migration_fee", + "type": "u64" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "fee_recipients", + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "set_creator_authority", + "type": "pubkey" + }, + { + "name": "admin_set_creator_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "total_claimed_tokens_before", + "type": "u64" + }, + { + "name": "total_claimed_tokens_after", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "TradeEvent", + "docs": ["ix_name: \"buy\" | \"sell\" | \"buy_exact_sol_in\""], + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "sol_amount", + "type": "u64" + }, + { + "name": "token_amount", + "type": "u64" + }, + { + "name": "is_buy", + "type": "bool" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "real_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "fee_recipient", + "type": "pubkey" + }, + { + "name": "fee_basis_points", + "type": "u64" + }, + { + "name": "fee", + "type": "u64" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "creator_fee_basis_points", + "type": "u64" + }, + { + "name": "creator_fee", + "type": "u64" + }, + { + "name": "track_volume", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "ix_name", + "type": "string" + } + ] + } + }, + { + "name": "UpdateGlobalAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "global", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "UserVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "needs_claim", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "has_total_claimed_tokens", + "type": "bool" + } + ] + } + } + ] +} diff --git a/idl/bitquery/pumpswap/amm.json b/idl/bitquery/pumpswap/amm.json new file mode 100644 index 0000000..fbd5f14 --- /dev/null +++ b/idl/bitquery/pumpswap/amm.json @@ -0,0 +1,3433 @@ +{ + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", + "metadata": { + "name": "pump_amm", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "admin_set_coin_creator", + "docs": ["Overrides the coin creator for a canonical pump pool"], + "discriminator": [242, 40, 117, 145, 73, 96, 105, 104], + "accounts": [ + { + "name": "admin_set_coin_creator_authority", + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config" + }, + { + "name": "pool", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "coin_creator", + "type": "pubkey" + } + ] + }, + { + "name": "admin_update_token_incentives", + "discriminator": [209, 11, 115, 87, 213, 23, 124, 204], + "accounts": [ + { + "name": "admin", + "writable": true, + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103] + } + ] + } + }, + { + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "day_number", + "type": "u64" + }, + { + "name": "token_supply_per_day", + "type": "u64" + } + ] + }, + { + "name": "buy", + "discriminator": [102, 6, 61, 18, 1, 218, 235, 234], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "global_config" + }, + { + "name": "base_mint", + "relations": ["pool"] + }, + { + "name": "quote_mint", + "relations": ["pool"] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "protocol_fee_recipient" + }, + { + "name": "protocol_fee_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "protocol_fee_recipient" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 95, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "pool.coin_creator", + "account": "Pool" + } + ] + } + }, + { + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] + }, + { + "kind": "const", + "value": [ + 12, 20, 222, 252, 130, 94, 198, 118, 148, 37, 8, 24, 187, 101, 64, 101, 244, 41, + 141, 49, 86, 213, 113, 180, 212, 248, 9, 12, 24, 233, 168, 99 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "base_amount_out", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + } + ] + }, + { + "name": "buy_exact_quote_in", + "docs": [ + "Given a budget of spendable_quote_in, buy at least min_base_amount_out", + "Fees will be deducted from spendable_quote_in", + "", + "f(quote) = tokens, where tokens >= min_base_amount_out", + "", + "Make sure the payer has enough SOL to cover creation of the following accounts (unless already created):", + "- protocol_fee_recipient_token_account: rent.minimum_balance(TokenAccount::LEN)", + "- coin_creator_vault_ata: rent.minimum_balance(TokenAccount::LEN)", + "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)" + ], + "discriminator": [198, 46, 21, 82, 180, 217, 232, 112], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "global_config" + }, + { + "name": "base_mint", + "relations": ["pool"] + }, + { + "name": "quote_mint", + "relations": ["pool"] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "protocol_fee_recipient" + }, + { + "name": "protocol_fee_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "protocol_fee_recipient" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 95, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "pool.coin_creator", + "account": "Pool" + } + ] + } + }, + { + "name": "global_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] + }, + { + "kind": "const", + "value": [ + 12, 20, 222, 252, 130, 94, 198, 118, 148, 37, 8, 24, 187, 101, 64, 101, 244, 41, + 141, 49, 86, 213, 113, 180, 212, 248, 9, 12, 24, 233, 168, 99 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "spendable_quote_in", + "type": "u64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + } + ] + }, + { + "name": "claim_token_incentives", + "discriminator": [16, 4, 71, 28, 204, 1, 40, 27], + "accounts": [ + { + "name": "user" + }, + { + "name": "user_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "global_incentive_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "global_volume_accumulator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "mint", + "relations": ["global_volume_accumulator"] + }, + { + "name": "token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "payer", + "writable": true, + "signer": true + } + ], + "args": [] + }, + { + "name": "close_user_volume_accumulator", + "discriminator": [249, 69, 164, 218, 150, 103, 84, 138], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_coin_creator_fee", + "discriminator": [160, 57, 89, 42, 181, 139, 43, 66], + "accounts": [ + { + "name": "quote_mint" + }, + { + "name": "quote_token_program" + }, + { + "name": "coin_creator" + }, + { + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 95, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "coin_creator" + } + ] + } + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "coin_creator_token_account", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "create_config", + "discriminator": [201, 207, 243, 114, 75, 111, 47, 189], + "accounts": [ + { + "name": "admin", + "writable": true, + "signer": true, + "address": "8LWu7QM2dGR1G8nKDHthckea57bkCzXyBTAKPJUBDHo8" + }, + { + "name": "global_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [103, 108, 111, 98, 97, 108, 95, 99, 111, 110, 102, 105, 103] + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + }, + { + "name": "create_pool", + "discriminator": [233, 146, 209, 142, 207, 104, 64, 188], + "accounts": [ + { + "name": "pool", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [112, 111, 111, 108] + }, + { + "kind": "arg", + "path": "index" + }, + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "global_config" + }, + { + "name": "creator", + "writable": true, + "signer": true + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [112, 111, 111, 108, 95, 108, 112, 95, 109, 105, 110, 116] + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "user_pool_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "token_2022_program" + }, + { + "kind": "account", + "path": "lp_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "pool_base_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "base_token_program" + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "pool_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "pool" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "index", + "type": "u16" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + }, + { + "name": "deposit", + "discriminator": [242, 35, 198, 137, 82, 225, 242, 182], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "global_config" + }, + { + "name": "user", + "signer": true + }, + { + "name": "base_mint", + "relations": ["pool"] + }, + { + "name": "quote_mint", + "relations": ["pool"] + }, + { + "name": "lp_mint", + "writable": true, + "relations": ["pool"] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "user_pool_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_token_amount_out", + "type": "u64" + }, + { + "name": "max_base_amount_in", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + } + ] + }, + { + "name": "disable", + "discriminator": [185, 173, 187, 90, 216, 15, 238, 233], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "disable_create_pool", + "type": "bool" + }, + { + "name": "disable_deposit", + "type": "bool" + }, + { + "name": "disable_withdraw", + "type": "bool" + }, + { + "name": "disable_buy", + "type": "bool" + }, + { + "name": "disable_sell", + "type": "bool" + } + ] + }, + { + "name": "extend_account", + "discriminator": [234, 102, 194, 203, 150, 72, 62, 229], + "accounts": [ + { + "name": "account", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "init_user_volume_accumulator", + "discriminator": [94, 6, 202, 115, 255, 96, 232, 183], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "user" + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "sell", + "discriminator": [51, 230, 133, 164, 1, 127, 131, 173], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "global_config" + }, + { + "name": "base_mint", + "relations": ["pool"] + }, + { + "name": "quote_mint", + "relations": ["pool"] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "protocol_fee_recipient" + }, + { + "name": "protocol_fee_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "protocol_fee_recipient" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "base_token_program" + }, + { + "name": "quote_token_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program", + "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" + }, + { + "name": "coin_creator_vault_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "coin_creator_vault_authority" + }, + { + "kind": "account", + "path": "quote_token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "coin_creator_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [99, 114, 101, 97, 116, 111, 114, 95, 118, 97, 117, 108, 116] + }, + { + "kind": "account", + "path": "pool.coin_creator", + "account": "Pool" + } + ] + } + }, + { + "name": "fee_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [102, 101, 101, 95, 99, 111, 110, 102, 105, 103] + }, + { + "kind": "const", + "value": [ + 12, 20, 222, 252, 130, 94, 198, 118, 148, 37, 8, 24, 187, 101, 64, 101, 244, 41, + 141, 49, 86, 213, 113, 180, 212, 248, 9, 12, 24, 233, 168, 99 + ] + } + ], + "program": { + "kind": "account", + "path": "fee_program" + } + } + }, + { + "name": "fee_program", + "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ" + } + ], + "args": [ + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + } + ] + }, + { + "name": "set_coin_creator", + "docs": ["Sets Pool::coin_creator from Metaplex metadata creator or BondingCurve::creator"], + "discriminator": [210, 149, 128, 45, 188, 58, 78, 175], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "metadata", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [109, 101, 116, 97, 100, 97, 116, 97] + }, + { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, + 108, 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + }, + { + "kind": "account", + "path": "pool.base_mint", + "account": "Pool" + } + ], + "program": { + "kind": "const", + "value": [ + 11, 112, 101, 177, 227, 209, 124, 69, 56, 157, 82, 127, 107, 4, 195, 205, 88, 184, 108, + 115, 26, 160, 253, 181, 73, 182, 209, 188, 3, 248, 41, 70 + ] + } + } + }, + { + "name": "bonding_curve", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [98, 111, 110, 100, 105, 110, 103, 45, 99, 117, 114, 118, 101] + }, + { + "kind": "account", + "path": "pool.base_mint", + "account": "Pool" + } + ], + "program": { + "kind": "const", + "value": [ + 1, 86, 224, 246, 147, 102, 90, 207, 68, 219, 21, 104, 191, 23, 91, 170, 81, 137, 203, + 151, 245, 210, 255, 59, 101, 93, 43, 182, 253, 109, 24, 176 + ] + } + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_reserved_fee_recipient", + "discriminator": [207, 189, 178, 71, 167, 122, 68, 180], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "whitelist_pda", + "type": "pubkey" + } + ] + }, + { + "name": "sync_user_volume_accumulator", + "discriminator": [86, 31, 192, 87, 163, 87, 79, 238], + "accounts": [ + { + "name": "user" + }, + { + "name": "global_volume_accumulator", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, 108, 111, 98, 97, 108, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, + 109, 117, 108, 97, 116, 111, 114 + ] + } + ] + } + }, + { + "name": "user_volume_accumulator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 117, 115, 101, 114, 95, 118, 111, 108, 117, 109, 101, 95, 97, 99, 99, 117, 109, 117, + 108, 97, 116, 111, 114 + ] + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "toggle_mayhem_mode", + "discriminator": [1, 9, 111, 208, 100, 31, 255, 163], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "enabled", + "type": "bool" + } + ] + }, + { + "name": "update_admin", + "discriminator": [161, 176, 40, 213, 60, 184, 179, 228], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "new_admin" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_fee_config", + "discriminator": [104, 184, 103, 242, 88, 151, 107, 20], + "accounts": [ + { + "name": "admin", + "signer": true, + "relations": ["global_config"] + }, + { + "name": "global_config", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + }, + { + "name": "withdraw", + "discriminator": [183, 18, 70, 156, 148, 109, 161, 34], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "global_config" + }, + { + "name": "user", + "signer": true + }, + { + "name": "base_mint", + "relations": ["pool"] + }, + { + "name": "quote_mint", + "relations": ["pool"] + }, + { + "name": "lp_mint", + "writable": true, + "relations": ["pool"] + }, + { + "name": "user_base_token_account", + "writable": true + }, + { + "name": "user_quote_token_account", + "writable": true + }, + { + "name": "user_pool_token_account", + "writable": true + }, + { + "name": "pool_base_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "pool_quote_token_account", + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "lp_token_amount_in", + "type": "u64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "BondingCurve", + "discriminator": [23, 183, 248, 55, 96, 216, 172, 96] + }, + { + "name": "FeeConfig", + "discriminator": [143, 52, 146, 187, 219, 123, 76, 155] + }, + { + "name": "GlobalConfig", + "discriminator": [149, 8, 156, 202, 160, 252, 176, 217] + }, + { + "name": "GlobalVolumeAccumulator", + "discriminator": [202, 42, 246, 43, 142, 190, 30, 255] + }, + { + "name": "Pool", + "discriminator": [241, 154, 109, 4, 17, 177, 109, 188] + }, + { + "name": "UserVolumeAccumulator", + "discriminator": [86, 255, 112, 14, 102, 53, 154, 250] + } + ], + "events": [ + { + "name": "AdminSetCoinCreatorEvent", + "discriminator": [45, 220, 93, 24, 25, 97, 172, 104] + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "discriminator": [147, 250, 108, 120, 247, 29, 67, 222] + }, + { + "name": "BuyEvent", + "discriminator": [103, 244, 82, 31, 44, 245, 119, 119] + }, + { + "name": "ClaimTokenIncentivesEvent", + "discriminator": [79, 172, 246, 49, 205, 91, 206, 232] + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "discriminator": [146, 159, 189, 172, 146, 88, 56, 244] + }, + { + "name": "CollectCoinCreatorFeeEvent", + "discriminator": [232, 245, 194, 238, 234, 218, 58, 89] + }, + { + "name": "CreateConfigEvent", + "discriminator": [107, 52, 89, 129, 55, 226, 81, 22] + }, + { + "name": "CreatePoolEvent", + "discriminator": [177, 49, 12, 210, 160, 118, 167, 116] + }, + { + "name": "DepositEvent", + "discriminator": [120, 248, 61, 83, 31, 142, 107, 144] + }, + { + "name": "DisableEvent", + "discriminator": [107, 253, 193, 76, 228, 202, 27, 104] + }, + { + "name": "ExtendAccountEvent", + "discriminator": [97, 97, 215, 144, 93, 146, 22, 124] + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "discriminator": [134, 36, 13, 72, 232, 101, 130, 216] + }, + { + "name": "SellEvent", + "discriminator": [62, 47, 55, 10, 165, 3, 220, 42] + }, + { + "name": "SetBondingCurveCoinCreatorEvent", + "discriminator": [242, 231, 235, 102, 65, 99, 189, 211] + }, + { + "name": "SetMetaplexCoinCreatorEvent", + "discriminator": [150, 107, 199, 123, 124, 207, 102, 228] + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "discriminator": [197, 122, 167, 124, 116, 81, 91, 255] + }, + { + "name": "UpdateAdminEvent", + "discriminator": [225, 152, 171, 87, 246, 63, 66, 234] + }, + { + "name": "UpdateFeeConfigEvent", + "discriminator": [90, 23, 65, 35, 62, 244, 188, 208] + }, + { + "name": "WithdrawEvent", + "discriminator": [22, 9, 133, 26, 160, 44, 71, 192] + } + ], + "errors": [ + { + "code": 6000, + "name": "FeeBasisPointsExceedsMaximum" + }, + { + "code": 6001, + "name": "ZeroBaseAmount" + }, + { + "code": 6002, + "name": "ZeroQuoteAmount" + }, + { + "code": 6003, + "name": "TooLittlePoolTokenLiquidity" + }, + { + "code": 6004, + "name": "ExceededSlippage" + }, + { + "code": 6005, + "name": "InvalidAdmin" + }, + { + "code": 6006, + "name": "UnsupportedBaseMint" + }, + { + "code": 6007, + "name": "UnsupportedQuoteMint" + }, + { + "code": 6008, + "name": "InvalidBaseMint" + }, + { + "code": 6009, + "name": "InvalidQuoteMint" + }, + { + "code": 6010, + "name": "InvalidLpMint" + }, + { + "code": 6011, + "name": "AllProtocolFeeRecipientsShouldBeNonZero" + }, + { + "code": 6012, + "name": "UnsortedNotUniqueProtocolFeeRecipients" + }, + { + "code": 6013, + "name": "InvalidProtocolFeeRecipient" + }, + { + "code": 6014, + "name": "InvalidPoolBaseTokenAccount" + }, + { + "code": 6015, + "name": "InvalidPoolQuoteTokenAccount" + }, + { + "code": 6016, + "name": "BuyMoreBaseAmountThanPoolReserves" + }, + { + "code": 6017, + "name": "DisabledCreatePool" + }, + { + "code": 6018, + "name": "DisabledDeposit" + }, + { + "code": 6019, + "name": "DisabledWithdraw" + }, + { + "code": 6020, + "name": "DisabledBuy" + }, + { + "code": 6021, + "name": "DisabledSell" + }, + { + "code": 6022, + "name": "SameMint" + }, + { + "code": 6023, + "name": "Overflow" + }, + { + "code": 6024, + "name": "Truncation" + }, + { + "code": 6025, + "name": "DivisionByZero" + }, + { + "code": 6026, + "name": "NewSizeLessThanCurrentSize" + }, + { + "code": 6027, + "name": "AccountTypeNotSupported" + }, + { + "code": 6028, + "name": "OnlyCanonicalPumpPoolsCanHaveCoinCreator" + }, + { + "code": 6029, + "name": "InvalidAdminSetCoinCreatorAuthority" + }, + { + "code": 6030, + "name": "StartTimeInThePast" + }, + { + "code": 6031, + "name": "EndTimeInThePast" + }, + { + "code": 6032, + "name": "EndTimeBeforeStartTime" + }, + { + "code": 6033, + "name": "TimeRangeTooLarge" + }, + { + "code": 6034, + "name": "EndTimeBeforeCurrentDay" + }, + { + "code": 6035, + "name": "SupplyUpdateForFinishedRange" + }, + { + "code": 6036, + "name": "DayIndexAfterEndIndex" + }, + { + "code": 6037, + "name": "DayInActiveRange" + }, + { + "code": 6038, + "name": "InvalidIncentiveMint" + }, + { + "code": 6039, + "name": "BuyNotEnoughQuoteTokensToCoverFees", + "msg": "buy: Not enough quote tokens to cover for fees." + }, + { + "code": 6040, + "name": "BuySlippageBelowMinBaseAmountOut", + "msg": "buy: slippage - would buy less tokens than expected min_base_amount_out" + }, + { + "code": 6041, + "name": "MayhemModeDisabled" + }, + { + "code": 6042, + "name": "OnlyPumpPoolsMayhemMode" + }, + { + "code": 6043, + "name": "MayhemModeInDesiredState" + } + ], + "types": [ + { + "name": "AdminSetCoinCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "old_coin_creator", + "type": "pubkey" + }, + { + "name": "new_coin_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminUpdateTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "day_number", + "type": "u64" + }, + { + "name": "token_supply_per_day", + "type": "u64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "BondingCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "virtual_token_reserves", + "type": "u64" + }, + { + "name": "virtual_sol_reserves", + "type": "u64" + }, + { + "name": "real_token_reserves", + "type": "u64" + }, + { + "name": "real_sol_reserves", + "type": "u64" + }, + { + "name": "token_total_supply", + "type": "u64" + }, + { + "name": "complete", + "type": "bool" + }, + { + "name": "creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "BuyEvent", + "docs": ["ix_name: \"buy\" | \"buy_exact_quote_in\""], + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_amount_out", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "lp_fee", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee", + "type": "u64" + }, + { + "name": "quote_amount_in_with_lp_fee", + "type": "u64" + }, + { + "name": "user_quote_amount_in", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient_token_account", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "coin_creator_fee", + "type": "u64" + }, + { + "name": "track_volume", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + }, + { + "name": "ix_name", + "type": "string" + } + ] + } + }, + { + "name": "ClaimTokenIncentivesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + } + ] + } + }, + { + "name": "CloseUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "CollectCoinCreatorFeeEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "coin_creator_fee", + "type": "u64" + }, + { + "name": "coin_creator_vault_ata", + "type": "pubkey" + }, + { + "name": "coin_creator_token_account", + "type": "pubkey" + } + ] + } + }, + { + "name": "CreateConfigEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "CreatePoolEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "index", + "type": "u16" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint_decimals", + "type": "u8" + }, + { + "name": "quote_mint_decimals", + "type": "u8" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "pool_base_amount", + "type": "u64" + }, + { + "name": "pool_quote_amount", + "type": "u64" + }, + { + "name": "minimum_liquidity", + "type": "u64" + }, + { + "name": "initial_liquidity", + "type": "u64" + }, + { + "name": "lp_token_amount_out", + "type": "u64" + }, + { + "name": "pool_bump", + "type": "u8" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "DepositEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "lp_token_amount_out", + "type": "u64" + }, + { + "name": "max_base_amount_in", + "type": "u64" + }, + { + "name": "max_quote_amount_in", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "quote_amount_in", + "type": "u64" + }, + { + "name": "lp_mint_supply", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "user_pool_token_account", + "type": "pubkey" + } + ] + } + }, + { + "name": "DisableEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "disable_create_pool", + "type": "bool" + }, + { + "name": "disable_deposit", + "type": "bool" + }, + { + "name": "disable_withdraw", + "type": "bool" + }, + { + "name": "disable_buy", + "type": "bool" + }, + { + "name": "disable_sell", + "type": "bool" + } + ] + } + }, + { + "name": "ExtendAccountEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "account", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "current_size", + "type": "u64" + }, + { + "name": "new_size", + "type": "u64" + } + ] + } + }, + { + "name": "FeeConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "flat_fees", + "type": { + "defined": { + "name": "Fees" + } + } + }, + { + "name": "fee_tiers", + "type": { + "vec": { + "defined": { + "name": "FeeTier" + } + } + } + } + ] + } + }, + { + "name": "FeeTier", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market_cap_lamports_threshold", + "type": "u128" + }, + { + "name": "fees", + "type": { + "defined": { + "name": "Fees" + } + } + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_fee_bps", + "type": "u64" + }, + { + "name": "protocol_fee_bps", + "type": "u64" + }, + { + "name": "creator_fee_bps", + "type": "u64" + } + ] + } + }, + { + "name": "GlobalConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "admin", + "docs": ["The admin pubkey"], + "type": "pubkey" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "disable_flags", + "docs": [ + "Flags to disable certain functionality", + "bit 0 - Disable create pool", + "bit 1 - Disable deposit", + "bit 2 - Disable withdraw", + "bit 3 - Disable buy", + "bit 4 - Disable sell" + ], + "type": "u8" + }, + { + "name": "protocol_fee_recipients", + "docs": ["Addresses of the protocol fee recipients"], + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "docs": ["The admin authority for setting coin creators"], + "type": "pubkey" + }, + { + "name": "whitelist_pda", + "type": "pubkey" + }, + { + "name": "reserved_fee_recipient", + "type": "pubkey" + }, + { + "name": "mayhem_mode_enabled", + "type": "bool" + } + ] + } + }, + { + "name": "GlobalVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_time", + "type": "i64" + }, + { + "name": "seconds_in_a_day", + "type": "i64" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "total_token_supply", + "type": { + "array": ["u64", 30] + } + }, + { + "name": "sol_volumes", + "type": { + "array": ["u64", 30] + } + } + ] + } + }, + { + "name": "InitUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "payer", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "Pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_bump", + "type": "u8" + }, + { + "name": "index", + "type": "u16" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "pool_base_token_account", + "type": "pubkey" + }, + { + "name": "pool_quote_token_account", + "type": "pubkey" + }, + { + "name": "lp_supply", + "docs": ["True circulating supply without burns and lock-ups"], + "type": "u64" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "is_mayhem_mode", + "type": "bool" + } + ] + } + }, + { + "name": "SellEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_amount_in", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "quote_amount_out", + "type": "u64" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "lp_fee", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee", + "type": "u64" + }, + { + "name": "quote_amount_out_without_lp_fee", + "type": "u64" + }, + { + "name": "user_quote_amount_out", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient", + "type": "pubkey" + }, + { + "name": "protocol_fee_recipient_token_account", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "coin_creator_fee", + "type": "u64" + } + ] + } + }, + { + "name": "SetBondingCurveCoinCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "bonding_curve", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetMetaplexCoinCreatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "metadata", + "type": "pubkey" + }, + { + "name": "coin_creator", + "type": "pubkey" + } + ] + } + }, + { + "name": "SyncUserVolumeAccumulatorEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "total_claimed_tokens_before", + "type": "u64" + }, + { + "name": "total_claimed_tokens_after", + "type": "u64" + }, + { + "name": "timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "UpdateAdminEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "new_admin", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateFeeConfigEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "lp_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_basis_points", + "type": "u64" + }, + { + "name": "protocol_fee_recipients", + "type": { + "array": ["pubkey", 8] + } + }, + { + "name": "coin_creator_fee_basis_points", + "type": "u64" + }, + { + "name": "admin_set_coin_creator_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "UserVolumeAccumulator", + "type": { + "kind": "struct", + "fields": [ + { + "name": "user", + "type": "pubkey" + }, + { + "name": "needs_claim", + "type": "bool" + }, + { + "name": "total_unclaimed_tokens", + "type": "u64" + }, + { + "name": "total_claimed_tokens", + "type": "u64" + }, + { + "name": "current_sol_volume", + "type": "u64" + }, + { + "name": "last_update_timestamp", + "type": "i64" + }, + { + "name": "has_total_claimed_tokens", + "type": "bool" + } + ] + } + }, + { + "name": "WithdrawEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "timestamp", + "type": "i64" + }, + { + "name": "lp_token_amount_in", + "type": "u64" + }, + { + "name": "min_base_amount_out", + "type": "u64" + }, + { + "name": "min_quote_amount_out", + "type": "u64" + }, + { + "name": "user_base_token_reserves", + "type": "u64" + }, + { + "name": "user_quote_token_reserves", + "type": "u64" + }, + { + "name": "pool_base_token_reserves", + "type": "u64" + }, + { + "name": "pool_quote_token_reserves", + "type": "u64" + }, + { + "name": "base_amount_out", + "type": "u64" + }, + { + "name": "quote_amount_out", + "type": "u64" + }, + { + "name": "lp_mint_supply", + "type": "u64" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "user_base_token_account", + "type": "pubkey" + }, + { + "name": "user_quote_token_account", + "type": "pubkey" + }, + { + "name": "user_pool_token_account", + "type": "pubkey" + } + ] + } + } + ] +} diff --git a/idl/bitquery/raydium/launchpad.json b/idl/bitquery/raydium/launchpad.json new file mode 100644 index 0000000..1cea6fa --- /dev/null +++ b/idl/bitquery/raydium/launchpad.json @@ -0,0 +1,5783 @@ +{ + "address": "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj", + "metadata": { + "name": "raydium_launchpad", + "version": "0.2.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "buy_exact_in", + "docs": [ + "Use the given amount of quote tokens to purchase base tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_in` - Amount of quote token to purchase", + "* `minimum_amount_out` - Minimum amount of base token to receive (slippage protection)", + "* `share_fee_rate` - Fee rate for the share", + "" + ], + "discriminator": [ + 250, + 234, + 13, + 123, + 213, + 156, + 19, + 236 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "minimum_amount_out", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "buy_exact_out", + "docs": [ + "Use quote tokens to purchase the given amount of base tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_out` - Amount of base token to receive", + "* `maximum_amount_in` - Maximum amount of quote token to purchase (slippage protection)", + "* `share_fee_rate` - Fee rate for the share" + ], + "discriminator": [ + 24, + 211, + 116, + 40, + 105, + 3, + 153, + 56 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "maximum_amount_in", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "claim_creator_fee", + "docs": [ + "Claim the fee from the exclusive creator fee vault.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 26, + 97, + 138, + 203, + 132, + 171, + 141, + 252 + ], + "accounts": [ + { + "name": "creator", + "docs": [ + "The pool creator" + ], + "writable": true, + "signer": true + }, + { + "name": "fee_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 102, + 101, + 101, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "creator_fee_vault", + "docs": [ + "The creator fee vault" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token" + ] + }, + { + "name": "token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "claim_platform_fee", + "docs": [ + "Claim platform fee", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 156, + 39, + 208, + 135, + 76, + 237, + 61, + 72 + ], + "accounts": [ + { + "name": "platform_fee_wallet", + "docs": [ + "Only the wallet stored in platform_config can collect platform fees" + ], + "writable": true, + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true + }, + { + "name": "platform_config", + "docs": [ + "The platform config account" + ] + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "platform_fee_wallet" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "claim_platform_fee_from_vault", + "docs": [ + "Claim the fee from the exclusive platform fee vault.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 117, + 241, + 198, + 168, + 248, + 218, + 80, + 29 + ], + "accounts": [ + { + "name": "platform_fee_wallet", + "docs": [ + "Only the wallet stored in platform_config can collect platform fees" + ], + "writable": true, + "signer": true + }, + { + "name": "fee_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 102, + 101, + 101, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "platform_config", + "docs": [ + "The platform config account" + ] + }, + { + "name": "platform_fee_vault", + "docs": [ + "The platform fee vault" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "platform_config" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "platform_fee_wallet" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "claim_vested_token", + "docs": [ + "Claim vested token", + "# Arguments" + ], + "discriminator": [ + 49, + 33, + 104, + 30, + 189, + 157, + 79, + 35 + ], + "accounts": [ + { + "name": "beneficiary", + "docs": [ + "The beneficiary of the vesting account" + ], + "writable": true, + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true + }, + { + "name": "vesting_record", + "docs": [ + "The vesting record account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 101, + 115, + 116, + 105, + 110, + 103 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "beneficiary" + } + ] + } + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "user_base_token", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "beneficiary" + }, + { + "kind": "account", + "path": "base_token_program" + }, + { + "kind": "account", + "path": "base_token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_token_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "collect_fee", + "docs": [ + "Collects accumulated fees from the pool", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 60, + 173, + 247, + 103, + 4, + 93, + 130, + 48 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "Only protocol_fee_owner saved in global_config can collect protocol fee now" + ], + "signer": true + }, + { + "name": "authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Pool state stores accumulated protocol fee amount" + ], + "writable": true + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "quote_vault", + "docs": [ + "The address that holds pool tokens for quote token" + ], + "writable": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [] + }, + { + "name": "collect_migrate_fee", + "docs": [ + "Collects migrate fees from the pool", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 255, + 186, + 150, + 223, + 235, + 118, + 201, + 186 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "Only migrate_fee_owner saved in global_config can collect migrate fee now" + ], + "signer": true + }, + { + "name": "authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Pool state stores accumulated protocol fee amount" + ], + "writable": true + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "quote_vault", + "docs": [ + "The address that holds pool tokens for quote token" + ], + "writable": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [] + }, + { + "name": "create_config", + "docs": [ + "Creates a new configuration", + "# Arguments", + "", + "* `ctx` - The accounts needed by instruction", + "* `curve_type` - The type of bonding curve (0: ConstantProduct)", + "* `index` - The index of config, there may be multiple config with the same curve type.", + "* `trade_fee_rate` - Trade fee rate, must be less than RATE_DENOMINATOR_VALUE", + "" + ], + "discriminator": [ + 201, + 207, + 243, + 114, + 75, + 111, + 47, + 189 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "The protocol owner/admin account", + "Must match the predefined admin address", + "Has authority to create and modify protocol configurations" + ], + "writable": true, + "signer": true, + "address": "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account that stores protocol-wide settings", + "PDA generated using GLOBAL_CONFIG_SEED, quote token mint, and curve type", + "Stores fee rates and protocol parameters" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "quote_token_mint" + }, + { + "kind": "arg", + "path": "curve_type" + }, + { + "kind": "arg", + "path": "index" + } + ] + } + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint address of the quote token (token used for buying)", + "This will be the standard token used for all pools with this config" + ] + }, + { + "name": "protocol_fee_owner", + "docs": [ + "Account that will receive protocol fees" + ] + }, + { + "name": "migrate_fee_owner", + "docs": [ + "Account that will receive migrate fees" + ] + }, + { + "name": "migrate_to_amm_wallet", + "docs": [ + "The control wallet address for migrating to amm" + ] + }, + { + "name": "migrate_to_cpswap_wallet", + "docs": [ + "The control wallet address for migrating to cpswap" + ] + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "curve_type", + "type": "u8" + }, + { + "name": "index", + "type": "u16" + }, + { + "name": "migrate_fee", + "type": "u64" + }, + { + "name": "trade_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "create_platform_config", + "docs": [ + "Create platform config account", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "# Fields", + "* `fee_rate` - Fee rate of the platform", + "* `name` - Name of the platform", + "* `web` - Website of the platform", + "* `img` - Image link of the platform", + "" + ], + "discriminator": [ + 176, + 90, + 196, + 175, + 253, + 113, + 220, + 20 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "writable": true, + "signer": true + }, + { + "name": "platform_fee_wallet" + }, + { + "name": "platform_nft_wallet" + }, + { + "name": "platform_config", + "docs": [ + "The platform config account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + }, + { + "name": "cpswap_config" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "transfer_fee_extension_authority" + } + ], + "args": [ + { + "name": "platform_params", + "type": { + "defined": { + "name": "PlatformParams" + } + } + } + ] + }, + { + "name": "create_vesting_account", + "docs": [ + "Create vesting account", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `share` - The share amount of base token to be vested", + "" + ], + "discriminator": [ + 129, + 178, + 2, + 13, + 217, + 172, + 230, + 218 + ], + "accounts": [ + { + "name": "creator", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "beneficiary", + "docs": [ + "The beneficiary is used to receive the allocated linear release of tokens.", + "Once this account is set, it cannot be modified, so please ensure the validity of this account,", + "otherwise, the unlocked tokens will not be claimable." + ], + "writable": true + }, + { + "name": "pool_state", + "docs": [ + "The pool state account" + ], + "writable": true + }, + { + "name": "vesting_record", + "docs": [ + "The vesting record account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 101, + 115, + 116, + 105, + 110, + 103 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "beneficiary" + } + ] + } + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "share_amount", + "type": "u64" + } + ] + }, + { + "name": "initialize", + "docs": [ + "Initializes a new trading pool", + "# Arguments", + "", + "* `ctx` - The context of accounts containing pool and token information", + "" + ], + "discriminator": [ + 175, + 175, + 109, + 31, + 13, + 152, + 155, + 237 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "creator" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform info", + "Includes settings like the fee_rate, name, web, img of the platform" + ] + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ], + "writable": true, + "signer": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)", + "Must match the quote_mint specified in global config" + ] + }, + { + "name": "base_vault", + "docs": [ + "Token account that holds the pool's base tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "quote_vault", + "docs": [ + "Token account that holds the pool's quote tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "metadata_account", + "docs": [ + "Account to store the base token's metadata", + "Created using Metaplex metadata program" + ], + "writable": true + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "metadata_program", + "docs": [ + "Metaplex Token Metadata program", + "Used to create metadata for the base token" + ], + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + } + ] + }, + { + "name": "initialize_v2", + "docs": [ + "Initializes a new trading pool", + "# Arguments", + "", + "* `ctx` - The context of accounts containing pool and token information", + "" + ], + "discriminator": [ + 67, + 153, + 175, + 39, + 218, + 16, + 38, + 32 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "creator" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform info", + "Includes settings like the fee_rate, name, web, img of the platform" + ] + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ], + "writable": true, + "signer": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)", + "Must match the quote_mint specified in global config" + ] + }, + { + "name": "base_vault", + "docs": [ + "Token account that holds the pool's base tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "quote_vault", + "docs": [ + "Token account that holds the pool's quote tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "metadata_account", + "docs": [ + "Account to store the base token's metadata", + "Created using Metaplex metadata program" + ], + "writable": true + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "metadata_program", + "docs": [ + "Metaplex Token Metadata program", + "Used to create metadata for the base token" + ], + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + }, + { + "name": "amm_fee_on", + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + } + ] + }, + { + "name": "initialize_with_token_2022", + "docs": [ + "Initializes a new trading pool with base token belongs to spl-token-2022,", + "pool created by this instruction must be migrated to cpswap after fundraising ends, i.e., curve_param.migrate_type = 1", + "# Arguments", + "", + "* `ctx` - The context of accounts containing pool and token information", + "" + ], + "discriminator": [ + 37, + 190, + 126, + 222, + 44, + 154, + 171, + 17 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "creator" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform info", + "Includes settings like the fee_rate, name, web, img of the platform" + ] + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ], + "writable": true, + "signer": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)", + "Must match the quote_mint specified in global config" + ] + }, + { + "name": "base_vault", + "docs": [ + "Token account that holds the pool's base tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "quote_vault", + "docs": [ + "Token account that holds the pool's quote tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + }, + { + "name": "amm_fee_on", + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + }, + { + "name": "transfer_fee_extension_param", + "type": { + "option": { + "defined": { + "name": "TransferFeeExtensionParams" + } + } + } + } + ] + }, + { + "name": "migrate_to_amm", + "docs": [ + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 207, + 82, + 192, + 145, + 254, + 207, + 145, + 223 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "Only migrate_to_amm_wallet can migrate to cpswap pool", + "This signer must match the migrate_to_amm_wallet saved in global_config" + ], + "writable": true, + "signer": true + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)" + ] + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)" + ] + }, + { + "name": "openbook_program", + "address": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX" + }, + { + "name": "market", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "request_queue", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "event_queue", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "bids", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "asks", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "market_vault_signer" + }, + { + "name": "market_base_vault", + "docs": [ + "Token account that holds the market's base tokens" + ], + "writable": true + }, + { + "name": "market_quote_vault", + "docs": [ + "Token account that holds the market's quote tokens" + ], + "writable": true + }, + { + "name": "amm_program", + "address": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8" + }, + { + "name": "amm_pool", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 32, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_open_orders", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 111, + 112, + 101, + 110, + 95, + 111, + 114, + 100, + 101, + 114, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 108, + 112, + 95, + 109, + 105, + 110, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 99, + 111, + 105, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 112, + 99, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_target_orders", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 116, + 97, + 114, + 103, + 101, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_create_fee_destination", + "writable": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "pool_lp_token", + "writable": true + }, + { + "name": "spl_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "docs": [ + "Program to create an ATA for receiving fee NFT" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + } + ], + "args": [ + { + "name": "base_lot_size", + "type": "u64" + }, + { + "name": "quote_lot_size", + "type": "u64" + }, + { + "name": "market_vault_signer_nonce", + "type": "u8" + } + ] + }, + { + "name": "migrate_to_cpswap", + "docs": [ + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 136, + 92, + 200, + 103, + 28, + 218, + 144, + 140 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "Only migrate_to_cpswap_wallet can migrate to cpswap pool", + "This signer must match the migrate_to_cpswap_wallet saved in global_config" + ], + "writable": true, + "signer": true + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)" + ], + "writable": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "cpswap_program", + "address": "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C" + }, + { + "name": "cpswap_pool", + "docs": [ + "PDA account:", + "seeds = [", + "b\"pool\",", + "cpswap_config.key().as_ref(),", + "token_0_mint.key().as_ref(),", + "token_1_mint.key().as_ref(),", + "],", + "seeds::program = cpswap_program,", + "", + "Or random account: must be signed by cli" + ], + "writable": true + }, + { + "name": "cpswap_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 110, + 100, + 95, + 108, + 112, + 95, + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 108, + 112, + 95, + 109, + 105, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_config" + }, + { + "name": "cpswap_create_pool_fee", + "writable": true + }, + { + "name": "cpswap_observation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 111, + 98, + 115, + 101, + 114, + 118, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "lock_program", + "address": "LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE" + }, + { + "name": "lock_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 111, + 99, + 107, + 95, + 99, + 112, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "lock_program" + } + } + }, + { + "name": "lock_lp_vault", + "writable": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "pool_lp_token", + "writable": true + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "docs": [ + "Program to create an ATA for receiving fee NFT" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "metadata_program", + "docs": [ + "Program to create NFT metadata accunt" + ], + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + } + ], + "args": [] + }, + { + "name": "remove_platform_curve_param", + "docs": [ + "Remove platform launch param", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `index` - The index of the curve param to remove", + "" + ], + "discriminator": [ + 27, + 30, + 62, + 169, + 93, + 224, + 24, + 145 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "signer": true + }, + { + "name": "platform_config", + "docs": [ + "Platform config account to be changed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + } + ], + "args": [ + { + "name": "index", + "type": "u8" + } + ] + }, + { + "name": "sell_exact_in", + "docs": [ + "Use the given amount of base tokens to sell for quote tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_in` - Amount of base token to sell", + "* `minimum_amount_out` - Minimum amount of quote token to receive (slippage protection)", + "* `share_fee_rate` - Fee rate for the share", + "" + ], + "discriminator": [ + 149, + 39, + 222, + 155, + 211, + 124, + 152, + 26 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "minimum_amount_out", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "sell_exact_out", + "docs": [ + "Sell base tokens for the given amount of quote tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_out` - Amount of quote token to receive", + "* `maximum_amount_in` - Maximum amount of base token to purchase (slippage protection)", + "* `share_fee_rate` - Fee rate for the share", + "" + ], + "discriminator": [ + 95, + 200, + 71, + 34, + 8, + 9, + 11, + 166 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "maximum_amount_in", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "update_config", + "docs": [ + "Updates configuration parameters", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `param` - Parameter to update:", + "- 0: Update trade_fee_rate", + "- 1: Update fee owner", + "* `value` - New value for the selected parameter", + "" + ], + "discriminator": [ + 29, + 158, + 252, + 191, + 10, + 83, + 219, + 99 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "The global config owner or admin" + ], + "signer": true, + "address": "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ" + }, + { + "name": "global_config", + "docs": [ + "Global config account to be changed" + ], + "writable": true + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "value", + "type": "u64" + } + ] + }, + { + "name": "update_platform_config", + "docs": [ + "Update platform config", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `param` - Parameter to update", + "" + ], + "discriminator": [ + 195, + 60, + 76, + 129, + 146, + 45, + 67, + 143 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "signer": true + }, + { + "name": "platform_config", + "docs": [ + "Platform config account to be changed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + } + ], + "args": [ + { + "name": "param", + "type": { + "defined": { + "name": "PlatformConfigParam" + } + } + } + ] + }, + { + "name": "update_platform_curve_param", + "docs": [ + "Update platform launch param", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `bonding_curve_param` - Parameter to update", + "" + ], + "discriminator": [ + 138, + 144, + 138, + 250, + 220, + 128, + 4, + 57 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "writable": true, + "signer": true + }, + { + "name": "platform_config", + "docs": [ + "Platform config account to be changed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "system_program", + "docs": [ + "System program for lamport transfers" + ], + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "index", + "type": "u8" + }, + { + "name": "bonding_curve_param", + "type": { + "defined": { + "name": "BondingCurveParam" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "GlobalConfig", + "discriminator": [ + 149, + 8, + 156, + 202, + 160, + 252, + 176, + 217 + ] + }, + { + "name": "PlatformConfig", + "discriminator": [ + 160, + 78, + 128, + 0, + 248, + 83, + 230, + 160 + ] + }, + { + "name": "PoolState", + "discriminator": [ + 247, + 237, + 227, + 245, + 215, + 195, + 222, + 70 + ] + }, + { + "name": "VestingRecord", + "discriminator": [ + 106, + 243, + 221, + 205, + 230, + 126, + 85, + 83 + ] + } + ], + "events": [ + { + "name": "ClaimVestedEvent", + "discriminator": [ + 21, + 194, + 114, + 87, + 120, + 211, + 226, + 32 + ] + }, + { + "name": "CreateVestingEvent", + "discriminator": [ + 150, + 152, + 11, + 179, + 52, + 210, + 191, + 125 + ] + }, + { + "name": "PoolCreateEvent", + "discriminator": [ + 151, + 215, + 226, + 9, + 118, + 161, + 115, + 174 + ] + }, + { + "name": "TradeEvent", + "discriminator": [ + 189, + 219, + 127, + 211, + 78, + 230, + 97, + 238 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "NotApproved", + "msg": "Not approved" + }, + { + "code": 6001, + "name": "InvalidOwner", + "msg": "Input account owner is not the program address" + }, + { + "code": 6002, + "name": "InvalidInput", + "msg": "InvalidInput" + }, + { + "code": 6003, + "name": "InputNotMatchCurveConfig", + "msg": "The input params are not match with curve type in config" + }, + { + "code": 6004, + "name": "ExceededSlippage", + "msg": "Exceeds desired slippage limit" + }, + { + "code": 6005, + "name": "PoolFunding", + "msg": "Pool funding" + }, + { + "code": 6006, + "name": "PoolMigrated", + "msg": "Pool migrated" + }, + { + "code": 6007, + "name": "MigrateTypeNotMatch", + "msg": "Migrate type not match" + }, + { + "code": 6008, + "name": "MathOverflow", + "msg": "Math overflow" + }, + { + "code": 6009, + "name": "NoAssetsToCollect", + "msg": "No assets to collect" + }, + { + "code": 6010, + "name": "VestingRatioTooHigh", + "msg": "Vesting ratio too high" + }, + { + "code": 6011, + "name": "VestingSettingEnded", + "msg": "Vesting setting ended" + }, + { + "code": 6012, + "name": "VestingNotStarted", + "msg": "Vesting not started" + }, + { + "code": 6013, + "name": "NoVestingSchedule", + "msg": "No vesting schedule" + }, + { + "code": 6014, + "name": "InvalidPlatformInfo", + "msg": "The platform info input is invalid" + }, + { + "code": 6015, + "name": "PoolNotMigrated", + "msg": "Pool not migrated" + }, + { + "code": 6016, + "name": "InvalidCpSwapConfig", + "msg": "The input cp swap config account is invalid" + }, + { + "code": 6017, + "name": "NoSupportExtension", + "msg": "No support extension" + }, + { + "code": 6018, + "name": "NotEnoughRemainingAccounts", + "msg": "Not enough remaining accounts" + }, + { + "code": 6019, + "name": "TransferFeeCalculateNotMatch", + "msg": "TransferFee calculate not match" + }, + { + "code": 6020, + "name": "CurveParamIsNotExist", + "msg": "Curve param is not exist" + } + ], + "types": [ + { + "name": "AmmCreatorFeeOn", + "docs": [ + "migrate to cpmm, creator fee on quote token or both token" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "QuoteToken" + }, + { + "name": "BothToken" + } + ] + } + }, + { + "name": "BondingCurveParam", + "type": { + "kind": "struct", + "fields": [ + { + "name": "migrate_type", + "docs": [ + "Migrate to AMM or CpSwap, 0: amm, 1: cpswap,", + "Neither 0 nor 1: invalid" + ], + "type": "u8" + }, + { + "name": "migrate_cpmm_fee_on", + "docs": [ + "The migrate fee on, 0 means fee on the quote token, 1 means fee on both token", + "Neither 0 nor 1: invalid" + ], + "type": "u8" + }, + { + "name": "supply", + "docs": [ + "The supply of the token,", + "0: invalid" + ], + "type": "u64" + }, + { + "name": "total_base_sell", + "docs": [ + "The total base sell of the token", + "0: invalid" + ], + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "docs": [ + "The total quote fund raising of the token", + "0: invalid" + ], + "type": "u64" + }, + { + "name": "total_locked_amount", + "docs": [ + "total amount of tokens to be unlocked", + "u64::MAX: invalid" + ], + "type": "u64" + }, + { + "name": "cliff_period", + "docs": [ + "Waiting time in seconds before unlocking after fundraising ends", + "u64::MAX: invalid" + ], + "type": "u64" + }, + { + "name": "unlock_period", + "docs": [ + "Unlocking period in seconds", + "u64::MAX: invalid" + ], + "type": "u64" + } + ] + } + }, + { + "name": "ClaimVestedEvent", + "docs": [ + "Emitted when vesting token claimed by beneficiary" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "beneficiary", + "type": "pubkey" + }, + { + "name": "claim_amount", + "type": "u64" + } + ] + } + }, + { + "name": "ConstantCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "supply", + "type": "u64" + }, + { + "name": "total_base_sell", + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "type": "u64" + }, + { + "name": "migrate_type", + "type": "u8" + } + ] + } + }, + { + "name": "CreateVestingEvent", + "docs": [ + "Emitted when vest_account created" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "beneficiary", + "type": "pubkey" + }, + { + "name": "share_amount", + "type": "u64" + } + ] + } + }, + { + "name": "CurveParams", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Constant", + "fields": [ + { + "name": "data", + "type": { + "defined": { + "name": "ConstantCurve" + } + } + } + ] + }, + { + "name": "Fixed", + "fields": [ + { + "name": "data", + "type": { + "defined": { + "name": "FixedCurve" + } + } + } + ] + }, + { + "name": "Linear", + "fields": [ + { + "name": "data", + "type": { + "defined": { + "name": "LinearCurve" + } + } + } + ] + } + ] + } + }, + { + "name": "FixedCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "supply", + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "type": "u64" + }, + { + "name": "migrate_type", + "type": "u8" + } + ] + } + }, + { + "name": "GlobalConfig", + "docs": [ + "Holds the current owner of the factory" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "Account update epoch" + ], + "type": "u64" + }, + { + "name": "curve_type", + "docs": [ + "0: Constant Product Curve", + "1: Fixed Price Curve", + "2: Linear Price Curve" + ], + "type": "u8" + }, + { + "name": "index", + "docs": [ + "Config index" + ], + "type": "u16" + }, + { + "name": "migrate_fee", + "docs": [ + "The fee of migrate to amm" + ], + "type": "u64" + }, + { + "name": "trade_fee_rate", + "docs": [ + "The trade fee rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "max_share_fee_rate", + "docs": [ + "The maximum share fee rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_base_supply", + "docs": [ + "The minimum base supply, the value without decimals" + ], + "type": "u64" + }, + { + "name": "max_lock_rate", + "docs": [ + "The maximum lock rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_base_sell_rate", + "docs": [ + "The minimum base sell rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_base_migrate_rate", + "docs": [ + "The minimum base migrate rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_quote_fund_raising", + "docs": [ + "The minimum quote fund raising, the value with decimals" + ], + "type": "u64" + }, + { + "name": "quote_mint", + "docs": [ + "Mint information for quote token" + ], + "type": "pubkey" + }, + { + "name": "protocol_fee_owner", + "docs": [ + "Protocol Fee owner" + ], + "type": "pubkey" + }, + { + "name": "migrate_fee_owner", + "docs": [ + "Migrate Fee owner" + ], + "type": "pubkey" + }, + { + "name": "migrate_to_amm_wallet", + "docs": [ + "Migrate to amm control wallet" + ], + "type": "pubkey" + }, + { + "name": "migrate_to_cpswap_wallet", + "docs": [ + "Migrate to cpswap wallet" + ], + "type": "pubkey" + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u64", + 16 + ] + } + } + ] + } + }, + { + "name": "LinearCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "supply", + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "type": "u64" + }, + { + "name": "migrate_type", + "type": "u8" + } + ] + } + }, + { + "name": "MigrateNftInfo", + "docs": [ + "Represents the parameters for initializing a platform config account(Only support MigrateType::CPSWAP)", + "# Fields", + "* `platform_scale` - Scale of the platform liquidity quantity rights will be converted into NFT", + "* `creator_scale` - Scale of the token creator liquidity quantity rights will be converted into NFT", + "* `burn_scale` - Scale of liquidity directly to burn", + "", + "* platform_scale + creator_scale + burn_scale = RATE_DENOMINATOR_VALUE" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "platform_scale", + "type": "u64" + }, + { + "name": "creator_scale", + "type": "u64" + }, + { + "name": "burn_scale", + "type": "u64" + } + ] + } + }, + { + "name": "MintParams", + "docs": [ + "Represents the parameters for initializing a new token mint", + "# Fields", + "* `decimals` - Number of decimal places for the token", + "* `name` - Name of the token", + "* `symbol` - Symbol/ticker of the token", + "* `uri` - URI pointing to token metadata" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "decimals", + "type": "u8" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + } + ] + } + }, + { + "name": "PlatformConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "The epoch for update interval" + ], + "type": "u64" + }, + { + "name": "platform_fee_wallet", + "docs": [ + "The platform fee wallet" + ], + "type": "pubkey" + }, + { + "name": "platform_nft_wallet", + "docs": [ + "The platform nft wallet to receive the platform NFT after migration if platform_scale is not 0(Only support MigrateType::CPSWAP)" + ], + "type": "pubkey" + }, + { + "name": "platform_scale", + "docs": [ + "Scale of the platform liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP)" + ], + "type": "u64" + }, + { + "name": "creator_scale", + "docs": [ + "Scale of the token creator liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP)" + ], + "type": "u64" + }, + { + "name": "burn_scale", + "docs": [ + "Scale of liquidity directly to burn" + ], + "type": "u64" + }, + { + "name": "fee_rate", + "docs": [ + "The platform fee rate" + ], + "type": "u64" + }, + { + "name": "name", + "docs": [ + "The platform name" + ], + "type": { + "array": [ + "u8", + 64 + ] + } + }, + { + "name": "web", + "docs": [ + "The platform website" + ], + "type": { + "array": [ + "u8", + 256 + ] + } + }, + { + "name": "img", + "docs": [ + "The platform img link" + ], + "type": { + "array": [ + "u8", + 256 + ] + } + }, + { + "name": "cpswap_config", + "docs": [ + "The platform specifies the trade fee rate after migration to cp swap" + ], + "type": "pubkey" + }, + { + "name": "creator_fee_rate", + "docs": [ + "Creator fee rate" + ], + "type": "u64" + }, + { + "name": "transfer_fee_extension_auth", + "docs": [ + "If the base token belongs to token2022, then you can choose to support the transferfeeConfig extension, which includes permissions such as `transfer_fee_config_authority`` and `withdraw_withheld_authority`.", + "When initializing mint, `withdraw_withheld_authority` and `transfer_fee_config_authority` both belongs to the contract.", + "Once the token is migrated to AMM, the authorities will be reset to this value" + ], + "type": "pubkey" + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u8", + 180 + ] + } + }, + { + "name": "curve_params", + "docs": [ + "The parameters for launching the pool" + ], + "type": { + "vec": { + "defined": { + "name": "PlatformCurveParam" + } + } + } + } + ] + } + }, + { + "name": "PlatformConfigInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "fee_wallet", + "type": "pubkey" + }, + { + "name": "nft_wallet", + "type": "pubkey" + }, + { + "name": "migrate_nft_info", + "type": { + "defined": { + "name": "MigrateNftInfo" + } + } + }, + { + "name": "fee_rate", + "type": "u64" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "web", + "type": "string" + }, + { + "name": "img", + "type": "string" + }, + { + "name": "transfer_fee_extension_auth", + "type": "pubkey" + }, + { + "name": "creator_fee_rate", + "type": "u64" + } + ] + } + }, + { + "name": "PlatformConfigParam", + "type": { + "kind": "enum", + "variants": [ + { + "name": "FeeWallet", + "fields": [ + "pubkey" + ] + }, + { + "name": "NFTWallet", + "fields": [ + "pubkey" + ] + }, + { + "name": "MigrateNftInfo", + "fields": [ + { + "defined": { + "name": "MigrateNftInfo" + } + } + ] + }, + { + "name": "FeeRate", + "fields": [ + "u64" + ] + }, + { + "name": "Name", + "fields": [ + "string" + ] + }, + { + "name": "Web", + "fields": [ + "string" + ] + }, + { + "name": "Img", + "fields": [ + "string" + ] + }, + { + "name": "CpSwapConfig" + }, + { + "name": "AllInfo", + "fields": [ + { + "defined": { + "name": "PlatformConfigInfo" + } + } + ] + } + ] + } + }, + { + "name": "PlatformCurveParam", + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "The epoch for update interval, 0 means not update" + ], + "type": "u64" + }, + { + "name": "index", + "docs": [ + "The curve params index" + ], + "type": "u8" + }, + { + "name": "global_config", + "docs": [ + "The global config address" + ], + "type": "pubkey" + }, + { + "name": "bonding_curve_param", + "docs": [ + "bonding curve param" + ], + "type": { + "defined": { + "name": "BondingCurveParam" + } + } + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u64", + 50 + ] + } + } + ] + } + }, + { + "name": "PlatformParams", + "docs": [ + "Represents the parameters for initializing a platform config account", + "# Fields", + "* `migrate_nft_info` - The platform configures liquidity info during migration(Only support MigrateType::CPSWAP)", + "* `fee_rate` - Fee rate of the platform", + "* `name` - Name of the platform", + "* `web` - Website of the platform", + "* `img` - Image link of the platform", + "/// * `creator_fee_rate` - The fee rate charged by the creator for each transaction." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "migrate_nft_info", + "type": { + "defined": { + "name": "MigrateNftInfo" + } + } + }, + { + "name": "fee_rate", + "type": "u64" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "web", + "type": "string" + }, + { + "name": "img", + "type": "string" + }, + { + "name": "creator_fee_rate", + "type": "u64" + } + ] + } + }, + { + "name": "PoolCreateEvent", + "docs": [ + "Emitted when pool created" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "config", + "type": "pubkey" + }, + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + }, + { + "name": "amm_fee_on", + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + } + ] + } + }, + { + "name": "PoolState", + "docs": [ + "Represents the state of a trading pool in the protocol", + "Stores all essential information about pool balances, fees, and configuration" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "Account update epoch" + ], + "type": "u64" + }, + { + "name": "auth_bump", + "docs": [ + "Bump seed used for PDA address derivation" + ], + "type": "u8" + }, + { + "name": "status", + "docs": [ + "Current status of the pool", + "* 0: Pool is funding", + "* 1: Pool funding is end, waiting for migration", + "* 2: Pool migration is done" + ], + "type": "u8" + }, + { + "name": "base_decimals", + "docs": [ + "Decimals of the pool base token" + ], + "type": "u8" + }, + { + "name": "quote_decimals", + "docs": [ + "Decimals of the pool quote token" + ], + "type": "u8" + }, + { + "name": "migrate_type", + "docs": [ + "Migrate to AMM or CpSwap, 0: amm, 1: cpswap" + ], + "type": "u8" + }, + { + "name": "supply", + "docs": [ + "Supply of the pool base token" + ], + "type": "u64" + }, + { + "name": "total_base_sell", + "docs": [ + "Total sell amount of the base token" + ], + "type": "u64" + }, + { + "name": "virtual_base", + "docs": [ + "For different curves, virtual_base and virtual_quote have different meanings", + "For constant product curve, virtual_base and virtual_quote are virtual liquidity, virtual_quote/virtual_base is the initial price", + "For linear price curve, virtual_base is the price slope parameter a, virtual_quote has no effect", + "For fixed price curve, virtual_quote/virtual_base is the initial price" + ], + "type": "u64" + }, + { + "name": "virtual_quote", + "type": "u64" + }, + { + "name": "real_base", + "docs": [ + "Actual base token amount in the pool", + "Represents the real tokens available for trading" + ], + "type": "u64" + }, + { + "name": "real_quote", + "docs": [ + "Actual quote token amount in the pool", + "Represents the real tokens available for trading" + ], + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "docs": [ + "The total quote fund raising of the pool" + ], + "type": "u64" + }, + { + "name": "quote_protocol_fee", + "docs": [ + "Accumulated trading fees in quote tokens", + "Can be collected by the protocol fee owner" + ], + "type": "u64" + }, + { + "name": "platform_fee", + "docs": [ + "Accumulated platform fees in quote tokens", + "Can be collected by the platform wallet stored in platform config" + ], + "type": "u64" + }, + { + "name": "migrate_fee", + "docs": [ + "The fee of migrate to amm" + ], + "type": "u64" + }, + { + "name": "vesting_schedule", + "docs": [ + "Vesting schedule for the base token" + ], + "type": { + "defined": { + "name": "VestingSchedule" + } + } + }, + { + "name": "global_config", + "docs": [ + "Public key of the global configuration account", + "Contains protocol-wide settings this pool adheres to" + ], + "type": "pubkey" + }, + { + "name": "platform_config", + "docs": [ + "Public key of the platform configuration account", + "Contains platform-wide settings this pool adheres to" + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "Public key of the base mint address" + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "Public key of the quote mint address" + ], + "type": "pubkey" + }, + { + "name": "base_vault", + "docs": [ + "Public key of the base token vault", + "Holds the actual base tokens owned by the pool" + ], + "type": "pubkey" + }, + { + "name": "quote_vault", + "docs": [ + "Public key of the quote token vault", + "Holds the actual quote tokens owned by the pool" + ], + "type": "pubkey" + }, + { + "name": "creator", + "docs": [ + "The creator of base token" + ], + "type": "pubkey" + }, + { + "name": "token_program_flag", + "docs": [ + "token program bits", + "bit0: base token program flag", + "0: spl_token_program", + "1: token_program_2022", + "", + "bit1: quote token program flag", + "0: spl_token_program", + "1: token_program_2022" + ], + "type": "u8" + }, + { + "name": "amm_creator_fee_on", + "docs": [ + "migrate to cpmm, creator fee on quote token or both token" + ], + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u8", + 62 + ] + } + } + ] + } + }, + { + "name": "PoolStatus", + "docs": [ + "Represents the different states a pool can be in", + "* Fund - Initial state where pool is accepting funds", + "* Migrate - Pool funding has ended and waiting for migration", + "* Trade - Pool migration is complete and amm trading is enabled" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Fund" + }, + { + "name": "Migrate" + }, + { + "name": "Trade" + } + ] + } + }, + { + "name": "TradeDirection", + "docs": [ + "Specifies the direction of a trade in the bonding curve", + "This is important because curves can treat tokens differently through weights or offsets" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Buy" + }, + { + "name": "Sell" + } + ] + } + }, + { + "name": "TradeEvent", + "docs": [ + "Emitted when trade process" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "total_base_sell", + "type": "u64" + }, + { + "name": "virtual_base", + "type": "u64" + }, + { + "name": "virtual_quote", + "type": "u64" + }, + { + "name": "real_base_before", + "type": "u64" + }, + { + "name": "real_quote_before", + "type": "u64" + }, + { + "name": "real_base_after", + "type": "u64" + }, + { + "name": "real_quote_after", + "type": "u64" + }, + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "protocol_fee", + "type": "u64" + }, + { + "name": "platform_fee", + "type": "u64" + }, + { + "name": "creator_fee", + "type": "u64" + }, + { + "name": "share_fee", + "type": "u64" + }, + { + "name": "trade_direction", + "type": { + "defined": { + "name": "TradeDirection" + } + } + }, + { + "name": "pool_status", + "type": { + "defined": { + "name": "PoolStatus" + } + } + }, + { + "name": "exact_in", + "type": "bool" + } + ] + } + }, + { + "name": "TransferFeeExtensionParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "transfer_fee_basis_points", + "docs": [ + "denominator is 10000, currently, this value cannot exceed 5%, which is 500." + ], + "type": "u16" + }, + { + "name": "maximum_fee", + "docs": [ + "Maximum fee on each transfers, the value must exceed supply * transfer_fee_basis_points / 10000" + ], + "type": "u64" + } + ] + } + }, + { + "name": "VestingParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "total_locked_amount", + "type": "u64" + }, + { + "name": "cliff_period", + "type": "u64" + }, + { + "name": "unlock_period", + "type": "u64" + } + ] + } + }, + { + "name": "VestingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "Account update epoch" + ], + "type": "u64" + }, + { + "name": "pool", + "docs": [ + "The pool state account" + ], + "type": "pubkey" + }, + { + "name": "beneficiary", + "docs": [ + "The beneficiary of the vesting account" + ], + "type": "pubkey" + }, + { + "name": "claimed_amount", + "docs": [ + "The amount of tokens claimed" + ], + "type": "u64" + }, + { + "name": "token_share_amount", + "docs": [ + "The share amount of the token to be vested" + ], + "type": "u64" + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u64", + 8 + ] + } + } + ] + } + }, + { + "name": "VestingSchedule", + "type": { + "kind": "struct", + "fields": [ + { + "name": "total_locked_amount", + "type": "u64" + }, + { + "name": "cliff_period", + "type": "u64" + }, + { + "name": "unlock_period", + "type": "u64" + }, + { + "name": "start_time", + "type": "u64" + }, + { + "name": "allocated_share_amount", + "docs": [ + "Total allocated share amount of the base token, not greater than total_locked_amount" + ], + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/idl/bitquery/raydium/raydium_amm.json b/idl/bitquery/raydium/raydium_amm.json new file mode 100644 index 0000000..291f168 --- /dev/null +++ b/idl/bitquery/raydium/raydium_amm.json @@ -0,0 +1,2401 @@ +{ + "version": "0.3.0", + "name": "raydium_amm", + "instructions": [ + { + "name": "initialize", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "coinMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "pcMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTargetOrdersAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLpTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userWallet", + "isMut": true, + "isSigner": true + } + ], + "args": [ + { + "name": "nonce", + "type": "u8" + }, + { + "name": "openTime", + "type": "u64" + } + ] + }, + { + "name": "initialize2", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "splAssociatedTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false + }, + { + "name": "coinMint", + "isMut": false, + "isSigner": false + }, + { + "name": "pcMint", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLp", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userWallet", + "isMut": true, + "isSigner": true + }, + { + "name": "userTokenCoin", + "isMut": true, + "isSigner": false + }, + { + "name": "userTokenPc", + "isMut": true, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "nonce", + "type": "u8" + }, + { + "name": "openTime", + "type": "u64" + }, + { + "name": "initPcAmount", + "type": "u64" + }, + { + "name": "initCoinAmount", + "type": "u64" + } + ] + }, + { + "name": "monitorStep", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "clock", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "serumReqQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "planOrderLimit", + "type": "u16" + }, + { + "name": "placeOrderLimit", + "type": "u16" + }, + { + "name": "cancelOrderLimit", + "type": "u16" + } + ] + }, + { + "name": "deposit", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": false, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userOwner", + "isMut": false, + "isSigner": true + }, + { + "name": "serumEventQueue", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "maxCoinAmount", + "type": "u64" + }, + { + "name": "maxPcAmount", + "type": "u64" + }, + { + "name": "baseSide", + "type": "u64" + } + ] + }, + { + "name": "withdraw", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userOwner", + "isMut": false, + "isSigner": true + }, + { + "name": "serumEventQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "migrateToOpenBook", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTokenCoin", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTokenPc", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "newAmmOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "newSerumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "newSerumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "admin", + "isMut": true, + "isSigner": true + } + ], + "args": [] + }, + { + "name": "setParams", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "ammPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAdminAccount", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "value", + "type": { + "option": "u64" + } + }, + { + "name": "newPubkey", + "type": { + "option": "publicKey" + } + }, + { + "name": "fees", + "type": { + "option": { + "defined": "Fees" + } + } + }, + { + "name": "lastOrderDistance", + "type": { + "option": { + "defined": "LastOrderDistance" + } + } + }, + { + "name": "needTakeAmounts", + "type": { + "option": { + "defined": "NeedTake" + } + } + } + ] + }, + { + "name": "withdrawPnl", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "coinPnlTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "pcPnlTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "pnlOwnerAccount", + "isMut": false, + "isSigner": true + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": false, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + } + ], + "args": [] + }, + { + "name": "withdrawSrm", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOwnerAccount", + "isMut": false, + "isSigner": true + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "srmToken", + "isMut": true, + "isSigner": false + }, + { + "name": "destSrmToken", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "swapBaseIn", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceOwner", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + }, + { + "name": "preInitialize", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "coinMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "pcMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userWallet", + "isMut": true, + "isSigner": true + } + ], + "args": [ + { + "name": "nonce", + "type": "u8" + } + ] + }, + { + "name": "swapBaseOut", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceOwner", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "maxAmountIn", + "type": "u64" + }, + { + "name": "amountOut", + "type": "u64" + } + ] + }, + { + "name": "simulateInfo", + "accounts": [ + { + "name": "amm", + "isMut": false, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "swapBaseInValue", + "type": { + "option": { + "defined": "SwapInstructionBaseIn" + } + } + }, + { + "name": "swapBaseOutValue", + "type": { + "option": { + "defined": "SwapInstructionBaseOut" + } + } + } + ] + }, + { + "name": "adminCancelOrders", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": false, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "ammOwnerAccount", + "isMut": false, + "isSigner": true + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "serumEventQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "limit", + "type": "u16" + } + ] + }, + { + "name": "createConfigAccount", + "accounts": [ + { + "name": "admin", + "isMut": true, + "isSigner": true + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + } + ], + "args": [] + }, + { + "name": "updateConfigAccount", + "accounts": [ + { + "name": "admin", + "isMut": false, + "isSigner": true + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "owner", + "type": "publicKey" + } + ] + }, + { + "name": "swapBaseInV2", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "ammPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userWalletAccount", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + }, + { + "name": "swapBaseOutV2", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "ammPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userWalletAccount", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "maxAmountIn", + "type": "u64" + }, + { + "name": "amountOut", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "TargetOrders", + "type": { + "kind": "struct", + "fields": [ + { + "name": "owner", + "type": { + "array": ["u64", 4] + } + }, + { + "name": "buyOrders", + "type": { + "array": [ + { + "defined": "TargetOrder" + }, + 50 + ] + } + }, + { + "name": "padding1", + "type": { + "array": ["u64", 8] + } + }, + { + "name": "targetX", + "type": "u128" + }, + { + "name": "targetY", + "type": "u128" + }, + { + "name": "planXBuy", + "type": "u128" + }, + { + "name": "planYBuy", + "type": "u128" + }, + { + "name": "planXSell", + "type": "u128" + }, + { + "name": "planYSell", + "type": "u128" + }, + { + "name": "placedX", + "type": "u128" + }, + { + "name": "placedY", + "type": "u128" + }, + { + "name": "calcPnlX", + "type": "u128" + }, + { + "name": "calcPnlY", + "type": "u128" + }, + { + "name": "sellOrders", + "type": { + "array": [ + { + "defined": "TargetOrder" + }, + 50 + ] + } + }, + { + "name": "padding2", + "type": { + "array": ["u64", 6] + } + }, + { + "name": "replaceBuyClientId", + "type": { + "array": ["u64", 10] + } + }, + { + "name": "replaceSellClientId", + "type": { + "array": ["u64", 10] + } + }, + { + "name": "lastOrderNumerator", + "type": "u64" + }, + { + "name": "lastOrderDenominator", + "type": "u64" + }, + { + "name": "planOrdersCur", + "type": "u64" + }, + { + "name": "placeOrdersCur", + "type": "u64" + }, + { + "name": "validBuyOrderNum", + "type": "u64" + }, + { + "name": "validSellOrderNum", + "type": "u64" + }, + { + "name": "padding3", + "type": { + "array": ["u64", 10] + } + }, + { + "name": "freeSlotBits", + "type": "u128" + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minSeparateNumerator", + "type": "u64" + }, + { + "name": "minSeparateDenominator", + "type": "u64" + }, + { + "name": "tradeFeeNumerator", + "type": "u64" + }, + { + "name": "tradeFeeDenominator", + "type": "u64" + }, + { + "name": "pnlNumerator", + "type": "u64" + }, + { + "name": "pnlDenominator", + "type": "u64" + }, + { + "name": "swapFeeNumerator", + "type": "u64" + }, + { + "name": "swapFeeDenominator", + "type": "u64" + } + ] + } + }, + { + "name": "AmmInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "status", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "orderNum", + "type": "u64" + }, + { + "name": "depth", + "type": "u64" + }, + { + "name": "coinDecimals", + "type": "u64" + }, + { + "name": "pcDecimals", + "type": "u64" + }, + { + "name": "state", + "type": "u64" + }, + { + "name": "resetFlag", + "type": "u64" + }, + { + "name": "minSize", + "type": "u64" + }, + { + "name": "volMaxCutRatio", + "type": "u64" + }, + { + "name": "amountWave", + "type": "u64" + }, + { + "name": "coinLotSize", + "type": "u64" + }, + { + "name": "pcLotSize", + "type": "u64" + }, + { + "name": "minPriceMultiplier", + "type": "u64" + }, + { + "name": "maxPriceMultiplier", + "type": "u64" + }, + { + "name": "sysDecimalValue", + "type": "u64" + }, + { + "name": "fees", + "type": { + "defined": "Fees" + } + }, + { + "name": "outPut", + "type": { + "defined": "OutPutData" + } + }, + { + "name": "tokenCoin", + "type": "publicKey" + }, + { + "name": "tokenPc", + "type": "publicKey" + }, + { + "name": "coinMint", + "type": "publicKey" + }, + { + "name": "pcMint", + "type": "publicKey" + }, + { + "name": "lpMint", + "type": "publicKey" + }, + { + "name": "openOrders", + "type": "publicKey" + }, + { + "name": "market", + "type": "publicKey" + }, + { + "name": "serumDex", + "type": "publicKey" + }, + { + "name": "targetOrders", + "type": "publicKey" + }, + { + "name": "withdrawQueue", + "type": "publicKey" + }, + { + "name": "tokenTempLp", + "type": "publicKey" + }, + { + "name": "ammOwner", + "type": "publicKey" + }, + { + "name": "lpAmount", + "type": "u64" + }, + { + "name": "clientOrderId", + "type": "u64" + }, + { + "name": "padding", + "type": { + "array": ["u64", 2] + } + } + ] + } + } + ], + "types": [ + { + "name": "WithdrawDestToken", + "type": { + "kind": "struct", + "fields": [ + { + "name": "withdrawAmount", + "type": "u64" + }, + { + "name": "coinAmount", + "type": "u64" + }, + { + "name": "pcAmount", + "type": "u64" + }, + { + "name": "destTokenCoin", + "type": "publicKey" + }, + { + "name": "destTokenPc", + "type": "publicKey" + } + ] + } + }, + { + "name": "WithdrawQueue", + "type": { + "kind": "struct", + "fields": [ + { + "name": "owner", + "type": { + "array": ["u64", 4] + } + }, + { + "name": "head", + "type": "u64" + }, + { + "name": "count", + "type": "u64" + }, + { + "name": "buf", + "type": { + "array": [ + { + "defined": "WithdrawDestToken" + }, + 64 + ] + } + } + ] + } + }, + { + "name": "TargetOrder", + "type": { + "kind": "struct", + "fields": [ + { + "name": "price", + "type": "u64" + }, + { + "name": "vol", + "type": "u64" + } + ] + } + }, + { + "name": "OutPutData", + "type": { + "kind": "struct", + "fields": [ + { + "name": "needTakePnlCoin", + "type": "u64" + }, + { + "name": "needTakePnlPc", + "type": "u64" + }, + { + "name": "totalPnlPc", + "type": "u64" + }, + { + "name": "totalPnlCoin", + "type": "u64" + }, + { + "name": "poolOpenTime", + "type": "u64" + }, + { + "name": "punishPcAmount", + "type": "u64" + }, + { + "name": "punishCoinAmount", + "type": "u64" + }, + { + "name": "orderbookToInitTime", + "type": "u64" + }, + { + "name": "swapCoinInAmount", + "type": "u128" + }, + { + "name": "swapPcOutAmount", + "type": "u128" + }, + { + "name": "swapTakePcFee", + "type": "u64" + }, + { + "name": "swapPcInAmount", + "type": "u128" + }, + { + "name": "swapCoinOutAmount", + "type": "u128" + }, + { + "name": "swapTakeCoinFee", + "type": "u64" + } + ] + } + }, + { + "name": "AmmConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pnlOwner", + "type": "publicKey" + }, + { + "name": "cancelOwner", + "type": "publicKey" + }, + { + "name": "pending1", + "type": { + "array": ["u64", 28] + } + }, + { + "name": "pending2", + "type": { + "array": ["u64", 32] + } + } + ] + } + }, + { + "name": "LastOrderDistance", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lastOrderNumerator", + "type": "u64" + }, + { + "name": "lastOrderDenominator", + "type": "u64" + } + ] + } + }, + { + "name": "NeedTake", + "type": { + "kind": "struct", + "fields": [ + { + "name": "needTakePc", + "type": "u64" + }, + { + "name": "needTakeCoin", + "type": "u64" + } + ] + } + }, + { + "name": "SwapInstructionBaseIn", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + } + }, + { + "name": "SwapInstructionBaseOut", + "type": { + "kind": "struct", + "fields": [ + { + "name": "maxAmountIn", + "type": "u64" + }, + { + "name": "amountOut", + "type": "u64" + } + ] + } + } + ], + "errors": [ + { + "code": 0, + "name": "AlreadyInUse", + "msg": "AlreadyInUse" + }, + { + "code": 1, + "name": "InvalidProgramAddress", + "msg": "InvalidProgramAddress" + }, + { + "code": 2, + "name": "ExpectedMint", + "msg": "ExpectedMint" + }, + { + "code": 3, + "name": "ExpectedAccount", + "msg": "ExpectedAccount" + }, + { + "code": 4, + "name": "InvalidCoinVault", + "msg": "InvalidCoinVault" + }, + { + "code": 5, + "name": "InvalidPCVault", + "msg": "InvalidPCVault" + }, + { + "code": 6, + "name": "InvalidTokenLP", + "msg": "InvalidTokenLP" + }, + { + "code": 7, + "name": "InvalidDestTokenCoin", + "msg": "InvalidDestTokenCoin" + }, + { + "code": 8, + "name": "InvalidDestTokenPC", + "msg": "InvalidDestTokenPC" + }, + { + "code": 9, + "name": "InvalidPoolMint", + "msg": "InvalidPoolMint" + }, + { + "code": 10, + "name": "InvalidOpenOrders", + "msg": "InvalidOpenOrders" + }, + { + "code": 11, + "name": "InvalidSerumMarket", + "msg": "InvalidSerumMarket" + }, + { + "code": 12, + "name": "InvalidSerumProgram", + "msg": "InvalidSerumProgram" + }, + { + "code": 13, + "name": "InvalidTargetOrders", + "msg": "InvalidTargetOrders" + }, + { + "code": 14, + "name": "InvalidWithdrawQueue", + "msg": "InvalidWithdrawQueue" + }, + { + "code": 15, + "name": "InvalidTempLp", + "msg": "InvalidTempLp" + }, + { + "code": 16, + "name": "InvalidCoinMint", + "msg": "InvalidCoinMint" + }, + { + "code": 17, + "name": "InvalidPCMint", + "msg": "InvalidPCMint" + }, + { + "code": 18, + "name": "InvalidOwner", + "msg": "InvalidOwner" + }, + { + "code": 19, + "name": "InvalidSupply", + "msg": "InvalidSupply" + }, + { + "code": 20, + "name": "InvalidDelegate", + "msg": "InvalidDelegate" + }, + { + "code": 21, + "name": "InvalidSignAccount", + "msg": "Invalid Sign Account" + }, + { + "code": 22, + "name": "InvalidStatus", + "msg": "InvalidStatus" + }, + { + "code": 23, + "name": "InvalidInstruction", + "msg": "Invalid instruction" + }, + { + "code": 24, + "name": "WrongAccountsNumber", + "msg": "Wrong accounts number" + }, + { + "code": 25, + "name": "WithdrawTransferBusy", + "msg": "Withdraw_transfer is busy" + }, + { + "code": 26, + "name": "WithdrawQueueFull", + "msg": "WithdrawQueue is full" + }, + { + "code": 27, + "name": "WithdrawQueueEmpty", + "msg": "WithdrawQueue is empty" + }, + { + "code": 28, + "name": "InvalidParamsSet", + "msg": "Params Set is invalid" + }, + { + "code": 29, + "name": "InvalidInput", + "msg": "InvalidInput" + }, + { + "code": 30, + "name": "ExceededSlippage", + "msg": "instruction exceeds desired slippage limit" + }, + { + "code": 31, + "name": "CalculationExRateFailure", + "msg": "CalculationExRateFailure" + }, + { + "code": 32, + "name": "CheckedSubOverflow", + "msg": "Checked_Sub Overflow" + }, + { + "code": 33, + "name": "CheckedAddOverflow", + "msg": "Checked_Add Overflow" + }, + { + "code": 34, + "name": "CheckedMulOverflow", + "msg": "Checked_Mul Overflow" + }, + { + "code": 35, + "name": "CheckedDivOverflow", + "msg": "Checked_Div Overflow" + }, + { + "code": 36, + "name": "CheckedEmptyFunds", + "msg": "Empty Funds" + }, + { + "code": 37, + "name": "CalcPnlError", + "msg": "Calc pnl error" + }, + { + "code": 38, + "name": "InvalidSplTokenProgram", + "msg": "InvalidSplTokenProgram" + }, + { + "code": 39, + "name": "TakePnlError", + "msg": "Take Pnl error" + }, + { + "code": 40, + "name": "InsufficientFunds", + "msg": "Insufficient funds" + }, + { + "code": 41, + "name": "ConversionFailure", + "msg": "Conversion to u64 failed with an overflow or underflow" + }, + { + "code": 42, + "name": "InvalidUserToken", + "msg": "user token input does not match amm" + }, + { + "code": 43, + "name": "InvalidSrmMint", + "msg": "InvalidSrmMint" + }, + { + "code": 44, + "name": "InvalidSrmToken", + "msg": "InvalidSrmToken" + }, + { + "code": 45, + "name": "TooManyOpenOrders", + "msg": "TooManyOpenOrders" + }, + { + "code": 46, + "name": "OrderAtSlotIsPlaced", + "msg": "OrderAtSlotIsPlaced" + }, + { + "code": 47, + "name": "InvalidSysProgramAddress", + "msg": "InvalidSysProgramAddress" + }, + { + "code": 48, + "name": "InvalidFee", + "msg": "The provided fee does not match the program owner's constraints" + }, + { + "code": 49, + "name": "RepeatCreateAmm", + "msg": "Repeat create amm about market" + }, + { + "code": 50, + "name": "NotAllowZeroLP", + "msg": "Not allow Zero LP" + }, + { + "code": 51, + "name": "InvalidCloseAuthority", + "msg": "Token account has a close authority" + }, + { + "code": 52, + "name": "InvalidFreezeAuthority", + "msg": "Pool token mint has a freeze authority" + }, + { + "code": 53, + "name": "InvalidReferPCMint", + "msg": "InvalidReferPCMint" + }, + { + "code": 54, + "name": "InvalidConfigAccount", + "msg": "InvalidConfigAccount" + }, + { + "code": 55, + "name": "RepeatCreateConfigAccount", + "msg": "Repeat create staking config account" + }, + { + "code": 56, + "name": "UnknownAmmError", + "msg": "Unknown Amm Error" + } + ], + "metadata": { + "instruction_selector_type": "index", + "address": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8" + } +} diff --git a/idl/bitquery/raydium/raydium_cp.json b/idl/bitquery/raydium/raydium_cp.json new file mode 100644 index 0000000..86958f1 --- /dev/null +++ b/idl/bitquery/raydium/raydium_cp.json @@ -0,0 +1,1093 @@ +{ + "version": "0.1.0", + "name": "raydium_cp_swap", + "metadata": { + "address": "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C" + }, + "instructions": [ + { + "name": "createAmmConfig", + "docs": [ + "# Arguments", + "", + "* `ctx`- The accounts needed by instruction.", + "* `index` - The index of amm config, there may be multiple config.", + "* `trade_fee_rate` - Trade fee rate, can be changed.", + "* `protocol_fee_rate` - The rate of protocol fee within tarde fee.", + "* `fund_fee_rate` - The rate of fund fee within tarde fee.", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": true, + "isSigner": true, + "docs": ["Address to be set as protocol owner."] + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false, + "docs": [ + "Initialize config state account to store protocol owner address and fee rates." + ] + }, + { "name": "systemProgram", "isMut": false, "isSigner": false } + ], + "args": [ + { "name": "index", "type": "u16" }, + { "name": "tradeFeeRate", "type": "u64" }, + { "name": "protocolFeeRate", "type": "u64" }, + { "name": "fundFeeRate", "type": "u64" }, + { "name": "createPoolFee", "type": "u64" } + ] + }, + { + "name": "updateAmmConfig", + "docs": [ + "Updates the owner of the amm config", + "Must be called by the current owner or admin", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `trade_fee_rate`- The new trade fee rate of amm config, be set when `param` is 0", + "* `protocol_fee_rate`- The new protocol fee rate of amm config, be set when `param` is 1", + "* `fund_fee_rate`- The new fund fee rate of amm config, be set when `param` is 2", + "* `new_owner`- The config's new owner, be set when `param` is 3", + "* `new_fund_owner`- The config's new fund owner, be set when `param` is 4", + "* `param`- The vaule can be 0 | 1 | 2 | 3 | 4, otherwise will report a error", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["The amm config owner or admin"] + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false, + "docs": ["Amm config account to be changed"] + } + ], + "args": [ + { "name": "param", "type": "u8" }, + { "name": "value", "type": "u64" } + ] + }, + { + "name": "updatePoolStatus", + "docs": [ + "Update pool status for given vaule", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `status` - The vaule of status", + "" + ], + "accounts": [ + { "name": "authority", "isMut": false, "isSigner": true }, + { "name": "poolState", "isMut": true, "isSigner": false } + ], + "args": [{ "name": "status", "type": "u8" }] + }, + { + "name": "collectProtocolFee", + "docs": [ + "Collect the protocol fee accrued to the pool", + "", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", + "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Only admin or owner can collect fee now"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Pool state stores accumulated protocol fee amount"] + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["Amm config account stores owner"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "recipientToken0Account", + "isMut": true, + "isSigner": false, + "docs": [ + "The address that receives the collected token_0 protocol fees" + ] + }, + { + "name": "recipientToken1Account", + "isMut": true, + "isSigner": false, + "docs": [ + "The address that receives the collected token_1 protocol fees" + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program to perform token transfers"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program 2022 to perform token transfers"] + } + ], + "args": [ + { "name": "amount0Requested", "type": "u64" }, + { "name": "amount1Requested", "type": "u64" } + ] + }, + { + "name": "collectFundFee", + "docs": [ + "Collect the fund fee accrued to the pool", + "", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", + "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Only admin or fund_owner can collect fee now"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Pool state stores accumulated protocol fee amount"] + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["Amm config account stores fund_owner"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "recipientToken0Account", + "isMut": true, + "isSigner": false, + "docs": ["The address that receives the collected token_0 fund fees"] + }, + { + "name": "recipientToken1Account", + "isMut": true, + "isSigner": false, + "docs": ["The address that receives the collected token_1 fund fees"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program to perform token transfers"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program 2022 to perform token transfers"] + } + ], + "args": [ + { "name": "amount0Requested", "type": "u64" }, + { "name": "amount1Requested", "type": "u64" } + ] + }, + { + "name": "initialize", + "docs": [ + "Creates a pool for the given token pair and the initial price", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `init_amount_0` - the initial amount_0 to deposit", + "* `init_amount_1` - the initial amount_1 to deposit", + "* `open_time` - the timestamp allowed for swap", + "" + ], + "accounts": [ + { + "name": "creator", + "isMut": true, + "isSigner": true, + "docs": ["Address paying to create the pool. Can be anyone"] + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["Which config the pool belongs to."] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Initialize an account to store the pool state"] + }, + { + "name": "token0Mint", + "isMut": false, + "isSigner": false, + "docs": ["Token_0 mint, the key must smaller then token_1 mint."] + }, + { + "name": "token1Mint", + "isMut": false, + "isSigner": false, + "docs": ["Token_1 mint, the key must grater then token_0 mint."] + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": ["pool lp mint"] + }, + { + "name": "creatorToken0", + "isMut": true, + "isSigner": false, + "docs": ["payer token0 account"] + }, + { + "name": "creatorToken1", + "isMut": true, + "isSigner": false, + "docs": ["creator token1 account"] + }, + { + "name": "creatorLpToken", + "isMut": true, + "isSigner": false, + "docs": ["creator lp token account"] + }, + { "name": "token0Vault", "isMut": true, "isSigner": false }, + { "name": "token1Vault", "isMut": true, "isSigner": false }, + { + "name": "createPoolFee", + "isMut": true, + "isSigner": false, + "docs": ["create pool fee account"] + }, + { + "name": "observationState", + "isMut": true, + "isSigner": false, + "docs": ["an account to store oracle observations"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["Program to create mint account and mint tokens"] + }, + { + "name": "token0Program", + "isMut": false, + "isSigner": false, + "docs": ["Spl token program or token program 2022"] + }, + { + "name": "token1Program", + "isMut": false, + "isSigner": false, + "docs": ["Spl token program or token program 2022"] + }, + { + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["Program to create an ATA for receiving position NFT"] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": ["To create a new program account"] + }, + { + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": ["Sysvar for program account"] + } + ], + "args": [ + { "name": "initAmount0", "type": "u64" }, + { "name": "initAmount1", "type": "u64" }, + { "name": "openTime", "type": "u64" } + ] + }, + { + "name": "deposit", + "docs": [ + "Creates a pool for the given token pair and the initial price", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `lp_token_amount` - Pool token amount to transfer. token_a and token_b amount are set by the current exchange rate and size of the pool", + "* `maximum_token_0_amount` - Maximum token 0 amount to deposit, prevents excessive slippage", + "* `maximum_token_1_amount` - Maximum token 1 amount to deposit, prevents excessive slippage", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Pays to mint the position"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { "name": "poolState", "isMut": true, "isSigner": false }, + { + "name": "ownerLpToken", + "isMut": true, + "isSigner": false, + "docs": ["Owner lp tokan account"] + }, + { + "name": "token0Account", + "isMut": true, + "isSigner": false, + "docs": ["The payer's token account for token_0"] + }, + { + "name": "token1Account", + "isMut": true, + "isSigner": false, + "docs": ["The payer's token account for token_1"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["token Program"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["Token program 2022"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": ["Lp token mint"] + } + ], + "args": [ + { "name": "lpTokenAmount", "type": "u64" }, + { "name": "maximumToken0Amount", "type": "u64" }, + { "name": "maximumToken1Amount", "type": "u64" } + ] + }, + { + "name": "withdraw", + "docs": [ + "Withdraw lp for token0 ande token1", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `lp_token_amount` - Amount of pool tokens to burn. User receives an output of token a and b based on the percentage of the pool tokens that are returned.", + "* `minimum_token_0_amount` - Minimum amount of token 0 to receive, prevents excessive slippage", + "* `minimum_token_1_amount` - Minimum amount of token 1 to receive, prevents excessive slippage", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Pays to mint the position"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Pool state account"] + }, + { + "name": "ownerLpToken", + "isMut": true, + "isSigner": false, + "docs": ["Owner lp token account"] + }, + { + "name": "token0Account", + "isMut": true, + "isSigner": false, + "docs": ["The owner's token account for receive token_0"] + }, + { + "name": "token1Account", + "isMut": true, + "isSigner": false, + "docs": ["The owner's token account for receive token_1"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["token Program"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["Token program 2022"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": ["Pool lp token mint"] + }, + { + "name": "memoProgram", + "isMut": false, + "isSigner": false, + "docs": ["memo program"] + } + ], + "args": [ + { "name": "lpTokenAmount", "type": "u64" }, + { "name": "minimumToken0Amount", "type": "u64" }, + { "name": "minimumToken1Amount", "type": "u64" } + ] + }, + { + "name": "swapBaseInput", + "docs": [ + "Swap the tokens in the pool base input amount", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `amount_in` - input amount to transfer, output to DESTINATION is based on the exchange rate", + "* `minimum_amount_out` - Minimum amount of output token, prevents excessive slippage", + "" + ], + "accounts": [ + { + "name": "payer", + "isMut": false, + "isSigner": true, + "docs": ["The user performing the swap"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["The factory state to read protocol fees"] + }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": [ + "The program account of the pool in which the swap will be performed" + ] + }, + { + "name": "inputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for input token"] + }, + { + "name": "outputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for output token"] + }, + { + "name": "inputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for input token"] + }, + { + "name": "outputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for output token"] + }, + { + "name": "inputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for input token transfers"] + }, + { + "name": "outputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for output token transfers"] + }, + { + "name": "inputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of input token"] + }, + { + "name": "outputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of output token"] + }, + { + "name": "observationState", + "isMut": true, + "isSigner": false, + "docs": ["The program account for the most recent oracle observation"] + } + ], + "args": [ + { "name": "amountIn", "type": "u64" }, + { "name": "minimumAmountOut", "type": "u64" } + ] + }, + { + "name": "swapBaseOutput", + "docs": [ + "Swap the tokens in the pool base output amount", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `max_amount_in` - input amount prevents excessive slippage", + "* `amount_out` - amount of output token", + "" + ], + "accounts": [ + { + "name": "payer", + "isMut": false, + "isSigner": true, + "docs": ["The user performing the swap"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["The factory state to read protocol fees"] + }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": [ + "The program account of the pool in which the swap will be performed" + ] + }, + { + "name": "inputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for input token"] + }, + { + "name": "outputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for output token"] + }, + { + "name": "inputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for input token"] + }, + { + "name": "outputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for output token"] + }, + { + "name": "inputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for input token transfers"] + }, + { + "name": "outputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for output token transfers"] + }, + { + "name": "inputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of input token"] + }, + { + "name": "outputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of output token"] + }, + { + "name": "observationState", + "isMut": true, + "isSigner": false, + "docs": ["The program account for the most recent oracle observation"] + } + ], + "args": [ + { "name": "maxAmountIn", "type": "u64" }, + { "name": "amountOut", "type": "u64" } + ] + } + ], + "accounts": [ + { + "name": "AmmConfig", + "docs": ["Holds the current owner of the factory"], + "type": { + "kind": "struct", + "fields": [ + { "name": "bump", "docs": ["Bump to identify PDA"], "type": "u8" }, + { + "name": "disableCreatePool", + "docs": ["Status to control if new pool can be create"], + "type": "bool" + }, + { "name": "index", "docs": ["Config index"], "type": "u16" }, + { + "name": "tradeFeeRate", + "docs": [ + "The trade fee, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "protocolFeeRate", + "docs": ["The protocol fee"], + "type": "u64" + }, + { + "name": "fundFeeRate", + "docs": [ + "The fund fee, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "createPoolFee", + "docs": ["Fee for create a new pool"], + "type": "u64" + }, + { + "name": "protocolOwner", + "docs": ["Address of the protocol fee owner"], + "type": "publicKey" + }, + { + "name": "fundOwner", + "docs": ["Address of the fund fee owner"], + "type": "publicKey" + }, + { + "name": "padding", + "docs": ["padding"], + "type": { "array": ["u64", 16] } + } + ] + } + }, + { + "name": "ObservationState", + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "docs": ["Whether the ObservationState is initialized"], + "type": "bool" + }, + { + "name": "observationIndex", + "docs": [ + "the most-recently updated index of the observations array" + ], + "type": "u16" + }, + { "name": "poolId", "type": "publicKey" }, + { + "name": "observations", + "docs": ["observation array"], + "type": { "array": [{ "defined": "Observation" }, 100] } + }, + { + "name": "padding", + "docs": ["padding for feature update"], + "type": { "array": ["u64", 4] } + } + ] + } + }, + { + "name": "PoolState", + "type": { + "kind": "struct", + "fields": [ + { + "name": "ammConfig", + "docs": ["Which config the pool belongs"], + "type": "publicKey" + }, + { + "name": "poolCreator", + "docs": ["pool creator"], + "type": "publicKey" + }, + { "name": "token0Vault", "docs": ["Token A"], "type": "publicKey" }, + { "name": "token1Vault", "docs": ["Token B"], "type": "publicKey" }, + { + "name": "lpMint", + "docs": [ + "Pool tokens are issued when A or B tokens are deposited.", + "Pool tokens can be withdrawn back to the original A or B token." + ], + "type": "publicKey" + }, + { + "name": "token0Mint", + "docs": ["Mint information for token A"], + "type": "publicKey" + }, + { + "name": "token1Mint", + "docs": ["Mint information for token B"], + "type": "publicKey" + }, + { + "name": "token0Program", + "docs": ["token_0 program"], + "type": "publicKey" + }, + { + "name": "token1Program", + "docs": ["token_1 program"], + "type": "publicKey" + }, + { + "name": "observationKey", + "docs": ["observation account to store oracle data"], + "type": "publicKey" + }, + { "name": "authBump", "type": "u8" }, + { + "name": "status", + "docs": [ + "Bitwise representation of the state of the pool", + "bit0, 1: disable deposit(vaule is 1), 0: normal", + "bit1, 1: disable withdraw(vaule is 2), 0: normal", + "bit2, 1: disable swap(vaule is 4), 0: normal" + ], + "type": "u8" + }, + { "name": "lpMintDecimals", "type": "u8" }, + { + "name": "mint0Decimals", + "docs": ["mint0 and mint1 decimals"], + "type": "u8" + }, + { "name": "mint1Decimals", "type": "u8" }, + { "name": "lpSupply", "docs": ["lp mint supply"], "type": "u64" }, + { + "name": "protocolFeesToken0", + "docs": [ + "The amounts of token_0 and token_1 that are owed to the liquidity provider." + ], + "type": "u64" + }, + { "name": "protocolFeesToken1", "type": "u64" }, + { "name": "fundFeesToken0", "type": "u64" }, + { "name": "fundFeesToken1", "type": "u64" }, + { + "name": "openTime", + "docs": ["The timestamp allowed for swap in the pool."], + "type": "u64" + }, + { + "name": "padding", + "docs": ["padding for future updates"], + "type": { "array": ["u64", 32] } + } + ] + } + } + ], + "types": [ + { + "name": "Observation", + "docs": ["The element of observations in ObservationState"], + "type": { + "kind": "struct", + "fields": [ + { + "name": "blockTimestamp", + "docs": ["The block timestamp of the observation"], + "type": "u64" + }, + { + "name": "cumulativeToken0PriceX32", + "docs": [ + "the cumulative of token0 price during the duration time, Q32.32, the remaining 64 bit for overflow" + ], + "type": "u128" + }, + { + "name": "cumulativeToken1PriceX32", + "docs": [ + "the cumulative of token1 price during the duration time, Q32.32, the remaining 64 bit for overflow" + ], + "type": "u128" + } + ] + } + }, + { + "name": "TradeDirection", + "docs": [ + "The direction of a trade, since curves can be specialized to treat each", + "token differently (by adding offsets or weights)" + ], + "type": { + "kind": "enum", + "variants": [{ "name": "ZeroForOne" }, { "name": "OneForZero" }] + } + }, + { + "name": "RoundDirection", + "docs": [ + "The direction to round. Used for pool token to trading token conversions to", + "avoid losing value on any deposit or withdrawal." + ], + "type": { + "kind": "enum", + "variants": [{ "name": "Floor" }, { "name": "Ceiling" }] + } + }, + { + "name": "PoolStatusBitIndex", + "type": { + "kind": "enum", + "variants": [ + { "name": "Deposit" }, + { "name": "Withdraw" }, + { "name": "Swap" } + ] + } + }, + { + "name": "PoolStatusBitFlag", + "type": { + "kind": "enum", + "variants": [{ "name": "Enable" }, { "name": "Disable" }] + } + } + ], + "events": [ + { + "name": "LpChangeEvent", + "fields": [ + { "name": "poolId", "type": "publicKey", "index": true }, + { "name": "lpAmountBefore", "type": "u64", "index": false }, + { "name": "token0VaultBefore", "type": "u64", "index": false }, + { "name": "token1VaultBefore", "type": "u64", "index": false }, + { "name": "token0Amount", "type": "u64", "index": false }, + { "name": "token1Amount", "type": "u64", "index": false }, + { "name": "token0TransferFee", "type": "u64", "index": false }, + { "name": "token1TransferFee", "type": "u64", "index": false }, + { "name": "changeType", "type": "u8", "index": false } + ] + }, + { + "name": "SwapEvent", + "fields": [ + { "name": "poolId", "type": "publicKey", "index": true }, + { "name": "inputVaultBefore", "type": "u64", "index": false }, + { "name": "outputVaultBefore", "type": "u64", "index": false }, + { "name": "inputAmount", "type": "u64", "index": false }, + { "name": "outputAmount", "type": "u64", "index": false }, + { "name": "inputTransferFee", "type": "u64", "index": false }, + { "name": "outputTransferFee", "type": "u64", "index": false }, + { "name": "baseInput", "type": "bool", "index": false } + ] + } + ], + "errors": [ + { "code": 6000, "name": "NotApproved", "msg": "Not approved" }, + { + "code": 6001, + "name": "InvalidOwner", + "msg": "Input account owner is not the program address" + }, + { "code": 6002, "name": "EmptySupply", "msg": "Input token account empty" }, + { "code": 6003, "name": "InvalidInput", "msg": "InvalidInput" }, + { + "code": 6004, + "name": "IncorrectLpMint", + "msg": "Address of the provided lp token mint is incorrect" + }, + { + "code": 6005, + "name": "ExceededSlippage", + "msg": "Exceeds desired slippage limit" + }, + { + "code": 6006, + "name": "ZeroTradingTokens", + "msg": "Given pool token amount results in zero trading tokens" + }, + { + "code": 6007, + "name": "NotSupportMint", + "msg": "Not support token_2022 mint extension" + }, + { "code": 6008, "name": "InvalidVault", "msg": "invaild vault" }, + { + "code": 6009, + "name": "InitLpAmountTooLess", + "msg": "Init lp amount is too less(Because 100 amount lp will be locked)" + } + ] +} diff --git a/idl/bonk.json b/idl/bonk.json new file mode 100644 index 0000000..1cea6fa --- /dev/null +++ b/idl/bonk.json @@ -0,0 +1,5783 @@ +{ + "address": "LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj", + "metadata": { + "name": "raydium_launchpad", + "version": "0.2.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "buy_exact_in", + "docs": [ + "Use the given amount of quote tokens to purchase base tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_in` - Amount of quote token to purchase", + "* `minimum_amount_out` - Minimum amount of base token to receive (slippage protection)", + "* `share_fee_rate` - Fee rate for the share", + "" + ], + "discriminator": [ + 250, + 234, + 13, + 123, + 213, + 156, + 19, + 236 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "minimum_amount_out", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "buy_exact_out", + "docs": [ + "Use quote tokens to purchase the given amount of base tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_out` - Amount of base token to receive", + "* `maximum_amount_in` - Maximum amount of quote token to purchase (slippage protection)", + "* `share_fee_rate` - Fee rate for the share" + ], + "discriminator": [ + 24, + 211, + 116, + 40, + 105, + 3, + 153, + 56 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "maximum_amount_in", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "claim_creator_fee", + "docs": [ + "Claim the fee from the exclusive creator fee vault.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 26, + 97, + 138, + 203, + 132, + 171, + 141, + 252 + ], + "accounts": [ + { + "name": "creator", + "docs": [ + "The pool creator" + ], + "writable": true, + "signer": true + }, + { + "name": "fee_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 102, + 101, + 101, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "creator_fee_vault", + "docs": [ + "The creator fee vault" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token" + ] + }, + { + "name": "token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "claim_platform_fee", + "docs": [ + "Claim platform fee", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 156, + 39, + 208, + 135, + 76, + 237, + 61, + 72 + ], + "accounts": [ + { + "name": "platform_fee_wallet", + "docs": [ + "Only the wallet stored in platform_config can collect platform fees" + ], + "writable": true, + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true + }, + { + "name": "platform_config", + "docs": [ + "The platform config account" + ] + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "platform_fee_wallet" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "claim_platform_fee_from_vault", + "docs": [ + "Claim the fee from the exclusive platform fee vault.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 117, + 241, + 198, + 168, + 248, + 218, + 80, + 29 + ], + "accounts": [ + { + "name": "platform_fee_wallet", + "docs": [ + "Only the wallet stored in platform_config can collect platform fees" + ], + "writable": true, + "signer": true + }, + { + "name": "fee_vault_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 102, + 101, + 101, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "platform_config", + "docs": [ + "The platform config account" + ] + }, + { + "name": "platform_fee_vault", + "docs": [ + "The platform fee vault" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "platform_config" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "platform_fee_wallet" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "claim_vested_token", + "docs": [ + "Claim vested token", + "# Arguments" + ], + "discriminator": [ + 49, + 33, + 104, + 30, + 189, + 157, + 79, + 35 + ], + "accounts": [ + { + "name": "beneficiary", + "docs": [ + "The beneficiary of the vesting account" + ], + "writable": true, + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true + }, + { + "name": "vesting_record", + "docs": [ + "The vesting record account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 101, + 115, + 116, + 105, + 110, + 103 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "beneficiary" + } + ] + } + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "user_base_token", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "beneficiary" + }, + { + "kind": "account", + "path": "base_token_program" + }, + { + "kind": "account", + "path": "base_token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_token_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "docs": [ + "Required for associated token program" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + } + ], + "args": [] + }, + { + "name": "collect_fee", + "docs": [ + "Collects accumulated fees from the pool", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 60, + 173, + 247, + 103, + 4, + 93, + 130, + 48 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "Only protocol_fee_owner saved in global_config can collect protocol fee now" + ], + "signer": true + }, + { + "name": "authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Pool state stores accumulated protocol fee amount" + ], + "writable": true + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "quote_vault", + "docs": [ + "The address that holds pool tokens for quote token" + ], + "writable": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [] + }, + { + "name": "collect_migrate_fee", + "docs": [ + "Collects migrate fees from the pool", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 255, + 186, + 150, + 223, + 235, + 118, + 201, + 186 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "Only migrate_fee_owner saved in global_config can collect migrate fee now" + ], + "signer": true + }, + { + "name": "authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Pool state stores accumulated protocol fee amount" + ], + "writable": true + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "quote_vault", + "docs": [ + "The address that holds pool tokens for quote token" + ], + "writable": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint of quote token vault" + ] + }, + { + "name": "recipient_token_account", + "docs": [ + "The address that receives the collected quote token fees" + ], + "writable": true + }, + { + "name": "token_program", + "docs": [ + "SPL program for input token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [] + }, + { + "name": "create_config", + "docs": [ + "Creates a new configuration", + "# Arguments", + "", + "* `ctx` - The accounts needed by instruction", + "* `curve_type` - The type of bonding curve (0: ConstantProduct)", + "* `index` - The index of config, there may be multiple config with the same curve type.", + "* `trade_fee_rate` - Trade fee rate, must be less than RATE_DENOMINATOR_VALUE", + "" + ], + "discriminator": [ + 201, + 207, + 243, + 114, + 75, + 111, + 47, + 189 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "The protocol owner/admin account", + "Must match the predefined admin address", + "Has authority to create and modify protocol configurations" + ], + "writable": true, + "signer": true, + "address": "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account that stores protocol-wide settings", + "PDA generated using GLOBAL_CONFIG_SEED, quote token mint, and curve type", + "Stores fee rates and protocol parameters" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 108, + 111, + 98, + 97, + 108, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "quote_token_mint" + }, + { + "kind": "arg", + "path": "curve_type" + }, + { + "kind": "arg", + "path": "index" + } + ] + } + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint address of the quote token (token used for buying)", + "This will be the standard token used for all pools with this config" + ] + }, + { + "name": "protocol_fee_owner", + "docs": [ + "Account that will receive protocol fees" + ] + }, + { + "name": "migrate_fee_owner", + "docs": [ + "Account that will receive migrate fees" + ] + }, + { + "name": "migrate_to_amm_wallet", + "docs": [ + "The control wallet address for migrating to amm" + ] + }, + { + "name": "migrate_to_cpswap_wallet", + "docs": [ + "The control wallet address for migrating to cpswap" + ] + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "curve_type", + "type": "u8" + }, + { + "name": "index", + "type": "u16" + }, + { + "name": "migrate_fee", + "type": "u64" + }, + { + "name": "trade_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "create_platform_config", + "docs": [ + "Create platform config account", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "# Fields", + "* `fee_rate` - Fee rate of the platform", + "* `name` - Name of the platform", + "* `web` - Website of the platform", + "* `img` - Image link of the platform", + "" + ], + "discriminator": [ + 176, + 90, + 196, + 175, + 253, + 113, + 220, + 20 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "writable": true, + "signer": true + }, + { + "name": "platform_fee_wallet" + }, + { + "name": "platform_nft_wallet" + }, + { + "name": "platform_config", + "docs": [ + "The platform config account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + }, + { + "name": "cpswap_config" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "transfer_fee_extension_authority" + } + ], + "args": [ + { + "name": "platform_params", + "type": { + "defined": { + "name": "PlatformParams" + } + } + } + ] + }, + { + "name": "create_vesting_account", + "docs": [ + "Create vesting account", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `share` - The share amount of base token to be vested", + "" + ], + "discriminator": [ + 129, + 178, + 2, + 13, + 217, + 172, + 230, + 218 + ], + "accounts": [ + { + "name": "creator", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "beneficiary", + "docs": [ + "The beneficiary is used to receive the allocated linear release of tokens.", + "Once this account is set, it cannot be modified, so please ensure the validity of this account,", + "otherwise, the unlocked tokens will not be claimable." + ], + "writable": true + }, + { + "name": "pool_state", + "docs": [ + "The pool state account" + ], + "writable": true + }, + { + "name": "vesting_record", + "docs": [ + "The vesting record account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 101, + 115, + 116, + 105, + 110, + 103 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "beneficiary" + } + ] + } + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "share_amount", + "type": "u64" + } + ] + }, + { + "name": "initialize", + "docs": [ + "Initializes a new trading pool", + "# Arguments", + "", + "* `ctx` - The context of accounts containing pool and token information", + "" + ], + "discriminator": [ + 175, + 175, + 109, + 31, + 13, + 152, + 155, + 237 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "creator" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform info", + "Includes settings like the fee_rate, name, web, img of the platform" + ] + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ], + "writable": true, + "signer": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)", + "Must match the quote_mint specified in global config" + ] + }, + { + "name": "base_vault", + "docs": [ + "Token account that holds the pool's base tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "quote_vault", + "docs": [ + "Token account that holds the pool's quote tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "metadata_account", + "docs": [ + "Account to store the base token's metadata", + "Created using Metaplex metadata program" + ], + "writable": true + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "metadata_program", + "docs": [ + "Metaplex Token Metadata program", + "Used to create metadata for the base token" + ], + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + } + ] + }, + { + "name": "initialize_v2", + "docs": [ + "Initializes a new trading pool", + "# Arguments", + "", + "* `ctx` - The context of accounts containing pool and token information", + "" + ], + "discriminator": [ + 67, + 153, + 175, + 39, + 218, + 16, + 38, + 32 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "creator" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform info", + "Includes settings like the fee_rate, name, web, img of the platform" + ] + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ], + "writable": true, + "signer": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)", + "Must match the quote_mint specified in global config" + ] + }, + { + "name": "base_vault", + "docs": [ + "Token account that holds the pool's base tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "quote_vault", + "docs": [ + "Token account that holds the pool's quote tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "metadata_account", + "docs": [ + "Account to store the base token's metadata", + "Created using Metaplex metadata program" + ], + "writable": true + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "metadata_program", + "docs": [ + "Metaplex Token Metadata program", + "Used to create metadata for the base token" + ], + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + }, + { + "name": "amm_fee_on", + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + } + ] + }, + { + "name": "initialize_with_token_2022", + "docs": [ + "Initializes a new trading pool with base token belongs to spl-token-2022,", + "pool created by this instruction must be migrated to cpswap after fundraising ends, i.e., curve_param.migrate_type = 1", + "# Arguments", + "", + "* `ctx` - The context of accounts containing pool and token information", + "" + ], + "discriminator": [ + 37, + 190, + 126, + 222, + 44, + 154, + 171, + 17 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The account paying for the initialization costs", + "This can be any account with sufficient SOL to cover the transaction" + ], + "writable": true, + "signer": true + }, + { + "name": "creator" + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform info", + "Includes settings like the fee_rate, name, web, img of the platform" + ] + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault and mint operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)", + "Created in this instruction with specified decimals" + ], + "writable": true, + "signer": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)", + "Must match the quote_mint specified in global config" + ] + }, + { + "name": "base_vault", + "docs": [ + "Token account that holds the pool's base tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "quote_vault", + "docs": [ + "Token account that holds the pool's quote tokens", + "PDA generated using POOL_VAULT_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool_state" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + }, + { + "name": "amm_fee_on", + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + }, + { + "name": "transfer_fee_extension_param", + "type": { + "option": { + "defined": { + "name": "TransferFeeExtensionParams" + } + } + } + } + ] + }, + { + "name": "migrate_to_amm", + "docs": [ + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 207, + 82, + 192, + 145, + 254, + 207, + 145, + 223 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "Only migrate_to_amm_wallet can migrate to cpswap pool", + "This signer must match the migrate_to_amm_wallet saved in global_config" + ], + "writable": true, + "signer": true + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)" + ] + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)" + ] + }, + { + "name": "openbook_program", + "address": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX" + }, + { + "name": "market", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "request_queue", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "event_queue", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "bids", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "asks", + "docs": [ + "Account created and asigned to openbook_program but not been initialized" + ], + "writable": true + }, + { + "name": "market_vault_signer" + }, + { + "name": "market_base_vault", + "docs": [ + "Token account that holds the market's base tokens" + ], + "writable": true + }, + { + "name": "market_quote_vault", + "docs": [ + "Token account that holds the market's quote tokens" + ], + "writable": true + }, + { + "name": "amm_program", + "address": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8" + }, + { + "name": "amm_pool", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 32, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_open_orders", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 111, + 112, + 101, + 110, + 95, + 111, + 114, + 100, + 101, + 114, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 108, + 112, + 95, + 109, + 105, + 110, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 99, + 111, + 105, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 112, + 99, + 95, + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_target_orders", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "amm_program" + }, + { + "kind": "account", + "path": "market" + }, + { + "kind": "const", + "value": [ + 116, + 97, + 114, + 103, + 101, + 116, + 95, + 97, + 115, + 115, + 111, + 99, + 105, + 97, + 116, + 101, + 100, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "amm_program" + } + } + }, + { + "name": "amm_create_fee_destination", + "writable": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "pool_lp_token", + "writable": true + }, + { + "name": "spl_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "docs": [ + "Program to create an ATA for receiving fee NFT" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + } + ], + "args": [ + { + "name": "base_lot_size", + "type": "u64" + }, + { + "name": "quote_lot_size", + "type": "u64" + }, + { + "name": "market_vault_signer_nonce", + "type": "u8" + } + ] + }, + { + "name": "migrate_to_cpswap", + "docs": [ + "# Arguments", + "", + "* `ctx` - The context of accounts", + "" + ], + "discriminator": [ + 136, + 92, + 200, + 103, + 28, + 218, + 144, + 140 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "Only migrate_to_cpswap_wallet can migrate to cpswap pool", + "This signer must match the migrate_to_cpswap_wallet saved in global_config" + ], + "writable": true, + "signer": true + }, + { + "name": "base_mint", + "docs": [ + "The mint for the base token (token being sold)" + ], + "writable": true + }, + { + "name": "quote_mint", + "docs": [ + "The mint for the quote token (token used to buy)" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "cpswap_program", + "address": "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C" + }, + { + "name": "cpswap_pool", + "docs": [ + "PDA account:", + "seeds = [", + "b\"pool\",", + "cpswap_config.key().as_ref(),", + "token_0_mint.key().as_ref(),", + "token_1_mint.key().as_ref(),", + "],", + "seeds::program = cpswap_program,", + "", + "Or random account: must be signed by cli" + ], + "writable": true + }, + { + "name": "cpswap_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 110, + 100, + 95, + 108, + 112, + 95, + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_lp_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 108, + 112, + 95, + 109, + 105, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "cpswap_config" + }, + { + "name": "cpswap_create_pool_fee", + "writable": true + }, + { + "name": "cpswap_observation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 111, + 98, + 115, + 101, + 114, + 118, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "cpswap_pool" + } + ], + "program": { + "kind": "account", + "path": "cpswap_program" + } + } + }, + { + "name": "lock_program", + "address": "LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE" + }, + { + "name": "lock_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 111, + 99, + 107, + 95, + 99, + 112, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + 95, + 115, + 101, + 101, + 100 + ] + } + ], + "program": { + "kind": "account", + "path": "lock_program" + } + } + }, + { + "name": "lock_lp_vault", + "writable": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "pool_state", + "docs": [ + "Account that stores the pool's state and parameters", + "PDA generated using POOL_SEED and both token mints" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global config account stores owner" + ] + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will be fully drained during migration" + ], + "writable": true + }, + { + "name": "pool_lp_token", + "writable": true + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for the base token", + "Must be the standard Token program" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for the quote token" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "docs": [ + "Program to create an ATA for receiving fee NFT" + ], + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "docs": [ + "Required for account creation" + ], + "address": "11111111111111111111111111111111" + }, + { + "name": "rent_program", + "docs": [ + "Required for rent exempt calculations" + ], + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "metadata_program", + "docs": [ + "Program to create NFT metadata accunt" + ], + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + } + ], + "args": [] + }, + { + "name": "remove_platform_curve_param", + "docs": [ + "Remove platform launch param", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `index` - The index of the curve param to remove", + "" + ], + "discriminator": [ + 27, + 30, + 62, + 169, + 93, + 224, + 24, + 145 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "signer": true + }, + { + "name": "platform_config", + "docs": [ + "Platform config account to be changed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + } + ], + "args": [ + { + "name": "index", + "type": "u8" + } + ] + }, + { + "name": "sell_exact_in", + "docs": [ + "Use the given amount of base tokens to sell for quote tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_in` - Amount of base token to sell", + "* `minimum_amount_out` - Minimum amount of quote token to receive (slippage protection)", + "* `share_fee_rate` - Fee rate for the share", + "" + ], + "discriminator": [ + 149, + 39, + 222, + 155, + 211, + 124, + 152, + 26 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "minimum_amount_out", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "sell_exact_out", + "docs": [ + "Sell base tokens for the given amount of quote tokens.", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_out` - Amount of quote token to receive", + "* `maximum_amount_in` - Maximum amount of base token to purchase (slippage protection)", + "* `share_fee_rate` - Fee rate for the share", + "" + ], + "discriminator": [ + 95, + 200, + 71, + 34, + 8, + 9, + 11, + 166 + ], + "accounts": [ + { + "name": "payer", + "docs": [ + "The user performing the swap operation", + "Must sign the transaction and pay for fees" + ], + "signer": true + }, + { + "name": "authority", + "docs": [ + "PDA that acts as the authority for pool vault operations", + "Generated using AUTH_SEED" + ], + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116, + 95, + 97, + 117, + 116, + 104, + 95, + 115, + 101, + 101, + 100 + ] + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Used to read protocol fee rates and curve type" + ] + }, + { + "name": "platform_config", + "docs": [ + "Platform configuration account containing platform-wide settings", + "Used to read platform fee rate" + ] + }, + { + "name": "pool_state", + "docs": [ + "The pool state account where the swap will be performed", + "Contains current pool parameters and balances" + ], + "writable": true + }, + { + "name": "user_base_token", + "docs": [ + "The user's token account for base tokens (tokens being bought)", + "Will receive the output tokens after the swap" + ], + "writable": true + }, + { + "name": "user_quote_token", + "docs": [ + "The user's token account for quote tokens (tokens being sold)", + "Will be debited for the input amount" + ], + "writable": true + }, + { + "name": "base_vault", + "docs": [ + "The pool's vault for base tokens", + "Will be debited to send tokens to the user" + ], + "writable": true + }, + { + "name": "quote_vault", + "docs": [ + "The pool's vault for quote tokens", + "Will receive the input tokens from the user" + ], + "writable": true + }, + { + "name": "base_token_mint", + "docs": [ + "The mint of the base token", + "Used for transfer fee calculations if applicable" + ] + }, + { + "name": "quote_token_mint", + "docs": [ + "The mint of the quote token" + ] + }, + { + "name": "base_token_program", + "docs": [ + "SPL Token program for base token transfers" + ] + }, + { + "name": "quote_token_program", + "docs": [ + "SPL Token program for quote token transfers" + ], + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "maximum_amount_in", + "type": "u64" + }, + { + "name": "share_fee_rate", + "type": "u64" + } + ] + }, + { + "name": "update_config", + "docs": [ + "Updates configuration parameters", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `param` - Parameter to update:", + "- 0: Update trade_fee_rate", + "- 1: Update fee owner", + "* `value` - New value for the selected parameter", + "" + ], + "discriminator": [ + 29, + 158, + 252, + 191, + 10, + 83, + 219, + 99 + ], + "accounts": [ + { + "name": "owner", + "docs": [ + "The global config owner or admin" + ], + "signer": true, + "address": "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ" + }, + { + "name": "global_config", + "docs": [ + "Global config account to be changed" + ], + "writable": true + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "value", + "type": "u64" + } + ] + }, + { + "name": "update_platform_config", + "docs": [ + "Update platform config", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `param` - Parameter to update", + "" + ], + "discriminator": [ + 195, + 60, + 76, + 129, + 146, + 45, + 67, + 143 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "signer": true + }, + { + "name": "platform_config", + "docs": [ + "Platform config account to be changed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + } + ], + "args": [ + { + "name": "param", + "type": { + "defined": { + "name": "PlatformConfigParam" + } + } + } + ] + }, + { + "name": "update_platform_curve_param", + "docs": [ + "Update platform launch param", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `bonding_curve_param` - Parameter to update", + "" + ], + "discriminator": [ + 138, + 144, + 138, + 250, + 220, + 128, + 4, + 57 + ], + "accounts": [ + { + "name": "platform_admin", + "docs": [ + "The account paying for the initialization costs" + ], + "writable": true, + "signer": true + }, + { + "name": "platform_config", + "docs": [ + "Platform config account to be changed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 108, + 97, + 116, + 102, + 111, + 114, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "platform_admin" + } + ] + } + }, + { + "name": "global_config", + "docs": [ + "Global configuration account containing protocol-wide settings", + "Includes settings like quote token mint and fee parameters" + ] + }, + { + "name": "system_program", + "docs": [ + "System program for lamport transfers" + ], + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "index", + "type": "u8" + }, + { + "name": "bonding_curve_param", + "type": { + "defined": { + "name": "BondingCurveParam" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "GlobalConfig", + "discriminator": [ + 149, + 8, + 156, + 202, + 160, + 252, + 176, + 217 + ] + }, + { + "name": "PlatformConfig", + "discriminator": [ + 160, + 78, + 128, + 0, + 248, + 83, + 230, + 160 + ] + }, + { + "name": "PoolState", + "discriminator": [ + 247, + 237, + 227, + 245, + 215, + 195, + 222, + 70 + ] + }, + { + "name": "VestingRecord", + "discriminator": [ + 106, + 243, + 221, + 205, + 230, + 126, + 85, + 83 + ] + } + ], + "events": [ + { + "name": "ClaimVestedEvent", + "discriminator": [ + 21, + 194, + 114, + 87, + 120, + 211, + 226, + 32 + ] + }, + { + "name": "CreateVestingEvent", + "discriminator": [ + 150, + 152, + 11, + 179, + 52, + 210, + 191, + 125 + ] + }, + { + "name": "PoolCreateEvent", + "discriminator": [ + 151, + 215, + 226, + 9, + 118, + 161, + 115, + 174 + ] + }, + { + "name": "TradeEvent", + "discriminator": [ + 189, + 219, + 127, + 211, + 78, + 230, + 97, + 238 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "NotApproved", + "msg": "Not approved" + }, + { + "code": 6001, + "name": "InvalidOwner", + "msg": "Input account owner is not the program address" + }, + { + "code": 6002, + "name": "InvalidInput", + "msg": "InvalidInput" + }, + { + "code": 6003, + "name": "InputNotMatchCurveConfig", + "msg": "The input params are not match with curve type in config" + }, + { + "code": 6004, + "name": "ExceededSlippage", + "msg": "Exceeds desired slippage limit" + }, + { + "code": 6005, + "name": "PoolFunding", + "msg": "Pool funding" + }, + { + "code": 6006, + "name": "PoolMigrated", + "msg": "Pool migrated" + }, + { + "code": 6007, + "name": "MigrateTypeNotMatch", + "msg": "Migrate type not match" + }, + { + "code": 6008, + "name": "MathOverflow", + "msg": "Math overflow" + }, + { + "code": 6009, + "name": "NoAssetsToCollect", + "msg": "No assets to collect" + }, + { + "code": 6010, + "name": "VestingRatioTooHigh", + "msg": "Vesting ratio too high" + }, + { + "code": 6011, + "name": "VestingSettingEnded", + "msg": "Vesting setting ended" + }, + { + "code": 6012, + "name": "VestingNotStarted", + "msg": "Vesting not started" + }, + { + "code": 6013, + "name": "NoVestingSchedule", + "msg": "No vesting schedule" + }, + { + "code": 6014, + "name": "InvalidPlatformInfo", + "msg": "The platform info input is invalid" + }, + { + "code": 6015, + "name": "PoolNotMigrated", + "msg": "Pool not migrated" + }, + { + "code": 6016, + "name": "InvalidCpSwapConfig", + "msg": "The input cp swap config account is invalid" + }, + { + "code": 6017, + "name": "NoSupportExtension", + "msg": "No support extension" + }, + { + "code": 6018, + "name": "NotEnoughRemainingAccounts", + "msg": "Not enough remaining accounts" + }, + { + "code": 6019, + "name": "TransferFeeCalculateNotMatch", + "msg": "TransferFee calculate not match" + }, + { + "code": 6020, + "name": "CurveParamIsNotExist", + "msg": "Curve param is not exist" + } + ], + "types": [ + { + "name": "AmmCreatorFeeOn", + "docs": [ + "migrate to cpmm, creator fee on quote token or both token" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "QuoteToken" + }, + { + "name": "BothToken" + } + ] + } + }, + { + "name": "BondingCurveParam", + "type": { + "kind": "struct", + "fields": [ + { + "name": "migrate_type", + "docs": [ + "Migrate to AMM or CpSwap, 0: amm, 1: cpswap,", + "Neither 0 nor 1: invalid" + ], + "type": "u8" + }, + { + "name": "migrate_cpmm_fee_on", + "docs": [ + "The migrate fee on, 0 means fee on the quote token, 1 means fee on both token", + "Neither 0 nor 1: invalid" + ], + "type": "u8" + }, + { + "name": "supply", + "docs": [ + "The supply of the token,", + "0: invalid" + ], + "type": "u64" + }, + { + "name": "total_base_sell", + "docs": [ + "The total base sell of the token", + "0: invalid" + ], + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "docs": [ + "The total quote fund raising of the token", + "0: invalid" + ], + "type": "u64" + }, + { + "name": "total_locked_amount", + "docs": [ + "total amount of tokens to be unlocked", + "u64::MAX: invalid" + ], + "type": "u64" + }, + { + "name": "cliff_period", + "docs": [ + "Waiting time in seconds before unlocking after fundraising ends", + "u64::MAX: invalid" + ], + "type": "u64" + }, + { + "name": "unlock_period", + "docs": [ + "Unlocking period in seconds", + "u64::MAX: invalid" + ], + "type": "u64" + } + ] + } + }, + { + "name": "ClaimVestedEvent", + "docs": [ + "Emitted when vesting token claimed by beneficiary" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "beneficiary", + "type": "pubkey" + }, + { + "name": "claim_amount", + "type": "u64" + } + ] + } + }, + { + "name": "ConstantCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "supply", + "type": "u64" + }, + { + "name": "total_base_sell", + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "type": "u64" + }, + { + "name": "migrate_type", + "type": "u8" + } + ] + } + }, + { + "name": "CreateVestingEvent", + "docs": [ + "Emitted when vest_account created" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "beneficiary", + "type": "pubkey" + }, + { + "name": "share_amount", + "type": "u64" + } + ] + } + }, + { + "name": "CurveParams", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Constant", + "fields": [ + { + "name": "data", + "type": { + "defined": { + "name": "ConstantCurve" + } + } + } + ] + }, + { + "name": "Fixed", + "fields": [ + { + "name": "data", + "type": { + "defined": { + "name": "FixedCurve" + } + } + } + ] + }, + { + "name": "Linear", + "fields": [ + { + "name": "data", + "type": { + "defined": { + "name": "LinearCurve" + } + } + } + ] + } + ] + } + }, + { + "name": "FixedCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "supply", + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "type": "u64" + }, + { + "name": "migrate_type", + "type": "u8" + } + ] + } + }, + { + "name": "GlobalConfig", + "docs": [ + "Holds the current owner of the factory" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "Account update epoch" + ], + "type": "u64" + }, + { + "name": "curve_type", + "docs": [ + "0: Constant Product Curve", + "1: Fixed Price Curve", + "2: Linear Price Curve" + ], + "type": "u8" + }, + { + "name": "index", + "docs": [ + "Config index" + ], + "type": "u16" + }, + { + "name": "migrate_fee", + "docs": [ + "The fee of migrate to amm" + ], + "type": "u64" + }, + { + "name": "trade_fee_rate", + "docs": [ + "The trade fee rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "max_share_fee_rate", + "docs": [ + "The maximum share fee rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_base_supply", + "docs": [ + "The minimum base supply, the value without decimals" + ], + "type": "u64" + }, + { + "name": "max_lock_rate", + "docs": [ + "The maximum lock rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_base_sell_rate", + "docs": [ + "The minimum base sell rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_base_migrate_rate", + "docs": [ + "The minimum base migrate rate, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "min_quote_fund_raising", + "docs": [ + "The minimum quote fund raising, the value with decimals" + ], + "type": "u64" + }, + { + "name": "quote_mint", + "docs": [ + "Mint information for quote token" + ], + "type": "pubkey" + }, + { + "name": "protocol_fee_owner", + "docs": [ + "Protocol Fee owner" + ], + "type": "pubkey" + }, + { + "name": "migrate_fee_owner", + "docs": [ + "Migrate Fee owner" + ], + "type": "pubkey" + }, + { + "name": "migrate_to_amm_wallet", + "docs": [ + "Migrate to amm control wallet" + ], + "type": "pubkey" + }, + { + "name": "migrate_to_cpswap_wallet", + "docs": [ + "Migrate to cpswap wallet" + ], + "type": "pubkey" + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u64", + 16 + ] + } + } + ] + } + }, + { + "name": "LinearCurve", + "type": { + "kind": "struct", + "fields": [ + { + "name": "supply", + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "type": "u64" + }, + { + "name": "migrate_type", + "type": "u8" + } + ] + } + }, + { + "name": "MigrateNftInfo", + "docs": [ + "Represents the parameters for initializing a platform config account(Only support MigrateType::CPSWAP)", + "# Fields", + "* `platform_scale` - Scale of the platform liquidity quantity rights will be converted into NFT", + "* `creator_scale` - Scale of the token creator liquidity quantity rights will be converted into NFT", + "* `burn_scale` - Scale of liquidity directly to burn", + "", + "* platform_scale + creator_scale + burn_scale = RATE_DENOMINATOR_VALUE" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "platform_scale", + "type": "u64" + }, + { + "name": "creator_scale", + "type": "u64" + }, + { + "name": "burn_scale", + "type": "u64" + } + ] + } + }, + { + "name": "MintParams", + "docs": [ + "Represents the parameters for initializing a new token mint", + "# Fields", + "* `decimals` - Number of decimal places for the token", + "* `name` - Name of the token", + "* `symbol` - Symbol/ticker of the token", + "* `uri` - URI pointing to token metadata" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "decimals", + "type": "u8" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + } + ] + } + }, + { + "name": "PlatformConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "The epoch for update interval" + ], + "type": "u64" + }, + { + "name": "platform_fee_wallet", + "docs": [ + "The platform fee wallet" + ], + "type": "pubkey" + }, + { + "name": "platform_nft_wallet", + "docs": [ + "The platform nft wallet to receive the platform NFT after migration if platform_scale is not 0(Only support MigrateType::CPSWAP)" + ], + "type": "pubkey" + }, + { + "name": "platform_scale", + "docs": [ + "Scale of the platform liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP)" + ], + "type": "u64" + }, + { + "name": "creator_scale", + "docs": [ + "Scale of the token creator liquidity quantity rights will be converted into NFT(Only support MigrateType::CPSWAP)" + ], + "type": "u64" + }, + { + "name": "burn_scale", + "docs": [ + "Scale of liquidity directly to burn" + ], + "type": "u64" + }, + { + "name": "fee_rate", + "docs": [ + "The platform fee rate" + ], + "type": "u64" + }, + { + "name": "name", + "docs": [ + "The platform name" + ], + "type": { + "array": [ + "u8", + 64 + ] + } + }, + { + "name": "web", + "docs": [ + "The platform website" + ], + "type": { + "array": [ + "u8", + 256 + ] + } + }, + { + "name": "img", + "docs": [ + "The platform img link" + ], + "type": { + "array": [ + "u8", + 256 + ] + } + }, + { + "name": "cpswap_config", + "docs": [ + "The platform specifies the trade fee rate after migration to cp swap" + ], + "type": "pubkey" + }, + { + "name": "creator_fee_rate", + "docs": [ + "Creator fee rate" + ], + "type": "u64" + }, + { + "name": "transfer_fee_extension_auth", + "docs": [ + "If the base token belongs to token2022, then you can choose to support the transferfeeConfig extension, which includes permissions such as `transfer_fee_config_authority`` and `withdraw_withheld_authority`.", + "When initializing mint, `withdraw_withheld_authority` and `transfer_fee_config_authority` both belongs to the contract.", + "Once the token is migrated to AMM, the authorities will be reset to this value" + ], + "type": "pubkey" + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u8", + 180 + ] + } + }, + { + "name": "curve_params", + "docs": [ + "The parameters for launching the pool" + ], + "type": { + "vec": { + "defined": { + "name": "PlatformCurveParam" + } + } + } + } + ] + } + }, + { + "name": "PlatformConfigInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "fee_wallet", + "type": "pubkey" + }, + { + "name": "nft_wallet", + "type": "pubkey" + }, + { + "name": "migrate_nft_info", + "type": { + "defined": { + "name": "MigrateNftInfo" + } + } + }, + { + "name": "fee_rate", + "type": "u64" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "web", + "type": "string" + }, + { + "name": "img", + "type": "string" + }, + { + "name": "transfer_fee_extension_auth", + "type": "pubkey" + }, + { + "name": "creator_fee_rate", + "type": "u64" + } + ] + } + }, + { + "name": "PlatformConfigParam", + "type": { + "kind": "enum", + "variants": [ + { + "name": "FeeWallet", + "fields": [ + "pubkey" + ] + }, + { + "name": "NFTWallet", + "fields": [ + "pubkey" + ] + }, + { + "name": "MigrateNftInfo", + "fields": [ + { + "defined": { + "name": "MigrateNftInfo" + } + } + ] + }, + { + "name": "FeeRate", + "fields": [ + "u64" + ] + }, + { + "name": "Name", + "fields": [ + "string" + ] + }, + { + "name": "Web", + "fields": [ + "string" + ] + }, + { + "name": "Img", + "fields": [ + "string" + ] + }, + { + "name": "CpSwapConfig" + }, + { + "name": "AllInfo", + "fields": [ + { + "defined": { + "name": "PlatformConfigInfo" + } + } + ] + } + ] + } + }, + { + "name": "PlatformCurveParam", + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "The epoch for update interval, 0 means not update" + ], + "type": "u64" + }, + { + "name": "index", + "docs": [ + "The curve params index" + ], + "type": "u8" + }, + { + "name": "global_config", + "docs": [ + "The global config address" + ], + "type": "pubkey" + }, + { + "name": "bonding_curve_param", + "docs": [ + "bonding curve param" + ], + "type": { + "defined": { + "name": "BondingCurveParam" + } + } + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u64", + 50 + ] + } + } + ] + } + }, + { + "name": "PlatformParams", + "docs": [ + "Represents the parameters for initializing a platform config account", + "# Fields", + "* `migrate_nft_info` - The platform configures liquidity info during migration(Only support MigrateType::CPSWAP)", + "* `fee_rate` - Fee rate of the platform", + "* `name` - Name of the platform", + "* `web` - Website of the platform", + "* `img` - Image link of the platform", + "/// * `creator_fee_rate` - The fee rate charged by the creator for each transaction." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "migrate_nft_info", + "type": { + "defined": { + "name": "MigrateNftInfo" + } + } + }, + { + "name": "fee_rate", + "type": "u64" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "web", + "type": "string" + }, + { + "name": "img", + "type": "string" + }, + { + "name": "creator_fee_rate", + "type": "u64" + } + ] + } + }, + { + "name": "PoolCreateEvent", + "docs": [ + "Emitted when pool created" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "config", + "type": "pubkey" + }, + { + "name": "base_mint_param", + "type": { + "defined": { + "name": "MintParams" + } + } + }, + { + "name": "curve_param", + "type": { + "defined": { + "name": "CurveParams" + } + } + }, + { + "name": "vesting_param", + "type": { + "defined": { + "name": "VestingParams" + } + } + }, + { + "name": "amm_fee_on", + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + } + ] + } + }, + { + "name": "PoolState", + "docs": [ + "Represents the state of a trading pool in the protocol", + "Stores all essential information about pool balances, fees, and configuration" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "Account update epoch" + ], + "type": "u64" + }, + { + "name": "auth_bump", + "docs": [ + "Bump seed used for PDA address derivation" + ], + "type": "u8" + }, + { + "name": "status", + "docs": [ + "Current status of the pool", + "* 0: Pool is funding", + "* 1: Pool funding is end, waiting for migration", + "* 2: Pool migration is done" + ], + "type": "u8" + }, + { + "name": "base_decimals", + "docs": [ + "Decimals of the pool base token" + ], + "type": "u8" + }, + { + "name": "quote_decimals", + "docs": [ + "Decimals of the pool quote token" + ], + "type": "u8" + }, + { + "name": "migrate_type", + "docs": [ + "Migrate to AMM or CpSwap, 0: amm, 1: cpswap" + ], + "type": "u8" + }, + { + "name": "supply", + "docs": [ + "Supply of the pool base token" + ], + "type": "u64" + }, + { + "name": "total_base_sell", + "docs": [ + "Total sell amount of the base token" + ], + "type": "u64" + }, + { + "name": "virtual_base", + "docs": [ + "For different curves, virtual_base and virtual_quote have different meanings", + "For constant product curve, virtual_base and virtual_quote are virtual liquidity, virtual_quote/virtual_base is the initial price", + "For linear price curve, virtual_base is the price slope parameter a, virtual_quote has no effect", + "For fixed price curve, virtual_quote/virtual_base is the initial price" + ], + "type": "u64" + }, + { + "name": "virtual_quote", + "type": "u64" + }, + { + "name": "real_base", + "docs": [ + "Actual base token amount in the pool", + "Represents the real tokens available for trading" + ], + "type": "u64" + }, + { + "name": "real_quote", + "docs": [ + "Actual quote token amount in the pool", + "Represents the real tokens available for trading" + ], + "type": "u64" + }, + { + "name": "total_quote_fund_raising", + "docs": [ + "The total quote fund raising of the pool" + ], + "type": "u64" + }, + { + "name": "quote_protocol_fee", + "docs": [ + "Accumulated trading fees in quote tokens", + "Can be collected by the protocol fee owner" + ], + "type": "u64" + }, + { + "name": "platform_fee", + "docs": [ + "Accumulated platform fees in quote tokens", + "Can be collected by the platform wallet stored in platform config" + ], + "type": "u64" + }, + { + "name": "migrate_fee", + "docs": [ + "The fee of migrate to amm" + ], + "type": "u64" + }, + { + "name": "vesting_schedule", + "docs": [ + "Vesting schedule for the base token" + ], + "type": { + "defined": { + "name": "VestingSchedule" + } + } + }, + { + "name": "global_config", + "docs": [ + "Public key of the global configuration account", + "Contains protocol-wide settings this pool adheres to" + ], + "type": "pubkey" + }, + { + "name": "platform_config", + "docs": [ + "Public key of the platform configuration account", + "Contains platform-wide settings this pool adheres to" + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "Public key of the base mint address" + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "Public key of the quote mint address" + ], + "type": "pubkey" + }, + { + "name": "base_vault", + "docs": [ + "Public key of the base token vault", + "Holds the actual base tokens owned by the pool" + ], + "type": "pubkey" + }, + { + "name": "quote_vault", + "docs": [ + "Public key of the quote token vault", + "Holds the actual quote tokens owned by the pool" + ], + "type": "pubkey" + }, + { + "name": "creator", + "docs": [ + "The creator of base token" + ], + "type": "pubkey" + }, + { + "name": "token_program_flag", + "docs": [ + "token program bits", + "bit0: base token program flag", + "0: spl_token_program", + "1: token_program_2022", + "", + "bit1: quote token program flag", + "0: spl_token_program", + "1: token_program_2022" + ], + "type": "u8" + }, + { + "name": "amm_creator_fee_on", + "docs": [ + "migrate to cpmm, creator fee on quote token or both token" + ], + "type": { + "defined": { + "name": "AmmCreatorFeeOn" + } + } + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u8", + 62 + ] + } + } + ] + } + }, + { + "name": "PoolStatus", + "docs": [ + "Represents the different states a pool can be in", + "* Fund - Initial state where pool is accepting funds", + "* Migrate - Pool funding has ended and waiting for migration", + "* Trade - Pool migration is complete and amm trading is enabled" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Fund" + }, + { + "name": "Migrate" + }, + { + "name": "Trade" + } + ] + } + }, + { + "name": "TradeDirection", + "docs": [ + "Specifies the direction of a trade in the bonding curve", + "This is important because curves can treat tokens differently through weights or offsets" + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Buy" + }, + { + "name": "Sell" + } + ] + } + }, + { + "name": "TradeEvent", + "docs": [ + "Emitted when trade process" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_state", + "type": "pubkey" + }, + { + "name": "total_base_sell", + "type": "u64" + }, + { + "name": "virtual_base", + "type": "u64" + }, + { + "name": "virtual_quote", + "type": "u64" + }, + { + "name": "real_base_before", + "type": "u64" + }, + { + "name": "real_quote_before", + "type": "u64" + }, + { + "name": "real_base_after", + "type": "u64" + }, + { + "name": "real_quote_after", + "type": "u64" + }, + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "protocol_fee", + "type": "u64" + }, + { + "name": "platform_fee", + "type": "u64" + }, + { + "name": "creator_fee", + "type": "u64" + }, + { + "name": "share_fee", + "type": "u64" + }, + { + "name": "trade_direction", + "type": { + "defined": { + "name": "TradeDirection" + } + } + }, + { + "name": "pool_status", + "type": { + "defined": { + "name": "PoolStatus" + } + } + }, + { + "name": "exact_in", + "type": "bool" + } + ] + } + }, + { + "name": "TransferFeeExtensionParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "transfer_fee_basis_points", + "docs": [ + "denominator is 10000, currently, this value cannot exceed 5%, which is 500." + ], + "type": "u16" + }, + { + "name": "maximum_fee", + "docs": [ + "Maximum fee on each transfers, the value must exceed supply * transfer_fee_basis_points / 10000" + ], + "type": "u64" + } + ] + } + }, + { + "name": "VestingParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "total_locked_amount", + "type": "u64" + }, + { + "name": "cliff_period", + "type": "u64" + }, + { + "name": "unlock_period", + "type": "u64" + } + ] + } + }, + { + "name": "VestingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "epoch", + "docs": [ + "Account update epoch" + ], + "type": "u64" + }, + { + "name": "pool", + "docs": [ + "The pool state account" + ], + "type": "pubkey" + }, + { + "name": "beneficiary", + "docs": [ + "The beneficiary of the vesting account" + ], + "type": "pubkey" + }, + { + "name": "claimed_amount", + "docs": [ + "The amount of tokens claimed" + ], + "type": "u64" + }, + { + "name": "token_share_amount", + "docs": [ + "The share amount of the token to be vested" + ], + "type": "u64" + }, + { + "name": "padding", + "docs": [ + "padding for future updates" + ], + "type": { + "array": [ + "u64", + 8 + ] + } + } + ] + } + }, + { + "name": "VestingSchedule", + "type": { + "kind": "struct", + "fields": [ + { + "name": "total_locked_amount", + "type": "u64" + }, + { + "name": "cliff_period", + "type": "u64" + }, + { + "name": "unlock_period", + "type": "u64" + }, + { + "name": "start_time", + "type": "u64" + }, + { + "name": "allocated_share_amount", + "docs": [ + "Total allocated share amount of the base token, not greater than total_locked_amount" + ], + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/idl/meteora_damm_v2.json b/idl/meteora_damm_v2.json new file mode 100644 index 0000000..3425ca2 --- /dev/null +++ b/idl/meteora_damm_v2.json @@ -0,0 +1,2697 @@ +{ + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG", + "metadata": { "name": "cp_amm", "version": "0.1.6", "spec": "0.1.0", "description": "Created with Anchor" }, + "instructions": [ + { + "name": "add_liquidity", + "discriminator": [181, 157, 89, 67, 143, 182, 52, 72], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "AddLiquidityParameters" } } }] + }, + { + "name": "claim_partner_fee", + "discriminator": [97, 206, 39, 105, 94, 94, 126, 148], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { "name": "token_a_account", "docs": ["The treasury token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The treasury token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "partner", "signer": true, "relations": ["pool"] }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "max_amount_a", "type": "u64" }, + { "name": "max_amount_b", "type": "u64" } + ] + }, + { + "name": "claim_position_fee", + "discriminator": [180, 38, 154, 17, 133, 33, 162, 211], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "claim_protocol_fee", + "discriminator": [165, 228, 133, 48, 99, 249, 255, 33], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { + "name": "token_a_account", + "docs": ["The treasury token a account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 48, 9, 89, 123, 106, 114, 131, 251, 50, 173, 254, 250, 10, 80, 160, 84, 143, 100, + 81, 249, 134, 112, 30, 213, 50, 166, 239, 78, 53, 175, 188, 85 + ] + }, + { "kind": "account", "path": "token_a_program" }, + { "kind": "account", "path": "token_a_mint" } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "token_b_account", + "docs": ["The treasury token b account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 48, 9, 89, 123, 106, 114, 131, 251, 50, 173, 254, 250, 10, 80, 160, 84, 143, 100, + 81, 249, 134, 112, 30, 213, 50, 166, 239, 78, 53, 175, 188, 85 + ] + }, + { "kind": "account", "path": "token_b_program" }, + { "kind": "account", "path": "token_b_mint" } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { "name": "operator", "docs": ["Claim fee operator"] }, + { "name": "whitelisted_address", "docs": ["Operator"], "signer": true, "relations": ["operator"] }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "max_amount_a", "type": "u64" }, + { "name": "max_amount_b", "type": "u64" } + ] + }, + { + "name": "claim_reward", + "discriminator": [149, 95, 181, 242, 94, 90, 158, 162], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "reward_vault", "docs": ["The vault token account for reward token"], "writable": true }, + { "name": "reward_mint" }, + { "name": "user_token_account", "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_program" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "skip_reward", "type": "u8" } + ] + }, + { + "name": "close_config", + "discriminator": [145, 9, 72, 157, 95, 125, 61, 85], + "accounts": [ + { "name": "config", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "rent_receiver", "writable": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "close_operator_account", + "discriminator": [171, 9, 213, 74, 120, 23, 3, 29], + "accounts": [ + { "name": "operator", "writable": true }, + { "name": "admin", "signer": true }, + { "name": "rent_receiver", "writable": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "close_position", + "discriminator": [123, 134, 81, 0, 49, 68, 98, 98], + "accounts": [ + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"], "writable": true }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "rent_receiver", "writable": true }, + { "name": "owner", "docs": ["Owner of position"], "signer": true }, + { + "name": "token_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "close_token_badge", + "discriminator": [108, 146, 86, 110, 179, 254, 10, 104], + "accounts": [ + { "name": "token_badge", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "rent_receiver", "writable": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "create_config", + "docs": ["OPERATOR FUNCTIONS /////"], + "discriminator": [201, 207, 243, 114, 75, 111, 47, 189], + "accounts": [ + { + "name": "config", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [99, 111, 110, 102, 105, 103] }, + { "kind": "arg", "path": "index" } + ] + } + }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "index", "type": "u64" }, + { "name": "config_parameters", "type": { "defined": { "name": "StaticConfigParameters" } } } + ] + }, + { + "name": "create_dynamic_config", + "discriminator": [81, 251, 122, 78, 66, 57, 208, 82], + "accounts": [ + { + "name": "config", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [99, 111, 110, 102, 105, 103] }, + { "kind": "arg", "path": "index" } + ] + } + }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "index", "type": "u64" }, + { "name": "config_parameters", "type": { "defined": { "name": "DynamicConfigParameters" } } } + ] + }, + { + "name": "create_operator_account", + "docs": ["ADMIN FUNCTIONS /////"], + "discriminator": [221, 64, 246, 149, 240, 153, 229, 163], + "accounts": [ + { + "name": "operator", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [111, 112, 101, 114, 97, 116, 111, 114] }, + { "kind": "account", "path": "whitelisted_address" } + ] + } + }, + { "name": "whitelisted_address" }, + { "name": "admin", "signer": true }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "permission", "type": "u128" }] + }, + { + "name": "create_position", + "discriminator": [48, 215, 197, 153, 96, 203, 180, 133], + "accounts": [ + { "name": "owner" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "pool", "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { + "name": "payer", + "docs": ["Address paying to create the position. Can be anyone"], + "writable": true, + "signer": true + }, + { + "name": "token_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "create_token_badge", + "discriminator": [88, 206, 0, 91, 60, 175, 151, 118], + "accounts": [ + { + "name": "token_badge", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 98, 97, 100, 103, 101] }, + { "kind": "account", "path": "token_mint" } + ] + } + }, + { "name": "token_mint" }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [] + }, + { + "name": "dummy_ix", + "discriminator": [234, 95, 176, 185, 7, 42, 35, 159], + "accounts": [ + { "name": "pod_aligned_fee_time_scheduler" }, + { "name": "pod_aligned_fee_rate_limiter" }, + { "name": "pod_aligned_fee_market_cap_scheduler" } + ], + "args": [{ "name": "_ixs", "type": { "defined": { "name": "DummyParams" } } }] + }, + { + "name": "fund_reward", + "discriminator": [188, 50, 249, 165, 93, 151, 38, 63], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "reward_vault", "writable": true }, + { "name": "reward_mint" }, + { "name": "funder_token_account", "writable": true }, + { "name": "funder", "signer": true }, + { "name": "token_program" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "amount", "type": "u64" }, + { "name": "carry_forward", "type": "bool" } + ] + }, + { + "name": "initialize_customizable_pool", + "discriminator": [20, 161, 241, 24, 189, 221, 180, 2], + "accounts": [ + { "name": "creator" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { + "name": "payer", + "docs": ["Address paying to create the pool. Can be anyone"], + "writable": true, + "signer": true + }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Initialize an account to store the pool state"], "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "token_a_mint", "docs": ["Token a mint"] }, + { "name": "token_b_mint", "docs": ["Token b mint"] }, + { + "name": "token_a_vault", + "docs": ["Token a vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_a_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { + "name": "token_b_vault", + "docs": ["Token b vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_b_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { "name": "payer_token_a", "docs": ["payer token a account"], "writable": true }, + { "name": "payer_token_b", "docs": ["creator token b account"], "writable": true }, + { "name": "token_a_program", "docs": ["Program to create mint account and mint tokens"] }, + { "name": "token_b_program", "docs": ["Program to create mint account and mint tokens"] }, + { + "name": "token_2022_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "InitializeCustomizablePoolParameters" } } }] + }, + { + "name": "initialize_pool", + "docs": ["USER FUNCTIONS ////"], + "discriminator": [95, 180, 10, 172, 84, 174, 232, 40], + "accounts": [ + { "name": "creator" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { + "name": "payer", + "docs": ["Address paying to create the pool. Can be anyone"], + "writable": true, + "signer": true + }, + { "name": "config", "docs": ["Which config the pool belongs to."] }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Initialize an account to store the pool state"], "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "token_a_mint", "docs": ["Token a mint"] }, + { "name": "token_b_mint", "docs": ["Token b mint"] }, + { + "name": "token_a_vault", + "docs": ["Token a vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_a_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { + "name": "token_b_vault", + "docs": ["Token b vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_b_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { "name": "payer_token_a", "docs": ["payer token a account"], "writable": true }, + { "name": "payer_token_b", "docs": ["creator token b account"], "writable": true }, + { "name": "token_a_program", "docs": ["Program to create mint account and mint tokens"] }, + { "name": "token_b_program", "docs": ["Program to create mint account and mint tokens"] }, + { + "name": "token_2022_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "InitializePoolParameters" } } }] + }, + { + "name": "initialize_pool_with_dynamic_config", + "discriminator": [149, 82, 72, 197, 253, 252, 68, 15], + "accounts": [ + { "name": "creator" }, + { "name": "position_nft_mint", "docs": ["position_nft_mint"], "writable": true, "signer": true }, + { + "name": "position_nft_account", + "docs": ["position nft account"], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, + 110, 116 + ] + }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { + "name": "payer", + "docs": ["Address paying to create the pool. Can be anyone"], + "writable": true, + "signer": true + }, + { "name": "pool_creator_authority", "signer": true, "relations": ["config"] }, + { "name": "config", "docs": ["Which config the pool belongs to."] }, + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Initialize an account to store the pool state"], "writable": true }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [112, 111, 115, 105, 116, 105, 111, 110] }, + { "kind": "account", "path": "position_nft_mint" } + ] + } + }, + { "name": "token_a_mint", "docs": ["Token a mint"] }, + { "name": "token_b_mint", "docs": ["Token b mint"] }, + { + "name": "token_a_vault", + "docs": ["Token a vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_a_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { + "name": "token_b_vault", + "docs": ["Token b vault for the pool"], + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "token_b_mint" }, + { "kind": "account", "path": "pool" } + ] + } + }, + { "name": "payer_token_a", "docs": ["payer token a account"], "writable": true }, + { "name": "payer_token_b", "docs": ["creator token b account"], "writable": true }, + { "name": "token_a_program", "docs": ["Program to create mint account and mint tokens"] }, + { "name": "token_b_program", "docs": ["Program to create mint account and mint tokens"] }, + { + "name": "token_2022_program", + "docs": ["Program to create NFT mint/token account and transfer for token22 account"], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "InitializeCustomizablePoolParameters" } } }] + }, + { + "name": "initialize_reward", + "discriminator": [95, 135, 192, 196, 242, 129, 230, 68], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { + "name": "reward_vault", + "writable": true, + "pda": { + "seeds": [ + { "kind": "const", "value": [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116] }, + { "kind": "account", "path": "pool" }, + { "kind": "arg", "path": "reward_index" } + ] + } + }, + { "name": "reward_mint" }, + { "name": "signer", "signer": true }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "token_program" }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "reward_duration", "type": "u64" }, + { "name": "funder", "type": "pubkey" } + ] + }, + { + "name": "lock_position", + "discriminator": [227, 62, 2, 252, 247, 10, 171, 185], + "accounts": [ + { "name": "pool", "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "vesting", "writable": true, "signer": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "payer", "writable": true, "signer": true }, + { "name": "system_program", "address": "11111111111111111111111111111111" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "VestingParameters" } } }] + }, + { + "name": "permanent_lock_position", + "discriminator": [165, 176, 125, 6, 231, 171, 186, 213], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "permanent_lock_liquidity", "type": "u128" }] + }, + { + "name": "refresh_vesting", + "discriminator": [9, 94, 216, 14, 116, 204, 247, 0], + "accounts": [ + { "name": "pool", "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner" } + ], + "args": [] + }, + { + "name": "remove_all_liquidity", + "discriminator": [10, 51, 61, 35, 112, 105, 24, 85], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "token_a_amount_threshold", "type": "u64" }, + { "name": "token_b_amount_threshold", "type": "u64" } + ] + }, + { + "name": "remove_liquidity", + "discriminator": [80, 85, 209, 72, 24, 206, 177, 108], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true, "relations": ["position"] }, + { "name": "position", "writable": true }, + { "name": "token_a_account", "docs": ["The user token a account"], "writable": true }, + { "name": "token_b_account", "docs": ["The user token b account"], "writable": true }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"], "relations": ["pool"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"], "relations": ["pool"] }, + { "name": "position_nft_account", "docs": ["The token account for nft"] }, + { "name": "owner", "docs": ["owner of position"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "RemoveLiquidityParameters" } } }] + }, + { + "name": "set_pool_status", + "discriminator": [112, 87, 135, 223, 83, 204, 132, 53], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "status", "type": "u8" }] + }, + { + "name": "split_position", + "discriminator": [172, 241, 221, 138, 161, 29, 253, 42], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["first_position", "second_position"] }, + { "name": "first_position", "docs": ["The first position"], "writable": true }, + { "name": "first_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "second_position", "docs": ["The second position"], "writable": true }, + { "name": "second_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "first_owner", "docs": ["Owner of first position"], "signer": true }, + { "name": "second_owner", "docs": ["Owner of second position"], "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "SplitPositionParameters" } } }] + }, + { + "name": "split_position2", + "discriminator": [221, 147, 228, 207, 140, 212, 17, 119], + "accounts": [ + { "name": "pool", "writable": true, "relations": ["first_position", "second_position"] }, + { "name": "first_position", "docs": ["The first position"], "writable": true }, + { "name": "first_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "second_position", "docs": ["The second position"], "writable": true }, + { "name": "second_position_nft_account", "docs": ["The token account for position nft"] }, + { "name": "first_owner", "docs": ["Owner of first position"], "signer": true }, + { "name": "second_owner", "docs": ["Owner of second position"], "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "numerator", "type": "u32" }] + }, + { + "name": "swap", + "discriminator": [248, 198, 158, 145, 225, 117, 135, 200], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Pool account"], "writable": true }, + { "name": "input_token_account", "docs": ["The user token account for input token"], "writable": true }, + { + "name": "output_token_account", + "docs": ["The user token account for output token"], + "writable": true + }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"] }, + { "name": "payer", "docs": ["The user performing the swap"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "referral_token_account", + "docs": ["referral token account"], + "writable": true, + "optional": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "_params", "type": { "defined": { "name": "SwapParameters" } } }] + }, + { + "name": "swap2", + "discriminator": [65, 75, 63, 76, 235, 91, 91, 136], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "docs": ["Pool account"], "writable": true }, + { "name": "input_token_account", "docs": ["The user token account for input token"], "writable": true }, + { + "name": "output_token_account", + "docs": ["The user token account for output token"], + "writable": true + }, + { + "name": "token_a_vault", + "docs": ["The vault token account for input token"], + "writable": true, + "relations": ["pool"] + }, + { + "name": "token_b_vault", + "docs": ["The vault token account for output token"], + "writable": true, + "relations": ["pool"] + }, + { "name": "token_a_mint", "docs": ["The mint of token a"] }, + { "name": "token_b_mint", "docs": ["The mint of token b"] }, + { "name": "payer", "docs": ["The user performing the swap"], "signer": true }, + { "name": "token_a_program", "docs": ["Token a program"] }, + { "name": "token_b_program", "docs": ["Token b program"] }, + { + "name": "referral_token_account", + "docs": ["referral token account"], + "writable": true, + "optional": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "_params", "type": { "defined": { "name": "SwapParameters2" } } }] + }, + { + "name": "update_pool_fees", + "discriminator": [118, 217, 203, 179, 60, 8, 70, 89], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "operator" }, + { "name": "whitelisted_address", "signer": true, "relations": ["operator"] }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "params", "type": { "defined": { "name": "UpdatePoolFeesParameters" } } }] + }, + { + "name": "update_reward_duration", + "discriminator": [138, 174, 196, 169, 213, 235, 254, 107], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "signer", "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "new_duration", "type": "u64" } + ] + }, + { + "name": "update_reward_funder", + "discriminator": [211, 28, 48, 32, 215, 160, 35, 23], + "accounts": [ + { "name": "pool", "writable": true }, + { "name": "signer", "signer": true }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [ + { "name": "reward_index", "type": "u8" }, + { "name": "new_funder", "type": "pubkey" } + ] + }, + { + "name": "withdraw_ineligible_reward", + "discriminator": [148, 206, 42, 195, 247, 49, 103, 8], + "accounts": [ + { "name": "pool_authority", "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, + { "name": "pool", "writable": true }, + { "name": "reward_vault", "writable": true }, + { "name": "reward_mint" }, + { "name": "funder_token_account", "writable": true }, + { "name": "funder", "signer": true }, + { "name": "token_program" }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121 + ] + } + ] + } + }, + { "name": "program" } + ], + "args": [{ "name": "reward_index", "type": "u8" }] + } + ], + "accounts": [ + { "name": "Config", "discriminator": [155, 12, 170, 224, 30, 250, 204, 130] }, + { "name": "Operator", "discriminator": [219, 31, 188, 145, 69, 139, 204, 117] }, + { "name": "PodAlignedFeeMarketCapScheduler", "discriminator": [251, 130, 208, 253, 245, 27, 145, 203] }, + { "name": "PodAlignedFeeRateLimiter", "discriminator": [160, 219, 8, 251, 179, 7, 16, 117] }, + { "name": "PodAlignedFeeTimeScheduler", "discriminator": [239, 132, 138, 213, 67, 154, 130, 70] }, + { "name": "Pool", "discriminator": [241, 154, 109, 4, 17, 177, 109, 188] }, + { "name": "Position", "discriminator": [170, 188, 143, 228, 122, 64, 247, 208] }, + { "name": "TokenBadge", "discriminator": [116, 219, 204, 229, 249, 116, 255, 150] }, + { "name": "Vesting", "discriminator": [100, 149, 66, 138, 95, 200, 128, 241] } + ], + "events": [ + { "name": "EvtClaimPartnerFee", "discriminator": [118, 99, 77, 10, 226, 1, 1, 87] }, + { "name": "EvtClaimPositionFee", "discriminator": [198, 182, 183, 52, 97, 12, 49, 56] }, + { "name": "EvtClaimProtocolFee", "discriminator": [186, 244, 75, 251, 188, 13, 25, 33] }, + { "name": "EvtClaimReward", "discriminator": [218, 86, 147, 200, 235, 188, 215, 231] }, + { "name": "EvtCloseConfig", "discriminator": [36, 30, 239, 45, 58, 132, 14, 5] }, + { "name": "EvtClosePosition", "discriminator": [20, 145, 144, 68, 143, 142, 214, 178] }, + { "name": "EvtCreateConfig", "discriminator": [131, 207, 180, 174, 180, 73, 165, 54] }, + { "name": "EvtCreateDynamicConfig", "discriminator": [231, 197, 13, 164, 248, 213, 133, 152] }, + { "name": "EvtCreatePosition", "discriminator": [156, 15, 119, 198, 29, 181, 221, 55] }, + { "name": "EvtCreateTokenBadge", "discriminator": [141, 120, 134, 116, 34, 28, 114, 160] }, + { "name": "EvtFundReward", "discriminator": [104, 233, 237, 122, 199, 191, 121, 85] }, + { "name": "EvtInitializePool", "discriminator": [228, 50, 246, 85, 203, 66, 134, 37] }, + { "name": "EvtInitializeReward", "discriminator": [129, 91, 188, 3, 246, 52, 185, 249] }, + { "name": "EvtLiquidityChange", "discriminator": [197, 171, 78, 127, 224, 211, 87, 13] }, + { "name": "EvtLockPosition", "discriminator": [168, 63, 108, 83, 219, 82, 2, 200] }, + { "name": "EvtPermanentLockPosition", "discriminator": [145, 143, 162, 218, 218, 80, 67, 11] }, + { "name": "EvtSetPoolStatus", "discriminator": [100, 213, 74, 3, 95, 91, 228, 146] }, + { "name": "EvtSplitPosition2", "discriminator": [165, 32, 203, 174, 72, 100, 233, 103] }, + { "name": "EvtSwap2", "discriminator": [189, 66, 51, 168, 38, 80, 117, 153] }, + { "name": "EvtUpdatePoolFees", "discriminator": [76, 165, 246, 102, 102, 217, 156, 44] }, + { "name": "EvtUpdateRewardDuration", "discriminator": [149, 135, 65, 231, 129, 153, 65, 57] }, + { "name": "EvtUpdateRewardFunder", "discriminator": [76, 154, 208, 13, 40, 115, 246, 146] }, + { "name": "EvtWithdrawIneligibleReward", "discriminator": [248, 215, 184, 78, 31, 180, 179, 168] } + ], + "errors": [ + { "code": 6000, "name": "MathOverflow", "msg": "Math operation overflow" }, + { "code": 6001, "name": "InvalidFee", "msg": "Invalid fee setup" }, + { "code": 6002, "name": "ExceededSlippage", "msg": "Exceeded slippage tolerance" }, + { "code": 6003, "name": "PoolDisabled", "msg": "Pool disabled" }, + { "code": 6004, "name": "ExceedMaxFeeBps", "msg": "Exceeded max fee bps" }, + { "code": 6005, "name": "InvalidAdmin", "msg": "Invalid admin" }, + { "code": 6006, "name": "AmountIsZero", "msg": "Amount is zero" }, + { "code": 6007, "name": "TypeCastFailed", "msg": "Type cast error" }, + { "code": 6008, "name": "UnableToModifyActivationPoint", "msg": "Unable to modify activation point" }, + { "code": 6009, "name": "InvalidAuthorityToCreateThePool", "msg": "Invalid authority to create the pool" }, + { "code": 6010, "name": "InvalidActivationType", "msg": "Invalid activation type" }, + { "code": 6011, "name": "InvalidActivationPoint", "msg": "Invalid activation point" }, + { "code": 6012, "name": "InvalidQuoteMint", "msg": "Quote token must be SOL,USDC" }, + { "code": 6013, "name": "InvalidFeeCurve", "msg": "Invalid fee curve" }, + { "code": 6014, "name": "InvalidPriceRange", "msg": "Invalid Price Range" }, + { "code": 6015, "name": "PriceRangeViolation", "msg": "Trade is over price range" }, + { "code": 6016, "name": "InvalidParameters", "msg": "Invalid parameters" }, + { "code": 6017, "name": "InvalidCollectFeeMode", "msg": "Invalid collect fee mode" }, + { "code": 6018, "name": "InvalidInput", "msg": "Invalid input" }, + { + "code": 6019, + "name": "CannotCreateTokenBadgeOnSupportedMint", + "msg": "Cannot create token badge on supported mint" + }, + { "code": 6020, "name": "InvalidTokenBadge", "msg": "Invalid token badge" }, + { "code": 6021, "name": "InvalidMinimumLiquidity", "msg": "Invalid minimum liquidity" }, + { "code": 6022, "name": "InvalidVestingInfo", "msg": "Invalid vesting information" }, + { "code": 6023, "name": "InsufficientLiquidity", "msg": "Insufficient liquidity" }, + { "code": 6024, "name": "InvalidVestingAccount", "msg": "Invalid vesting account" }, + { "code": 6025, "name": "InvalidPoolStatus", "msg": "Invalid pool status" }, + { "code": 6026, "name": "UnsupportNativeMintToken2022", "msg": "Unsupported native mint token2022" }, + { "code": 6027, "name": "InvalidRewardIndex", "msg": "Invalid reward index" }, + { "code": 6028, "name": "InvalidRewardDuration", "msg": "Invalid reward duration" }, + { "code": 6029, "name": "RewardInitialized", "msg": "Reward already initialized" }, + { "code": 6030, "name": "RewardUninitialized", "msg": "Reward not initialized" }, + { "code": 6031, "name": "InvalidRewardVault", "msg": "Invalid reward vault" }, + { "code": 6032, "name": "MustWithdrawnIneligibleReward", "msg": "Must withdraw ineligible reward" }, + { "code": 6033, "name": "IdenticalRewardDuration", "msg": "Reward duration is the same" }, + { "code": 6034, "name": "RewardCampaignInProgress", "msg": "Reward campaign in progress" }, + { "code": 6035, "name": "IdenticalFunder", "msg": "Identical funder" }, + { "code": 6036, "name": "InvalidFunder", "msg": "Invalid funder" }, + { "code": 6037, "name": "RewardNotEnded", "msg": "Reward not ended" }, + { "code": 6038, "name": "FeeInverseIsIncorrect", "msg": "Fee inverse is incorrect" }, + { "code": 6039, "name": "PositionIsNotEmpty", "msg": "Position is not empty" }, + { "code": 6040, "name": "InvalidPoolCreatorAuthority", "msg": "Invalid pool creator authority" }, + { "code": 6041, "name": "InvalidConfigType", "msg": "Invalid config type" }, + { "code": 6042, "name": "InvalidPoolCreator", "msg": "Invalid pool creator" }, + { + "code": 6043, + "name": "RewardVaultFrozenSkipRequired", + "msg": "Reward vault is frozen, must skip reward to proceed" + }, + { "code": 6044, "name": "InvalidSplitPositionParameters", "msg": "Invalid parameters for split position" }, + { + "code": 6045, + "name": "UnsupportPositionHasVestingLock", + "msg": "Unsupported split position has vesting lock" + }, + { "code": 6046, "name": "SamePosition", "msg": "Same position" }, + { "code": 6047, "name": "InvalidBaseFeeMode", "msg": "Invalid base fee mode" }, + { "code": 6048, "name": "InvalidFeeRateLimiter", "msg": "Invalid fee rate limiter" }, + { + "code": 6049, + "name": "FailToValidateSingleSwapInstruction", + "msg": "Fail to validate single swap instruction in rate limiter" + }, + { "code": 6050, "name": "InvalidFeeTimeScheduler", "msg": "Invalid fee scheduler" }, + { "code": 6051, "name": "UndeterminedError", "msg": "Undetermined error" }, + { "code": 6052, "name": "InvalidPoolVersion", "msg": "Invalid pool version" }, + { "code": 6053, "name": "InvalidAuthority", "msg": "Invalid authority to do that action" }, + { "code": 6054, "name": "InvalidPermission", "msg": "Invalid permission" }, + { "code": 6055, "name": "InvalidFeeMarketCapScheduler", "msg": "Invalid fee market cap scheduler" }, + { "code": 6056, "name": "CannotUpdateBaseFee", "msg": "Cannot update base fee" }, + { "code": 6057, "name": "InvalidDynamicFeeParameters", "msg": "Invalid dynamic fee parameters" }, + { "code": 6058, "name": "InvalidUpdatePoolFeesParameters", "msg": "Invalid update pool fees parameters" }, + { "code": 6059, "name": "MissingOperatorAccount", "msg": "Missing operator account" } + ], + "types": [ + { + "name": "AddLiquidityParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity_delta", "docs": ["delta liquidity"], "type": "u128" }, + { "name": "token_a_amount_threshold", "docs": ["maximum token a amount"], "type": "u64" }, + { "name": "token_b_amount_threshold", "docs": ["maximum token b amount"], "type": "u64" } + ] + } + }, + { + "name": "BaseFeeInfo", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { "kind": "struct", "fields": [{ "name": "data", "type": { "array": ["u8", 32] } }] } + }, + { + "name": "BaseFeeParameters", + "type": { "kind": "struct", "fields": [{ "name": "data", "type": { "array": ["u8", 30] } }] } + }, + { + "name": "BaseFeeStruct", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "base_fee_info", "type": { "defined": { "name": "BaseFeeInfo" } } }, + { "name": "padding_1", "type": "u64" } + ] + } + }, + { + "name": "BorshFeeMarketCapScheduler", + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "number_of_period", "type": "u16" }, + { "name": "sqrt_price_step_bps", "type": "u32" }, + { "name": "scheduler_expiration_duration", "type": "u32" }, + { "name": "reduction_factor", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 3] } } + ] + } + }, + { + "name": "BorshFeeRateLimiter", + "docs": [ + "we denote reference_amount = x0, cliff_fee_numerator = c, fee_increment = i", + "if input_amount <= x0, then fee = input_amount * c", + "", + "if input_amount > x0, then input_amount = x0 + (a * x0 + b)", + "if a < max_index", + "then fee = x0 * c + x0 * (c + i) + .... + x0 * (c + i*a) + b * (c + i * (a+1))", + "then fee = x0 * (c + c*a + i*a*(a+1)/2) + b * (c + i * (a+1))", + "", + "if a >= max_index", + "if a = max_index + d, input_amount = x0 + max_index * x0 + (d * x0 + b)", + "then fee = x0 * (c + c*max_index + i*max_index*(max_index+1)/2) + (d * x0 + b) * MAX_FEE" + ], + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "fee_increment_bps", "type": "u16" }, + { "name": "max_limiter_duration", "type": "u32" }, + { "name": "max_fee_bps", "type": "u32" }, + { "name": "reference_amount", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 3] } } + ] + } + }, + { + "name": "BorshFeeTimeScheduler", + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "number_of_period", "type": "u16" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "reduction_factor", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 3] } } + ] + } + }, + { + "name": "Config", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "vault_config_key", "docs": ["Vault config key"], "type": "pubkey" }, + { + "name": "pool_creator_authority", + "docs": [ + "Only pool_creator_authority can use the current config to initialize new pool. When it's Pubkey::default, it's a public config." + ], + "type": "pubkey" + }, + { "name": "pool_fees", "docs": ["Pool fee"], "type": { "defined": { "name": "PoolFeesConfig" } } }, + { "name": "activation_type", "docs": ["Activation type"], "type": "u8" }, + { "name": "collect_fee_mode", "docs": ["Collect fee mode"], "type": "u8" }, + { "name": "config_type", "docs": ["Config type mode, 0 for static, 1 for dynamic"], "type": "u8" }, + { "name": "_padding_0", "docs": ["padding 0"], "type": { "array": ["u8", 5] } }, + { "name": "index", "docs": ["config index"], "type": "u64" }, + { "name": "sqrt_min_price", "docs": ["sqrt min price"], "type": "u128" }, + { "name": "sqrt_max_price", "docs": ["sqrt max price"], "type": "u128" }, + { + "name": "_padding_1", + "docs": ["Fee curve point", "Padding for further use"], + "type": { "array": ["u64", 10] } + } + ] + } + }, + { + "name": "DummyParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "borsh_fee_time_scheduler_params", + "type": { "defined": { "name": "BorshFeeTimeScheduler" } } + }, + { + "name": "borsh_fee_rate_limiter_params", + "type": { "defined": { "name": "BorshFeeRateLimiter" } } + }, + { + "name": "borsh_fee_market_cap_scheduler_params", + "type": { "defined": { "name": "BorshFeeMarketCapScheduler" } } + } + ] + } + }, + { + "name": "DynamicConfigParameters", + "type": { "kind": "struct", "fields": [{ "name": "pool_creator_authority", "type": "pubkey" }] } + }, + { + "name": "DynamicFeeConfig", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "initialized", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 7] } }, + { "name": "max_volatility_accumulator", "type": "u32" }, + { "name": "variable_fee_control", "type": "u32" }, + { "name": "bin_step", "type": "u16" }, + { "name": "filter_period", "type": "u16" }, + { "name": "decay_period", "type": "u16" }, + { "name": "reduction_factor", "type": "u16" }, + { "name": "padding_1", "type": { "array": ["u8", 8] } }, + { "name": "bin_step_u128", "type": "u128" } + ] + } + }, + { + "name": "DynamicFeeParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "bin_step", "type": "u16" }, + { "name": "bin_step_u128", "type": "u128" }, + { "name": "filter_period", "type": "u16" }, + { "name": "decay_period", "type": "u16" }, + { "name": "reduction_factor", "type": "u16" }, + { "name": "max_volatility_accumulator", "type": "u32" }, + { "name": "variable_fee_control", "type": "u32" } + ] + } + }, + { + "name": "DynamicFeeStruct", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "initialized", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 7] } }, + { "name": "max_volatility_accumulator", "type": "u32" }, + { "name": "variable_fee_control", "type": "u32" }, + { "name": "bin_step", "type": "u16" }, + { "name": "filter_period", "type": "u16" }, + { "name": "decay_period", "type": "u16" }, + { "name": "reduction_factor", "type": "u16" }, + { "name": "last_update_timestamp", "type": "u64" }, + { "name": "bin_step_u128", "type": "u128" }, + { "name": "sqrt_price_reference", "type": "u128" }, + { "name": "volatility_accumulator", "type": "u128" }, + { "name": "volatility_reference", "type": "u128" } + ] + } + }, + { + "name": "EvtClaimPartnerFee", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" } + ] + } + }, + { + "name": "EvtClaimPositionFee", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "fee_a_claimed", "type": "u64" }, + { "name": "fee_b_claimed", "type": "u64" } + ] + } + }, + { + "name": "EvtClaimProtocolFee", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" } + ] + } + }, + { + "name": "EvtClaimReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "mint_reward", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "total_reward", "type": "u64" } + ] + } + }, + { + "name": "EvtCloseConfig", + "docs": ["Close config"], + "type": { + "kind": "struct", + "fields": [ + { "name": "config", "docs": ["Config pubkey"], "type": "pubkey" }, + { "name": "admin", "docs": ["admin pk"], "type": "pubkey" } + ] + } + }, + { + "name": "EvtClosePosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "position_nft_mint", "type": "pubkey" } + ] + } + }, + { + "name": "EvtCreateConfig", + "docs": ["Create static config"], + "type": { + "kind": "struct", + "fields": [ + { "name": "pool_fees", "type": { "defined": { "name": "PoolFeeParameters" } } }, + { "name": "vault_config_key", "type": "pubkey" }, + { "name": "pool_creator_authority", "type": "pubkey" }, + { "name": "activation_type", "type": "u8" }, + { "name": "sqrt_min_price", "type": "u128" }, + { "name": "sqrt_max_price", "type": "u128" }, + { "name": "collect_fee_mode", "type": "u8" }, + { "name": "index", "type": "u64" }, + { "name": "config", "type": "pubkey" } + ] + } + }, + { + "name": "EvtCreateDynamicConfig", + "docs": ["Create dynamic config"], + "type": { + "kind": "struct", + "fields": [ + { "name": "config", "type": "pubkey" }, + { "name": "pool_creator_authority", "type": "pubkey" }, + { "name": "index", "type": "u64" } + ] + } + }, + { + "name": "EvtCreatePosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "position_nft_mint", "type": "pubkey" } + ] + } + }, + { + "name": "EvtCreateTokenBadge", + "docs": ["Create token badge"], + "type": { "kind": "struct", "fields": [{ "name": "token_mint", "type": "pubkey" }] } + }, + { + "name": "EvtFundReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "funder", "type": "pubkey" }, + { "name": "mint_reward", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "amount", "type": "u64" }, + { "name": "transfer_fee_excluded_amount_in", "type": "u64" }, + { "name": "reward_duration_end", "type": "u64" }, + { "name": "pre_reward_rate", "type": "u128" }, + { "name": "post_reward_rate", "type": "u128" } + ] + } + }, + { + "name": "EvtInitializePool", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "token_a_mint", "type": "pubkey" }, + { "name": "token_b_mint", "type": "pubkey" }, + { "name": "creator", "type": "pubkey" }, + { "name": "payer", "type": "pubkey" }, + { "name": "alpha_vault", "type": "pubkey" }, + { "name": "pool_fees", "type": { "defined": { "name": "PoolFeeParameters" } } }, + { "name": "sqrt_min_price", "type": "u128" }, + { "name": "sqrt_max_price", "type": "u128" }, + { "name": "activation_type", "type": "u8" }, + { "name": "collect_fee_mode", "type": "u8" }, + { "name": "liquidity", "type": "u128" }, + { "name": "sqrt_price", "type": "u128" }, + { "name": "activation_point", "type": "u64" }, + { "name": "token_a_flag", "type": "u8" }, + { "name": "token_b_flag", "type": "u8" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" }, + { "name": "total_amount_a", "type": "u64" }, + { "name": "total_amount_b", "type": "u64" }, + { "name": "pool_type", "type": "u8" } + ] + } + }, + { + "name": "EvtInitializeReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_mint", "type": "pubkey" }, + { "name": "funder", "type": "pubkey" }, + { "name": "creator", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "reward_duration", "type": "u64" } + ] + } + }, + { + "name": "EvtLiquidityChange", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "token_a_amount", "type": "u64" }, + { "name": "token_b_amount", "type": "u64" }, + { "name": "transfer_fee_included_token_a_amount", "type": "u64" }, + { "name": "transfer_fee_included_token_b_amount", "type": "u64" }, + { "name": "reserve_a_amount", "type": "u64" }, + { "name": "reserve_b_amount", "type": "u64" }, + { "name": "liquidity_delta", "type": "u128" }, + { "name": "token_a_amount_threshold", "type": "u64" }, + { "name": "token_b_amount_threshold", "type": "u64" }, + { "name": "change_type", "type": "u8" } + ] + } + }, + { + "name": "EvtLockPosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "owner", "type": "pubkey" }, + { "name": "vesting", "type": "pubkey" }, + { "name": "cliff_point", "type": "u64" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "cliff_unlock_liquidity", "type": "u128" }, + { "name": "liquidity_per_period", "type": "u128" }, + { "name": "number_of_period", "type": "u16" } + ] + } + }, + { + "name": "EvtPermanentLockPosition", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "position", "type": "pubkey" }, + { "name": "lock_liquidity_amount", "type": "u128" }, + { "name": "total_permanent_locked_liquidity", "type": "u128" } + ] + } + }, + { + "name": "EvtSetPoolStatus", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "status", "type": "u8" } + ] + } + }, + { + "name": "EvtSplitPosition2", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "first_owner", "type": "pubkey" }, + { "name": "second_owner", "type": "pubkey" }, + { "name": "first_position", "type": "pubkey" }, + { "name": "second_position", "type": "pubkey" }, + { "name": "current_sqrt_price", "type": "u128" }, + { "name": "amount_splits", "type": { "defined": { "name": "SplitAmountInfo" } } }, + { "name": "first_position_info", "type": { "defined": { "name": "SplitPositionInfo" } } }, + { "name": "second_position_info", "type": { "defined": { "name": "SplitPositionInfo" } } }, + { + "name": "split_position_parameters", + "type": { "defined": { "name": "SplitPositionParameters2" } } + } + ] + } + }, + { + "name": "EvtSwap2", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "trade_direction", "type": "u8" }, + { "name": "collect_fee_mode", "type": "u8" }, + { "name": "has_referral", "type": "bool" }, + { "name": "params", "type": { "defined": { "name": "SwapParameters2" } } }, + { "name": "swap_result", "type": { "defined": { "name": "SwapResult2" } } }, + { "name": "included_transfer_fee_amount_in", "type": "u64" }, + { "name": "included_transfer_fee_amount_out", "type": "u64" }, + { "name": "excluded_transfer_fee_amount_out", "type": "u64" }, + { "name": "current_timestamp", "type": "u64" }, + { "name": "reserve_a_amount", "type": "u64" }, + { "name": "reserve_b_amount", "type": "u64" } + ] + } + }, + { + "name": "EvtUpdatePoolFees", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "operator", "type": "pubkey" }, + { "name": "params", "type": { "defined": { "name": "UpdatePoolFeesParameters" } } } + ] + } + }, + { + "name": "EvtUpdateRewardDuration", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "old_reward_duration", "type": "u64" }, + { "name": "new_reward_duration", "type": "u64" } + ] + } + }, + { + "name": "EvtUpdateRewardFunder", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_index", "type": "u8" }, + { "name": "old_funder", "type": "pubkey" }, + { "name": "new_funder", "type": "pubkey" } + ] + } + }, + { + "name": "EvtWithdrawIneligibleReward", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "reward_mint", "type": "pubkey" }, + { "name": "amount", "type": "u64" } + ] + } + }, + { + "name": "InitializeCustomizablePoolParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool_fees", + "docs": ["pool fees"], + "type": { "defined": { "name": "PoolFeeParameters" } } + }, + { "name": "sqrt_min_price", "docs": ["sqrt min price"], "type": "u128" }, + { "name": "sqrt_max_price", "docs": ["sqrt max price"], "type": "u128" }, + { "name": "has_alpha_vault", "docs": ["has alpha vault"], "type": "bool" }, + { "name": "liquidity", "docs": ["initialize liquidity"], "type": "u128" }, + { + "name": "sqrt_price", + "docs": [ + "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value. Market cap fee scheduler minimum price will be derived from this value" + ], + "type": "u128" + }, + { "name": "activation_type", "docs": ["activation type"], "type": "u8" }, + { "name": "collect_fee_mode", "docs": ["collect fee mode"], "type": "u8" }, + { "name": "activation_point", "docs": ["activation point"], "type": { "option": "u64" } } + ] + } + }, + { + "name": "InitializePoolParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity", "docs": ["initialize liquidity"], "type": "u128" }, + { + "name": "sqrt_price", + "docs": ["The init price of the pool as a sqrt(token_b/token_a) Q64.64 value"], + "type": "u128" + }, + { "name": "activation_point", "docs": ["activation point"], "type": { "option": "u64" } } + ] + } + }, + { + "name": "Operator", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "whitelisted_address", "type": "pubkey" }, + { "name": "permission", "type": "u128" }, + { "name": "padding", "type": { "array": ["u64", 2] } } + ] + } + }, + { + "name": "PodAlignedFeeMarketCapScheduler", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 5] } }, + { "name": "number_of_period", "type": "u16" }, + { "name": "sqrt_price_step_bps", "type": "u32" }, + { "name": "scheduler_expiration_duration", "type": "u32" }, + { "name": "reduction_factor", "type": "u64" } + ] + } + }, + { + "name": "PodAlignedFeeRateLimiter", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 5] } }, + { "name": "fee_increment_bps", "type": "u16" }, + { "name": "max_limiter_duration", "type": "u32" }, + { "name": "max_fee_bps", "type": "u32" }, + { "name": "reference_amount", "type": "u64" } + ] + } + }, + { + "name": "PodAlignedFeeTimeScheduler", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_fee_numerator", "type": "u64" }, + { "name": "base_fee_mode", "type": "u8" }, + { "name": "padding", "type": { "array": ["u8", 5] } }, + { "name": "number_of_period", "type": "u16" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "reduction_factor", "type": "u64" } + ] + } + }, + { + "name": "Pool", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "pool_fees", "docs": ["Pool fee"], "type": { "defined": { "name": "PoolFeesStruct" } } }, + { "name": "token_a_mint", "docs": ["token a mint"], "type": "pubkey" }, + { "name": "token_b_mint", "docs": ["token b mint"], "type": "pubkey" }, + { "name": "token_a_vault", "docs": ["token a vault"], "type": "pubkey" }, + { "name": "token_b_vault", "docs": ["token b vault"], "type": "pubkey" }, + { + "name": "whitelisted_vault", + "docs": ["Whitelisted vault to be able to buy pool before activation_point"], + "type": "pubkey" + }, + { "name": "partner", "docs": ["partner"], "type": "pubkey" }, + { "name": "liquidity", "docs": ["liquidity share"], "type": "u128" }, + { + "name": "_padding", + "docs": ["padding, previous reserve amount, be careful to use that field"], + "type": "u128" + }, + { "name": "protocol_a_fee", "docs": ["protocol a fee"], "type": "u64" }, + { "name": "protocol_b_fee", "docs": ["protocol b fee"], "type": "u64" }, + { "name": "partner_a_fee", "docs": ["partner a fee"], "type": "u64" }, + { "name": "partner_b_fee", "docs": ["partner b fee"], "type": "u64" }, + { "name": "sqrt_min_price", "docs": ["min price"], "type": "u128" }, + { "name": "sqrt_max_price", "docs": ["max price"], "type": "u128" }, + { "name": "sqrt_price", "docs": ["current price"], "type": "u128" }, + { + "name": "activation_point", + "docs": ["Activation point, can be slot or timestamp"], + "type": "u64" + }, + { + "name": "activation_type", + "docs": ["Activation type, 0 means by slot, 1 means by timestamp"], + "type": "u8" + }, + { "name": "pool_status", "docs": ["pool status, 0: enable, 1 disable"], "type": "u8" }, + { "name": "token_a_flag", "docs": ["token a flag"], "type": "u8" }, + { "name": "token_b_flag", "docs": ["token b flag"], "type": "u8" }, + { + "name": "collect_fee_mode", + "docs": ["0 is collect fee in both token, 1 only collect fee only in token b"], + "type": "u8" + }, + { "name": "pool_type", "docs": ["pool type"], "type": "u8" }, + { + "name": "version", + "docs": ["pool version, 0: max_fee is still capped at 50%, 1: max_fee is capped at 99%"], + "type": "u8" + }, + { "name": "_padding_0", "docs": ["padding"], "type": "u8" }, + { "name": "fee_a_per_liquidity", "docs": ["cumulative"], "type": { "array": ["u8", 32] } }, + { "name": "fee_b_per_liquidity", "docs": ["cumulative"], "type": { "array": ["u8", 32] } }, + { "name": "permanent_lock_liquidity", "type": "u128" }, + { "name": "metrics", "docs": ["metrics"], "type": { "defined": { "name": "PoolMetrics" } } }, + { "name": "creator", "docs": ["pool creator"], "type": "pubkey" }, + { "name": "_padding_1", "docs": ["Padding for further use"], "type": { "array": ["u64", 6] } }, + { + "name": "reward_infos", + "docs": ["Farming reward information"], + "type": { "array": [{ "defined": { "name": "RewardInfo" } }, 2] } + } + ] + } + }, + { + "name": "PoolFeeParameters", + "docs": ["Information regarding fee charges"], + "type": { + "kind": "struct", + "fields": [ + { + "name": "base_fee", + "docs": ["Base fee"], + "type": { "defined": { "name": "BaseFeeParameters" } } + }, + { + "name": "dynamic_fee", + "docs": ["dynamic fee"], + "type": { "option": { "defined": { "name": "DynamicFeeParameters" } } } + } + ] + } + }, + { + "name": "PoolFeesConfig", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "base_fee", "type": { "defined": { "name": "BaseFeeInfo" } } }, + { "name": "dynamic_fee", "type": { "defined": { "name": "DynamicFeeConfig" } } }, + { "name": "protocol_fee_percent", "type": "u8" }, + { "name": "partner_fee_percent", "type": "u8" }, + { "name": "referral_fee_percent", "type": "u8" }, + { "name": "padding_0", "type": { "array": ["u8", 5] } }, + { "name": "padding_1", "type": { "array": ["u64", 5] } } + ] + } + }, + { + "name": "PoolFeesStruct", + "docs": [ + "Information regarding fee charges", + "trading_fee = amount * trade_fee_numerator / denominator", + "protocol_fee = trading_fee * protocol_fee_percentage / 100", + "referral_fee = protocol_fee * referral_percentage / 100", + "partner_fee = (protocol_fee - referral_fee) * partner_fee_percentage / denominator" + ], + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "base_fee", + "docs": [ + "Trade fees are extra token amounts that are held inside the token", + "accounts during a trade, making the value of liquidity tokens rise.", + "Trade fee numerator" + ], + "type": { "defined": { "name": "BaseFeeStruct" } } + }, + { + "name": "protocol_fee_percent", + "docs": [ + "Protocol trading fees are extra token amounts that are held inside the token", + "accounts during a trade, with the equivalent in pool tokens minted to", + "the protocol of the program.", + "Protocol trade fee numerator" + ], + "type": "u8" + }, + { "name": "partner_fee_percent", "docs": ["partner fee"], "type": "u8" }, + { "name": "referral_fee_percent", "docs": ["referral fee"], "type": "u8" }, + { "name": "padding_0", "docs": ["padding"], "type": { "array": ["u8", 5] } }, + { + "name": "dynamic_fee", + "docs": ["dynamic fee"], + "type": { "defined": { "name": "DynamicFeeStruct" } } + }, + { "name": "init_sqrt_price", "type": "u128" } + ] + } + }, + { + "name": "PoolMetrics", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "total_lp_a_fee", "type": "u128" }, + { "name": "total_lp_b_fee", "type": "u128" }, + { "name": "total_protocol_a_fee", "type": "u64" }, + { "name": "total_protocol_b_fee", "type": "u64" }, + { "name": "total_partner_a_fee", "type": "u64" }, + { "name": "total_partner_b_fee", "type": "u64" }, + { "name": "total_position", "type": "u64" }, + { "name": "padding", "type": "u64" } + ] + } + }, + { + "name": "Position", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "pool", "type": "pubkey" }, + { "name": "nft_mint", "docs": ["nft mint"], "type": "pubkey" }, + { + "name": "fee_a_per_token_checkpoint", + "docs": ["fee a checkpoint"], + "type": { "array": ["u8", 32] } + }, + { + "name": "fee_b_per_token_checkpoint", + "docs": ["fee b checkpoint"], + "type": { "array": ["u8", 32] } + }, + { "name": "fee_a_pending", "docs": ["fee a pending"], "type": "u64" }, + { "name": "fee_b_pending", "docs": ["fee b pending"], "type": "u64" }, + { "name": "unlocked_liquidity", "docs": ["unlock liquidity"], "type": "u128" }, + { "name": "vested_liquidity", "docs": ["vesting liquidity"], "type": "u128" }, + { "name": "permanent_locked_liquidity", "docs": ["permanent locked liquidity"], "type": "u128" }, + { "name": "metrics", "docs": ["metrics"], "type": { "defined": { "name": "PositionMetrics" } } }, + { + "name": "reward_infos", + "docs": ["Farming reward information"], + "type": { "array": [{ "defined": { "name": "UserRewardInfo" } }, 2] } + }, + { "name": "padding", "docs": ["padding for future usage"], "type": { "array": ["u128", 6] } } + ] + } + }, + { + "name": "PositionMetrics", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "total_claimed_a_fee", "type": "u64" }, + { "name": "total_claimed_b_fee", "type": "u64" } + ] + } + }, + { + "name": "RemoveLiquidityParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity_delta", "docs": ["delta liquidity"], "type": "u128" }, + { "name": "token_a_amount_threshold", "docs": ["minimum token a amount"], "type": "u64" }, + { "name": "token_b_amount_threshold", "docs": ["minimum token b amount"], "type": "u64" } + ] + } + }, + { + "name": "RewardInfo", + "docs": ["Stores the state relevant for tracking liquidity mining rewards"], + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "initialized", "docs": ["Indicates if the reward has been initialized"], "type": "u8" }, + { "name": "reward_token_flag", "docs": ["reward token flag"], "type": "u8" }, + { "name": "_padding_0", "docs": ["padding"], "type": { "array": ["u8", 6] } }, + { + "name": "_padding_1", + "docs": ["Padding to ensure `reward_rate: u128` is 16-byte aligned"], + "type": { "array": ["u8", 8] } + }, + { "name": "mint", "docs": ["Reward token mint."], "type": "pubkey" }, + { "name": "vault", "docs": ["Reward vault token account."], "type": "pubkey" }, + { "name": "funder", "docs": ["Authority account that allows to fund rewards"], "type": "pubkey" }, + { "name": "reward_duration", "docs": ["reward duration"], "type": "u64" }, + { "name": "reward_duration_end", "docs": ["reward duration end"], "type": "u64" }, + { "name": "reward_rate", "docs": ["reward rate"], "type": "u128" }, + { + "name": "reward_per_token_stored", + "docs": ["Reward per token stored"], + "type": { "array": ["u8", 32] } + }, + { + "name": "last_update_time", + "docs": ["The last time reward states were updated."], + "type": "u64" + }, + { + "name": "cumulative_seconds_with_empty_liquidity_reward", + "docs": [ + "Accumulated seconds when the farm distributed rewards but the bin was empty.", + "These rewards will be carried over to the next reward time window." + ], + "type": "u64" + } + ] + } + }, + { + "name": "SplitAmountInfo", + "type": { + "kind": "struct", + "fields": [ + { "name": "permanent_locked_liquidity", "type": "u128" }, + { "name": "unlocked_liquidity", "type": "u128" }, + { "name": "fee_a", "type": "u64" }, + { "name": "fee_b", "type": "u64" }, + { "name": "reward_0", "type": "u64" }, + { "name": "reward_1", "type": "u64" } + ] + } + }, + { + "name": "SplitPositionInfo", + "type": { + "kind": "struct", + "fields": [ + { "name": "liquidity", "type": "u128" }, + { "name": "fee_a", "type": "u64" }, + { "name": "fee_b", "type": "u64" }, + { "name": "reward_0", "type": "u64" }, + { "name": "reward_1", "type": "u64" } + ] + } + }, + { + "name": "SplitPositionParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "unlocked_liquidity_percentage", + "docs": ["Percentage of unlocked liquidity to split to the second position"], + "type": "u8" + }, + { + "name": "permanent_locked_liquidity_percentage", + "docs": ["Percentage of permanent locked liquidity to split to the second position"], + "type": "u8" + }, + { + "name": "fee_a_percentage", + "docs": ["Percentage of fee A pending to split to the second position"], + "type": "u8" + }, + { + "name": "fee_b_percentage", + "docs": ["Percentage of fee B pending to split to the second position"], + "type": "u8" + }, + { + "name": "reward_0_percentage", + "docs": ["Percentage of reward 0 pending to split to the second position"], + "type": "u8" + }, + { + "name": "reward_1_percentage", + "docs": ["Percentage of reward 1 pending to split to the second position"], + "type": "u8" + }, + { "name": "padding", "docs": ["padding for future"], "type": { "array": ["u8", 16] } } + ] + } + }, + { + "name": "SplitPositionParameters2", + "type": { + "kind": "struct", + "fields": [ + { "name": "unlocked_liquidity_numerator", "type": "u32" }, + { "name": "permanent_locked_liquidity_numerator", "type": "u32" }, + { "name": "fee_a_numerator", "type": "u32" }, + { "name": "fee_b_numerator", "type": "u32" }, + { "name": "reward_0_numerator", "type": "u32" }, + { "name": "reward_1_numerator", "type": "u32" } + ] + } + }, + { + "name": "StaticConfigParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "pool_fees", "type": { "defined": { "name": "PoolFeeParameters" } } }, + { "name": "sqrt_min_price", "type": "u128" }, + { "name": "sqrt_max_price", "type": "u128" }, + { "name": "vault_config_key", "type": "pubkey" }, + { "name": "pool_creator_authority", "type": "pubkey" }, + { "name": "activation_type", "type": "u8" }, + { "name": "collect_fee_mode", "type": "u8" } + ] + } + }, + { + "name": "SwapParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "amount_in", "type": "u64" }, + { "name": "minimum_amount_out", "type": "u64" } + ] + } + }, + { + "name": "SwapParameters2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_0", + "docs": [ + "When it's exact in, partial fill, this will be amount_in. When it's exact out, this will be amount_out" + ], + "type": "u64" + }, + { + "name": "amount_1", + "docs": [ + "When it's exact in, partial fill, this will be minimum_amount_out. When it's exact out, this will be maximum_amount_in" + ], + "type": "u64" + }, + { "name": "swap_mode", "docs": ["Swap mode, refer [SwapMode]"], "type": "u8" } + ] + } + }, + { + "name": "SwapResult2", + "type": { + "kind": "struct", + "fields": [ + { "name": "included_fee_input_amount", "type": "u64" }, + { "name": "excluded_fee_input_amount", "type": "u64" }, + { "name": "amount_left", "type": "u64" }, + { "name": "output_amount", "type": "u64" }, + { "name": "next_sqrt_price", "type": "u128" }, + { "name": "trading_fee", "type": "u64" }, + { "name": "protocol_fee", "type": "u64" }, + { "name": "partner_fee", "type": "u64" }, + { "name": "referral_fee", "type": "u64" } + ] + } + }, + { + "name": "TokenBadge", + "docs": ["Parameter that set by the protocol"], + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "token_mint", "docs": ["token mint"], "type": "pubkey" }, + { "name": "_padding", "docs": ["Reserve"], "type": { "array": ["u8", 128] } } + ] + } + }, + { + "name": "UpdatePoolFeesParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliff_fee_numerator", + "docs": [ + "Base fee update mode:", + "- None: skip base fee update", + "- Some: update new cliff_fee_numerator if base fee is static" + ], + "type": { "option": "u64" } + }, + { + "name": "dynamic_fee", + "docs": [ + "Dynamic fee update mode:", + "- None: skip dynamic fee update", + "- Some(with default value): disable dynamic fee", + "- Some(with non default value): enable dynamic fee if disabled or update dynamic fee if enabled" + ], + "type": { "option": { "defined": { "name": "DynamicFeeParameters" } } } + } + ] + } + }, + { + "name": "UserRewardInfo", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "reward_per_token_checkpoint", + "docs": ["The latest update reward checkpoint"], + "type": { "array": ["u8", 32] } + }, + { "name": "reward_pendings", "docs": ["Current pending rewards"], "type": "u64" }, + { "name": "total_claimed_rewards", "docs": ["Total claimed rewards"], "type": "u64" } + ] + } + }, + { + "name": "Vesting", + "serialization": "bytemuck", + "repr": { "kind": "c" }, + "type": { + "kind": "struct", + "fields": [ + { "name": "position", "type": "pubkey" }, + { "name": "cliff_point", "type": "u64" }, + { "name": "period_frequency", "type": "u64" }, + { "name": "cliff_unlock_liquidity", "type": "u128" }, + { "name": "liquidity_per_period", "type": "u128" }, + { "name": "total_released_liquidity", "type": "u128" }, + { "name": "number_of_period", "type": "u16" }, + { "name": "padding", "type": { "array": ["u8", 14] } }, + { "name": "padding2", "type": { "array": ["u128", 4] } } + ] + } + }, + { + "name": "VestingParameters", + "type": { + "kind": "struct", + "fields": [ + { "name": "cliff_point", "type": { "option": "u64" } }, + { "name": "period_frequency", "type": "u64" }, + { "name": "cliff_unlock_liquidity", "type": "u128" }, + { "name": "liquidity_per_period", "type": "u128" }, + { "name": "number_of_period", "type": "u16" } + ] + } + } + ], + "constants": [ + { "name": "BIN_STEP_BPS_DEFAULT", "type": "u16", "value": "1" }, + { + "name": "BIN_STEP_U128_DEFAULT_LE_BYTES", + "type": { "array": ["u8", 16] }, + "value": "[203, 16, 199, 186, 184, 141, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { "name": "CUSTOMIZABLE_POOL_PREFIX", "type": "bytes", "value": "[99, 112, 111, 111, 108]" }, + { + "name": "FEE_DENOMINATOR", + "docs": [ + "Default fee denominator. DO NOT simply update it as it will break logic that depends on it as default value." + ], + "type": "u64", + "value": "1000000000" + }, + { "name": "MAX_BASIS_POINT", "docs": ["Max basis point. 100% in pct"], "type": "u64", "value": "10000" }, + { + "name": "MAX_SQRT_PRICE_LE_BYTES", + "type": { "array": ["u8", 16] }, + "value": "[155, 87, 105, 78, 169, 26, 92, 132, 177, 196, 254, 255, 0, 0, 0, 0]" + }, + { + "name": "MIN_SQRT_PRICE_LE_BYTES", + "type": { "array": ["u8", 16] }, + "value": "[80, 59, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { + "name": "POOL_AUTHORITY_PREFIX", + "type": "bytes", + "value": "[112, 111, 111, 108, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]" + }, + { "name": "POOL_PREFIX", "type": "bytes", "value": "[112, 111, 111, 108]" }, + { + "name": "POSITION_NFT_ACCOUNT_PREFIX", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, 110, 116]" + }, + { "name": "POSITION_PREFIX", "type": "bytes", "value": "[112, 111, 115, 105, 116, 105, 111, 110]" }, + { "name": "SPLIT_POSITION_DENOMINATOR", "type": "u32", "value": "1000000000" }, + { + "name": "TOKEN_VAULT_PREFIX", + "type": "bytes", + "value": "[116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116]" + } + ] +} diff --git a/idl/raydium_amm_v4.json b/idl/raydium_amm_v4.json new file mode 100644 index 0000000..291f168 --- /dev/null +++ b/idl/raydium_amm_v4.json @@ -0,0 +1,2401 @@ +{ + "version": "0.3.0", + "name": "raydium_amm", + "instructions": [ + { + "name": "initialize", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "coinMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "pcMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTargetOrdersAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLpTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userWallet", + "isMut": true, + "isSigner": true + } + ], + "args": [ + { + "name": "nonce", + "type": "u8" + }, + { + "name": "openTime", + "type": "u64" + } + ] + }, + { + "name": "initialize2", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "splAssociatedTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false + }, + { + "name": "coinMint", + "isMut": false, + "isSigner": false + }, + { + "name": "pcMint", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLp", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userWallet", + "isMut": true, + "isSigner": true + }, + { + "name": "userTokenCoin", + "isMut": true, + "isSigner": false + }, + { + "name": "userTokenPc", + "isMut": true, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "nonce", + "type": "u8" + }, + { + "name": "openTime", + "type": "u64" + }, + { + "name": "initPcAmount", + "type": "u64" + }, + { + "name": "initCoinAmount", + "type": "u64" + } + ] + }, + { + "name": "monitorStep", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "clock", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "serumReqQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "planOrderLimit", + "type": "u16" + }, + { + "name": "placeOrderLimit", + "type": "u16" + }, + { + "name": "cancelOrderLimit", + "type": "u16" + } + ] + }, + { + "name": "deposit", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": false, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userOwner", + "isMut": false, + "isSigner": true + }, + { + "name": "serumEventQueue", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "maxCoinAmount", + "type": "u64" + }, + { + "name": "maxPcAmount", + "type": "u64" + }, + { + "name": "baseSide", + "type": "u64" + } + ] + }, + { + "name": "withdraw", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "userLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userOwner", + "isMut": false, + "isSigner": true + }, + { + "name": "serumEventQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "migrateToOpenBook", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTokenCoin", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTokenPc", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "newAmmOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "newSerumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "newSerumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "admin", + "isMut": true, + "isSigner": true + } + ], + "args": [] + }, + { + "name": "setParams", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "ammPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAdminAccount", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "value", + "type": { + "option": "u64" + } + }, + { + "name": "newPubkey", + "type": { + "option": "publicKey" + } + }, + { + "name": "fees", + "type": { + "option": { + "defined": "Fees" + } + } + }, + { + "name": "lastOrderDistance", + "type": { + "option": { + "defined": "LastOrderDistance" + } + } + }, + { + "name": "needTakeAmounts", + "type": { + "option": { + "defined": "NeedTake" + } + } + } + ] + }, + { + "name": "withdrawPnl", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "coinPnlTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "pcPnlTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "pnlOwnerAccount", + "isMut": false, + "isSigner": true + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": false, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + } + ], + "args": [] + }, + { + "name": "withdrawSrm", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOwnerAccount", + "isMut": false, + "isSigner": true + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "srmToken", + "isMut": true, + "isSigner": false + }, + { + "name": "destSrmToken", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "swapBaseIn", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceOwner", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + }, + { + "name": "preInitialize", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolWithdrawQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": true, + "isSigner": false + }, + { + "name": "coinMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "pcMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolTempLpTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "userWallet", + "isMut": true, + "isSigner": true + } + ], + "args": [ + { + "name": "nonce", + "type": "u8" + } + ] + }, + { + "name": "swapBaseOut", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceOwner", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "maxAmountIn", + "type": "u64" + }, + { + "name": "amountOut", + "type": "u64" + } + ] + }, + { + "name": "simulateInfo", + "accounts": [ + { + "name": "amm", + "isMut": false, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": false, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": false, + "isSigner": false + }, + { + "name": "lpMintAddress", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false + }, + { + "name": "serumEventQueue", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "swapBaseInValue", + "type": { + "option": { + "defined": "SwapInstructionBaseIn" + } + } + }, + { + "name": "swapBaseOutValue", + "type": { + "option": { + "defined": "SwapInstructionBaseOut" + } + } + } + ] + }, + { + "name": "adminCancelOrders", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": false, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammOpenOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "ammTargetOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "poolCoinTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "poolPcTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "ammOwnerAccount", + "isMut": false, + "isSigner": true + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": true, + "isSigner": false + }, + { + "name": "serumCoinVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumPcVaultAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "serumVaultSigner", + "isMut": false, + "isSigner": false + }, + { + "name": "serumEventQ", + "isMut": true, + "isSigner": false + }, + { + "name": "serumBids", + "isMut": true, + "isSigner": false + }, + { + "name": "serumAsks", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "limit", + "type": "u16" + } + ] + }, + { + "name": "createConfigAccount", + "accounts": [ + { + "name": "admin", + "isMut": true, + "isSigner": true + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false + }, + { + "name": "owner", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "rent", + "isMut": false, + "isSigner": false + } + ], + "args": [] + }, + { + "name": "updateConfigAccount", + "accounts": [ + { + "name": "admin", + "isMut": false, + "isSigner": true + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "param", + "type": "u8" + }, + { + "name": "owner", + "type": "publicKey" + } + ] + }, + { + "name": "swapBaseInV2", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "ammPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userWalletAccount", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + }, + { + "name": "swapBaseOutV2", + "accounts": [ + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "amm", + "isMut": true, + "isSigner": false + }, + { + "name": "ammAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "ammCoinVault", + "isMut": true, + "isSigner": false + }, + { + "name": "ammPcVault", + "isMut": true, + "isSigner": false + }, + { + "name": "userSourceTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userDestinationTokenAccount", + "isMut": true, + "isSigner": false + }, + { + "name": "userWalletAccount", + "isMut": false, + "isSigner": true + } + ], + "args": [ + { + "name": "maxAmountIn", + "type": "u64" + }, + { + "name": "amountOut", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "TargetOrders", + "type": { + "kind": "struct", + "fields": [ + { + "name": "owner", + "type": { + "array": ["u64", 4] + } + }, + { + "name": "buyOrders", + "type": { + "array": [ + { + "defined": "TargetOrder" + }, + 50 + ] + } + }, + { + "name": "padding1", + "type": { + "array": ["u64", 8] + } + }, + { + "name": "targetX", + "type": "u128" + }, + { + "name": "targetY", + "type": "u128" + }, + { + "name": "planXBuy", + "type": "u128" + }, + { + "name": "planYBuy", + "type": "u128" + }, + { + "name": "planXSell", + "type": "u128" + }, + { + "name": "planYSell", + "type": "u128" + }, + { + "name": "placedX", + "type": "u128" + }, + { + "name": "placedY", + "type": "u128" + }, + { + "name": "calcPnlX", + "type": "u128" + }, + { + "name": "calcPnlY", + "type": "u128" + }, + { + "name": "sellOrders", + "type": { + "array": [ + { + "defined": "TargetOrder" + }, + 50 + ] + } + }, + { + "name": "padding2", + "type": { + "array": ["u64", 6] + } + }, + { + "name": "replaceBuyClientId", + "type": { + "array": ["u64", 10] + } + }, + { + "name": "replaceSellClientId", + "type": { + "array": ["u64", 10] + } + }, + { + "name": "lastOrderNumerator", + "type": "u64" + }, + { + "name": "lastOrderDenominator", + "type": "u64" + }, + { + "name": "planOrdersCur", + "type": "u64" + }, + { + "name": "placeOrdersCur", + "type": "u64" + }, + { + "name": "validBuyOrderNum", + "type": "u64" + }, + { + "name": "validSellOrderNum", + "type": "u64" + }, + { + "name": "padding3", + "type": { + "array": ["u64", 10] + } + }, + { + "name": "freeSlotBits", + "type": "u128" + } + ] + } + }, + { + "name": "Fees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minSeparateNumerator", + "type": "u64" + }, + { + "name": "minSeparateDenominator", + "type": "u64" + }, + { + "name": "tradeFeeNumerator", + "type": "u64" + }, + { + "name": "tradeFeeDenominator", + "type": "u64" + }, + { + "name": "pnlNumerator", + "type": "u64" + }, + { + "name": "pnlDenominator", + "type": "u64" + }, + { + "name": "swapFeeNumerator", + "type": "u64" + }, + { + "name": "swapFeeDenominator", + "type": "u64" + } + ] + } + }, + { + "name": "AmmInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "status", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "orderNum", + "type": "u64" + }, + { + "name": "depth", + "type": "u64" + }, + { + "name": "coinDecimals", + "type": "u64" + }, + { + "name": "pcDecimals", + "type": "u64" + }, + { + "name": "state", + "type": "u64" + }, + { + "name": "resetFlag", + "type": "u64" + }, + { + "name": "minSize", + "type": "u64" + }, + { + "name": "volMaxCutRatio", + "type": "u64" + }, + { + "name": "amountWave", + "type": "u64" + }, + { + "name": "coinLotSize", + "type": "u64" + }, + { + "name": "pcLotSize", + "type": "u64" + }, + { + "name": "minPriceMultiplier", + "type": "u64" + }, + { + "name": "maxPriceMultiplier", + "type": "u64" + }, + { + "name": "sysDecimalValue", + "type": "u64" + }, + { + "name": "fees", + "type": { + "defined": "Fees" + } + }, + { + "name": "outPut", + "type": { + "defined": "OutPutData" + } + }, + { + "name": "tokenCoin", + "type": "publicKey" + }, + { + "name": "tokenPc", + "type": "publicKey" + }, + { + "name": "coinMint", + "type": "publicKey" + }, + { + "name": "pcMint", + "type": "publicKey" + }, + { + "name": "lpMint", + "type": "publicKey" + }, + { + "name": "openOrders", + "type": "publicKey" + }, + { + "name": "market", + "type": "publicKey" + }, + { + "name": "serumDex", + "type": "publicKey" + }, + { + "name": "targetOrders", + "type": "publicKey" + }, + { + "name": "withdrawQueue", + "type": "publicKey" + }, + { + "name": "tokenTempLp", + "type": "publicKey" + }, + { + "name": "ammOwner", + "type": "publicKey" + }, + { + "name": "lpAmount", + "type": "u64" + }, + { + "name": "clientOrderId", + "type": "u64" + }, + { + "name": "padding", + "type": { + "array": ["u64", 2] + } + } + ] + } + } + ], + "types": [ + { + "name": "WithdrawDestToken", + "type": { + "kind": "struct", + "fields": [ + { + "name": "withdrawAmount", + "type": "u64" + }, + { + "name": "coinAmount", + "type": "u64" + }, + { + "name": "pcAmount", + "type": "u64" + }, + { + "name": "destTokenCoin", + "type": "publicKey" + }, + { + "name": "destTokenPc", + "type": "publicKey" + } + ] + } + }, + { + "name": "WithdrawQueue", + "type": { + "kind": "struct", + "fields": [ + { + "name": "owner", + "type": { + "array": ["u64", 4] + } + }, + { + "name": "head", + "type": "u64" + }, + { + "name": "count", + "type": "u64" + }, + { + "name": "buf", + "type": { + "array": [ + { + "defined": "WithdrawDestToken" + }, + 64 + ] + } + } + ] + } + }, + { + "name": "TargetOrder", + "type": { + "kind": "struct", + "fields": [ + { + "name": "price", + "type": "u64" + }, + { + "name": "vol", + "type": "u64" + } + ] + } + }, + { + "name": "OutPutData", + "type": { + "kind": "struct", + "fields": [ + { + "name": "needTakePnlCoin", + "type": "u64" + }, + { + "name": "needTakePnlPc", + "type": "u64" + }, + { + "name": "totalPnlPc", + "type": "u64" + }, + { + "name": "totalPnlCoin", + "type": "u64" + }, + { + "name": "poolOpenTime", + "type": "u64" + }, + { + "name": "punishPcAmount", + "type": "u64" + }, + { + "name": "punishCoinAmount", + "type": "u64" + }, + { + "name": "orderbookToInitTime", + "type": "u64" + }, + { + "name": "swapCoinInAmount", + "type": "u128" + }, + { + "name": "swapPcOutAmount", + "type": "u128" + }, + { + "name": "swapTakePcFee", + "type": "u64" + }, + { + "name": "swapPcInAmount", + "type": "u128" + }, + { + "name": "swapCoinOutAmount", + "type": "u128" + }, + { + "name": "swapTakeCoinFee", + "type": "u64" + } + ] + } + }, + { + "name": "AmmConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pnlOwner", + "type": "publicKey" + }, + { + "name": "cancelOwner", + "type": "publicKey" + }, + { + "name": "pending1", + "type": { + "array": ["u64", 28] + } + }, + { + "name": "pending2", + "type": { + "array": ["u64", 32] + } + } + ] + } + }, + { + "name": "LastOrderDistance", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lastOrderNumerator", + "type": "u64" + }, + { + "name": "lastOrderDenominator", + "type": "u64" + } + ] + } + }, + { + "name": "NeedTake", + "type": { + "kind": "struct", + "fields": [ + { + "name": "needTakePc", + "type": "u64" + }, + { + "name": "needTakeCoin", + "type": "u64" + } + ] + } + }, + { + "name": "SwapInstructionBaseIn", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + } + }, + { + "name": "SwapInstructionBaseOut", + "type": { + "kind": "struct", + "fields": [ + { + "name": "maxAmountIn", + "type": "u64" + }, + { + "name": "amountOut", + "type": "u64" + } + ] + } + } + ], + "errors": [ + { + "code": 0, + "name": "AlreadyInUse", + "msg": "AlreadyInUse" + }, + { + "code": 1, + "name": "InvalidProgramAddress", + "msg": "InvalidProgramAddress" + }, + { + "code": 2, + "name": "ExpectedMint", + "msg": "ExpectedMint" + }, + { + "code": 3, + "name": "ExpectedAccount", + "msg": "ExpectedAccount" + }, + { + "code": 4, + "name": "InvalidCoinVault", + "msg": "InvalidCoinVault" + }, + { + "code": 5, + "name": "InvalidPCVault", + "msg": "InvalidPCVault" + }, + { + "code": 6, + "name": "InvalidTokenLP", + "msg": "InvalidTokenLP" + }, + { + "code": 7, + "name": "InvalidDestTokenCoin", + "msg": "InvalidDestTokenCoin" + }, + { + "code": 8, + "name": "InvalidDestTokenPC", + "msg": "InvalidDestTokenPC" + }, + { + "code": 9, + "name": "InvalidPoolMint", + "msg": "InvalidPoolMint" + }, + { + "code": 10, + "name": "InvalidOpenOrders", + "msg": "InvalidOpenOrders" + }, + { + "code": 11, + "name": "InvalidSerumMarket", + "msg": "InvalidSerumMarket" + }, + { + "code": 12, + "name": "InvalidSerumProgram", + "msg": "InvalidSerumProgram" + }, + { + "code": 13, + "name": "InvalidTargetOrders", + "msg": "InvalidTargetOrders" + }, + { + "code": 14, + "name": "InvalidWithdrawQueue", + "msg": "InvalidWithdrawQueue" + }, + { + "code": 15, + "name": "InvalidTempLp", + "msg": "InvalidTempLp" + }, + { + "code": 16, + "name": "InvalidCoinMint", + "msg": "InvalidCoinMint" + }, + { + "code": 17, + "name": "InvalidPCMint", + "msg": "InvalidPCMint" + }, + { + "code": 18, + "name": "InvalidOwner", + "msg": "InvalidOwner" + }, + { + "code": 19, + "name": "InvalidSupply", + "msg": "InvalidSupply" + }, + { + "code": 20, + "name": "InvalidDelegate", + "msg": "InvalidDelegate" + }, + { + "code": 21, + "name": "InvalidSignAccount", + "msg": "Invalid Sign Account" + }, + { + "code": 22, + "name": "InvalidStatus", + "msg": "InvalidStatus" + }, + { + "code": 23, + "name": "InvalidInstruction", + "msg": "Invalid instruction" + }, + { + "code": 24, + "name": "WrongAccountsNumber", + "msg": "Wrong accounts number" + }, + { + "code": 25, + "name": "WithdrawTransferBusy", + "msg": "Withdraw_transfer is busy" + }, + { + "code": 26, + "name": "WithdrawQueueFull", + "msg": "WithdrawQueue is full" + }, + { + "code": 27, + "name": "WithdrawQueueEmpty", + "msg": "WithdrawQueue is empty" + }, + { + "code": 28, + "name": "InvalidParamsSet", + "msg": "Params Set is invalid" + }, + { + "code": 29, + "name": "InvalidInput", + "msg": "InvalidInput" + }, + { + "code": 30, + "name": "ExceededSlippage", + "msg": "instruction exceeds desired slippage limit" + }, + { + "code": 31, + "name": "CalculationExRateFailure", + "msg": "CalculationExRateFailure" + }, + { + "code": 32, + "name": "CheckedSubOverflow", + "msg": "Checked_Sub Overflow" + }, + { + "code": 33, + "name": "CheckedAddOverflow", + "msg": "Checked_Add Overflow" + }, + { + "code": 34, + "name": "CheckedMulOverflow", + "msg": "Checked_Mul Overflow" + }, + { + "code": 35, + "name": "CheckedDivOverflow", + "msg": "Checked_Div Overflow" + }, + { + "code": 36, + "name": "CheckedEmptyFunds", + "msg": "Empty Funds" + }, + { + "code": 37, + "name": "CalcPnlError", + "msg": "Calc pnl error" + }, + { + "code": 38, + "name": "InvalidSplTokenProgram", + "msg": "InvalidSplTokenProgram" + }, + { + "code": 39, + "name": "TakePnlError", + "msg": "Take Pnl error" + }, + { + "code": 40, + "name": "InsufficientFunds", + "msg": "Insufficient funds" + }, + { + "code": 41, + "name": "ConversionFailure", + "msg": "Conversion to u64 failed with an overflow or underflow" + }, + { + "code": 42, + "name": "InvalidUserToken", + "msg": "user token input does not match amm" + }, + { + "code": 43, + "name": "InvalidSrmMint", + "msg": "InvalidSrmMint" + }, + { + "code": 44, + "name": "InvalidSrmToken", + "msg": "InvalidSrmToken" + }, + { + "code": 45, + "name": "TooManyOpenOrders", + "msg": "TooManyOpenOrders" + }, + { + "code": 46, + "name": "OrderAtSlotIsPlaced", + "msg": "OrderAtSlotIsPlaced" + }, + { + "code": 47, + "name": "InvalidSysProgramAddress", + "msg": "InvalidSysProgramAddress" + }, + { + "code": 48, + "name": "InvalidFee", + "msg": "The provided fee does not match the program owner's constraints" + }, + { + "code": 49, + "name": "RepeatCreateAmm", + "msg": "Repeat create amm about market" + }, + { + "code": 50, + "name": "NotAllowZeroLP", + "msg": "Not allow Zero LP" + }, + { + "code": 51, + "name": "InvalidCloseAuthority", + "msg": "Token account has a close authority" + }, + { + "code": 52, + "name": "InvalidFreezeAuthority", + "msg": "Pool token mint has a freeze authority" + }, + { + "code": 53, + "name": "InvalidReferPCMint", + "msg": "InvalidReferPCMint" + }, + { + "code": 54, + "name": "InvalidConfigAccount", + "msg": "InvalidConfigAccount" + }, + { + "code": 55, + "name": "RepeatCreateConfigAccount", + "msg": "Repeat create staking config account" + }, + { + "code": 56, + "name": "UnknownAmmError", + "msg": "Unknown Amm Error" + } + ], + "metadata": { + "instruction_selector_type": "index", + "address": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8" + } +} diff --git a/idl/raydium_cpmm.json b/idl/raydium_cpmm.json new file mode 100644 index 0000000..86958f1 --- /dev/null +++ b/idl/raydium_cpmm.json @@ -0,0 +1,1093 @@ +{ + "version": "0.1.0", + "name": "raydium_cp_swap", + "metadata": { + "address": "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C" + }, + "instructions": [ + { + "name": "createAmmConfig", + "docs": [ + "# Arguments", + "", + "* `ctx`- The accounts needed by instruction.", + "* `index` - The index of amm config, there may be multiple config.", + "* `trade_fee_rate` - Trade fee rate, can be changed.", + "* `protocol_fee_rate` - The rate of protocol fee within tarde fee.", + "* `fund_fee_rate` - The rate of fund fee within tarde fee.", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": true, + "isSigner": true, + "docs": ["Address to be set as protocol owner."] + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false, + "docs": [ + "Initialize config state account to store protocol owner address and fee rates." + ] + }, + { "name": "systemProgram", "isMut": false, "isSigner": false } + ], + "args": [ + { "name": "index", "type": "u16" }, + { "name": "tradeFeeRate", "type": "u64" }, + { "name": "protocolFeeRate", "type": "u64" }, + { "name": "fundFeeRate", "type": "u64" }, + { "name": "createPoolFee", "type": "u64" } + ] + }, + { + "name": "updateAmmConfig", + "docs": [ + "Updates the owner of the amm config", + "Must be called by the current owner or admin", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `trade_fee_rate`- The new trade fee rate of amm config, be set when `param` is 0", + "* `protocol_fee_rate`- The new protocol fee rate of amm config, be set when `param` is 1", + "* `fund_fee_rate`- The new fund fee rate of amm config, be set when `param` is 2", + "* `new_owner`- The config's new owner, be set when `param` is 3", + "* `new_fund_owner`- The config's new fund owner, be set when `param` is 4", + "* `param`- The vaule can be 0 | 1 | 2 | 3 | 4, otherwise will report a error", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["The amm config owner or admin"] + }, + { + "name": "ammConfig", + "isMut": true, + "isSigner": false, + "docs": ["Amm config account to be changed"] + } + ], + "args": [ + { "name": "param", "type": "u8" }, + { "name": "value", "type": "u64" } + ] + }, + { + "name": "updatePoolStatus", + "docs": [ + "Update pool status for given vaule", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `status` - The vaule of status", + "" + ], + "accounts": [ + { "name": "authority", "isMut": false, "isSigner": true }, + { "name": "poolState", "isMut": true, "isSigner": false } + ], + "args": [{ "name": "status", "type": "u8" }] + }, + { + "name": "collectProtocolFee", + "docs": [ + "Collect the protocol fee accrued to the pool", + "", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", + "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Only admin or owner can collect fee now"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Pool state stores accumulated protocol fee amount"] + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["Amm config account stores owner"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "recipientToken0Account", + "isMut": true, + "isSigner": false, + "docs": [ + "The address that receives the collected token_0 protocol fees" + ] + }, + { + "name": "recipientToken1Account", + "isMut": true, + "isSigner": false, + "docs": [ + "The address that receives the collected token_1 protocol fees" + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program to perform token transfers"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program 2022 to perform token transfers"] + } + ], + "args": [ + { "name": "amount0Requested", "type": "u64" }, + { "name": "amount1Requested", "type": "u64" } + ] + }, + { + "name": "collectFundFee", + "docs": [ + "Collect the fund fee accrued to the pool", + "", + "# Arguments", + "", + "* `ctx` - The context of accounts", + "* `amount_0_requested` - The maximum amount of token_0 to send, can be 0 to collect fees in only token_1", + "* `amount_1_requested` - The maximum amount of token_1 to send, can be 0 to collect fees in only token_0", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Only admin or fund_owner can collect fee now"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Pool state stores accumulated protocol fee amount"] + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["Amm config account stores fund_owner"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "recipientToken0Account", + "isMut": true, + "isSigner": false, + "docs": ["The address that receives the collected token_0 fund fees"] + }, + { + "name": "recipientToken1Account", + "isMut": true, + "isSigner": false, + "docs": ["The address that receives the collected token_1 fund fees"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program to perform token transfers"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["The SPL program 2022 to perform token transfers"] + } + ], + "args": [ + { "name": "amount0Requested", "type": "u64" }, + { "name": "amount1Requested", "type": "u64" } + ] + }, + { + "name": "initialize", + "docs": [ + "Creates a pool for the given token pair and the initial price", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `init_amount_0` - the initial amount_0 to deposit", + "* `init_amount_1` - the initial amount_1 to deposit", + "* `open_time` - the timestamp allowed for swap", + "" + ], + "accounts": [ + { + "name": "creator", + "isMut": true, + "isSigner": true, + "docs": ["Address paying to create the pool. Can be anyone"] + }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["Which config the pool belongs to."] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Initialize an account to store the pool state"] + }, + { + "name": "token0Mint", + "isMut": false, + "isSigner": false, + "docs": ["Token_0 mint, the key must smaller then token_1 mint."] + }, + { + "name": "token1Mint", + "isMut": false, + "isSigner": false, + "docs": ["Token_1 mint, the key must grater then token_0 mint."] + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": ["pool lp mint"] + }, + { + "name": "creatorToken0", + "isMut": true, + "isSigner": false, + "docs": ["payer token0 account"] + }, + { + "name": "creatorToken1", + "isMut": true, + "isSigner": false, + "docs": ["creator token1 account"] + }, + { + "name": "creatorLpToken", + "isMut": true, + "isSigner": false, + "docs": ["creator lp token account"] + }, + { "name": "token0Vault", "isMut": true, "isSigner": false }, + { "name": "token1Vault", "isMut": true, "isSigner": false }, + { + "name": "createPoolFee", + "isMut": true, + "isSigner": false, + "docs": ["create pool fee account"] + }, + { + "name": "observationState", + "isMut": true, + "isSigner": false, + "docs": ["an account to store oracle observations"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["Program to create mint account and mint tokens"] + }, + { + "name": "token0Program", + "isMut": false, + "isSigner": false, + "docs": ["Spl token program or token program 2022"] + }, + { + "name": "token1Program", + "isMut": false, + "isSigner": false, + "docs": ["Spl token program or token program 2022"] + }, + { + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["Program to create an ATA for receiving position NFT"] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": ["To create a new program account"] + }, + { + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": ["Sysvar for program account"] + } + ], + "args": [ + { "name": "initAmount0", "type": "u64" }, + { "name": "initAmount1", "type": "u64" }, + { "name": "openTime", "type": "u64" } + ] + }, + { + "name": "deposit", + "docs": [ + "Creates a pool for the given token pair and the initial price", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `lp_token_amount` - Pool token amount to transfer. token_a and token_b amount are set by the current exchange rate and size of the pool", + "* `maximum_token_0_amount` - Maximum token 0 amount to deposit, prevents excessive slippage", + "* `maximum_token_1_amount` - Maximum token 1 amount to deposit, prevents excessive slippage", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Pays to mint the position"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { "name": "poolState", "isMut": true, "isSigner": false }, + { + "name": "ownerLpToken", + "isMut": true, + "isSigner": false, + "docs": ["Owner lp tokan account"] + }, + { + "name": "token0Account", + "isMut": true, + "isSigner": false, + "docs": ["The payer's token account for token_0"] + }, + { + "name": "token1Account", + "isMut": true, + "isSigner": false, + "docs": ["The payer's token account for token_1"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["token Program"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["Token program 2022"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": ["Lp token mint"] + } + ], + "args": [ + { "name": "lpTokenAmount", "type": "u64" }, + { "name": "maximumToken0Amount", "type": "u64" }, + { "name": "maximumToken1Amount", "type": "u64" } + ] + }, + { + "name": "withdraw", + "docs": [ + "Withdraw lp for token0 ande token1", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `lp_token_amount` - Amount of pool tokens to burn. User receives an output of token a and b based on the percentage of the pool tokens that are returned.", + "* `minimum_token_0_amount` - Minimum amount of token 0 to receive, prevents excessive slippage", + "* `minimum_token_1_amount` - Minimum amount of token 1 to receive, prevents excessive slippage", + "" + ], + "accounts": [ + { + "name": "owner", + "isMut": false, + "isSigner": true, + "docs": ["Pays to mint the position"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": ["Pool state account"] + }, + { + "name": "ownerLpToken", + "isMut": true, + "isSigner": false, + "docs": ["Owner lp token account"] + }, + { + "name": "token0Account", + "isMut": true, + "isSigner": false, + "docs": ["The owner's token account for receive token_0"] + }, + { + "name": "token1Account", + "isMut": true, + "isSigner": false, + "docs": ["The owner's token account for receive token_1"] + }, + { + "name": "token0Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_0"] + }, + { + "name": "token1Vault", + "isMut": true, + "isSigner": false, + "docs": ["The address that holds pool tokens for token_1"] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["token Program"] + }, + { + "name": "tokenProgram2022", + "isMut": false, + "isSigner": false, + "docs": ["Token program 2022"] + }, + { + "name": "vault0Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_0 vault"] + }, + { + "name": "vault1Mint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of token_1 vault"] + }, + { + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": ["Pool lp token mint"] + }, + { + "name": "memoProgram", + "isMut": false, + "isSigner": false, + "docs": ["memo program"] + } + ], + "args": [ + { "name": "lpTokenAmount", "type": "u64" }, + { "name": "minimumToken0Amount", "type": "u64" }, + { "name": "minimumToken1Amount", "type": "u64" } + ] + }, + { + "name": "swapBaseInput", + "docs": [ + "Swap the tokens in the pool base input amount", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `amount_in` - input amount to transfer, output to DESTINATION is based on the exchange rate", + "* `minimum_amount_out` - Minimum amount of output token, prevents excessive slippage", + "" + ], + "accounts": [ + { + "name": "payer", + "isMut": false, + "isSigner": true, + "docs": ["The user performing the swap"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["The factory state to read protocol fees"] + }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": [ + "The program account of the pool in which the swap will be performed" + ] + }, + { + "name": "inputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for input token"] + }, + { + "name": "outputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for output token"] + }, + { + "name": "inputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for input token"] + }, + { + "name": "outputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for output token"] + }, + { + "name": "inputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for input token transfers"] + }, + { + "name": "outputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for output token transfers"] + }, + { + "name": "inputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of input token"] + }, + { + "name": "outputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of output token"] + }, + { + "name": "observationState", + "isMut": true, + "isSigner": false, + "docs": ["The program account for the most recent oracle observation"] + } + ], + "args": [ + { "name": "amountIn", "type": "u64" }, + { "name": "minimumAmountOut", "type": "u64" } + ] + }, + { + "name": "swapBaseOutput", + "docs": [ + "Swap the tokens in the pool base output amount", + "", + "# Arguments", + "", + "* `ctx`- The context of accounts", + "* `max_amount_in` - input amount prevents excessive slippage", + "* `amount_out` - amount of output token", + "" + ], + "accounts": [ + { + "name": "payer", + "isMut": false, + "isSigner": true, + "docs": ["The user performing the swap"] + }, + { "name": "authority", "isMut": false, "isSigner": false }, + { + "name": "ammConfig", + "isMut": false, + "isSigner": false, + "docs": ["The factory state to read protocol fees"] + }, + { + "name": "poolState", + "isMut": true, + "isSigner": false, + "docs": [ + "The program account of the pool in which the swap will be performed" + ] + }, + { + "name": "inputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for input token"] + }, + { + "name": "outputTokenAccount", + "isMut": true, + "isSigner": false, + "docs": ["The user token account for output token"] + }, + { + "name": "inputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for input token"] + }, + { + "name": "outputVault", + "isMut": true, + "isSigner": false, + "docs": ["The vault token account for output token"] + }, + { + "name": "inputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for input token transfers"] + }, + { + "name": "outputTokenProgram", + "isMut": false, + "isSigner": false, + "docs": ["SPL program for output token transfers"] + }, + { + "name": "inputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of input token"] + }, + { + "name": "outputTokenMint", + "isMut": false, + "isSigner": false, + "docs": ["The mint of output token"] + }, + { + "name": "observationState", + "isMut": true, + "isSigner": false, + "docs": ["The program account for the most recent oracle observation"] + } + ], + "args": [ + { "name": "maxAmountIn", "type": "u64" }, + { "name": "amountOut", "type": "u64" } + ] + } + ], + "accounts": [ + { + "name": "AmmConfig", + "docs": ["Holds the current owner of the factory"], + "type": { + "kind": "struct", + "fields": [ + { "name": "bump", "docs": ["Bump to identify PDA"], "type": "u8" }, + { + "name": "disableCreatePool", + "docs": ["Status to control if new pool can be create"], + "type": "bool" + }, + { "name": "index", "docs": ["Config index"], "type": "u16" }, + { + "name": "tradeFeeRate", + "docs": [ + "The trade fee, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "protocolFeeRate", + "docs": ["The protocol fee"], + "type": "u64" + }, + { + "name": "fundFeeRate", + "docs": [ + "The fund fee, denominated in hundredths of a bip (10^-6)" + ], + "type": "u64" + }, + { + "name": "createPoolFee", + "docs": ["Fee for create a new pool"], + "type": "u64" + }, + { + "name": "protocolOwner", + "docs": ["Address of the protocol fee owner"], + "type": "publicKey" + }, + { + "name": "fundOwner", + "docs": ["Address of the fund fee owner"], + "type": "publicKey" + }, + { + "name": "padding", + "docs": ["padding"], + "type": { "array": ["u64", 16] } + } + ] + } + }, + { + "name": "ObservationState", + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "docs": ["Whether the ObservationState is initialized"], + "type": "bool" + }, + { + "name": "observationIndex", + "docs": [ + "the most-recently updated index of the observations array" + ], + "type": "u16" + }, + { "name": "poolId", "type": "publicKey" }, + { + "name": "observations", + "docs": ["observation array"], + "type": { "array": [{ "defined": "Observation" }, 100] } + }, + { + "name": "padding", + "docs": ["padding for feature update"], + "type": { "array": ["u64", 4] } + } + ] + } + }, + { + "name": "PoolState", + "type": { + "kind": "struct", + "fields": [ + { + "name": "ammConfig", + "docs": ["Which config the pool belongs"], + "type": "publicKey" + }, + { + "name": "poolCreator", + "docs": ["pool creator"], + "type": "publicKey" + }, + { "name": "token0Vault", "docs": ["Token A"], "type": "publicKey" }, + { "name": "token1Vault", "docs": ["Token B"], "type": "publicKey" }, + { + "name": "lpMint", + "docs": [ + "Pool tokens are issued when A or B tokens are deposited.", + "Pool tokens can be withdrawn back to the original A or B token." + ], + "type": "publicKey" + }, + { + "name": "token0Mint", + "docs": ["Mint information for token A"], + "type": "publicKey" + }, + { + "name": "token1Mint", + "docs": ["Mint information for token B"], + "type": "publicKey" + }, + { + "name": "token0Program", + "docs": ["token_0 program"], + "type": "publicKey" + }, + { + "name": "token1Program", + "docs": ["token_1 program"], + "type": "publicKey" + }, + { + "name": "observationKey", + "docs": ["observation account to store oracle data"], + "type": "publicKey" + }, + { "name": "authBump", "type": "u8" }, + { + "name": "status", + "docs": [ + "Bitwise representation of the state of the pool", + "bit0, 1: disable deposit(vaule is 1), 0: normal", + "bit1, 1: disable withdraw(vaule is 2), 0: normal", + "bit2, 1: disable swap(vaule is 4), 0: normal" + ], + "type": "u8" + }, + { "name": "lpMintDecimals", "type": "u8" }, + { + "name": "mint0Decimals", + "docs": ["mint0 and mint1 decimals"], + "type": "u8" + }, + { "name": "mint1Decimals", "type": "u8" }, + { "name": "lpSupply", "docs": ["lp mint supply"], "type": "u64" }, + { + "name": "protocolFeesToken0", + "docs": [ + "The amounts of token_0 and token_1 that are owed to the liquidity provider." + ], + "type": "u64" + }, + { "name": "protocolFeesToken1", "type": "u64" }, + { "name": "fundFeesToken0", "type": "u64" }, + { "name": "fundFeesToken1", "type": "u64" }, + { + "name": "openTime", + "docs": ["The timestamp allowed for swap in the pool."], + "type": "u64" + }, + { + "name": "padding", + "docs": ["padding for future updates"], + "type": { "array": ["u64", 32] } + } + ] + } + } + ], + "types": [ + { + "name": "Observation", + "docs": ["The element of observations in ObservationState"], + "type": { + "kind": "struct", + "fields": [ + { + "name": "blockTimestamp", + "docs": ["The block timestamp of the observation"], + "type": "u64" + }, + { + "name": "cumulativeToken0PriceX32", + "docs": [ + "the cumulative of token0 price during the duration time, Q32.32, the remaining 64 bit for overflow" + ], + "type": "u128" + }, + { + "name": "cumulativeToken1PriceX32", + "docs": [ + "the cumulative of token1 price during the duration time, Q32.32, the remaining 64 bit for overflow" + ], + "type": "u128" + } + ] + } + }, + { + "name": "TradeDirection", + "docs": [ + "The direction of a trade, since curves can be specialized to treat each", + "token differently (by adding offsets or weights)" + ], + "type": { + "kind": "enum", + "variants": [{ "name": "ZeroForOne" }, { "name": "OneForZero" }] + } + }, + { + "name": "RoundDirection", + "docs": [ + "The direction to round. Used for pool token to trading token conversions to", + "avoid losing value on any deposit or withdrawal." + ], + "type": { + "kind": "enum", + "variants": [{ "name": "Floor" }, { "name": "Ceiling" }] + } + }, + { + "name": "PoolStatusBitIndex", + "type": { + "kind": "enum", + "variants": [ + { "name": "Deposit" }, + { "name": "Withdraw" }, + { "name": "Swap" } + ] + } + }, + { + "name": "PoolStatusBitFlag", + "type": { + "kind": "enum", + "variants": [{ "name": "Enable" }, { "name": "Disable" }] + } + } + ], + "events": [ + { + "name": "LpChangeEvent", + "fields": [ + { "name": "poolId", "type": "publicKey", "index": true }, + { "name": "lpAmountBefore", "type": "u64", "index": false }, + { "name": "token0VaultBefore", "type": "u64", "index": false }, + { "name": "token1VaultBefore", "type": "u64", "index": false }, + { "name": "token0Amount", "type": "u64", "index": false }, + { "name": "token1Amount", "type": "u64", "index": false }, + { "name": "token0TransferFee", "type": "u64", "index": false }, + { "name": "token1TransferFee", "type": "u64", "index": false }, + { "name": "changeType", "type": "u8", "index": false } + ] + }, + { + "name": "SwapEvent", + "fields": [ + { "name": "poolId", "type": "publicKey", "index": true }, + { "name": "inputVaultBefore", "type": "u64", "index": false }, + { "name": "outputVaultBefore", "type": "u64", "index": false }, + { "name": "inputAmount", "type": "u64", "index": false }, + { "name": "outputAmount", "type": "u64", "index": false }, + { "name": "inputTransferFee", "type": "u64", "index": false }, + { "name": "outputTransferFee", "type": "u64", "index": false }, + { "name": "baseInput", "type": "bool", "index": false } + ] + } + ], + "errors": [ + { "code": 6000, "name": "NotApproved", "msg": "Not approved" }, + { + "code": 6001, + "name": "InvalidOwner", + "msg": "Input account owner is not the program address" + }, + { "code": 6002, "name": "EmptySupply", "msg": "Input token account empty" }, + { "code": 6003, "name": "InvalidInput", "msg": "InvalidInput" }, + { + "code": 6004, + "name": "IncorrectLpMint", + "msg": "Address of the provided lp token mint is incorrect" + }, + { + "code": 6005, + "name": "ExceededSlippage", + "msg": "Exceeds desired slippage limit" + }, + { + "code": 6006, + "name": "ZeroTradingTokens", + "msg": "Given pool token amount results in zero trading tokens" + }, + { + "code": 6007, + "name": "NotSupportMint", + "msg": "Not support token_2022 mint extension" + }, + { "code": 6008, "name": "InvalidVault", "msg": "invaild vault" }, + { + "code": 6009, + "name": "InitLpAmountTooLess", + "msg": "Init lp amount is too less(Because 100 amount lp will be locked)" + } + ] +} diff --git a/src/client/mod.rs b/src/client/mod.rs index 4d627e1..efb846f 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -362,7 +362,8 @@ pub struct TradeBuyParams { pub create_mint_ata: bool, /// Durable nonce information pub durable_nonce: Option, - /// Optional fixed output token amount (If this value is set, it will be directly assigned to the output amount instead of being calculated) + /// Optional fixed output token amount. On exact-out capable DEXes this uses + /// the exact-out instruction and treats `input_token_amount` as max input. pub fixed_output_token_amount: Option, /// Gas fee strategy pub gas_fee_strategy: GasFeeStrategy, @@ -413,7 +414,8 @@ pub struct TradeSellParams { pub close_mint_token_ata: bool, /// Durable nonce information pub durable_nonce: Option, - /// Optional fixed output token amount (If this value is set, it will be directly assigned to the output amount instead of being calculated) + /// Optional fixed output token amount. On exact-out capable DEXes this uses + /// the exact-out instruction and treats `input_token_amount` as max input. pub fixed_output_token_amount: Option, /// Gas fee strategy pub gas_fee_strategy: GasFeeStrategy, diff --git a/src/common/fast_timing.rs b/src/common/fast_timing.rs index 92b9b61..160fa01 100644 --- a/src/common/fast_timing.rs +++ b/src/common/fast_timing.rs @@ -141,8 +141,8 @@ mod tests { std::thread::sleep(Duration::from_millis(10)); let elapsed = fast_elapsed_nanos(start); - // 应该大约是 10ms = 10,000,000 纳秒 - assert!(elapsed >= 9_000_000 && elapsed <= 12_000_000); + // Scheduler jitter can exceed the sleep duration; the fast timer must not under-report. + assert!(elapsed >= 9_000_000); } #[test] @@ -151,7 +151,7 @@ mod tests { std::thread::sleep(Duration::from_millis(10)); let elapsed_ms = sw.elapsed_millis(); - assert!(elapsed_ms >= 9 && elapsed_ms <= 12); + assert!(elapsed_ms >= 9); } #[test] diff --git a/src/common/types.rs b/src/common/types.rs index 6f12935..77835e9 100755 --- a/src/common/types.rs +++ b/src/common/types.rs @@ -112,7 +112,7 @@ impl TradeConfig { /// - `.mev_protection(bool)` — MEV protection for Astralane/BlockRazor (default: false) /// /// # Example - /// ```rust + /// ```rust,ignore /// let config = TradeConfig::builder(rpc_url, swqos_configs, commitment) /// .mev_protection(true) /// .check_min_tip(true) diff --git a/src/instruction/bonk.rs b/src/instruction/bonk.rs index 9873654..75b6445 100755 --- a/src/instruction/bonk.rs +++ b/src/instruction/bonk.rs @@ -1,8 +1,14 @@ use crate::{ constants::trade::trade::DEFAULT_SLIPPAGE, - instruction::utils::bonk::{ - accounts, get_pool_pda, get_vault_pda, BUY_EXECT_IN_DISCRIMINATOR, - SELL_EXECT_IN_DISCRIMINATOR, + instruction::{ + token_account_setup::{ + push_close_wsol_if_needed, push_create_or_wrap_user_token_account, + push_create_user_token_account, + }, + utils::bonk::{ + accounts, get_pool_pda, get_vault_pda, BUY_EXECT_IN_DISCRIMINATOR, + BUY_EXECT_OUT_DISCRIMINATOR, SELL_EXECT_IN_DISCRIMINATOR, SELL_EXECT_OUT_DISCRIMINATOR, + }, }, trading::core::{ params::{BonkParams, SwapParams}, @@ -55,6 +61,11 @@ impl InstructionBuilder for BonkInstructionBuilder { accounts::GLOBAL_CONFIG_META }; + let quote_mint = if usd1_pool { + crate::constants::USD1_TOKEN_ACCOUNT + } else { + crate::constants::WSOL_TOKEN_ACCOUNT + }; let quote_token_mint = if usd1_pool { crate::constants::USD1_TOKEN_ACCOUNT_META } else { @@ -88,11 +99,7 @@ impl InstructionBuilder for BonkInstructionBuilder { let user_quote_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - if usd1_pool { - &crate::constants::USD1_TOKEN_ACCOUNT - } else { - &crate::constants::WSOL_TOKEN_ACCOUNT - }, + "e_mint, &crate::constants::TOKEN_PROGRAM, params.open_seed_optimize, ); @@ -103,11 +110,7 @@ impl InstructionBuilder for BonkInstructionBuilder { protocol_params.base_vault }; let quote_vault_account = if protocol_params.quote_vault == Pubkey::default() { - if usd1_pool { - get_vault_pda(&pool_state, &crate::constants::USD1_TOKEN_ACCOUNT).unwrap() - } else { - get_vault_pda(&pool_state, &crate::constants::WSOL_TOKEN_ACCOUNT).unwrap() - } + get_vault_pda(&pool_state, "e_mint).unwrap() } else { protocol_params.quote_vault }; @@ -117,9 +120,15 @@ impl InstructionBuilder for BonkInstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(6); - if params.create_input_mint_ata && !usd1_pool { - instructions - .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); + if params.create_input_mint_ata { + push_create_or_wrap_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + "e_mint, + &crate::constants::TOKEN_PROGRAM, + amount_in, + params.open_seed_optimize, + ); } if params.create_output_mint_ata { @@ -135,12 +144,18 @@ impl InstructionBuilder for BonkInstructionBuilder { } let mut data = [0u8; 32]; - data[..8].copy_from_slice(&BUY_EXECT_IN_DISCRIMINATOR); - data[8..16].copy_from_slice(&amount_in.to_le_bytes()); - data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + if let Some(amount_out) = params.fixed_output_amount { + data[..8].copy_from_slice(&BUY_EXECT_OUT_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_out.to_le_bytes()); + data[16..24].copy_from_slice(&amount_in.to_le_bytes()); + } else { + data[..8].copy_from_slice(&BUY_EXECT_IN_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_in.to_le_bytes()); + data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + } data[24..32].copy_from_slice(&share_fee_rate.to_le_bytes()); - let accounts: [AccountMeta; 18] = [ + let accounts: [AccountMeta; 15] = [ AccountMeta::new(params.payer.pubkey(), true), // Payer (signer) accounts::AUTHORITY_META, // Authority (readonly) global_config, // Global Config (readonly) @@ -156,15 +171,12 @@ impl InstructionBuilder for BonkInstructionBuilder { crate::constants::TOKEN_PROGRAM_META, // Quote Token Program (readonly) accounts::EVENT_AUTHORITY_META, // Event Authority (readonly) accounts::BONK_META, // Program (readonly) - crate::constants::SYSTEM_PROGRAM_META, // System Program (readonly) - AccountMeta::new(protocol_params.platform_associated_account, false), // Platform Associated Account - AccountMeta::new(protocol_params.creator_associated_account, false), // Creator Associated Account ]; instructions.push(Instruction::new_with_bytes(accounts::BONK, &data, accounts.to_vec())); if params.close_input_mint_ata { - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), "e_mint); } Ok(instructions) @@ -203,6 +215,11 @@ impl InstructionBuilder for BonkInstructionBuilder { accounts::GLOBAL_CONFIG_META }; + let quote_mint = if usd1_pool { + crate::constants::USD1_TOKEN_ACCOUNT + } else { + crate::constants::WSOL_TOKEN_ACCOUNT + }; let quote_token_mint = if usd1_pool { crate::constants::USD1_TOKEN_ACCOUNT_META } else { @@ -235,11 +252,7 @@ impl InstructionBuilder for BonkInstructionBuilder { let user_quote_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - if usd1_pool { - &crate::constants::USD1_TOKEN_ACCOUNT - } else { - &crate::constants::WSOL_TOKEN_ACCOUNT - }, + "e_mint, &crate::constants::TOKEN_PROGRAM, params.open_seed_optimize, ); @@ -250,11 +263,7 @@ impl InstructionBuilder for BonkInstructionBuilder { protocol_params.base_vault }; let quote_vault_account = if protocol_params.quote_vault == Pubkey::default() { - if usd1_pool { - get_vault_pda(&pool_state, &crate::constants::USD1_TOKEN_ACCOUNT).unwrap() - } else { - get_vault_pda(&pool_state, &crate::constants::WSOL_TOKEN_ACCOUNT).unwrap() - } + get_vault_pda(&pool_state, "e_mint).unwrap() } else { protocol_params.quote_vault }; @@ -262,19 +271,31 @@ impl InstructionBuilder for BonkInstructionBuilder { // ======================================== // Build instructions // ======================================== - let mut instructions = Vec::with_capacity(3); + let mut instructions = Vec::with_capacity(4); - if params.close_output_mint_ata && !usd1_pool { - instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); + if params.create_output_mint_ata { + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + "e_mint, + &crate::constants::TOKEN_PROGRAM, + params.open_seed_optimize, + ); } let mut data = [0u8; 32]; - data[..8].copy_from_slice(&SELL_EXECT_IN_DISCRIMINATOR); - data[8..16].copy_from_slice(&amount.to_le_bytes()); - data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + if let Some(amount_out) = params.fixed_output_amount { + data[..8].copy_from_slice(&SELL_EXECT_OUT_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_out.to_le_bytes()); + data[16..24].copy_from_slice(&amount.to_le_bytes()); + } else { + data[..8].copy_from_slice(&SELL_EXECT_IN_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount.to_le_bytes()); + data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + } data[24..32].copy_from_slice(&share_fee_rate.to_le_bytes()); - let accounts: [AccountMeta; 18] = [ + let accounts: [AccountMeta; 15] = [ AccountMeta::new(params.payer.pubkey(), true), // Payer (signer) accounts::AUTHORITY_META, // Authority (readonly) global_config, // Global Config (readonly) @@ -290,15 +311,12 @@ impl InstructionBuilder for BonkInstructionBuilder { crate::constants::TOKEN_PROGRAM_META, // Quote Token Program (readonly) accounts::EVENT_AUTHORITY_META, // Event Authority (readonly) accounts::BONK_META, // Program (readonly) - crate::constants::SYSTEM_PROGRAM_META, // System Program (readonly) - AccountMeta::new(protocol_params.platform_associated_account, false), // Platform Associated Account - AccountMeta::new(protocol_params.creator_associated_account, false), // Creator Associated Account ]; instructions.push(Instruction::new_with_bytes(accounts::BONK, &data, accounts.to_vec())); if params.close_output_mint_ata { - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), "e_mint); } if params.close_input_mint_ata { instructions.push(crate::common::spl_token::close_account( @@ -313,3 +331,111 @@ impl InstructionBuilder for BonkInstructionBuilder { Ok(instructions) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::{common::GasFeeStrategy, swqos::TradeType, trading::core::params::DexParamEnum}; + use solana_sdk::{pubkey::Pubkey, signature::Keypair}; + use std::sync::Arc; + + fn pk(seed: u8) -> Pubkey { + Pubkey::new_from_array([seed; 32]) + } + + fn bonk_params() -> BonkParams { + BonkParams { + mint_token_program: crate::constants::TOKEN_PROGRAM, + platform_config: pk(8), + platform_associated_account: pk(9), + creator_associated_account: pk(10), + global_config: accounts::GLOBAL_CONFIG, + ..Default::default() + } + } + + fn swap_params(trade_type: TradeType) -> SwapParams { + SwapParams { + rpc: None, + payer: Arc::new(Keypair::new()), + trade_type, + input_mint: pk(3), + input_token_program: None, + output_mint: pk(3), + output_token_program: None, + input_amount: Some(100_000), + slippage_basis_points: Some(100), + address_lookup_table_account: None, + recent_blockhash: None, + wait_tx_confirmed: false, + protocol_params: DexParamEnum::Bonk(bonk_params()), + open_seed_optimize: true, + swqos_clients: Arc::new(Vec::new()), + middleware_manager: None, + durable_nonce: None, + with_tip: false, + create_input_mint_ata: false, + close_input_mint_ata: false, + create_output_mint_ata: false, + close_output_mint_ata: false, + fixed_output_amount: Some(42), + gas_fee_strategy: GasFeeStrategy::new(), + simulate: true, + log_enabled: false, + use_dedicated_sender_threads: false, + sender_thread_cores: None, + max_sender_concurrency: 0, + effective_core_ids: Arc::new(Vec::new()), + check_min_tip: false, + grpc_recv_us: None, + use_exact_sol_amount: None, + use_pumpfun_v2: false, + } + } + + #[tokio::test] + async fn bonk_buy_uses_exact_out_when_fixed_output_is_set() { + let instructions = BonkInstructionBuilder + .build_buy_instructions(&swap_params(TradeType::Buy)) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(ix.accounts.len(), 15); + assert_eq!(ix.accounts[14].pubkey, accounts::BONK); + assert_eq!(&ix.data[..8], BUY_EXECT_OUT_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 42); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 100_000); + } + + #[tokio::test] + async fn bonk_sell_uses_exact_out_when_fixed_output_is_set() { + let instructions = BonkInstructionBuilder + .build_sell_instructions(&swap_params(TradeType::Sell)) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(ix.accounts.len(), 15); + assert_eq!(ix.accounts[14].pubkey, accounts::BONK); + assert_eq!(&ix.data[..8], SELL_EXECT_OUT_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 42); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 100_000); + } + + #[tokio::test] + async fn bonk_usd1_buy_create_input_builds_usd1_ata_not_wsol_wrap() { + let mut params = swap_params(TradeType::Buy); + if let DexParamEnum::Bonk(protocol_params) = &mut params.protocol_params { + protocol_params.global_config = accounts::USD1_GLOBAL_CONFIG; + } + params.create_input_mint_ata = true; + params.open_seed_optimize = false; + + let instructions = BonkInstructionBuilder.build_buy_instructions(¶ms).await.unwrap(); + let create_ix = instructions.first().unwrap(); + + assert_eq!(create_ix.program_id, crate::constants::ASSOCIATED_TOKEN_PROGRAM_ID); + assert_eq!(create_ix.accounts[3].pubkey, crate::constants::USD1_TOKEN_ACCOUNT); + } +} diff --git a/src/instruction/meteora_damm_v2.rs b/src/instruction/meteora_damm_v2.rs index 5ef86c9..429bb83 100644 --- a/src/instruction/meteora_damm_v2.rs +++ b/src/instruction/meteora_damm_v2.rs @@ -1,5 +1,14 @@ use crate::{ - instruction::utils::meteora_damm_v2::{accounts, get_event_authority_pda, SWAP_DISCRIMINATOR}, + instruction::{ + token_account_setup::{ + push_close_wsol_if_needed, push_create_or_wrap_user_token_account, + push_create_user_token_account, + }, + utils::meteora_damm_v2::{ + accounts, get_event_authority_pda, SWAP2_DISCRIMINATOR, SWAP_MODE_EXACT_IN, + SWAP_MODE_EXACT_OUT, SWAP_MODE_PARTIAL_FILL, + }, + }, trading::core::{ params::{MeteoraDammV2Params, SwapParams}, traits::InstructionBuilder, @@ -42,32 +51,43 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder { // ======================================== let is_a_in = protocol_params.token_a_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.token_a_mint == crate::constants::USDC_TOKEN_ACCOUNT; + let input_mint = + if is_a_in { protocol_params.token_a_mint } else { protocol_params.token_b_mint }; + let input_token_program = + if is_a_in { protocol_params.token_a_program } else { protocol_params.token_b_program }; + let output_mint = + if is_a_in { protocol_params.token_b_mint } else { protocol_params.token_a_mint }; + let output_token_program = + if is_a_in { protocol_params.token_b_program } else { protocol_params.token_a_program }; let amount_in: u64 = params.input_amount.unwrap_or(0); - let minimum_amount_out: u64 = match params.fixed_output_amount { - Some(fixed) => fixed, - None => return Err(anyhow!("fixed_output_amount must be set for MeteoraDammV2 swap")), + let (amount_0, amount_1) = match protocol_params.swap_mode { + SWAP_MODE_EXACT_OUT => { + let amount_out = params.fixed_output_amount.ok_or_else(|| { + anyhow!("fixed_output_amount must be set for MeteoraDammV2 exact-out swap2") + })?; + (amount_out, amount_in) + } + SWAP_MODE_EXACT_IN | SWAP_MODE_PARTIAL_FILL => { + let minimum_amount_out = params.fixed_output_amount.ok_or_else(|| { + anyhow!("fixed_output_amount must be set for MeteoraDammV2 swap2 min output") + })?; + (amount_in, minimum_amount_out) + } + mode => return Err(anyhow!("Unsupported MeteoraDammV2 swap_mode {}", mode)), }; let input_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.input_mint, - if is_a_in { - &protocol_params.token_a_program - } else { - &protocol_params.token_b_program - }, + &input_mint, + &input_token_program, params.open_seed_optimize, ); let output_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.output_mint, - if is_a_in { - &protocol_params.token_b_program - } else { - &protocol_params.token_a_program - }, + &output_mint, + &output_token_program, params.open_seed_optimize, ); @@ -77,28 +97,32 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder { let mut instructions = Vec::with_capacity(6); if params.create_input_mint_ata { - instructions - .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); + push_create_or_wrap_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &input_mint, + &input_token_program, + amount_in, + params.open_seed_optimize, + ); } if params.create_output_mint_ata { - instructions.extend( - crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( - ¶ms.payer.pubkey(), - ¶ms.payer.pubkey(), - ¶ms.output_mint, - if is_a_in { - &protocol_params.token_b_program - } else { - &protocol_params.token_a_program - }, - params.open_seed_optimize, - ), + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_mint, + &output_token_program, + params.open_seed_optimize, ); } // Create buy instruction - let accounts: [AccountMeta; 14] = [ + let mut account_metas = Vec::with_capacity( + 13 + usize::from(protocol_params.referral_token_account.is_some()) + + usize::from(protocol_params.include_rate_limiter_sysvar), + ); + account_metas.extend([ accounts::AUTHORITY_META, // Pool Authority (readonly) AccountMeta::new(protocol_params.pool, false), // Pool AccountMeta::new(input_token_account, false), // Input Token Account @@ -110,25 +134,32 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder { AccountMeta::new(params.payer.pubkey(), true), // User Transfer Authority AccountMeta::new_readonly(protocol_params.token_a_program, false), // Token Program (readonly) AccountMeta::new_readonly(protocol_params.token_b_program, false), // Token Program (readonly) - accounts::METEORA_DAMM_V2_META, // Referral Token Account (readonly) + ]); + if let Some(referral_token_account) = protocol_params.referral_token_account { + account_metas.push(AccountMeta::new(referral_token_account, false)); + } + account_metas.extend([ AccountMeta::new_readonly(get_event_authority_pda(), false), // Event Authority (readonly) accounts::METEORA_DAMM_V2_META, // Program (readonly) - ]; + ]); + if protocol_params.include_rate_limiter_sysvar { + account_metas.push(accounts::SYSVAR_INSTRUCTIONS_META); + } // Create instruction data - let mut data = [0u8; 24]; - data[..8].copy_from_slice(&SWAP_DISCRIMINATOR); - data[8..16].copy_from_slice(&amount_in.to_le_bytes()); - data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + let mut data = [0u8; 25]; + data[..8].copy_from_slice(&SWAP2_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_0.to_le_bytes()); + data[16..24].copy_from_slice(&amount_1.to_le_bytes()); + data[24] = protocol_params.swap_mode; instructions.push(Instruction::new_with_bytes( accounts::METEORA_DAMM_V2, &data, - accounts.to_vec(), + account_metas, )); if params.close_input_mint_ata { - // Close wSOL ATA account, reclaim rent - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), &input_mint); } Ok(instructions) @@ -161,45 +192,67 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder { // ======================================== let is_a_in = protocol_params.token_b_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.token_b_mint == crate::constants::USDC_TOKEN_ACCOUNT; - let minimum_amount_out: u64 = match params.fixed_output_amount { - Some(fixed) => fixed, - None => return Err(anyhow!("fixed_output_amount must be set for MeteoraDammV2 swap")), + let input_mint = + if is_a_in { protocol_params.token_a_mint } else { protocol_params.token_b_mint }; + let input_token_program = + if is_a_in { protocol_params.token_a_program } else { protocol_params.token_b_program }; + let output_mint = + if is_a_in { protocol_params.token_b_mint } else { protocol_params.token_a_mint }; + let output_token_program = + if is_a_in { protocol_params.token_b_program } else { protocol_params.token_a_program }; + let amount_in = params.input_amount.unwrap_or(0); + let (amount_0, amount_1) = match protocol_params.swap_mode { + SWAP_MODE_EXACT_OUT => { + let amount_out = params.fixed_output_amount.ok_or_else(|| { + anyhow!("fixed_output_amount must be set for MeteoraDammV2 exact-out swap2") + })?; + (amount_out, amount_in) + } + SWAP_MODE_EXACT_IN | SWAP_MODE_PARTIAL_FILL => { + let minimum_amount_out = params.fixed_output_amount.ok_or_else(|| { + anyhow!("fixed_output_amount must be set for MeteoraDammV2 swap2 min output") + })?; + (amount_in, minimum_amount_out) + } + mode => return Err(anyhow!("Unsupported MeteoraDammV2 swap_mode {}", mode)), }; let input_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.input_mint, - if is_a_in { - &protocol_params.token_a_program - } else { - &protocol_params.token_b_program - }, + &input_mint, + &input_token_program, params.open_seed_optimize, ); let output_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.output_mint, - if is_a_in { - &protocol_params.token_b_program - } else { - &protocol_params.token_a_program - }, + &output_mint, + &output_token_program, params.open_seed_optimize, ); // ======================================== // Build instructions // ======================================== - let mut instructions = Vec::with_capacity(3); + let mut instructions = Vec::with_capacity(4); if params.create_output_mint_ata { - instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_mint, + &output_token_program, + params.open_seed_optimize, + ); } // Create buy instruction - let accounts: [AccountMeta; 14] = [ + let mut account_metas = Vec::with_capacity( + 13 + usize::from(protocol_params.referral_token_account.is_some()) + + usize::from(protocol_params.include_rate_limiter_sysvar), + ); + account_metas.extend([ accounts::AUTHORITY_META, // Pool Authority (readonly) AccountMeta::new(protocol_params.pool, false), // Pool AccountMeta::new(input_token_account, false), // Input Token Account @@ -211,32 +264,36 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder { AccountMeta::new(params.payer.pubkey(), true), // User Transfer Authority AccountMeta::new_readonly(protocol_params.token_a_program, false), // Token Program (readonly) AccountMeta::new_readonly(protocol_params.token_b_program, false), // Token Program (readonly) - accounts::METEORA_DAMM_V2_META, // Referral Token Account (readonly) + ]); + if let Some(referral_token_account) = protocol_params.referral_token_account { + account_metas.push(AccountMeta::new(referral_token_account, false)); + } + account_metas.extend([ AccountMeta::new_readonly(get_event_authority_pda(), false), // Event Authority (readonly) accounts::METEORA_DAMM_V2_META, // Program (readonly) - ]; + ]); + if protocol_params.include_rate_limiter_sysvar { + account_metas.push(accounts::SYSVAR_INSTRUCTIONS_META); + } // Create instruction data - let mut data = [0u8; 24]; - data[..8].copy_from_slice(&SWAP_DISCRIMINATOR); - data[8..16].copy_from_slice(¶ms.input_amount.unwrap_or_default().to_le_bytes()); - data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + let mut data = [0u8; 25]; + data[..8].copy_from_slice(&SWAP2_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_0.to_le_bytes()); + data[16..24].copy_from_slice(&amount_1.to_le_bytes()); + data[24] = protocol_params.swap_mode; instructions.push(Instruction::new_with_bytes( accounts::METEORA_DAMM_V2, &data, - accounts.to_vec(), + account_metas, )); if params.close_output_mint_ata { - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), &output_mint); } if params.close_input_mint_ata { instructions.push(crate::common::spl_token::close_account( - if is_a_in { - &protocol_params.token_a_program - } else { - &protocol_params.token_b_program - }, + &input_token_program, &input_token_account, ¶ms.payer.pubkey(), ¶ms.payer.pubkey(), @@ -247,3 +304,162 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder { Ok(instructions) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + common::GasFeeStrategy, + swqos::TradeType, + trading::core::params::{DexParamEnum, SwapParams}, + }; + use solana_sdk::{pubkey::Pubkey, signature::Keypair}; + use std::sync::Arc; + + fn pk(seed: u8) -> Pubkey { + Pubkey::new_from_array([seed; 32]) + } + + fn meteora_params(referral: Option) -> MeteoraDammV2Params { + let params = MeteoraDammV2Params::new( + pk(1), + pk(2), + pk(3), + crate::constants::WSOL_TOKEN_ACCOUNT, + pk(4), + crate::constants::TOKEN_PROGRAM, + crate::constants::TOKEN_PROGRAM, + ); + match referral { + Some(account) => params.with_referral_token_account(account), + None => params, + } + } + + fn swap_params(protocol_params: MeteoraDammV2Params) -> SwapParams { + SwapParams { + rpc: None, + payer: Arc::new(Keypair::new()), + trade_type: TradeType::Buy, + input_mint: crate::constants::WSOL_TOKEN_ACCOUNT, + input_token_program: None, + output_mint: pk(4), + output_token_program: None, + input_amount: Some(100_000), + slippage_basis_points: Some(100), + address_lookup_table_account: None, + recent_blockhash: None, + wait_tx_confirmed: false, + protocol_params: DexParamEnum::MeteoraDammV2(protocol_params), + open_seed_optimize: true, + swqos_clients: Arc::new(Vec::new()), + middleware_manager: None, + durable_nonce: None, + with_tip: false, + create_input_mint_ata: false, + close_input_mint_ata: false, + create_output_mint_ata: false, + close_output_mint_ata: false, + fixed_output_amount: Some(1), + gas_fee_strategy: GasFeeStrategy::new(), + simulate: true, + log_enabled: false, + use_dedicated_sender_threads: false, + sender_thread_cores: None, + max_sender_concurrency: 0, + effective_core_ids: Arc::new(Vec::new()), + check_min_tip: false, + grpc_recv_us: None, + use_exact_sol_amount: None, + use_pumpfun_v2: false, + } + } + + #[tokio::test] + async fn meteora_omits_optional_referral_account() { + let instructions = MeteoraDammV2InstructionBuilder + .build_buy_instructions(&swap_params(meteora_params(None))) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(ix.accounts.len(), 13); + assert_eq!(ix.accounts[11].pubkey, get_event_authority_pda()); + assert_eq!(ix.accounts[12].pubkey, accounts::METEORA_DAMM_V2); + assert_eq!(&ix.data[..8], SWAP2_DISCRIMINATOR); + assert_eq!(ix.data[24], SWAP_MODE_PARTIAL_FILL); + } + + #[tokio::test] + async fn meteora_includes_writable_referral_account_when_set() { + let referral = pk(9); + let instructions = MeteoraDammV2InstructionBuilder + .build_buy_instructions(&swap_params(meteora_params(Some(referral)))) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(ix.accounts.len(), 14); + assert_eq!(ix.accounts[11].pubkey, referral); + assert!(ix.accounts[11].is_writable); + assert_eq!(ix.accounts[12].pubkey, get_event_authority_pda()); + assert_eq!(ix.accounts[13].pubkey, accounts::METEORA_DAMM_V2); + } + + #[tokio::test] + async fn meteora_includes_sysvar_only_when_rate_limiter_is_set() { + let protocol_params = meteora_params(None).with_rate_limiter_sysvar(true); + let instructions = MeteoraDammV2InstructionBuilder + .build_buy_instructions(&swap_params(protocol_params)) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(ix.accounts.len(), 14); + assert_eq!(ix.accounts[11].pubkey, get_event_authority_pda()); + assert_eq!(ix.accounts[12].pubkey, accounts::METEORA_DAMM_V2); + assert_eq!(ix.accounts[13].pubkey, accounts::SYSVAR_INSTRUCTIONS); + } + + #[tokio::test] + async fn meteora_swap2_exact_out_uses_amount_out_then_max_input() { + let protocol_params = meteora_params(None).with_swap_mode(SWAP_MODE_EXACT_OUT); + let instructions = MeteoraDammV2InstructionBuilder + .build_buy_instructions(&swap_params(protocol_params)) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], SWAP2_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 1); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 100_000); + assert_eq!(ix.data[24], SWAP_MODE_EXACT_OUT); + } + + #[tokio::test] + async fn meteora_sol_buy_uses_pool_wsol_mint_for_user_input_account() { + let mut params = swap_params(meteora_params(None)); + params.input_mint = crate::constants::SOL_TOKEN_ACCOUNT; + + let instructions = + MeteoraDammV2InstructionBuilder.build_buy_instructions(¶ms).await.unwrap(); + let ix = instructions.last().unwrap(); + let expected_wsol_ata = + crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( + ¶ms.payer.pubkey(), + &crate::constants::WSOL_TOKEN_ACCOUNT, + &crate::constants::TOKEN_PROGRAM, + params.open_seed_optimize, + ); + let wrong_sol_ata = + crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( + ¶ms.payer.pubkey(), + &crate::constants::SOL_TOKEN_ACCOUNT, + &crate::constants::TOKEN_PROGRAM, + params.open_seed_optimize, + ); + + assert_eq!(ix.accounts[2].pubkey, expected_wsol_ata); + assert_ne!(ix.accounts[2].pubkey, wrong_sol_ata); + } +} diff --git a/src/instruction/mod.rs b/src/instruction/mod.rs index ef15ba5..35d6499 100755 --- a/src/instruction/mod.rs +++ b/src/instruction/mod.rs @@ -6,4 +6,5 @@ pub mod pumpswap; pub(crate) mod pumpswap_ix_data; pub mod raydium_amm_v4; pub mod raydium_cpmm; +pub(crate) mod token_account_setup; pub mod utils; diff --git a/src/instruction/pumpfun.rs b/src/instruction/pumpfun.rs index 237fa5d..6a85605 100644 --- a/src/instruction/pumpfun.rs +++ b/src/instruction/pumpfun.rs @@ -13,10 +13,16 @@ use crate::{ }, }; use crate::{ - instruction::utils::pumpfun::{ - accounts, get_bonding_curve_pda, get_user_volume_accumulator_pda, - global_constants::{self}, - pump_fun_fee_recipient_meta, resolve_creator_vault_for_ix_with_fee_sharing, + instruction::{ + token_account_setup::{ + push_close_wsol_if_needed, push_create_or_wrap_user_token_account, + push_create_user_token_account, + }, + utils::pumpfun::{ + accounts, get_bonding_curve_pda, get_user_volume_accumulator_pda, + global_constants::{self}, + pump_fun_fee_recipient_meta, resolve_creator_vault_for_ix_with_fee_sharing, + }, }, utils::calc::{ common::{calculate_with_slippage_buy, calculate_with_slippage_sell}, @@ -28,10 +34,7 @@ use solana_sdk::instruction::AccountMeta; use solana_sdk::{instruction::Instruction, pubkey::Pubkey, signer::Signer}; #[inline] -fn effective_pump_mint_token_program(mint: &Pubkey, protocol_params: &PumpFunParams) -> Pubkey { - if mint.to_string().ends_with("pump") { - return TOKEN_PROGRAM_2022; - } +fn effective_pump_mint_token_program(_mint: &Pubkey, protocol_params: &PumpFunParams) -> Pubkey { let tp = protocol_params.token_program; if tp == Pubkey::default() { TOKEN_PROGRAM_2022 @@ -108,19 +111,6 @@ fn build_buy_v1(params: &SwapParams) -> Result> { ) .ok_or_else(|| anyhow!("creator_vault PDA derivation failed (creator={})", creator))?; - let buy_token_amount = match params.fixed_output_amount { - Some(amount) => amount, - None => get_buy_token_amount_from_sol_amount( - bonding_curve.virtual_token_reserves as u128, - bonding_curve.virtual_sol_reserves as u128, - bonding_curve.real_token_reserves as u128, - creator, - lamports_in, - ), - }; - - let max_sol_cost = calculate_with_slippage_buy(lamports_in, slippage_bp); - let bonding_curve_addr = get_bonding_curve_pda(¶ms.output_mint).ok_or_else(|| { anyhow!("bonding_curve PDA derivation failed for mint {}", params.output_mint) })?; @@ -167,11 +157,23 @@ fn build_buy_v1(params: &SwapParams) -> Result> { // ── Legacy buy path ── let track_volume_val = if bonding_curve.is_cashback_coin { 1u8 } else { 0u8 }; - let buy_data = if params.use_exact_sol_amount.unwrap_or(true) { - let min_tokens_out = calculate_with_slippage_sell(buy_token_amount, slippage_bp); - encode_pumpfun_buy_exact_sol_in_ix_data(lamports_in, min_tokens_out, track_volume_val) + let buy_data = if let Some(token_amount) = params.fixed_output_amount { + encode_pumpfun_buy_ix_data(token_amount, lamports_in, track_volume_val) } else { - encode_pumpfun_buy_ix_data(buy_token_amount, max_sol_cost, track_volume_val) + let buy_token_amount = get_buy_token_amount_from_sol_amount( + bonding_curve.virtual_token_reserves as u128, + bonding_curve.virtual_sol_reserves as u128, + bonding_curve.real_token_reserves as u128, + creator, + lamports_in, + ); + if params.use_exact_sol_amount.unwrap_or(true) { + let min_tokens_out = calculate_with_slippage_sell(buy_token_amount, slippage_bp); + encode_pumpfun_buy_exact_sol_in_ix_data(lamports_in, min_tokens_out, track_volume_val) + } else { + let max_sol_cost = calculate_with_slippage_buy(lamports_in, slippage_bp); + encode_pumpfun_buy_ix_data(buy_token_amount, max_sol_cost, track_volume_val) + } }; let fee_recipient_meta = @@ -250,18 +252,17 @@ fn build_sell_v1(params: &SwapParams) -> Result> { })? }; - let creator = protocol_params.effective_creator_for_trade(); - - let sol_amount = get_sell_sol_amount_from_token_amount( - bonding_curve.virtual_token_reserves as u128, - bonding_curve.virtual_sol_reserves as u128, - creator, - token_amount, - ); - - let min_sol_output = match params.fixed_output_amount { - Some(fixed) => fixed, - None => calculate_with_slippage_sell(sol_amount, slippage_bp), + let min_sol_output = if let Some(fixed) = params.fixed_output_amount { + fixed + } else { + let creator = protocol_params.effective_creator_for_trade(); + let sol_amount = get_sell_sol_amount_from_token_amount( + bonding_curve.virtual_token_reserves as u128, + bonding_curve.virtual_sol_reserves as u128, + creator, + token_amount, + ); + calculate_with_slippage_sell(sol_amount, slippage_bp) }; let bonding_curve_addr = get_bonding_curve_pda(¶ms.input_mint).ok_or_else(|| { @@ -378,19 +379,6 @@ fn build_buy_v2(params: &SwapParams) -> Result> { ) .ok_or_else(|| anyhow!("creator_vault PDA derivation failed (creator={})", creator))?; - let buy_token_amount = match params.fixed_output_amount { - Some(amount) => amount, - None => get_buy_token_amount_from_sol_amount( - bonding_curve.virtual_token_reserves as u128, - bonding_curve.virtual_sol_reserves as u128, - bonding_curve.real_token_reserves as u128, - creator, - lamports_in, - ), - }; - - let max_sol_cost = calculate_with_slippage_buy(lamports_in, slippage_bp); - let bonding_curve_addr = get_bonding_curve_pda(¶ms.output_mint).ok_or_else(|| { anyhow!("bonding_curve PDA derivation failed for mint {}", params.output_mint) })?; @@ -472,7 +460,7 @@ fn build_buy_v2(params: &SwapParams) -> Result> { "e_token_program, ); - let mut instructions = Vec::with_capacity(4); + let mut instructions = Vec::with_capacity(6); if params.create_output_mint_ata { instructions.extend( @@ -486,25 +474,36 @@ fn build_buy_v2(params: &SwapParams) -> Result> { ); } + let (buy_data, quote_amount_to_fund) = if let Some(token_amount) = params.fixed_output_amount { + (encode_pumpfun_buy_v2_ix_data(token_amount, lamports_in), lamports_in) + } else { + let buy_token_amount = get_buy_token_amount_from_sol_amount( + bonding_curve.virtual_token_reserves as u128, + bonding_curve.virtual_sol_reserves as u128, + bonding_curve.real_token_reserves as u128, + creator, + lamports_in, + ); + if params.use_exact_sol_amount.unwrap_or(true) { + let min_tokens_out = calculate_with_slippage_sell(buy_token_amount, slippage_bp); + (encode_pumpfun_buy_exact_quote_in_v2_ix_data(lamports_in, min_tokens_out), lamports_in) + } else { + let max_sol_cost = calculate_with_slippage_buy(lamports_in, slippage_bp); + (encode_pumpfun_buy_v2_ix_data(buy_token_amount, max_sol_cost), max_sol_cost) + } + }; + if params.create_input_mint_ata { - instructions.extend( - crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( - ¶ms.payer.pubkey(), - ¶ms.payer.pubkey(), - "e_mint, - "e_token_program, - params.open_seed_optimize, - ), + push_create_or_wrap_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + "e_mint, + "e_token_program, + quote_amount_to_fund, + params.open_seed_optimize, ); } - let buy_data = if params.use_exact_sol_amount.unwrap_or(true) { - let min_tokens_out = calculate_with_slippage_sell(buy_token_amount, slippage_bp); - encode_pumpfun_buy_exact_quote_in_v2_ix_data(lamports_in, min_tokens_out) - } else { - encode_pumpfun_buy_v2_ix_data(buy_token_amount, max_sol_cost) - }; - let metas: Vec = vec![ global_constants::GLOBAL_ACCOUNT_META, AccountMeta::new_readonly(params.output_mint, false), @@ -537,6 +536,10 @@ fn build_buy_v2(params: &SwapParams) -> Result> { instructions.push(Instruction::new_with_bytes(accounts::PUMPFUN, &buy_data, metas)); + if params.close_input_mint_ata { + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), "e_mint); + } + Ok(instructions) } @@ -584,18 +587,17 @@ fn build_sell_v2(params: &SwapParams) -> Result> { })? }; - let creator = protocol_params.effective_creator_for_trade(); - - let sol_amount = get_sell_sol_amount_from_token_amount( - bonding_curve.virtual_token_reserves as u128, - bonding_curve.virtual_sol_reserves as u128, - creator, - token_amount, - ); - - let min_sol_output = match params.fixed_output_amount { - Some(fixed) => fixed, - None => calculate_with_slippage_sell(sol_amount, slippage_bp), + let min_sol_output = if let Some(fixed) = params.fixed_output_amount { + fixed + } else { + let creator = protocol_params.effective_creator_for_trade(); + let sol_amount = get_sell_sol_amount_from_token_amount( + bonding_curve.virtual_token_reserves as u128, + bonding_curve.virtual_sol_reserves as u128, + creator, + token_amount, + ); + calculate_with_slippage_sell(sol_amount, slippage_bp) }; let bonding_curve_addr = get_bonding_curve_pda(¶ms.input_mint).ok_or_else(|| { @@ -678,17 +680,15 @@ fn build_sell_v2(params: &SwapParams) -> Result> { "e_token_program, ); - let mut instructions = Vec::with_capacity(3); + let mut instructions = Vec::with_capacity(4); if params.create_output_mint_ata { - instructions.extend( - crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( - ¶ms.payer.pubkey(), - ¶ms.payer.pubkey(), - "e_mint, - "e_token_program, - params.open_seed_optimize, - ), + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + "e_mint, + "e_token_program, + params.open_seed_optimize, ); } @@ -736,6 +736,10 @@ fn build_sell_v2(params: &SwapParams) -> Result> { )?); } + if params.close_output_mint_ata { + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), "e_mint); + } + Ok(instructions) } @@ -846,14 +850,122 @@ mod tests { } #[test] - fn pump_suffix_buy_forces_token_2022_even_with_legacy_cached_program() { + fn pump_suffix_buy_respects_explicit_legacy_token_program() { crate::common::seed::set_default_rents(); let params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM); let instructions = build_buy_v1(¶ms).unwrap(); assert_eq!(instructions.len(), 3); - assert_eq!(instructions[1].program_id, TOKEN_PROGRAM_2022); - assert_eq!(instructions[2].accounts[8].pubkey, TOKEN_PROGRAM_2022); + assert_eq!(instructions[2].accounts[8].pubkey, TOKEN_PROGRAM); assert_eq!(instructions[2].accounts.len(), 18); + assert_eq!(instructions[2].data.len(), 25); + } + + #[test] + fn pumpfun_v1_fixed_output_uses_buy_with_max_input_budget() { + let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM); + params.create_output_mint_ata = false; + params.fixed_output_amount = Some(42); + params.use_exact_sol_amount = Some(true); + + let instructions = build_buy_v1(¶ms).unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], crate::instruction::utils::pumpfun::BUY_DISCRIMINATOR); + assert_eq!(ix.data.len(), 25); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 42); + assert_eq!( + u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), + params.input_amount.unwrap() + ); + assert_eq!(ix.data[24], 0); + } + + #[test] + fn pumpfun_v2_fixed_output_uses_buy_with_max_input_budget() { + let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM); + params.create_output_mint_ata = false; + params.fixed_output_amount = Some(42); + params.use_exact_sol_amount = Some(true); + + let instructions = build_buy_v2(¶ms).unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], crate::instruction::utils::pumpfun::BUY_V2_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 42); + assert_eq!( + u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), + params.input_amount.unwrap() + ); + } + + #[test] + fn pumpfun_v2_regular_buy_wraps_max_quote_budget() { + let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM); + params.create_output_mint_ata = false; + params.create_input_mint_ata = true; + params.use_exact_sol_amount = Some(false); + + let instructions = build_buy_v2(¶ms).unwrap(); + let transfer_ix = &instructions[1]; + let system_ix = bincode::deserialize::< + solana_system_interface::instruction::SystemInstruction, + >(&transfer_ix.data) + .unwrap(); + let expected = crate::utils::calc::common::calculate_with_slippage_buy( + params.input_amount.unwrap(), + params.slippage_basis_points.unwrap(), + ); + + match system_ix { + solana_system_interface::instruction::SystemInstruction::Transfer { lamports } => { + assert_eq!(lamports, expected); + } + other => panic!("unexpected system instruction: {:?}", other), + } + } + + #[test] + fn pumpfun_v1_sell_fixed_output_uses_min_sol_directly() { + let mint = pump_mint(); + let mut params = swap_params_for_buy(mint, TOKEN_PROGRAM); + params.trade_type = crate::swqos::TradeType::Sell; + params.input_mint = mint; + params.output_mint = crate::constants::SOL_TOKEN_ACCOUNT; + params.create_output_mint_ata = false; + params.fixed_output_amount = Some(42); + + let instructions = build_sell_v1(¶ms).unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], crate::instruction::utils::pumpfun::SELL_DISCRIMINATOR); + assert_eq!(ix.data.len(), 24); + assert_eq!( + u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), + params.input_amount.unwrap() + ); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 42); + } + + #[test] + fn pumpfun_v2_sell_fixed_output_uses_min_sol_directly() { + let mint = pump_mint(); + let mut params = swap_params_for_buy(mint, TOKEN_PROGRAM); + params.trade_type = crate::swqos::TradeType::Sell; + params.input_mint = mint; + params.output_mint = crate::constants::SOL_TOKEN_ACCOUNT; + params.create_output_mint_ata = false; + params.fixed_output_amount = Some(42); + + let instructions = build_sell_v2(¶ms).unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], crate::instruction::utils::pumpfun::SELL_V2_DISCRIMINATOR); + assert_eq!(ix.data.len(), 24); + assert_eq!( + u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), + params.input_amount.unwrap() + ); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 42); } } diff --git a/src/instruction/pumpfun_ix_data.rs b/src/instruction/pumpfun_ix_data.rs index c757f6e..31d6fba 100644 --- a/src/instruction/pumpfun_ix_data.rs +++ b/src/instruction/pumpfun_ix_data.rs @@ -1,8 +1,8 @@ //! Pump.fun 曲线 **legacy** `buy` / `buy_exact_sol_in` / `sell` 与 **`buy_v2` / `sell_v2` / `buy_exact_quote_in_v2`** //! 的 instruction data 栈上编码(热路径零堆分配)。 //! -//! Legacy `buy` / `buy_exact_sol_in` 与 `@pump-fun/pump-sdk` 对齐:`OptionBool` 在 ix 参数中为 -//! **1 字节 option tag + 1 字节值**(Anchor `Option` = 2 字节),共 26 字节 ix data。 +//! Legacy `buy` / `buy_exact_sol_in` 与 `@pump-fun/pump-sdk` 对齐:`OptionBool` 是单字段 +//! struct(TypeScript 传 `[true]`),在 ix 参数中为 1 字节 bool,共 25 字节 ix data。 //! `*_v2` 指令无 `track_volume` 字节(见 [pump-public-docs](https://github.com/pump-fun/pump-public-docs))。 use crate::instruction::utils::pumpfun::{ @@ -10,22 +10,17 @@ use crate::instruction::utils::pumpfun::{ BUY_V2_DISCRIMINATOR, SELL_DISCRIMINATOR, SELL_V2_DISCRIMINATOR, }; -/// 与官方 `getBuyInstructionInternal` 对齐:`OptionBool` 在 ix 中为 1 字节 option tag + 1 字节值。 -/// `track_volume` 在调用侧组合为 `(1u8, cashback as u8)`(Option tag + value),共 26 字节 ix data。 -pub const TRACK_VOLUME_OPTION_TAG: u8 = 1; - #[inline(always)] pub fn encode_pumpfun_buy_ix_data( token_amount: u64, max_sol_cost: u64, track_volume_val: u8, -) -> [u8; 26] { - let mut d = [0u8; 26]; +) -> [u8; 25] { + let mut d = [0u8; 25]; d[..8].copy_from_slice(&BUY_DISCRIMINATOR); d[8..16].copy_from_slice(&token_amount.to_le_bytes()); d[16..24].copy_from_slice(&max_sol_cost.to_le_bytes()); - d[24] = TRACK_VOLUME_OPTION_TAG; - d[25] = track_volume_val; + d[24] = track_volume_val; d } @@ -34,13 +29,12 @@ pub fn encode_pumpfun_buy_exact_sol_in_ix_data( spendable_sol_in: u64, min_tokens_out: u64, track_volume_val: u8, -) -> [u8; 26] { - let mut d = [0u8; 26]; +) -> [u8; 25] { + let mut d = [0u8; 25]; d[..8].copy_from_slice(&BUY_EXACT_SOL_IN_DISCRIMINATOR); d[8..16].copy_from_slice(&spendable_sol_in.to_le_bytes()); d[16..24].copy_from_slice(&min_tokens_out.to_le_bytes()); - d[24] = TRACK_VOLUME_OPTION_TAG; - d[25] = track_volume_val; + d[24] = track_volume_val; d } diff --git a/src/instruction/pumpswap.rs b/src/instruction/pumpswap.rs index 43f400f..a935f82 100755 --- a/src/instruction/pumpswap.rs +++ b/src/instruction/pumpswap.rs @@ -4,18 +4,21 @@ use crate::{ encode_pumpswap_buy_exact_quote_in_ix_data, encode_pumpswap_buy_ix_data, encode_pumpswap_buy_two_args, encode_pumpswap_sell_ix_data, }, - instruction::utils::pumpswap::{ - accounts, fee_recipient_ata, get_mayhem_fee_recipient_random, get_pool_v2_pda, - get_protocol_extra_fee_recipient_random, get_protocol_fee_recipient_random, - get_user_volume_accumulator_pda, get_user_volume_accumulator_quote_ata, - get_user_volume_accumulator_wsol_ata, warm_pumpswap_global_config, - }, - trading::{ - common::wsol_manager, - core::{ - params::{PumpSwapParams, SwapParams}, - traits::InstructionBuilder, + instruction::{ + token_account_setup::{ + push_close_wsol_if_needed, push_create_or_wrap_user_token_account, + push_create_user_token_account, }, + utils::pumpswap::{ + accounts, fee_recipient_ata, get_mayhem_fee_recipient_random, get_pool_v2_pda, + get_protocol_extra_fee_recipient_random, get_protocol_fee_recipient_random, + get_user_volume_accumulator_pda, get_user_volume_accumulator_quote_ata, + get_user_volume_accumulator_wsol_ata, + }, + }, + trading::core::{ + params::{PumpSwapParams, SwapParams}, + traits::InstructionBuilder, }, utils::calc::pumpswap::{buy_quote_input_internal, sell_base_input_internal}, }; @@ -32,7 +35,6 @@ pub struct PumpSwapInstructionBuilder; #[async_trait::async_trait] impl InstructionBuilder for PumpSwapInstructionBuilder { async fn build_buy_instructions(&self, params: &SwapParams) -> Result> { - warm_pumpswap_global_config(params.rpc.as_ref()).await; // ======================================== // Parameter validation and basic data preparation // ======================================== @@ -53,7 +55,7 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { let pool_quote_token_reserves = protocol_params.pool_quote_token_reserves; let params_coin_creator_vault_ata = protocol_params.coin_creator_vault_ata; let params_coin_creator_vault_authority = protocol_params.coin_creator_vault_authority; - let create_wsol_ata = params.create_input_mint_ata; + let create_input_ata = params.create_input_mint_ata; let close_wsol_ata = params.close_input_mint_ata; let base_token_program = protocol_params.base_token_program; let quote_token_program = protocol_params.quote_token_program; @@ -77,13 +79,21 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { // ======================================== let quote_is_wsol_or_usdc = quote_mint == crate::constants::WSOL_TOKEN_ACCOUNT || quote_mint == crate::constants::USDC_TOKEN_ACCOUNT; + let input_stable_mint = if quote_is_wsol_or_usdc { quote_mint } else { base_mint }; + let input_stable_token_program = + if quote_is_wsol_or_usdc { quote_token_program } else { base_token_program }; + let output_trade_mint = if quote_is_wsol_or_usdc { base_mint } else { quote_mint }; + let output_trade_token_program = + if quote_is_wsol_or_usdc { base_token_program } else { quote_token_program }; let mut creator = Pubkey::default(); if params_coin_creator_vault_authority != accounts::DEFAULT_COIN_CREATOR_VAULT_AUTHORITY { creator = params_coin_creator_vault_authority; } let cashback_fee_bps = protocol_params.cashback_fee_basis_points; - let (mut token_amount, sol_amount) = if quote_is_wsol_or_usdc { + let (token_amount, sol_amount) = if let Some(output_amount) = params.fixed_output_amount { + (output_amount, params.input_amount.unwrap_or(0)) + } else if quote_is_wsol_or_usdc { let result = buy_quote_input_internal( params.input_amount.unwrap_or(0), params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), @@ -109,10 +119,6 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { (result.min_quote, params.input_amount.unwrap_or(0)) }; - if params.fixed_output_amount.is_some() { - token_amount = params.fixed_output_amount.unwrap(); - } - let user_base_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), @@ -143,7 +149,7 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { // ======================================== let mut instructions = Vec::with_capacity(6); - if create_wsol_ata { + if create_input_ata { // Determine wrap amount based on instruction type: // - buy_exact_quote_in: program spends exactly input_amount, wrap input_amount // - buy: program may spend up to max_quote, wrap max_quote @@ -153,19 +159,23 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { } else { sol_amount }; - instructions - .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), wrap_amount)); + push_create_or_wrap_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &input_stable_mint, + &input_stable_token_program, + wrap_amount, + params.open_seed_optimize, + ); } if params.create_output_mint_ata { - instructions.extend( - crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( - ¶ms.payer.pubkey(), - ¶ms.payer.pubkey(), - if quote_is_wsol_or_usdc { &base_mint } else { "e_mint }, - if quote_is_wsol_or_usdc { &base_token_program } else { "e_token_program }, - params.open_seed_optimize, - ), + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_trade_mint, + &output_trade_token_program, + params.open_seed_optimize, ); } @@ -225,7 +235,9 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { // buy / buy_exact_quote_in:栈上 `[u8;25]` + `new_with_bytes`,避免每笔 `Vec` 堆分配。 let track_volume: u8 = if protocol_params.is_cashback_coin { 1 } else { 0 }; if quote_is_wsol_or_usdc { - let ix_data = if params.use_exact_sol_amount.unwrap_or(true) { + let ix_data = if params.fixed_output_amount.is_some() { + encode_pumpswap_buy_ix_data(token_amount, sol_amount, track_volume) + } else if params.use_exact_sol_amount.unwrap_or(true) { let min_base_amount_out = crate::utils::calc::common::calculate_with_slippage_sell( token_amount, params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), @@ -252,14 +264,16 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { )); } if close_wsol_ata { - // Close wSOL ATA account, reclaim rent - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed( + &mut instructions, + ¶ms.payer.pubkey(), + &input_stable_mint, + ); } Ok(instructions) } async fn build_sell_instructions(&self, params: &SwapParams) -> Result> { - warm_pumpswap_global_config(params.rpc.as_ref()).await; // ======================================== // Parameter validation and basic data preparation // ======================================== @@ -278,7 +292,7 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { let pool_quote_token_account = protocol_params.pool_quote_token_account; let params_coin_creator_vault_ata = protocol_params.coin_creator_vault_ata; let params_coin_creator_vault_authority = protocol_params.coin_creator_vault_authority; - let create_wsol_ata = params.create_output_mint_ata; + let create_output_ata = params.create_output_mint_ata; let close_wsol_ata = params.close_output_mint_ata; let base_token_program = protocol_params.base_token_program; let quote_token_program = protocol_params.quote_token_program; @@ -304,13 +318,18 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { // ======================================== let quote_is_wsol_or_usdc = quote_mint == crate::constants::WSOL_TOKEN_ACCOUNT || quote_mint == crate::constants::USDC_TOKEN_ACCOUNT; + let output_stable_mint = if quote_is_wsol_or_usdc { quote_mint } else { base_mint }; + let output_stable_token_program = + if quote_is_wsol_or_usdc { quote_token_program } else { base_token_program }; let mut creator = Pubkey::default(); if params_coin_creator_vault_authority != accounts::DEFAULT_COIN_CREATOR_VAULT_AUTHORITY { creator = params_coin_creator_vault_authority; } let cashback_fee_bps = protocol_params.cashback_fee_basis_points; - let (token_amount, mut sol_amount) = if quote_is_wsol_or_usdc { + let (token_amount, sol_amount) = if let Some(output_amount) = params.fixed_output_amount { + (params.input_amount.unwrap(), output_amount) + } else if quote_is_wsol_or_usdc { let result = sell_base_input_internal( params.input_amount.unwrap(), params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), @@ -336,10 +355,6 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { (result.max_quote, result.base) }; - if params.fixed_output_amount.is_some() { - sol_amount = params.fixed_output_amount.unwrap(); - } - // Determine fee recipient based on mayhem mode (pump-public-docs: 10th = Mayhem fee recipient, 11th = WSOL ATA of Mayhem; use any one randomly) let is_mayhem_mode = protocol_params.is_mayhem_mode; let (fee_recipient, fee_recipient_meta) = if is_mayhem_mode { @@ -368,10 +383,16 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { // ======================================== // Build instructions // ======================================== - let mut instructions = Vec::with_capacity(3); + let mut instructions = Vec::with_capacity(4); - if create_wsol_ata { - instructions.extend(wsol_manager::create_wsol_ata(¶ms.payer.pubkey())); + if create_output_ata { + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_stable_mint, + &output_stable_token_program, + params.open_seed_optimize, + ); } // Create sell instruction @@ -442,7 +463,11 @@ impl InstructionBuilder for PumpSwapInstructionBuilder { instructions.push(Instruction::new_with_bytes(accounts::AMM_PROGRAM, &ix_data, accounts)); if close_wsol_ata { - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed( + &mut instructions, + ¶ms.payer.pubkey(), + &output_stable_mint, + ); } if params.close_input_mint_ata { instructions.push(crate::common::spl_token::close_account( @@ -495,3 +520,141 @@ pub fn claim_cashback_pumpswap_instruction( accounts, )) } + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + common::GasFeeStrategy, + swqos::TradeType, + trading::core::params::{DexParamEnum, PumpSwapParams, SwapParams}, + }; + use solana_sdk::{pubkey::Pubkey, signature::Keypair}; + use std::sync::Arc; + + fn pk(seed: u8) -> Pubkey { + Pubkey::new_from_array([seed; 32]) + } + + fn pumpswap_params() -> PumpSwapParams { + PumpSwapParams::new( + pk(1), + pk(2), + crate::constants::WSOL_TOKEN_ACCOUNT, + pk(3), + pk(4), + 1_000_000_000, + 2_000_000_000, + pk(5), + accounts::DEFAULT_COIN_CREATOR_VAULT_AUTHORITY, + crate::constants::TOKEN_PROGRAM, + crate::constants::TOKEN_PROGRAM, + accounts::PROTOCOL_FEE_RECIPIENT, + Pubkey::default(), + false, + 0, + ) + } + + fn swap_params(trade_type: TradeType, fixed_output_amount: Option) -> SwapParams { + let (input_mint, output_mint) = if trade_type == TradeType::Sell { + (pk(2), crate::constants::WSOL_TOKEN_ACCOUNT) + } else { + (crate::constants::WSOL_TOKEN_ACCOUNT, pk(2)) + }; + SwapParams { + rpc: None, + payer: Arc::new(Keypair::new()), + trade_type, + input_mint, + input_token_program: None, + output_mint, + output_token_program: None, + input_amount: Some(100_000), + slippage_basis_points: Some(100), + address_lookup_table_account: None, + recent_blockhash: None, + wait_tx_confirmed: false, + protocol_params: DexParamEnum::PumpSwap(pumpswap_params()), + open_seed_optimize: true, + swqos_clients: Arc::new(Vec::new()), + middleware_manager: None, + durable_nonce: None, + with_tip: false, + create_input_mint_ata: false, + close_input_mint_ata: false, + create_output_mint_ata: false, + close_output_mint_ata: false, + fixed_output_amount, + gas_fee_strategy: GasFeeStrategy::new(), + simulate: true, + log_enabled: false, + use_dedicated_sender_threads: false, + sender_thread_cores: None, + max_sender_concurrency: 0, + effective_core_ids: Arc::new(Vec::new()), + check_min_tip: false, + grpc_recv_us: None, + use_exact_sol_amount: Some(true), + use_pumpfun_v2: false, + } + } + + #[tokio::test] + async fn pumpswap_fixed_output_uses_buy_with_max_input_budget() { + let instructions = PumpSwapInstructionBuilder + .build_buy_instructions(&swap_params(TradeType::Buy, Some(42))) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], crate::instruction::utils::pumpswap::BUY_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 42); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 100_000); + } + + #[tokio::test] + async fn pumpswap_sell_fixed_output_uses_min_quote_directly() { + let instructions = PumpSwapInstructionBuilder + .build_sell_instructions(&swap_params(TradeType::Sell, Some(42))) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], crate::instruction::utils::pumpswap::SELL_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 100_000); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 42); + } + + #[tokio::test] + async fn pumpswap_usdc_buy_create_input_builds_usdc_ata() { + let mut params = swap_params(TradeType::Buy, Some(42)); + params.protocol_params = DexParamEnum::PumpSwap(PumpSwapParams::new( + pk(1), + pk(2), + crate::constants::USDC_TOKEN_ACCOUNT, + pk(3), + pk(4), + 1_000_000_000, + 2_000_000_000, + pk(5), + accounts::DEFAULT_COIN_CREATOR_VAULT_AUTHORITY, + crate::constants::TOKEN_PROGRAM, + crate::constants::TOKEN_PROGRAM, + accounts::PROTOCOL_FEE_RECIPIENT, + Pubkey::default(), + false, + 0, + )); + params.input_mint = crate::constants::USDC_TOKEN_ACCOUNT; + params.create_input_mint_ata = true; + params.open_seed_optimize = false; + + let instructions = + PumpSwapInstructionBuilder.build_buy_instructions(¶ms).await.unwrap(); + let create_ix = instructions.first().unwrap(); + + assert_eq!(create_ix.program_id, crate::constants::ASSOCIATED_TOKEN_PROGRAM_ID); + assert_eq!(create_ix.accounts[3].pubkey, crate::constants::USDC_TOKEN_ACCOUNT); + } +} diff --git a/src/instruction/raydium_amm_v4.rs b/src/instruction/raydium_amm_v4.rs index a5deeab..205d5e4 100755 --- a/src/instruction/raydium_amm_v4.rs +++ b/src/instruction/raydium_amm_v4.rs @@ -1,6 +1,14 @@ use crate::{ constants::trade::trade::DEFAULT_SLIPPAGE, - instruction::utils::raydium_amm_v4::{accounts, SWAP_BASE_IN_DISCRIMINATOR}, + instruction::{ + token_account_setup::{ + push_close_wsol_if_needed, push_create_or_wrap_user_token_account, + push_create_user_token_account, + }, + utils::raydium_amm_v4::{ + accounts, SWAP_BASE_IN_DISCRIMINATOR, SWAP_BASE_OUT_DISCRIMINATOR, + }, + }, trading::core::{ params::{RaydiumAmmV4Params, SwapParams}, traits::InstructionBuilder, @@ -10,12 +18,38 @@ use crate::{ use anyhow::{anyhow, Result}; use solana_sdk::{ instruction::{AccountMeta, Instruction}, + pubkey::Pubkey, signer::Signer, }; /// Instruction builder for RaydiumCpmm protocol pub struct RaydiumAmmV4InstructionBuilder; +fn ensure_market_accounts(params: &RaydiumAmmV4Params) -> Result<()> { + let required = [ + ("amm_open_orders", params.amm_open_orders), + ("amm_target_orders", params.amm_target_orders), + ("serum_program", params.serum_program), + ("serum_market", params.serum_market), + ("serum_bids", params.serum_bids), + ("serum_asks", params.serum_asks), + ("serum_event_queue", params.serum_event_queue), + ("serum_coin_vault_account", params.serum_coin_vault_account), + ("serum_pc_vault_account", params.serum_pc_vault_account), + ("serum_vault_signer", params.serum_vault_signer), + ]; + + for (name, account) in required { + if account == Pubkey::default() { + return Err(anyhow!( + "Raydium AMM v4 requires {}; use RaydiumAmmV4Params::from_amm_address_by_rpc or with_market_accounts", + name + )); + } + } + Ok(()) +} + #[async_trait::async_trait] impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { async fn build_buy_instructions(&self, params: &SwapParams) -> Result> { @@ -30,6 +64,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { .as_any() .downcast_ref::() .ok_or_else(|| anyhow!("Invalid protocol params for RaydiumAmmV4"))?; + ensure_market_accounts(protocol_params)?; let is_wsol = protocol_params.coin_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.pc_mint == crate::constants::WSOL_TOKEN_ACCOUNT; @@ -47,33 +82,22 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { let is_base_in = protocol_params.coin_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.coin_mint == crate::constants::USDC_TOKEN_ACCOUNT; let amount_in: u64 = params.input_amount.unwrap_or(0); - let swap_result = compute_swap_amount( - protocol_params.coin_reserve, - protocol_params.pc_reserve, - is_base_in, - amount_in, - params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), - ); - let minimum_amount_out = match params.fixed_output_amount { - Some(fixed) => fixed, - None => swap_result.min_amount_out, - }; + let input_mint = + if is_base_in { protocol_params.coin_mint } else { protocol_params.pc_mint }; + let output_mint = + if is_base_in { protocol_params.pc_mint } else { protocol_params.coin_mint }; let user_source_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - if is_wsol { - &crate::constants::WSOL_TOKEN_ACCOUNT - } else { - &crate::constants::USDC_TOKEN_ACCOUNT - }, + &input_mint, &crate::constants::TOKEN_PROGRAM, params.open_seed_optimize, ); let user_destination_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.output_mint, + &output_mint, &crate::constants::TOKEN_PROGRAM, params.open_seed_optimize, ); @@ -84,47 +108,66 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { let mut instructions = Vec::with_capacity(6); if params.create_input_mint_ata { - instructions - .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); + push_create_or_wrap_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &input_mint, + &crate::constants::TOKEN_PROGRAM, + amount_in, + params.open_seed_optimize, + ); } if params.create_output_mint_ata { - instructions.extend( - crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( - ¶ms.payer.pubkey(), - ¶ms.payer.pubkey(), - ¶ms.output_mint, - &crate::constants::TOKEN_PROGRAM, - params.open_seed_optimize, - ), + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_mint, + &crate::constants::TOKEN_PROGRAM, + params.open_seed_optimize, ); } // Create buy instruction - let accounts: [AccountMeta; 17] = [ + let accounts: [AccountMeta; 18] = [ crate::constants::TOKEN_PROGRAM_META, // Token Program (readonly) AccountMeta::new(protocol_params.amm, false), // Amm accounts::AUTHORITY_META, // Authority (readonly) - AccountMeta::new(protocol_params.amm, false), // Amm Open Orders + AccountMeta::new(protocol_params.amm_open_orders, false), // Amm Open Orders + AccountMeta::new(protocol_params.amm_target_orders, false), // Amm Target Orders AccountMeta::new(protocol_params.token_coin, false), // Pool Coin Token Account AccountMeta::new(protocol_params.token_pc, false), // Pool Pc Token Account - AccountMeta::new(protocol_params.amm, false), // Serum Program - AccountMeta::new(protocol_params.amm, false), // Serum Market - AccountMeta::new(protocol_params.amm, false), // Serum Bids - AccountMeta::new(protocol_params.amm, false), // Serum Asks - AccountMeta::new(protocol_params.amm, false), // Serum Event Queue - AccountMeta::new(protocol_params.amm, false), // Serum Coin Vault Account - AccountMeta::new(protocol_params.amm, false), // Serum Pc Vault Account - AccountMeta::new(protocol_params.amm, false), // Serum Vault Signer + AccountMeta::new_readonly(protocol_params.serum_program, false), // Serum Program + AccountMeta::new(protocol_params.serum_market, false), // Serum Market + AccountMeta::new(protocol_params.serum_bids, false), // Serum Bids + AccountMeta::new(protocol_params.serum_asks, false), // Serum Asks + AccountMeta::new(protocol_params.serum_event_queue, false), // Serum Event Queue + AccountMeta::new(protocol_params.serum_coin_vault_account, false), // Serum Coin Vault Account + AccountMeta::new(protocol_params.serum_pc_vault_account, false), // Serum Pc Vault Account + AccountMeta::new_readonly(protocol_params.serum_vault_signer, false), // Serum Vault Signer AccountMeta::new(user_source_token_account, false), // User Source Token Account AccountMeta::new(user_destination_token_account, false), // User Destination Token Account AccountMeta::new(params.payer.pubkey(), true), // User Source Owner ]; // Create instruction data let mut data = [0u8; 17]; - data[..1].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); - data[1..9].copy_from_slice(&amount_in.to_le_bytes()); - data[9..17].copy_from_slice(&minimum_amount_out.to_le_bytes()); + if let Some(amount_out) = params.fixed_output_amount { + data[..1].copy_from_slice(&SWAP_BASE_OUT_DISCRIMINATOR); + data[1..9].copy_from_slice(&amount_in.to_le_bytes()); + data[9..17].copy_from_slice(&amount_out.to_le_bytes()); + } else { + let minimum_amount_out = compute_swap_amount( + protocol_params.coin_reserve, + protocol_params.pc_reserve, + is_base_in, + amount_in, + params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), + ) + .min_amount_out; + data[..1].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); + data[1..9].copy_from_slice(&amount_in.to_le_bytes()); + data[9..17].copy_from_slice(&minimum_amount_out.to_le_bytes()); + } instructions.push(Instruction::new_with_bytes( accounts::RAYDIUM_AMM_V4, @@ -133,8 +176,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { )); if params.close_input_mint_ata { - // Close wSOL ATA account, reclaim rent - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), &input_mint); } Ok(instructions) @@ -149,6 +191,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { .as_any() .downcast_ref::() .ok_or_else(|| anyhow!("Invalid protocol params for RaydiumAmmV4"))?; + ensure_market_accounts(protocol_params)?; if params.input_amount.is_none() || params.input_amount.unwrap_or(0) == 0 { return Err(anyhow!("Token amount is not set")); @@ -169,33 +212,22 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { // ======================================== let is_base_in = protocol_params.pc_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.pc_mint == crate::constants::USDC_TOKEN_ACCOUNT; - let swap_result = compute_swap_amount( - protocol_params.coin_reserve, - protocol_params.pc_reserve, - is_base_in, - params.input_amount.unwrap_or(0), - params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), - ); - let minimum_amount_out = match params.fixed_output_amount { - Some(fixed) => fixed, - None => swap_result.min_amount_out, - }; + let input_mint = + if is_base_in { protocol_params.coin_mint } else { protocol_params.pc_mint }; + let output_mint = + if is_base_in { protocol_params.pc_mint } else { protocol_params.coin_mint }; let user_source_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.input_mint, + &input_mint, &crate::constants::TOKEN_PROGRAM, params.open_seed_optimize, ); let user_destination_token_account = crate::common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - if is_wsol { - &crate::constants::WSOL_TOKEN_ACCOUNT - } else { - &crate::constants::USDC_TOKEN_ACCOUNT - }, + &output_mint, &crate::constants::TOKEN_PROGRAM, params.open_seed_optimize, ); @@ -203,37 +235,59 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { // ======================================== // Build instructions // ======================================== - let mut instructions = Vec::with_capacity(3); + let mut instructions = Vec::with_capacity(4); if params.create_output_mint_ata { - instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_mint, + &crate::constants::TOKEN_PROGRAM, + params.open_seed_optimize, + ); } // Create buy instruction - let accounts: [AccountMeta; 17] = [ + let accounts: [AccountMeta; 18] = [ crate::constants::TOKEN_PROGRAM_META, // Token Program (readonly) AccountMeta::new(protocol_params.amm, false), // Amm accounts::AUTHORITY_META, // Authority (readonly) - AccountMeta::new(protocol_params.amm, false), // Amm Open Orders + AccountMeta::new(protocol_params.amm_open_orders, false), // Amm Open Orders + AccountMeta::new(protocol_params.amm_target_orders, false), // Amm Target Orders AccountMeta::new(protocol_params.token_coin, false), // Pool Coin Token Account AccountMeta::new(protocol_params.token_pc, false), // Pool Pc Token Account - AccountMeta::new(protocol_params.amm, false), // Serum Program - AccountMeta::new(protocol_params.amm, false), // Serum Market - AccountMeta::new(protocol_params.amm, false), // Serum Bids - AccountMeta::new(protocol_params.amm, false), // Serum Asks - AccountMeta::new(protocol_params.amm, false), // Serum Event Queue - AccountMeta::new(protocol_params.amm, false), // Serum Coin Vault Account - AccountMeta::new(protocol_params.amm, false), // Serum Pc Vault Account - AccountMeta::new(protocol_params.amm, false), // Serum Vault Signer + AccountMeta::new_readonly(protocol_params.serum_program, false), // Serum Program + AccountMeta::new(protocol_params.serum_market, false), // Serum Market + AccountMeta::new(protocol_params.serum_bids, false), // Serum Bids + AccountMeta::new(protocol_params.serum_asks, false), // Serum Asks + AccountMeta::new(protocol_params.serum_event_queue, false), // Serum Event Queue + AccountMeta::new(protocol_params.serum_coin_vault_account, false), // Serum Coin Vault Account + AccountMeta::new(protocol_params.serum_pc_vault_account, false), // Serum Pc Vault Account + AccountMeta::new_readonly(protocol_params.serum_vault_signer, false), // Serum Vault Signer AccountMeta::new(user_source_token_account, false), // User Source Token Account AccountMeta::new(user_destination_token_account, false), // User Destination Token Account AccountMeta::new(params.payer.pubkey(), true), // User Source Owner ]; // Create instruction data let mut data = [0u8; 17]; - data[..1].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); - data[1..9].copy_from_slice(¶ms.input_amount.unwrap_or(0).to_le_bytes()); - data[9..17].copy_from_slice(&minimum_amount_out.to_le_bytes()); + let amount_in = params.input_amount.unwrap_or(0); + if let Some(amount_out) = params.fixed_output_amount { + data[..1].copy_from_slice(&SWAP_BASE_OUT_DISCRIMINATOR); + data[1..9].copy_from_slice(&amount_in.to_le_bytes()); + data[9..17].copy_from_slice(&amount_out.to_le_bytes()); + } else { + let minimum_amount_out = compute_swap_amount( + protocol_params.coin_reserve, + protocol_params.pc_reserve, + is_base_in, + amount_in, + params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), + ) + .min_amount_out; + data[..1].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); + data[1..9].copy_from_slice(&amount_in.to_le_bytes()); + data[9..17].copy_from_slice(&minimum_amount_out.to_le_bytes()); + } instructions.push(Instruction::new_with_bytes( accounts::RAYDIUM_AMM_V4, @@ -242,7 +296,7 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { )); if params.close_output_mint_ata { - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), &output_mint); } if params.close_input_mint_ata { instructions.push(crate::common::spl_token::close_account( @@ -257,3 +311,160 @@ impl InstructionBuilder for RaydiumAmmV4InstructionBuilder { Ok(instructions) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + common::GasFeeStrategy, + swqos::TradeType, + trading::core::params::{DexParamEnum, SwapParams}, + }; + use solana_sdk::{pubkey::Pubkey, signature::Keypair}; + use std::sync::Arc; + + fn pk(seed: u8) -> Pubkey { + Pubkey::new_from_array([seed; 32]) + } + + fn market_params() -> RaydiumAmmV4Params { + RaydiumAmmV4Params::new( + pk(1), + crate::constants::WSOL_TOKEN_ACCOUNT, + pk(2), + pk(3), + pk(4), + 1_000_000_000, + 2_000_000_000, + ) + .with_market_accounts( + pk(5), + pk(6), + pk(7), + pk(8), + pk(9), + pk(10), + pk(11), + pk(12), + pk(13), + pk(14), + ) + } + + fn swap_params( + protocol_params: RaydiumAmmV4Params, + fixed_output_amount: Option, + ) -> SwapParams { + SwapParams { + rpc: None, + payer: Arc::new(Keypair::new()), + trade_type: TradeType::Buy, + input_mint: crate::constants::WSOL_TOKEN_ACCOUNT, + input_token_program: None, + output_mint: pk(2), + output_token_program: None, + input_amount: Some(100_000), + slippage_basis_points: Some(100), + address_lookup_table_account: None, + recent_blockhash: None, + wait_tx_confirmed: false, + protocol_params: DexParamEnum::RaydiumAmmV4(protocol_params), + open_seed_optimize: true, + swqos_clients: Arc::new(Vec::new()), + middleware_manager: None, + durable_nonce: None, + with_tip: false, + create_input_mint_ata: false, + close_input_mint_ata: false, + create_output_mint_ata: false, + close_output_mint_ata: false, + fixed_output_amount, + gas_fee_strategy: GasFeeStrategy::new(), + simulate: true, + log_enabled: false, + use_dedicated_sender_threads: false, + sender_thread_cores: None, + max_sender_concurrency: 0, + effective_core_ids: Arc::new(Vec::new()), + check_min_tip: false, + grpc_recv_us: None, + use_exact_sol_amount: None, + use_pumpfun_v2: false, + } + } + + #[tokio::test] + async fn raydium_amm_v4_uses_idl_market_account_order() { + let instructions = RaydiumAmmV4InstructionBuilder + .build_buy_instructions(&swap_params(market_params(), None)) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(ix.accounts.len(), 18); + assert_eq!(&ix.data[..1], SWAP_BASE_IN_DISCRIMINATOR); + assert_eq!(ix.accounts[3].pubkey, pk(5)); + assert_eq!(ix.accounts[4].pubkey, pk(6)); + assert_eq!(ix.accounts[7].pubkey, pk(7)); + assert_eq!(ix.accounts[8].pubkey, pk(8)); + assert_eq!(ix.accounts[9].pubkey, pk(9)); + assert_eq!(ix.accounts[10].pubkey, pk(10)); + assert_eq!(ix.accounts[11].pubkey, pk(11)); + assert_eq!(ix.accounts[12].pubkey, pk(12)); + assert_eq!(ix.accounts[13].pubkey, pk(13)); + assert_eq!(ix.accounts[14].pubkey, pk(14)); + assert!(!ix.accounts[7].is_writable); + assert!(!ix.accounts[14].is_writable); + } + + #[tokio::test] + async fn raydium_amm_v4_uses_base_out_when_fixed_output_is_set() { + let instructions = RaydiumAmmV4InstructionBuilder + .build_buy_instructions(&swap_params(market_params(), Some(42))) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..1], SWAP_BASE_OUT_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[1..9].try_into().unwrap()), 100_000); + assert_eq!(u64::from_le_bytes(ix.data[9..17].try_into().unwrap()), 42); + } + + #[tokio::test] + async fn raydium_amm_v4_rejects_placeholder_market_accounts() { + let err = RaydiumAmmV4InstructionBuilder + .build_buy_instructions(&swap_params( + RaydiumAmmV4Params::new( + pk(1), + crate::constants::WSOL_TOKEN_ACCOUNT, + pk(2), + pk(3), + pk(4), + 1_000_000_000, + 2_000_000_000, + ), + None, + )) + .await + .unwrap_err(); + assert!(err.to_string().contains("amm_open_orders")); + } + + #[tokio::test] + async fn raydium_amm_v4_usdc_buy_create_input_builds_usdc_ata() { + let mut protocol_params = market_params(); + protocol_params.coin_mint = crate::constants::USDC_TOKEN_ACCOUNT; + + let mut params = swap_params(protocol_params, Some(42)); + params.input_mint = crate::constants::USDC_TOKEN_ACCOUNT; + params.create_input_mint_ata = true; + params.open_seed_optimize = false; + + let instructions = + RaydiumAmmV4InstructionBuilder.build_buy_instructions(¶ms).await.unwrap(); + let create_ix = instructions.first().unwrap(); + + assert_eq!(create_ix.program_id, crate::constants::ASSOCIATED_TOKEN_PROGRAM_ID); + assert_eq!(create_ix.accounts[3].pubkey, crate::constants::USDC_TOKEN_ACCOUNT); + } +} diff --git a/src/instruction/raydium_cpmm.rs b/src/instruction/raydium_cpmm.rs index 1fc780f..5454a8a 100755 --- a/src/instruction/raydium_cpmm.rs +++ b/src/instruction/raydium_cpmm.rs @@ -1,9 +1,15 @@ use crate::{ common::fast_fn::get_associated_token_address_with_program_id_fast_use_seed, constants::trade::trade::DEFAULT_SLIPPAGE, - instruction::utils::raydium_cpmm::{ - accounts, get_observation_state_pda, get_pool_pda, get_vault_account, - SWAP_BASE_IN_DISCRIMINATOR, + instruction::{ + token_account_setup::{ + push_close_wsol_if_needed, push_create_or_wrap_user_token_account, + push_create_user_token_account, + }, + utils::raydium_cpmm::{ + accounts, get_observation_state_pda, get_pool_pda, get_vault_account, + SWAP_BASE_IN_DISCRIMINATOR, SWAP_BASE_OUT_DISCRIMINATOR, + }, }, trading::core::{ params::{RaydiumCpmmParams, SwapParams}, @@ -63,53 +69,38 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { // ======================================== let is_base_in = protocol_params.base_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.base_mint == crate::constants::USDC_TOKEN_ACCOUNT; - let mint_token_program = if is_base_in { + let input_mint = + if is_base_in { protocol_params.base_mint } else { protocol_params.quote_mint }; + let input_token_program = if is_base_in { + protocol_params.base_token_program + } else { + protocol_params.quote_token_program + }; + let output_mint = + if is_base_in { protocol_params.quote_mint } else { protocol_params.base_mint }; + let output_token_program = if is_base_in { protocol_params.quote_token_program } else { protocol_params.base_token_program }; let amount_in: u64 = params.input_amount.unwrap_or(0); - let result = compute_swap_amount( - protocol_params.base_reserve, - protocol_params.quote_reserve, - is_base_in, - amount_in, - params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), - ); - let minimum_amount_out = match params.fixed_output_amount { - Some(fixed) => fixed, - None => result.min_amount_out, - }; let input_token_account = get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - if is_wsol { - &crate::constants::WSOL_TOKEN_ACCOUNT - } else { - &crate::constants::USDC_TOKEN_ACCOUNT - }, - &crate::constants::TOKEN_PROGRAM, + &input_mint, + &input_token_program, params.open_seed_optimize, ); let output_token_account = get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.output_mint, - &mint_token_program, + &output_mint, + &output_token_program, params.open_seed_optimize, ); - let input_vault_account = get_vault_account( - &pool_state, - if is_wsol { - &crate::constants::WSOL_TOKEN_ACCOUNT - } else { - &crate::constants::USDC_TOKEN_ACCOUNT - }, - protocol_params, - ); - let output_vault_account = - get_vault_account(&pool_state, ¶ms.output_mint, protocol_params); + let input_vault_account = get_vault_account(&pool_state, &input_mint, protocol_params); + let output_vault_account = get_vault_account(&pool_state, &output_mint, protocol_params); let observation_state_account = if protocol_params.observation_state == Pubkey::default() { get_observation_state_pda(&pool_state).unwrap() @@ -123,19 +114,23 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { let mut instructions = Vec::with_capacity(6); if params.create_input_mint_ata { - instructions - .extend(crate::trading::common::handle_wsol(¶ms.payer.pubkey(), amount_in)); + push_create_or_wrap_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &input_mint, + &input_token_program, + amount_in, + params.open_seed_optimize, + ); } if params.create_output_mint_ata { - instructions.extend( - crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( - ¶ms.payer.pubkey(), - ¶ms.payer.pubkey(), - ¶ms.output_mint, - &mint_token_program, - params.open_seed_optimize, - ), + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_mint, + &output_token_program, + params.open_seed_optimize, ); } @@ -143,27 +138,37 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { let accounts: [AccountMeta; 13] = [ AccountMeta::new(params.payer.pubkey(), true), // Payer (signer) accounts::AUTHORITY_META, // Authority (readonly) - AccountMeta::new(protocol_params.amm_config, false), // Amm Config (readonly) + AccountMeta::new_readonly(protocol_params.amm_config, false), // Amm Config (readonly) AccountMeta::new(pool_state, false), // Pool State AccountMeta::new(input_token_account, false), // Input Token Account AccountMeta::new(output_token_account, false), // Output Token Account AccountMeta::new(input_vault_account, false), // Input Vault Account AccountMeta::new(output_vault_account, false), // Output Vault Account - crate::constants::TOKEN_PROGRAM_META, // Input Token Program (readonly) - AccountMeta::new_readonly(mint_token_program, false), // Output Token Program (readonly) - if is_wsol { - crate::constants::WSOL_TOKEN_ACCOUNT_META - } else { - crate::constants::USDC_TOKEN_ACCOUNT_META - }, // Input token mint (readonly) - AccountMeta::new_readonly(params.output_mint, false), // Output token mint (readonly) - AccountMeta::new(observation_state_account, false), // Observation State Account + AccountMeta::new_readonly(input_token_program, false), // Input Token Program (readonly) + AccountMeta::new_readonly(output_token_program, false), // Output Token Program (readonly) + AccountMeta::new_readonly(input_mint, false), // Input token mint (readonly) + AccountMeta::new_readonly(output_mint, false), // Output token mint (readonly) + AccountMeta::new(observation_state_account, false), // Observation State Account ]; // Create instruction data let mut data = [0u8; 24]; - data[..8].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); - data[8..16].copy_from_slice(&amount_in.to_le_bytes()); - data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + if let Some(amount_out) = params.fixed_output_amount { + data[..8].copy_from_slice(&SWAP_BASE_OUT_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_in.to_le_bytes()); + data[16..24].copy_from_slice(&amount_out.to_le_bytes()); + } else { + let minimum_amount_out = compute_swap_amount( + protocol_params.base_reserve, + protocol_params.quote_reserve, + is_base_in, + amount_in, + params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), + ) + .min_amount_out; + data[..8].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_in.to_le_bytes()); + data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + } instructions.push(Instruction::new_with_bytes( accounts::RAYDIUM_CPMM, @@ -172,8 +177,7 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { )); if params.close_input_mint_ata { - // Close wSOL ATA account, reclaim rent - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), &input_mint); } Ok(instructions) @@ -219,54 +223,36 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { // ======================================== let is_quote_out = protocol_params.quote_mint == crate::constants::WSOL_TOKEN_ACCOUNT || protocol_params.quote_mint == crate::constants::USDC_TOKEN_ACCOUNT; - let mint_token_program = if is_quote_out { + let input_mint = + if is_quote_out { protocol_params.base_mint } else { protocol_params.quote_mint }; + let input_token_program = if is_quote_out { protocol_params.base_token_program } else { protocol_params.quote_token_program }; - - let minimum_amount_out: u64 = match params.fixed_output_amount { - Some(fixed) => fixed, - None => { - compute_swap_amount( - protocol_params.base_reserve, - protocol_params.quote_reserve, - is_quote_out, - params.input_amount.unwrap_or(0), - params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), - ) - .min_amount_out - } + let output_mint = + if is_quote_out { protocol_params.quote_mint } else { protocol_params.base_mint }; + let output_token_program = if is_quote_out { + protocol_params.quote_token_program + } else { + protocol_params.base_token_program }; let output_token_account = get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - if is_wsol { - &crate::constants::WSOL_TOKEN_ACCOUNT - } else { - &crate::constants::USDC_TOKEN_ACCOUNT - }, - &crate::constants::TOKEN_PROGRAM, + &output_mint, + &output_token_program, params.open_seed_optimize, ); let input_token_account = get_associated_token_address_with_program_id_fast_use_seed( ¶ms.payer.pubkey(), - ¶ms.input_mint, - &mint_token_program, + &input_mint, + &input_token_program, params.open_seed_optimize, ); - let output_vault_account = get_vault_account( - &pool_state, - if is_wsol { - &crate::constants::WSOL_TOKEN_ACCOUNT - } else { - &crate::constants::USDC_TOKEN_ACCOUNT - }, - protocol_params, - ); - let input_vault_account = - get_vault_account(&pool_state, ¶ms.input_mint, protocol_params); + let output_vault_account = get_vault_account(&pool_state, &output_mint, protocol_params); + let input_vault_account = get_vault_account(&pool_state, &input_mint, protocol_params); let observation_state_account = if protocol_params.observation_state == Pubkey::default() { get_observation_state_pda(&pool_state).unwrap() @@ -277,37 +263,54 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { // ======================================== // Build instructions // ======================================== - let mut instructions = Vec::with_capacity(3); + let mut instructions = Vec::with_capacity(4); if params.create_output_mint_ata { - instructions.extend(crate::trading::common::create_wsol_ata(¶ms.payer.pubkey())); + push_create_user_token_account( + &mut instructions, + ¶ms.payer.pubkey(), + &output_mint, + &output_token_program, + params.open_seed_optimize, + ); } // Create sell instruction let accounts: [AccountMeta; 13] = [ AccountMeta::new(params.payer.pubkey(), true), // Payer (signer) accounts::AUTHORITY_META, // Authority (readonly) - AccountMeta::new(protocol_params.amm_config, false), // Amm Config (readonly) + AccountMeta::new_readonly(protocol_params.amm_config, false), // Amm Config (readonly) AccountMeta::new(pool_state, false), // Pool State AccountMeta::new(input_token_account, false), // Input Token Account AccountMeta::new(output_token_account, false), // Output Token Account AccountMeta::new(input_vault_account, false), // Input Vault Account AccountMeta::new(output_vault_account, false), // Output Vault Account - AccountMeta::new_readonly(mint_token_program, false), // Input Token Program (readonly) - crate::constants::TOKEN_PROGRAM_META, // Output Token Program (readonly) - AccountMeta::new_readonly(params.input_mint, false), // Input token mint (readonly) - if is_wsol { - crate::constants::WSOL_TOKEN_ACCOUNT_META - } else { - crate::constants::USDC_TOKEN_ACCOUNT_META - }, // Output token mint (readonly) - AccountMeta::new(observation_state_account, false), // Observation State Account + AccountMeta::new_readonly(input_token_program, false), // Input Token Program (readonly) + AccountMeta::new_readonly(output_token_program, false), // Output Token Program (readonly) + AccountMeta::new_readonly(input_mint, false), // Input token mint (readonly) + AccountMeta::new_readonly(output_mint, false), // Output token mint (readonly) + AccountMeta::new(observation_state_account, false), // Observation State Account ]; // Create instruction data let mut data = [0u8; 24]; - data[..8].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); - data[8..16].copy_from_slice(¶ms.input_amount.unwrap_or(0).to_le_bytes()); - data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + let amount_in = params.input_amount.unwrap_or(0); + if let Some(amount_out) = params.fixed_output_amount { + data[..8].copy_from_slice(&SWAP_BASE_OUT_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_in.to_le_bytes()); + data[16..24].copy_from_slice(&amount_out.to_le_bytes()); + } else { + let minimum_amount_out = compute_swap_amount( + protocol_params.base_reserve, + protocol_params.quote_reserve, + is_quote_out, + amount_in, + params.slippage_basis_points.unwrap_or(DEFAULT_SLIPPAGE), + ) + .min_amount_out; + data[..8].copy_from_slice(&SWAP_BASE_IN_DISCRIMINATOR); + data[8..16].copy_from_slice(&amount_in.to_le_bytes()); + data[16..24].copy_from_slice(&minimum_amount_out.to_le_bytes()); + } instructions.push(Instruction::new_with_bytes( accounts::RAYDIUM_CPMM, @@ -316,12 +319,11 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { )); if params.close_output_mint_ata { - // Close wSOL ATA account, reclaim rent - instructions.extend(crate::trading::common::close_wsol(¶ms.payer.pubkey())); + push_close_wsol_if_needed(&mut instructions, ¶ms.payer.pubkey(), &output_mint); } if params.close_input_mint_ata { instructions.push(crate::common::spl_token::close_account( - &mint_token_program, + &input_token_program, &input_token_account, ¶ms.payer.pubkey(), ¶ms.payer.pubkey(), @@ -332,3 +334,120 @@ impl InstructionBuilder for RaydiumCpmmInstructionBuilder { Ok(instructions) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + common::GasFeeStrategy, + swqos::TradeType, + trading::core::params::{DexParamEnum, SwapParams}, + }; + use solana_sdk::{pubkey::Pubkey, signature::Keypair}; + use std::sync::Arc; + + fn pk(seed: u8) -> Pubkey { + Pubkey::new_from_array([seed; 32]) + } + + fn cpmm_params() -> RaydiumCpmmParams { + RaydiumCpmmParams { + pool_state: pk(1), + amm_config: pk(2), + base_mint: crate::constants::WSOL_TOKEN_ACCOUNT, + quote_mint: pk(3), + base_reserve: 1_000_000_000, + quote_reserve: 2_000_000_000, + base_vault: pk(4), + quote_vault: pk(5), + base_token_program: crate::constants::TOKEN_PROGRAM, + quote_token_program: crate::constants::TOKEN_PROGRAM, + observation_state: pk(6), + } + } + + fn swap_params(fixed_output_amount: Option) -> SwapParams { + SwapParams { + rpc: None, + payer: Arc::new(Keypair::new()), + trade_type: TradeType::Buy, + input_mint: crate::constants::WSOL_TOKEN_ACCOUNT, + input_token_program: None, + output_mint: pk(3), + output_token_program: None, + input_amount: Some(100_000), + slippage_basis_points: Some(100), + address_lookup_table_account: None, + recent_blockhash: None, + wait_tx_confirmed: false, + protocol_params: DexParamEnum::RaydiumCpmm(cpmm_params()), + open_seed_optimize: true, + swqos_clients: Arc::new(Vec::new()), + middleware_manager: None, + durable_nonce: None, + with_tip: false, + create_input_mint_ata: false, + close_input_mint_ata: false, + create_output_mint_ata: false, + close_output_mint_ata: false, + fixed_output_amount, + gas_fee_strategy: GasFeeStrategy::new(), + simulate: true, + log_enabled: false, + use_dedicated_sender_threads: false, + sender_thread_cores: None, + max_sender_concurrency: 0, + effective_core_ids: Arc::new(Vec::new()), + check_min_tip: false, + grpc_recv_us: None, + use_exact_sol_amount: None, + use_pumpfun_v2: false, + } + } + + #[tokio::test] + async fn raydium_cpmm_uses_base_in_and_readonly_amm_config_by_default() { + let instructions = + RaydiumCpmmInstructionBuilder.build_buy_instructions(&swap_params(None)).await.unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], SWAP_BASE_IN_DISCRIMINATOR); + assert_eq!(ix.accounts[2].pubkey, pk(2)); + assert!(!ix.accounts[2].is_writable); + } + + #[tokio::test] + async fn raydium_cpmm_uses_base_output_when_fixed_output_is_set() { + let instructions = RaydiumCpmmInstructionBuilder + .build_buy_instructions(&swap_params(Some(42))) + .await + .unwrap(); + let ix = instructions.last().unwrap(); + + assert_eq!(&ix.data[..8], SWAP_BASE_OUT_DISCRIMINATOR); + assert_eq!(u64::from_le_bytes(ix.data[8..16].try_into().unwrap()), 100_000); + assert_eq!(u64::from_le_bytes(ix.data[16..24].try_into().unwrap()), 42); + } + + #[tokio::test] + async fn raydium_cpmm_usdc_buy_create_input_uses_usdc_accounts() { + let mut protocol_params = cpmm_params(); + protocol_params.base_mint = crate::constants::USDC_TOKEN_ACCOUNT; + protocol_params.quote_mint = pk(3); + + let mut params = swap_params(Some(42)); + params.protocol_params = DexParamEnum::RaydiumCpmm(protocol_params); + params.input_mint = crate::constants::USDC_TOKEN_ACCOUNT; + params.create_input_mint_ata = true; + params.open_seed_optimize = false; + + let instructions = + RaydiumCpmmInstructionBuilder.build_buy_instructions(¶ms).await.unwrap(); + let create_ix = instructions.first().unwrap(); + let swap_ix = instructions.last().unwrap(); + + assert_eq!(create_ix.program_id, crate::constants::ASSOCIATED_TOKEN_PROGRAM_ID); + assert_eq!(create_ix.accounts[3].pubkey, crate::constants::USDC_TOKEN_ACCOUNT); + assert_eq!(swap_ix.accounts[10].pubkey, crate::constants::USDC_TOKEN_ACCOUNT); + } +} diff --git a/src/instruction/token_account_setup.rs b/src/instruction/token_account_setup.rs new file mode 100644 index 0000000..1191c65 --- /dev/null +++ b/src/instruction/token_account_setup.rs @@ -0,0 +1,47 @@ +use solana_sdk::{instruction::Instruction, pubkey::Pubkey}; + +#[inline] +pub(crate) fn push_create_user_token_account( + instructions: &mut Vec, + payer: &Pubkey, + mint: &Pubkey, + token_program: &Pubkey, + use_seed: bool, +) { + instructions.extend( + crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed( + payer, + payer, + mint, + token_program, + use_seed, + ), + ); +} + +#[inline] +pub(crate) fn push_create_or_wrap_user_token_account( + instructions: &mut Vec, + payer: &Pubkey, + mint: &Pubkey, + token_program: &Pubkey, + amount: u64, + use_seed: bool, +) { + if *mint == crate::constants::WSOL_TOKEN_ACCOUNT { + instructions.extend(crate::trading::common::handle_wsol(payer, amount)); + } else { + push_create_user_token_account(instructions, payer, mint, token_program, use_seed); + } +} + +#[inline] +pub(crate) fn push_close_wsol_if_needed( + instructions: &mut Vec, + payer: &Pubkey, + mint: &Pubkey, +) { + if *mint == crate::constants::WSOL_TOKEN_ACCOUNT { + instructions.extend(crate::trading::common::close_wsol(payer)); + } +} diff --git a/src/instruction/utils/bonk.rs b/src/instruction/utils/bonk.rs index 20e69b2..5fab67a 100644 --- a/src/instruction/utils/bonk.rs +++ b/src/instruction/utils/bonk.rs @@ -57,7 +57,9 @@ pub mod accounts { } pub const BUY_EXECT_IN_DISCRIMINATOR: [u8; 8] = [250, 234, 13, 123, 213, 156, 19, 236]; +pub const BUY_EXECT_OUT_DISCRIMINATOR: [u8; 8] = [24, 211, 116, 40, 105, 3, 153, 56]; pub const SELL_EXECT_IN_DISCRIMINATOR: [u8; 8] = [149, 39, 222, 155, 211, 124, 152, 26]; +pub const SELL_EXECT_OUT_DISCRIMINATOR: [u8; 8] = [95, 200, 71, 34, 8, 9, 11, 166]; pub async fn fetch_pool_state( rpc: &SolanaRpcClient, diff --git a/src/instruction/utils/meteora_damm_v2.rs b/src/instruction/utils/meteora_damm_v2.rs index 7804ac1..bdadb32 100644 --- a/src/instruction/utils/meteora_damm_v2.rs +++ b/src/instruction/utils/meteora_damm_v2.rs @@ -16,6 +16,7 @@ pub mod accounts { pub const AUTHORITY: Pubkey = pubkey!("HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"); pub const METEORA_DAMM_V2: Pubkey = pubkey!("cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"); + pub const SYSVAR_INSTRUCTIONS: Pubkey = pubkey!("Sysvar1nstructions1111111111111111111111111"); // META @@ -32,9 +33,20 @@ pub mod accounts { is_signer: false, is_writable: false, }; + + pub const SYSVAR_INSTRUCTIONS_META: solana_sdk::instruction::AccountMeta = + solana_sdk::instruction::AccountMeta { + pubkey: SYSVAR_INSTRUCTIONS, + is_signer: false, + is_writable: false, + }; } pub const SWAP_DISCRIMINATOR: &[u8] = &[248, 198, 158, 145, 225, 117, 135, 200]; +pub const SWAP2_DISCRIMINATOR: &[u8] = &[65, 75, 63, 76, 235, 91, 91, 136]; +pub const SWAP_MODE_EXACT_IN: u8 = 0; +pub const SWAP_MODE_PARTIAL_FILL: u8 = 1; +pub const SWAP_MODE_EXACT_OUT: u8 = 2; pub async fn fetch_pool( rpc: &SolanaRpcClient, diff --git a/src/instruction/utils/pumpswap.rs b/src/instruction/utils/pumpswap.rs index 3c41f94..8a5c7a1 100644 --- a/src/instruction/utils/pumpswap.rs +++ b/src/instruction/utils/pumpswap.rs @@ -11,7 +11,10 @@ use parking_lot::RwLock; use rand::seq::IndexedRandom; use solana_account_decoder::UiAccountEncoding; use solana_sdk::{instruction::AccountMeta, pubkey::Pubkey}; -use std::sync::Arc; +use std::sync::{ + atomic::{AtomicBool, Ordering}, + Arc, +}; use std::time::{Duration, Instant}; use tracing::warn; @@ -205,6 +208,7 @@ struct CachedGlobalConfig { static GLOBAL_CONFIG_CACHE: Lazy>> = Lazy::new(|| RwLock::new(None)); +static GLOBAL_CONFIG_REFRESH_IN_FLIGHT: AtomicBool = AtomicBool::new(false); fn read_pubkey(data: &[u8], offset: usize) -> Option { let bytes = data.get(offset..offset + PUBKEY_LEN)?; @@ -294,8 +298,12 @@ pub async fn warm_pumpswap_global_config(rpc: Option<&Arc>) { .as_ref() .map(|c| c.fetched_at.elapsed() > PUMPSWAP_GLOBAL_CONFIG_TTL) .unwrap_or(true); - if stale { - let _ = refresh_global_config_once(rpc.as_ref()).await; + if stale && !GLOBAL_CONFIG_REFRESH_IN_FLIGHT.swap(true, Ordering::AcqRel) { + let rpc = Arc::clone(rpc); + tokio::spawn(async move { + let _ = refresh_global_config_once(rpc.as_ref()).await; + GLOBAL_CONFIG_REFRESH_IN_FLIGHT.store(false, Ordering::Release); + }); } } diff --git a/src/instruction/utils/raydium_amm_v4.rs b/src/instruction/utils/raydium_amm_v4.rs index 0a08a61..699feb2 100644 --- a/src/instruction/utils/raydium_amm_v4.rs +++ b/src/instruction/utils/raydium_amm_v4.rs @@ -1,6 +1,8 @@ use crate::{ common::SolanaRpcClient, - instruction::utils::raydium_amm_v4_types::{amm_info_decode, AmmInfo}, + instruction::utils::raydium_amm_v4_types::{ + amm_info_decode, market_state_decode, AmmInfo, MarketState, + }, }; use anyhow::anyhow; use solana_sdk::pubkey::Pubkey; @@ -40,3 +42,25 @@ pub async fn fetch_amm_info(rpc: &SolanaRpcClient, amm: Pubkey) -> Result Result { + let market_data = rpc.get_account_data(&market).await?; + market_state_decode(&market_data).ok_or_else(|| anyhow!("Failed to decode market state")) +} + +pub fn derive_serum_vault_signer( + serum_program: &Pubkey, + serum_market: &Pubkey, + vault_signer_nonce: u64, +) -> Result { + let nonce = vault_signer_nonce.to_le_bytes(); + Pubkey::create_program_address(&[serum_market.as_ref(), &nonce], serum_program) + .or_else(|_| { + let legacy_nonce = [vault_signer_nonce as u8]; + Pubkey::create_program_address(&[serum_market.as_ref(), &legacy_nonce], serum_program) + }) + .map_err(|err| anyhow!("Failed to derive Serum vault signer: {}", err)) +} diff --git a/src/instruction/utils/raydium_amm_v4_types.rs b/src/instruction/utils/raydium_amm_v4_types.rs index 6a7ebee..4ef12b8 100644 --- a/src/instruction/utils/raydium_amm_v4_types.rs +++ b/src/instruction/utils/raydium_amm_v4_types.rs @@ -77,3 +77,38 @@ pub fn amm_info_decode(data: &[u8]) -> Option { } borsh::from_slice::(&data[..AMM_INFO_SIZE]).ok() } + +#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)] +pub struct MarketState { + pub padding: [u8; 5], + pub account_flags: u64, + pub own_address: Pubkey, + pub vault_signer_nonce: u64, + pub coin_mint: Pubkey, + pub pc_mint: Pubkey, + pub serum_coin_vault_account: Pubkey, + pub coin_deposits_total: u64, + pub coin_fees_accrued: u64, + pub serum_pc_vault_account: Pubkey, + pub pc_deposits_total: u64, + pub pc_fees_accrued: u64, + pub pc_dust_threshold: u64, + pub request_queue: Pubkey, + pub serum_event_queue: Pubkey, + pub serum_bids: Pubkey, + pub serum_asks: Pubkey, + pub coin_lot_size: u64, + pub pc_lot_size: u64, + pub fee_rate_bps: u64, + pub referrer_rebate_accrued: u64, + pub padding2: [u8; 7], +} + +pub const MARKET_STATE_SIZE: usize = 388; + +pub fn market_state_decode(data: &[u8]) -> Option { + if data.len() < MARKET_STATE_SIZE { + return None; + } + borsh::from_slice::(&data[..MARKET_STATE_SIZE]).ok() +} diff --git a/src/perf/compiler_optimization.rs b/src/perf/compiler_optimization.rs index 37b3fd4..588b670 100644 --- a/src/perf/compiler_optimization.rs +++ b/src/perf/compiler_optimization.rs @@ -288,7 +288,10 @@ impl OptimizationFlags { "+popcnt".to_string(), ]; - #[cfg(not(target_arch = "x86_64"))] + #[cfg(target_arch = "aarch64")] + let target_features = vec!["+neon".to_string()]; + + #[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))] let target_features = vec![]; Self { opt_level: OptLevel::Aggressive, diff --git a/src/perf/hardware_optimizations.rs b/src/perf/hardware_optimizations.rs index 7815817..a88c03d 100644 --- a/src/perf/hardware_optimizations.rs +++ b/src/perf/hardware_optimizations.rs @@ -172,10 +172,17 @@ impl SIMDMemoryOps { unsafe fn memcmp_small(a: *const u8, b: *const u8, len: usize) -> bool { match len { 1 => *a == *b, - 2 => *(a as *const u16) == *(b as *const u16), - 3 => *(a as *const u16) == *(b as *const u16) && *a.add(2) == *b.add(2), - 4 => *(a as *const u32) == *(b as *const u32), - 5..=8 => *(a as *const u64) == *(b as *const u64), + 2 => ptr::read_unaligned(a as *const u16) == ptr::read_unaligned(b as *const u16), + 3 => { + ptr::read_unaligned(a as *const u16) == ptr::read_unaligned(b as *const u16) + && *a.add(2) == *b.add(2) + } + 4 => ptr::read_unaligned(a as *const u32) == ptr::read_unaligned(b as *const u32), + 5..=7 => { + ptr::read_unaligned(a as *const u32) == ptr::read_unaligned(b as *const u32) + && (4..len).all(|i| *a.add(i) == *b.add(i)) + } + 8 => ptr::read_unaligned(a as *const u64) == ptr::read_unaligned(b as *const u64), _ => unreachable!(), } } diff --git a/src/perf/syscall_bypass.rs b/src/perf/syscall_bypass.rs index ea044a3..0e0fd16 100644 --- a/src/perf/syscall_bypass.rs +++ b/src/perf/syscall_bypass.rs @@ -49,7 +49,7 @@ impl Default for SyscallBypassConfig { pub struct SyscallBatchProcessor { pending_calls: crossbeam_queue::ArrayQueue, - _executor: tokio::runtime::Handle, + _executor: Option, batch_stats: CachePadded, } @@ -94,6 +94,7 @@ pub struct FastTimeProvider { /// 上次更新时间 last_update: CachePadded, /// 启用vDSO + #[cfg_attr(not(target_os = "linux"), allow(dead_code))] vdso_enabled: bool, } @@ -121,6 +122,7 @@ impl FastTimeProvider { /// 🚀 超快速获取当前时间 - 绕过系统调用 #[inline(always)] pub fn fast_now_nanos(&self) -> u64 { + #[cfg(target_os = "linux")] if self.vdso_enabled { // 使用vDSO快速获取时间 return self.vdso_time_nanos(); @@ -140,6 +142,7 @@ impl FastTimeProvider { /// vDSO时间获取 #[inline(always)] + #[cfg_attr(not(target_os = "linux"), allow(dead_code))] fn vdso_time_nanos(&self) -> u64 { #[cfg(target_os = "linux")] { @@ -371,7 +374,7 @@ impl SyscallBatchProcessor { /// 创建系统调用批处理器 pub fn new(batch_size: usize) -> Result { let pending_calls = crossbeam_queue::ArrayQueue::new(batch_size * 10); - let executor = tokio::runtime::Handle::current(); + let executor = tokio::runtime::Handle::try_current().ok(); tracing::info!(target: "sol_trade_sdk","🚀 Syscall batch processor created with batch size: {}", batch_size); diff --git a/src/trading/common/transaction_builder.rs b/src/trading/common/transaction_builder.rs index 824a223..bc9ae19 100755 --- a/src/trading/common/transaction_builder.rs +++ b/src/trading/common/transaction_builder.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use super::nonce_manager::{add_nonce_instruction, get_transaction_blockhash}; use crate::{ - common::{nonce_cache::DurableNonceInfo, SolanaRpcClient}, + common::nonce_cache::DurableNonceInfo, trading::{ core::transaction_pool::{acquire_builder, release_builder}, MiddlewareManager, @@ -26,11 +26,10 @@ fn sol_f64_to_lamports(sol: f64) -> u64 { (lamports.min(u64::MAX as f64)).round() as u64 } -/// Build standard RPC transaction (worker hot path). -/// Takes Arc/refs only; one Vec allocation (with_capacity), extend_from_slice for business_instructions, no extra clone of payer/rpc/middleware. -pub async fn build_transaction( +/// Build signed transaction (worker hot path, no RPC). +/// Takes Arc/refs only; one Vec allocation (with_capacity), extend_from_slice for business_instructions, no extra clone of payer/middleware. +pub fn build_transaction( payer: &Arc, - _rpc: Option<&Arc>, unit_limit: u32, unit_price: u64, business_instructions: &[Instruction], @@ -74,10 +73,9 @@ pub async fn build_transaction( protocol_name, is_buy, ) - .await } -async fn build_versioned_transaction( +fn build_versioned_transaction( payer: &Arc, instructions: Vec, address_lookup_table_account: Option<&AddressLookupTableAccount>, diff --git a/src/trading/core/async_executor.rs b/src/trading/core/async_executor.rs index fdbf95e..b64ccf9 100644 --- a/src/trading/core/async_executor.rs +++ b/src/trading/core/async_executor.rs @@ -36,7 +36,7 @@ type FnvHashMap = HashMap>; use crate::{ common::nonce_cache::DurableNonceInfo, - common::{GasFeeStrategy, SolanaRpcClient}, + common::GasFeeStrategy, swqos::{SwqosClient, SwqosType, TradeType}, trading::core::params::SenderConcurrencyConfig, trading::{common::build_transaction, MiddlewareManager}, @@ -51,7 +51,6 @@ const SWQOS_DEDICATED_DEFAULT_THREADS: usize = 18; struct SwqosSharedContext { payer: Arc, instructions: Arc>, - rpc: Option>, address_lookup_table_account: Option, recent_blockhash: Option, durable_nonce: Option, @@ -88,7 +87,6 @@ async fn run_one_swqos_job(job: SwqosJob) { let transaction = match build_transaction( &s.payer, - s.rpc.as_ref(), job.unit_limit, job.unit_price, s.instructions.as_ref(), @@ -101,9 +99,7 @@ async fn run_one_swqos_job(job: SwqosJob) { &job.tip_account, tip_amount, s.durable_nonce.as_ref(), - ) - .await - { + ) { Ok(tx) => tx, Err(e) => { s.collector.submit(TaskResult { @@ -436,7 +432,6 @@ impl ResultCollector { pub async fn execute_parallel( swqos_clients: &[Arc], payer: Arc, - rpc: Option<&Arc>, instructions: Vec, address_lookup_table_account: Option, recent_blockhash: Option, @@ -471,10 +466,10 @@ pub async fn execute_parallel( gas_fee_strategy.get_strategies(if is_buy { TradeType::Buy } else { TradeType::Sell }); let mut task_configs = Vec::with_capacity(swqos_clients.len() * 3); for (i, swqos_client) in swqos_clients.iter().enumerate() { - if !with_tip && !matches!(swqos_client.get_swqos_type(), SwqosType::Default) { + let swqos_type = swqos_client.get_swqos_type(); + if !with_tip && !matches!(swqos_type, SwqosType::Default) { continue; } - let swqos_type = swqos_client.get_swqos_type(); let check_tip = with_tip && !matches!(swqos_type, SwqosType::Default) && check_min_tip; let min_tip = if check_tip { swqos_client.min_tip_sol() } else { 0.0 }; for config in &gas_fee_configs { @@ -513,7 +508,6 @@ pub async fn execute_parallel( let shared = Arc::new(SwqosSharedContext { payer, instructions, - rpc: rpc.cloned(), address_lookup_table_account, recent_blockhash, durable_nonce, diff --git a/src/trading/core/executor.rs b/src/trading/core/executor.rs index 35fec81..24584a5 100755 --- a/src/trading/core/executor.rs +++ b/src/trading/core/executor.rs @@ -162,7 +162,6 @@ impl TradeExecutor for GenericTradeExecutor { let result = execute_parallel( params.swqos_clients.as_slice(), params.payer, - params.rpc.as_ref(), final_instructions, params.address_lookup_table_account, params.recent_blockhash, @@ -282,7 +281,6 @@ async fn simulate_transaction( let transaction = build_transaction( &payer, - Some(&rpc), unit_limit, unit_price, &instructions, @@ -295,8 +293,7 @@ async fn simulate_transaction( &Pubkey::default(), tip, durable_nonce.as_ref(), - ) - .await?; + )?; // Simulate the transaction use solana_commitment_config::CommitmentConfig; diff --git a/src/trading/core/params/dex_swap.rs b/src/trading/core/params/dex_swap.rs index 7cfd344..9713569 100644 --- a/src/trading/core/params/dex_swap.rs +++ b/src/trading/core/params/dex_swap.rs @@ -75,6 +75,8 @@ pub struct SwapParams { pub close_input_mint_ata: bool, pub create_output_mint_ata: bool, pub close_output_mint_ata: bool, + /// Fixed output amount. For protocols with exact-out instructions this selects exact-out + /// semantics and treats `input_amount` as the maximum input budget. pub fixed_output_amount: Option, pub gas_fee_strategy: GasFeeStrategy, pub simulate: bool, diff --git a/src/trading/core/params/meteora_damm_v2.rs b/src/trading/core/params/meteora_damm_v2.rs index e42d1b6..431ab54 100644 --- a/src/trading/core/params/meteora_damm_v2.rs +++ b/src/trading/core/params/meteora_damm_v2.rs @@ -12,6 +12,11 @@ pub struct MeteoraDammV2Params { pub token_b_mint: Pubkey, pub token_a_program: Pubkey, pub token_b_program: Pubkey, + pub referral_token_account: Option, + /// `swap2` mode: 0 exact-in, 1 partial-fill (recommended default), 2 exact-out. + pub swap_mode: u8, + /// Include the instructions sysvar remaining account when the pool's rate limiter applies. + pub include_rate_limiter_sysvar: bool, } impl MeteoraDammV2Params { @@ -32,9 +37,27 @@ impl MeteoraDammV2Params { token_b_mint, token_a_program, token_b_program, + referral_token_account: None, + swap_mode: crate::instruction::utils::meteora_damm_v2::SWAP_MODE_PARTIAL_FILL, + include_rate_limiter_sysvar: false, } } + pub fn with_referral_token_account(mut self, referral_token_account: Pubkey) -> Self { + self.referral_token_account = Some(referral_token_account); + self + } + + pub fn with_swap_mode(mut self, swap_mode: u8) -> Self { + self.swap_mode = swap_mode; + self + } + + pub fn with_rate_limiter_sysvar(mut self, include: bool) -> Self { + self.include_rate_limiter_sysvar = include; + self + } + pub async fn from_pool_address_by_rpc( rpc: &SolanaRpcClient, pool_address: &Pubkey, @@ -61,6 +84,9 @@ impl MeteoraDammV2Params { token_b_mint: pool_data.token_b_mint, token_a_program, token_b_program, + referral_token_account: None, + swap_mode: crate::instruction::utils::meteora_damm_v2::SWAP_MODE_PARTIAL_FILL, + include_rate_limiter_sysvar: false, }) } } diff --git a/src/trading/core/params/raydium_amm_v4.rs b/src/trading/core/params/raydium_amm_v4.rs index 2975e21..70ed24b 100644 --- a/src/trading/core/params/raydium_amm_v4.rs +++ b/src/trading/core/params/raydium_amm_v4.rs @@ -16,6 +16,26 @@ pub struct RaydiumAmmV4Params { pub token_coin: Pubkey, /// Pool's pc token account address pub token_pc: Pubkey, + /// AMM open orders account + pub amm_open_orders: Pubkey, + /// AMM target orders account + pub amm_target_orders: Pubkey, + /// Serum/OpenBook program used by the AMM market + pub serum_program: Pubkey, + /// Serum/OpenBook market account + pub serum_market: Pubkey, + /// Serum/OpenBook bids account + pub serum_bids: Pubkey, + /// Serum/OpenBook asks account + pub serum_asks: Pubkey, + /// Serum/OpenBook event queue account + pub serum_event_queue: Pubkey, + /// Serum/OpenBook coin vault account + pub serum_coin_vault_account: Pubkey, + /// Serum/OpenBook pc vault account + pub serum_pc_vault_account: Pubkey, + /// Serum/OpenBook vault signer PDA + pub serum_vault_signer: Pubkey, /// Current coin reserve amount in the pool pub coin_reserve: u64, /// Current pc reserve amount in the pool @@ -32,13 +52,68 @@ impl RaydiumAmmV4Params { coin_reserve: u64, pc_reserve: u64, ) -> Self { - Self { amm, coin_mint, pc_mint, token_coin, token_pc, coin_reserve, pc_reserve } + Self { + amm, + coin_mint, + pc_mint, + token_coin, + token_pc, + amm_open_orders: Pubkey::default(), + amm_target_orders: Pubkey::default(), + serum_program: Pubkey::default(), + serum_market: Pubkey::default(), + serum_bids: Pubkey::default(), + serum_asks: Pubkey::default(), + serum_event_queue: Pubkey::default(), + serum_coin_vault_account: Pubkey::default(), + serum_pc_vault_account: Pubkey::default(), + serum_vault_signer: Pubkey::default(), + coin_reserve, + pc_reserve, + } } + + #[allow(clippy::too_many_arguments)] + pub fn with_market_accounts( + mut self, + amm_open_orders: Pubkey, + amm_target_orders: Pubkey, + serum_program: Pubkey, + serum_market: Pubkey, + serum_bids: Pubkey, + serum_asks: Pubkey, + serum_event_queue: Pubkey, + serum_coin_vault_account: Pubkey, + serum_pc_vault_account: Pubkey, + serum_vault_signer: Pubkey, + ) -> Self { + self.amm_open_orders = amm_open_orders; + self.amm_target_orders = amm_target_orders; + self.serum_program = serum_program; + self.serum_market = serum_market; + self.serum_bids = serum_bids; + self.serum_asks = serum_asks; + self.serum_event_queue = serum_event_queue; + self.serum_coin_vault_account = serum_coin_vault_account; + self.serum_pc_vault_account = serum_pc_vault_account; + self.serum_vault_signer = serum_vault_signer; + self + } + pub async fn from_amm_address_by_rpc( rpc: &SolanaRpcClient, amm: Pubkey, ) -> Result { let amm_info = crate::instruction::utils::raydium_amm_v4::fetch_amm_info(rpc, amm).await?; + let market_state = + crate::instruction::utils::raydium_amm_v4::fetch_market_state(rpc, amm_info.market) + .await?; + let serum_vault_signer = + crate::instruction::utils::raydium_amm_v4::derive_serum_vault_signer( + &amm_info.serum_dex, + &amm_info.market, + market_state.vault_signer_nonce, + )?; let (coin_reserve, pc_reserve) = get_multi_token_balances(rpc, &amm_info.token_coin, &amm_info.token_pc).await?; Ok(Self { @@ -47,6 +122,16 @@ impl RaydiumAmmV4Params { pc_mint: amm_info.pc_mint, token_coin: amm_info.token_coin, token_pc: amm_info.token_pc, + amm_open_orders: amm_info.open_orders, + amm_target_orders: amm_info.target_orders, + serum_program: amm_info.serum_dex, + serum_market: amm_info.market, + serum_bids: market_state.serum_bids, + serum_asks: market_state.serum_asks, + serum_event_queue: market_state.serum_event_queue, + serum_coin_vault_account: market_state.serum_coin_vault_account, + serum_pc_vault_account: market_state.serum_pc_vault_account, + serum_vault_signer, coin_reserve, pc_reserve, })