diff --git a/Cargo.lock b/Cargo.lock index 9a3551e0..8b4e9113 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2287,6 +2287,7 @@ dependencies = [ "bincode", "mercurial-vault", "meteora-marinade-sdk", + "mpl-token-metadata", "serde", "serde_json", "solana-account-decoder", @@ -2386,6 +2387,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "mpl-token-metadata" +version = "3.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba8ee05284d79b367ae8966d558e1a305a781fc80c9df51f37775169117ba64f" +dependencies = [ + "borsh 0.10.3", + "num-derive 0.3.3", + "num-traits", + "solana-program", + "thiserror", +] + [[package]] name = "nix" version = "0.26.4" diff --git a/programs/amm/Cargo.toml b/programs/amm/Cargo.toml index aaa6458f..29bc6cc6 100644 --- a/programs/amm/Cargo.toml +++ b/programs/amm/Cargo.toml @@ -26,20 +26,28 @@ overflow-checks = true [dependencies] anchor-lang = "0.28.0" anchor-spl = "0.28.0" -mercurial-vault = { git="https://github.com/mercurial-finance/mercurial_sdk", features= ["cpi" , "no-entrypoint"], rev = "c590d6ba19ecb58d80dbe8b33fa8056a1ddbff43" } +mercurial-vault = { git = "https://github.com/mercurial-finance/mercurial_sdk", features = [ + "cpi", + "no-entrypoint", +], rev = "c590d6ba19ecb58d80dbe8b33fa8056a1ddbff43" } spl-token-swap = { version = "3.0.0", features = ["no-entrypoint"] } -meteora-stable-swap-math = { git="https://github.com/mercurial-finance/stable-swap", rev = "f49a9166fd1b7afd14dded3cdd600fb19b4c6982", package="stable-swap-math"} -meteora-stable-swap-client = { git="https://github.com/mercurial-finance/stable-swap", rev = "f49a9166fd1b7afd14dded3cdd600fb19b4c6982", package="stable-swap-client" } +meteora-stable-swap-math = { git = "https://github.com/mercurial-finance/stable-swap", rev = "f49a9166fd1b7afd14dded3cdd600fb19b4c6982", package = "stable-swap-math" } +meteora-stable-swap-client = { git = "https://github.com/mercurial-finance/stable-swap", rev = "f49a9166fd1b7afd14dded3cdd600fb19b4c6982", package = "stable-swap-client" } meteora-marinade-sdk = { version = "0.1.0", features = ["cpi"] } -spl-stake-pool = { git = "https://github.com/solana-labs/solana-program-library", rev = "cd79bba17331235ab489bae56600043ea853c70b", features = ["no-entrypoint"] } +spl-stake-pool = { git = "https://github.com/solana-labs/solana-program-library", rev = "cd79bba17331235ab489bae56600043ea853c70b", features = [ + "no-entrypoint", +] } anyhow = "1.0.71" +mpl-token-metadata = "3.2.3" [dev-dependencies] solana-program-test = "1.16.12" solana-sdk = "1.16.12" solana-account-decoder = "1.16.12" solana-client = "1.16.12" -spl-associated-token-account = { version = "1.1.2", features = ["no-entrypoint"] } +spl-associated-token-account = { version = "1.1.2", features = [ + "no-entrypoint", +] } serde_json = "1.0.95" serde = "1.0.159" -bincode = "1.3.3" \ No newline at end of file +bincode = "1.3.3" diff --git a/programs/amm/src/context.rs b/programs/amm/src/context.rs index 9e42a1d9..dbc6e494 100644 --- a/programs/amm/src/context.rs +++ b/programs/amm/src/context.rs @@ -291,6 +291,14 @@ pub struct InitializePermissionlessPoolWithFeeTier<'info> { )] pub admin_token_b_fee: Box>, + /// CHECK: LP mint metadata PDA. Metaplex do the checking. + #[account(mut)] + pub mint_metadata: UncheckedAccount<'info>, + + /// CHECK: Metadata program + #[account(address = mpl_token_metadata::ID)] + pub metadata_program: UncheckedAccount<'info>, + /// Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool. #[account(mut)] pub payer: Signer<'info>, @@ -466,6 +474,14 @@ pub struct InitializePermissionlessPool<'info> { )] pub admin_token_b_fee: Box>, + /// CHECK: LP mint metadata PDA. Metaplex do the checking. + #[account(mut)] + pub mint_metadata: UncheckedAccount<'info>, + + /// CHECK: Metadata program + #[account(address = mpl_token_metadata::ID)] + pub metadata_program: UncheckedAccount<'info>, + /// Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool. #[account(mut)] pub payer: Signer<'info>, diff --git a/ts-client/package.json b/ts-client/package.json index 20269659..5a74d504 100644 --- a/ts-client/package.json +++ b/ts-client/package.json @@ -1,6 +1,6 @@ { "name": "@mercurial-finance/dynamic-amm-sdk", - "version": "0.4.14", + "version": "0.4.15", "description": "Mercurial Vaults SDK is a typescript library that allows you to interact with Mercurial v2's AMM.", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", diff --git a/ts-client/src/amm/constants.ts b/ts-client/src/amm/constants.ts index b187765e..d358557a 100644 --- a/ts-client/src/amm/constants.ts +++ b/ts-client/src/amm/constants.ts @@ -123,3 +123,5 @@ export const CONSTANT_PRODUCT_ALLOWED_TRADE_FEE_BPS = [25, 100, 400, 600]; export const STABLE_SWAP_DEFAULT_TRADE_FEE_BPS = 1; export const STABLE_SWAP_ALLOWED_TRADE_FEE_BPS = [1, 4, 10, 100]; + +export const METAPLEX_PROGRAM = new PublicKey('metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'); diff --git a/ts-client/src/amm/idl.ts b/ts-client/src/amm/idl.ts index 78355860..61328e09 100644 --- a/ts-client/src/amm/idl.ts +++ b/ts-client/src/amm/idl.ts @@ -1,4445 +1,5543 @@ export type Amm = { - version: '0.4.8'; - name: 'amm'; - docs: ['Program for AMM']; - instructions: [ + "version": "0.4.12", + "name": "amm", + "docs": [ + "Program for AMM" + ], + "instructions": [ { - name: 'initializePermissionedPool'; - docs: ['Initialize a new permissioned pool.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: true; - docs: ['Pool account (arbitrary address)']; - }, - { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; - }, + "name": "initializePermissionedPool", + "docs": [ + "Initialize a new permissioned pool." + ], + "accounts": [ { - name: 'tokenAMint'; - isMut: false; - isSigner: false; - docs: ['Token A mint of the pool. Eg: USDT']; + "name": "pool", + "isMut": true, + "isSigner": true, + "docs": [ + "Pool account (arbitrary address)" + ] }, { - name: 'tokenBMint'; - isMut: false; - isSigner: false; - docs: ['Token B mint of the pool. Eg: USDC']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.']; + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint of the pool. Eg: USDT" + ] }, { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.']; + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint of the pool. Eg: USDC" + ] }, { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault A']; + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] }, { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault B']; + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] }, { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: ['LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.']; + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'adminTokenA'; - isMut: true; - isSigner: false; - docs: ['Admin token account for pool token A mint. Used to bootstrap the pool with initial liquidity.']; + "name": "adminTokenA", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token A mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'adminTokenB'; - isMut: true; - isSigner: false; - docs: ['Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.']; + "name": "adminTokenB", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'adminPoolLp'; - isMut: true; - isSigner: false; - docs: [ - 'Admin pool LP token account. Used to receive LP during first deposit (initialize pool)', - 'Admin pool LP token account. Used to receive LP during first deposit (initialize pool)', - ]; + "name": "adminPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin pool LP token account. Used to receive LP during first deposit (initialize pool)", + "Admin pool LP token account. Used to receive LP during first deposit (initialize pool)" + ] }, { - name: 'adminTokenAFee'; - isMut: true; - isSigner: false; - docs: ['Admin fee token account for token A. Used to receive trading fee.']; + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] }, { - name: 'adminTokenBFee'; - isMut: true; - isSigner: false; - docs: ['Admin fee token account for token B. Used to receive trading fee.']; + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] }, { - name: 'admin'; - isMut: true; - isSigner: true; - docs: [ - 'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.', - ]; + "name": "admin", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool." + ] }, { - name: 'feeOwner'; - isMut: false; - isSigner: false; + "name": "feeOwner", + "isMut": false, + "isSigner": false }, { - name: 'rent'; - isMut: false; - isSigner: false; - docs: ['Rent account.']; + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": [ + "Rent account." + ] }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.']; + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, { - name: 'associatedTokenProgram'; - isMut: false; - isSigner: false; - docs: ['Associated token program.']; + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] }, { - name: 'systemProgram'; - isMut: false; - isSigner: false; - docs: ['System program.']; + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] }, - ]; - args: [ { - name: 'curveType'; - type: { - defined: 'CurveType'; - }; + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Associated token program." + ] }, { - name: 'tokenAAmount'; - type: 'u64'; - }, + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } + ], + "args": [ { - name: 'tokenBAmount'; - type: 'u64'; - }, - ]; + "name": "curveType", + "type": { + "defined": "CurveType" + } + } + ] }, { - name: 'initializePermissionlessPool'; - docs: ['Initialize a new permissionless pool.']; - accounts: [ + "name": "initializePermissionlessPool", + "docs": [ + "Initialize a new permissionless pool." + ], + "accounts": [ { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA address)']; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA address)" + ] }, { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'tokenAMint'; - isMut: false; - isSigner: false; - docs: ['Token A mint of the pool. Eg: USDT']; + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint of the pool. Eg: USDT" + ] }, { - name: 'tokenBMint'; - isMut: false; - isSigner: false; - docs: ['Token B mint of the pool. Eg: USDC']; + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint of the pool. Eg: USDC" + ] }, { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.']; + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.']; + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] }, { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] }, { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault A']; + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] }, { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault B']; + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] }, { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: ['LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.']; + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'payerTokenA'; - isMut: true; - isSigner: false; - docs: ['Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity.']; + "name": "payerTokenA", + "isMut": true, + "isSigner": false, + "docs": [ + "Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'payerTokenB'; - isMut: true; - isSigner: false; - docs: ['Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.']; + "name": "payerTokenB", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'payerPoolLp'; - isMut: true; - isSigner: false; + "name": "payerPoolLp", + "isMut": true, + "isSigner": false }, { - name: 'adminTokenAFee'; - isMut: true; - isSigner: false; - docs: ['Admin fee token account for token A. Used to receive trading fee.']; + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] }, { - name: 'adminTokenBFee'; - isMut: true; - isSigner: false; - docs: ['Admin fee token account for token B. Used to receive trading fee.']; + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] }, { - name: 'payer'; - isMut: true; - isSigner: true; - docs: [ - 'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.', - ]; + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool." + ] }, { - name: 'feeOwner'; - isMut: false; - isSigner: false; + "name": "feeOwner", + "isMut": false, + "isSigner": false }, { - name: 'rent'; - isMut: false; - isSigner: false; - docs: ['Rent account.']; + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": [ + "Rent account." + ] }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.']; + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, { - name: 'associatedTokenProgram'; - isMut: false; - isSigner: false; - docs: ['Associated token program.']; + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] }, { - name: 'systemProgram'; - isMut: false; - isSigner: false; - docs: ['System program.']; + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] }, - ]; - args: [ { - name: 'curveType'; - type: { - defined: 'CurveType'; - }; + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Associated token program." + ] }, { - name: 'tokenAAmount'; - type: 'u64'; + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } + ], + "args": [ + { + "name": "curveType", + "type": { + "defined": "CurveType" + } }, { - name: 'tokenBAmount'; - type: 'u64'; + "name": "tokenAAmount", + "type": "u64" }, - ]; + { + "name": "tokenBAmount", + "type": "u64" + } + ] }, { - name: 'initializePermissionlessPoolWithFeeTier'; - docs: ['Initialize a new permissionless pool with customized fee tier']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA address)']; - }, + "name": "initializePermissionlessPoolWithFeeTier", + "docs": [ + "Initialize a new permissionless pool with customized fee tier" + ], + "accounts": [ { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA address)" + ] }, { - name: 'tokenAMint'; - isMut: false; - isSigner: false; - docs: ['Token A mint of the pool. Eg: USDT']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'tokenBMint'; - isMut: false; - isSigner: false; - docs: ['Token B mint of the pool. Eg: USDC']; + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint of the pool. Eg: USDT" + ] }, { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.']; + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint of the pool. Eg: USDC" + ] }, { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.']; + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] }, { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault A']; + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] }, { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault B']; + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] }, { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] }, { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: ['LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.']; + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'payerTokenA'; - isMut: true; - isSigner: false; - docs: ['Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity.']; + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'payerTokenB'; - isMut: true; - isSigner: false; - docs: ['Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.']; + "name": "payerTokenA", + "isMut": true, + "isSigner": false, + "docs": [ + "Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'payerPoolLp'; - isMut: true; - isSigner: false; + "name": "payerTokenB", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'adminTokenAFee'; - isMut: true; - isSigner: false; - docs: ['Admin fee token account for token A. Used to receive trading fee.']; + "name": "payerPoolLp", + "isMut": true, + "isSigner": false }, { - name: 'adminTokenBFee'; - isMut: true; - isSigner: false; - docs: ['Admin fee token account for token B. Used to receive trading fee.']; + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] }, { - name: 'payer'; - isMut: true; - isSigner: true; - docs: [ - 'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.', - ]; + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] }, { - name: 'feeOwner'; - isMut: false; - isSigner: false; + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool." + ] }, { - name: 'rent'; - isMut: false; - isSigner: false; - docs: ['Rent account.']; + "name": "feeOwner", + "isMut": false, + "isSigner": false }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.']; + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": [ + "Rent account." + ] }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'associatedTokenProgram'; - isMut: false; - isSigner: false; - docs: ['Associated token program.']; + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, { - name: 'systemProgram'; - isMut: false; - isSigner: false; - docs: ['System program.']; + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] }, - ]; - args: [ { - name: 'curveType'; - type: { - defined: 'CurveType'; - }; + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] }, { - name: 'tradeFeeBps'; - type: 'u64'; + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Associated token program." + ] }, { - name: 'tokenAAmount'; - type: 'u64'; - }, + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } + ], + "args": [ { - name: 'tokenBAmount'; - type: 'u64'; + "name": "curveType", + "type": { + "defined": "CurveType" + } }, - ]; - }, - { - name: 'enableOrDisablePool'; - docs: ['Enable or disable a pool. A disabled pool allow only remove balanced liquidity operation.']; - accounts: [ { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; + "name": "tradeFeeBps", + "type": "u64" }, { - name: 'admin'; - isMut: false; - isSigner: true; - docs: ['Admin account. Must be owner of the pool.']; + "name": "tokenAAmount", + "type": "u64" }, - ]; - args: [ { - name: 'enable'; - type: 'bool'; - }, - ]; + "name": "tokenBAmount", + "type": "u64" + } + ] }, { - name: 'swap'; - docs: [ - 'Swap token A to B, or vice versa. An amount of trading fee will be charged for liquidity provider, and the admin of the pool.', - ]; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'userSourceToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token account. Token from this account will be transfer into the vault by the pool in exchange for another token of the pool.', - ]; - }, - { - name: 'userDestinationToken'; - isMut: true; - isSigner: false; - docs: ['User token account. The exchanged token will be transfer into this account from the pool.']; - }, - { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; - }, - { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; - }, - { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['Lp token mint of vault a']; - }, - { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['Lp token mint of vault b']; - }, - { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'adminTokenFee'; - isMut: true; - isSigner: false; - docs: [ - "Admin fee token account. Used to receive trading fee. It's mint field must matched with user_source_token mint field.", - ]; - }, - { - name: 'user'; - isMut: false; - isSigner: true; - docs: ['User account. Must be owner of user_source_token.']; - }, - { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.']; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; - }, - ]; - args: [ - { - name: 'inAmount'; - type: 'u64'; - }, + "name": "enableOrDisablePool", + "docs": [ + "Enable or disable a pool. A disabled pool allow only remove balanced liquidity operation." + ], + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + } + ], + "args": [ { - name: 'minimumOutAmount'; - type: 'u64'; - }, - ]; + "name": "enable", + "type": "bool" + } + ] }, { - name: 'removeLiquiditySingleSide'; - docs: ['Withdraw only single token from the pool. Only supported by pool with stable swap curve.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; - }, - { - name: 'userPoolLp'; - isMut: true; - isSigner: false; - docs: ['User pool lp token account. LP will be burned from this account upon success liquidity removal.']; - }, - { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault A']; - }, - { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault B']; - }, - { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; - }, - { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; - }, - { - name: 'userDestinationToken'; - isMut: true; - isSigner: false; - docs: ['User token account to receive token upon success liquidity removal.']; - }, + "name": "swap", + "docs": [ + "Swap token A to B, or vice versa. An amount of trading fee will be charged for liquidity provider, and the admin of the pool." + ], + "accounts": [ { - name: 'user'; - isMut: false; - isSigner: true; - docs: ['User account. Must be owner of the user_pool_lp account.']; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.']; + "name": "userSourceToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token account. Token from this account will be transfer into the vault by the pool in exchange for another token of the pool." + ] }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; - }, - ]; - args: [ + "name": "userDestinationToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token account. The exchanged token will be transfer into this account from the pool." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "Lp token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "Lp token mint of vault b" + ] + }, + { + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "adminTokenFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account. Used to receive trading fee. It's mint field must matched with user_source_token mint field." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_source_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'poolTokenAmount'; - type: 'u64'; + "name": "inAmount", + "type": "u64" }, { - name: 'minimumOutAmount'; - type: 'u64'; - }, - ]; + "name": "minimumOutAmount", + "type": "u64" + } + ] }, { - name: 'addImbalanceLiquidity'; - docs: ['Deposit tokens to the pool in an imbalance ratio. Only supported by pool with stable swap curve.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; - }, - { - name: 'userPoolLp'; - isMut: true; - isSigner: false; - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.']; - }, - { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault a']; - }, - { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault b']; - }, - { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; - }, - { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; - }, - { - name: 'userAToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; - }, - { - name: 'userBToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; - }, - { - name: 'user'; - isMut: false; - isSigner: true; - docs: ['User account. Must be owner of user_a_token, and user_b_token.']; - }, + "name": "removeLiquiditySingleSide", + "docs": [ + "Withdraw only single token from the pool. Only supported by pool with stable swap curve." + ], + "accounts": [ { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.']; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, - ]; - args: [ { - name: 'minimumPoolTokenAmount'; - type: 'u64'; - }, + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "User pool lp token account. LP will be burned from this account upon success liquidity removal." + ] + }, + { + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userDestinationToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token account to receive token upon success liquidity removal." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of the user_pool_lp account." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'tokenAAmount'; - type: 'u64'; + "name": "poolTokenAmount", + "type": "u64" }, { - name: 'tokenBAmount'; - type: 'u64'; - }, - ]; + "name": "minimumOutAmount", + "type": "u64" + } + ] }, { - name: 'removeBalanceLiquidity'; - docs: [ - "Withdraw tokens from the pool in a balanced ratio. User will still able to withdraw from pool even the pool is disabled. This allow user to exit their liquidity when there's some unforeseen event happen.", - ]; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; - }, - { - name: 'userPoolLp'; - isMut: true; - isSigner: false; - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.']; - }, - { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault a']; - }, - { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault b']; - }, - { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; - }, - { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; - }, - { - name: 'userAToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; - }, + "name": "addImbalanceLiquidity", + "docs": [ + "Deposit tokens to the pool in an imbalance ratio. Only supported by pool with stable swap curve." + ], + "accounts": [ { - name: 'userBToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'user'; - isMut: false; - isSigner: true; - docs: ['User account. Must be owner of user_a_token, and user_b_token.']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.']; + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; - }, - ]; - args: [ + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'poolTokenAmount'; - type: 'u64'; + "name": "minimumPoolTokenAmount", + "type": "u64" }, { - name: 'minimumATokenOut'; - type: 'u64'; + "name": "tokenAAmount", + "type": "u64" }, { - name: 'minimumBTokenOut'; - type: 'u64'; - }, - ]; + "name": "tokenBAmount", + "type": "u64" + } + ] }, { - name: 'addBalanceLiquidity'; - docs: ['Deposit tokens to the pool in a balanced ratio.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; - }, - { - name: 'userPoolLp'; - isMut: true; - isSigner: false; - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.']; - }, - { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, + "name": "removeBalanceLiquidity", + "docs": [ + "Withdraw tokens from the pool in a balanced ratio. User will still able to withdraw from pool even the pool is disabled. This allow user to exit their liquidity when there's some unforeseen event happen." + ], + "accounts": [ { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.']; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault a']; + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault b']; - }, + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; + "name": "poolTokenAmount", + "type": "u64" }, { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; + "name": "minimumATokenOut", + "type": "u64" }, { - name: 'userAToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; - }, + "name": "minimumBTokenOut", + "type": "u64" + } + ] + }, + { + "name": "addBalanceLiquidity", + "docs": [ + "Deposit tokens to the pool in a balanced ratio." + ], + "accounts": [ { - name: 'userBToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'user'; - isMut: false; - isSigner: true; - docs: ['User account. Must be owner of user_a_token, and user_b_token.']; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.']; + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; - }, - ]; - args: [ + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'poolTokenAmount'; - type: 'u64'; + "name": "poolTokenAmount", + "type": "u64" }, { - name: 'maximumTokenAAmount'; - type: 'u64'; + "name": "maximumTokenAAmount", + "type": "u64" }, { - name: 'maximumTokenBAmount'; - type: 'u64'; - }, - ]; + "name": "maximumTokenBAmount", + "type": "u64" + } + ] }, { - name: 'setPoolFees'; - docs: ['Update trading fee charged for liquidity provider, and admin.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'admin'; - isMut: false; - isSigner: true; - docs: ['Admin account. Must be owner of the pool.']; - }, - ]; - args: [ + "name": "setPoolFees", + "docs": [ + "Update trading fee charged for liquidity provider, and admin." + ], + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + } + ], + "args": [ { - name: 'fees'; - type: { - defined: 'PoolFees'; - }; - }, - ]; + "name": "fees", + "type": { + "defined": "PoolFees" + } + } + ] }, { - name: 'overrideCurveParam'; - docs: [ - 'Update swap curve parameters. This function do not allow update of curve type. For example: stable swap curve to constant product curve. Only supported by pool with stable swap curve.', - 'Only amp is allowed to be override. The other attributes of stable swap curve will be ignored.', - ]; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'admin'; - isMut: false; - isSigner: true; - docs: ['Admin account. Must be owner of the pool.']; - }, - ]; - args: [ + "name": "overrideCurveParam", + "docs": [ + "Update swap curve parameters. This function do not allow update of curve type. For example: stable swap curve to constant product curve. Only supported by pool with stable swap curve.", + "Only amp is allowed to be override. The other attributes of stable swap curve will be ignored." + ], + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + } + ], + "args": [ { - name: 'curveType'; - type: { - defined: 'CurveType'; - }; - }, - ]; + "name": "curveType", + "type": { + "defined": "CurveType" + } + } + ] }, { - name: 'transferAdmin'; - docs: ['Transfer the admin of the pool to new admin.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'admin'; - isMut: false; - isSigner: true; - docs: ['Admin account. Must be owner of the pool.']; - }, - { - name: 'newAdmin'; - isMut: false; - isSigner: true; - docs: ['New admin account.']; - }, - ]; - args: []; + "name": "transferAdmin", + "docs": [ + "Transfer the admin of the pool to new admin." + ], + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + }, + { + "name": "newAdmin", + "isMut": false, + "isSigner": true, + "docs": [ + "New admin account." + ] + } + ], + "args": [] }, { - name: 'setAdminFeeAccount'; - docs: ['Update fee token account of the pool admin.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'newAdminTokenAFee'; - isMut: true; - isSigner: false; - docs: ['New admin fee token account for pool token A. Used to receive trading fee.']; - }, - { - name: 'newAdminTokenBFee'; - isMut: true; - isSigner: false; - docs: ['New admin fee token account for pool token B. Used to receive trading fee.']; - }, - { - name: 'admin'; - isMut: false; - isSigner: true; - docs: ['Admin account. Must be owner of the pool.']; - }, - ]; - args: []; + "name": "getPoolInfo", + "docs": [ + "Get the general information of the pool." + ], + "accounts": [ + { + "name": "pool", + "isMut": false, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "lpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] + }, + { + "name": "aVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + } + ], + "args": [] }, { - name: 'getPoolInfo'; - docs: ['Get the general information of the pool.']; - accounts: [ - { - name: 'pool'; - isMut: false; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'lpMint'; - isMut: false; - isSigner: false; - docs: ['LP token mint of the pool']; - }, + "name": "bootstrapLiquidity", + "docs": [ + "Bootstrap the pool when liquidity is depleted." + ], + "accounts": [ { - name: 'aVaultLp'; - isMut: false; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'bVaultLp'; - isMut: false; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aVault'; - isMut: false; - isSigner: false; - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.']; + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'bVault'; - isMut: false; - isSigner: false; - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.']; - }, + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'aVaultLpMint'; - isMut: false; - isSigner: false; - docs: ['LP token mint of vault a']; + "name": "tokenAAmount", + "type": "u64" }, { - name: 'bVaultLpMint'; - isMut: false; - isSigner: false; - docs: ['LP token mint of vault b']; - }, - ]; - args: []; + "name": "tokenBAmount", + "type": "u64" + } + ] }, { - name: 'bootstrapLiquidity'; - docs: ['Bootstrap the pool when liquidity is depleted.']; - accounts: [ - { - name: 'pool'; - isMut: true; - isSigner: false; - docs: ['Pool account (PDA)']; - }, - { - name: 'lpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of the pool']; - }, - { - name: 'userPoolLp'; - isMut: true; - isSigner: false; - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.']; - }, - { - name: 'aVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'bVaultLp'; - isMut: true; - isSigner: false; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - }, - { - name: 'aVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'bVault'; - isMut: true; - isSigner: false; - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.']; - }, - { - name: 'aVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault a']; - }, - { - name: 'bVaultLpMint'; - isMut: true; - isSigner: false; - docs: ['LP token mint of vault b']; - }, + "name": "migrateFeeAccount", + "docs": [ + "Migrate old token fee owner to PDA" + ], + "accounts": [ { - name: 'aTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault A']; + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account" + ] }, { - name: 'bTokenVault'; - isMut: true; - isSigner: false; - docs: ['Token vault account of vault B']; - }, + "name": "aVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "A vault LP token account of the pool." + ] + }, + { + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] + }, + { + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] + }, + { + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint" + ] + }, + { + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint" + ] + }, + { + "name": "newAdminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Token fee account. Controlled by pool a_vault_lp PDA." + ] + }, + { + "name": "newAdminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Token fee account. Controlled by pool a_vault_lp PDA." + ] + }, + { + "name": "admin", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + }, + { + "name": "treasuryTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Treasury token a fee ATA." + ] + }, + { + "name": "treasuryTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Treasury token b fee ATA." + ] + }, + { + "name": "treasury", + "isMut": false, + "isSigner": true, + "docs": [ + "Treasury signer" + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } + ], + "args": [] + }, + { + "name": "createMintMetadata", + "docs": [ + "Create mint metadata account for old pools" + ], + "accounts": [ { - name: 'userAToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; + "name": "pool", + "isMut": false, + "isSigner": false, + "docs": [ + "Pool account" + ] }, { - name: 'userBToken'; - isMut: true; - isSigner: false; - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ]; + "name": "lpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP mint account of the pool" + ] }, { - name: 'user'; - isMut: false; - isSigner: true; - docs: ['User account. Must be owner of user_a_token, and user_b_token.']; + "name": "aVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault A LP account of the pool" + ] }, { - name: 'vaultProgram'; - isMut: false; - isSigner: false; - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.']; + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - docs: ['Token program.']; + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, - ]; - args: [ { - name: 'tokenAAmount'; - type: 'u64'; + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] }, { - name: 'tokenBAmount'; - type: 'u64'; - }, - ]; - }, - ]; - accounts: [ + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "Payer" + ] + } + ], + "args": [] + } + ], + "accounts": [ { - name: 'pool'; - docs: ['State of pool account']; - type: { - kind: 'struct'; - fields: [ + "name": "pool", + "docs": [ + "State of pool account" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'lpMint'; - docs: ['LP token mint of the pool']; - type: 'publicKey'; + "name": "lpMint", + "docs": [ + "LP token mint of the pool" + ], + "type": "publicKey" }, { - name: 'tokenAMint'; - docs: ['Token A mint of the pool. Eg: USDT']; - type: 'publicKey'; + "name": "tokenAMint", + "docs": [ + "Token A mint of the pool. Eg: USDT" + ], + "type": "publicKey" }, { - name: 'tokenBMint'; - docs: ['Token B mint of the pool. Eg: USDC']; - type: 'publicKey'; + "name": "tokenBMint", + "docs": [ + "Token B mint of the pool. Eg: USDC" + ], + "type": "publicKey" }, { - name: 'aVault'; - docs: [ - 'Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.', - ]; - type: 'publicKey'; + "name": "aVault", + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ], + "type": "publicKey" }, { - name: 'bVault'; - docs: [ - 'Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.', - ]; - type: 'publicKey'; + "name": "bVault", + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ], + "type": "publicKey" }, { - name: 'aVaultLp'; - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - type: 'publicKey'; + "name": "aVaultLp", + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ], + "type": "publicKey" }, { - name: 'bVaultLp'; - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ]; - type: 'publicKey'; + "name": "bVaultLp", + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ], + "type": "publicKey" }, { - name: 'aVaultLpBump'; - docs: ['"A" vault lp bump. Used to create signer seeds.']; - type: 'u8'; + "name": "aVaultLpBump", + "docs": [ + "\"A\" vault lp bump. Used to create signer seeds." + ], + "type": "u8" }, { - name: 'enabled'; - docs: ['Flag to determine whether the pool is enabled, or disabled.']; - type: 'bool'; + "name": "enabled", + "docs": [ + "Flag to determine whether the pool is enabled, or disabled." + ], + "type": "bool" }, { - name: 'adminTokenAFee'; - docs: ['Admin fee token account for token A. Used to receive trading fee.']; - type: 'publicKey'; + "name": "adminTokenAFee", + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ], + "type": "publicKey" }, { - name: 'adminTokenBFee'; - docs: ['Admin fee token account for token B. Used to receive trading fee.']; - type: 'publicKey'; + "name": "adminTokenBFee", + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ], + "type": "publicKey" }, { - name: 'admin'; - docs: ['Owner of the pool.']; - type: 'publicKey'; + "name": "admin", + "docs": [ + "Owner of the pool." + ], + "type": "publicKey" }, { - name: 'fees'; - docs: ['Store the fee charges setting.']; - type: { - defined: 'PoolFees'; - }; + "name": "fees", + "docs": [ + "Store the fee charges setting." + ], + "type": { + "defined": "PoolFees" + } }, { - name: 'poolType'; - docs: ['Pool type']; - type: { - defined: 'PoolType'; - }; + "name": "poolType", + "docs": [ + "Pool type" + ], + "type": { + "defined": "PoolType" + } }, { - name: 'stake'; - docs: ['Stake pubkey of SPL stake pool']; - type: 'publicKey'; + "name": "stake", + "docs": [ + "Stake pubkey of SPL stake pool" + ], + "type": "publicKey" }, { - name: 'padding'; - docs: ['Padding for future pool field']; - type: { - defined: 'Padding'; - }; + "name": "padding", + "docs": [ + "Padding for future pool field" + ], + "type": { + "defined": "Padding" + } }, { - name: 'curveType'; - docs: ['The type of the swap curve supported by the pool.']; - type: { - defined: 'CurveType'; - }; - }, - ]; - }; - }, - ]; - types: [ + "name": "curveType", + "docs": [ + "The type of the swap curve supported by the pool." + ], + "type": { + "defined": "CurveType" + } + } + ] + } + } + ], + "types": [ { - name: 'TokenMultiplier'; - docs: ['Multiplier for the pool token. Used to normalized token with different decimal into the same precision.']; - type: { - kind: 'struct'; - fields: [ + "name": "TokenMultiplier", + "docs": [ + "Multiplier for the pool token. Used to normalized token with different decimal into the same precision." + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'tokenAMultiplier'; - docs: ['Multiplier for token A of the pool.']; - type: 'u64'; + "name": "tokenAMultiplier", + "docs": [ + "Multiplier for token A of the pool." + ], + "type": "u64" }, { - name: 'tokenBMultiplier'; - docs: ['Multiplier for token B of the pool.']; - type: 'u64'; + "name": "tokenBMultiplier", + "docs": [ + "Multiplier for token B of the pool." + ], + "type": "u64" }, { - name: 'precisionFactor'; - docs: [ - 'Record the highest token decimal in the pool. For example, Token A is 6 decimal, token B is 9 decimal. This will save value of 9.', - ]; - type: 'u8'; - }, - ]; - }; + "name": "precisionFactor", + "docs": [ + "Record the highest token decimal in the pool. For example, Token A is 6 decimal, token B is 9 decimal. This will save value of 9." + ], + "type": "u8" + } + ] + } }, { - name: 'PoolFees'; - docs: ['Information regarding fee charges']; - type: { - kind: 'struct'; - fields: [ + "name": "PoolFees", + "docs": [ + "Information regarding fee charges" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'tradeFeeNumerator'; - 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: 'u64'; + "name": "tradeFeeNumerator", + "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": "u64" }, { - name: 'tradeFeeDenominator'; - docs: ['Trade fee denominator']; - type: 'u64'; + "name": "tradeFeeDenominator", + "docs": [ + "Trade fee denominator" + ], + "type": "u64" }, { - name: 'ownerTradeFeeNumerator'; - docs: [ - 'Owner 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 owner of the program.', - 'Owner trade fee numerator', - ]; - type: 'u64'; + "name": "ownerTradeFeeNumerator", + "docs": [ + "Owner 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 owner of the program.", + "Owner trade fee numerator" + ], + "type": "u64" }, { - name: 'ownerTradeFeeDenominator'; - docs: ['Owner trade fee denominator']; - type: 'u64'; - }, - ]; - }; + "name": "ownerTradeFeeDenominator", + "docs": [ + "Owner trade fee denominator" + ], + "type": "u64" + } + ] + } }, { - name: 'Depeg'; - docs: ['Contains information for depeg pool']; - type: { - kind: 'struct'; - fields: [ + "name": "Depeg", + "docs": [ + "Contains information for depeg pool" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'baseVirtualPrice'; - docs: ['The virtual price of staking / interest bearing token']; - type: 'u64'; + "name": "baseVirtualPrice", + "docs": [ + "The virtual price of staking / interest bearing token" + ], + "type": "u64" }, { - name: 'baseCacheUpdated'; - docs: ['The virtual price of staking / interest bearing token']; - type: 'u64'; + "name": "baseCacheUpdated", + "docs": [ + "The virtual price of staking / interest bearing token" + ], + "type": "u64" }, { - name: 'depegType'; - docs: ['Type of the depeg pool']; - type: { - defined: 'DepegType'; - }; - }, - ]; - }; + "name": "depegType", + "docs": [ + "Type of the depeg pool" + ], + "type": { + "defined": "DepegType" + } + } + ] + } }, { - name: 'Padding'; - docs: ['Padding for future pool fields']; - type: { - kind: 'struct'; - fields: [ + "name": "Padding", + "docs": [ + "Padding for future pool fields" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'padding0'; - docs: ['Padding 0']; - type: { - array: ['u8', 15]; - }; + "name": "padding0", + "docs": [ + "Padding 0" + ], + "type": { + "array": [ + "u8", + 15 + ] + } }, { - name: 'padding'; - docs: ['Padding 1']; - type: { - array: ['u128', 29]; - }; - }, - ]; - }; - }, - { - name: 'RoundDirection'; - docs: ['Rounding direction']; - type: { - kind: 'enum'; - variants: [ + "name": "padding", + "docs": [ + "Padding 1" + ], + "type": { + "array": [ + "u128", + 29 + ] + } + } + ] + } + }, + { + "name": "RoundDirection", + "docs": [ + "Rounding direction" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'Floor'; + "name": "Floor" }, { - name: 'Ceiling'; - }, - ]; - }; + "name": "Ceiling" + } + ] + } }, { - name: 'TradeDirection'; - docs: ['Trade (swap) direction']; - type: { - kind: 'enum'; - variants: [ + "name": "TradeDirection", + "docs": [ + "Trade (swap) direction" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'AtoB'; + "name": "AtoB" }, { - name: 'BtoA'; - }, - ]; - }; + "name": "BtoA" + } + ] + } }, { - name: 'NewCurveType'; - docs: ['Type of the swap curve']; - type: { - kind: 'enum'; - variants: [ + "name": "NewCurveType", + "docs": [ + "Type of the swap curve" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'ConstantProduct'; + "name": "ConstantProduct" }, { - name: 'Stable'; - fields: [ + "name": "Stable", + "fields": [ { - name: 'amp'; - docs: ['Amplification coefficient']; - type: 'u64'; + "name": "amp", + "docs": [ + "Amplification coefficient" + ], + "type": "u64" }, { - name: 'token_multiplier'; - docs: [ - 'Multiplier for the pool token. Used to normalized token with different decimal into the same precision.', - ]; - type: { - defined: 'TokenMultiplier'; - }; + "name": "token_multiplier", + "docs": [ + "Multiplier for the pool token. Used to normalized token with different decimal into the same precision." + ], + "type": { + "defined": "TokenMultiplier" + } }, { - name: 'depeg'; - docs: [ - 'Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price', - ]; - type: { - defined: 'Depeg'; - }; + "name": "depeg", + "docs": [ + "Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price" + ], + "type": { + "defined": "Depeg" + } }, { - name: 'last_amp_updated_timestamp'; - docs: [ - 'The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period', - ]; - type: 'u64'; - }, - ]; + "name": "last_amp_updated_timestamp", + "docs": [ + "The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period" + ], + "type": "u64" + } + ] }, { - name: 'NewCurve'; - fields: [ + "name": "NewCurve", + "fields": [ { - name: 'field_one'; - type: 'u64'; + "name": "field_one", + "type": "u64" }, { - name: 'field_two'; - type: 'u64'; - }, - ]; - }, - ]; - }; - }, - { - name: 'CurveType'; - docs: ['Type of the swap curve']; - type: { - kind: 'enum'; - variants: [ + "name": "field_two", + "type": "u64" + } + ] + } + ] + } + }, + { + "name": "CurveType", + "docs": [ + "Type of the swap curve" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'ConstantProduct'; + "name": "ConstantProduct" }, { - name: 'Stable'; - fields: [ + "name": "Stable", + "fields": [ { - name: 'amp'; - docs: ['Amplification coefficient']; - type: 'u64'; + "name": "amp", + "docs": [ + "Amplification coefficient" + ], + "type": "u64" }, { - name: 'token_multiplier'; - docs: [ - 'Multiplier for the pool token. Used to normalized token with different decimal into the same precision.', - ]; - type: { - defined: 'TokenMultiplier'; - }; + "name": "token_multiplier", + "docs": [ + "Multiplier for the pool token. Used to normalized token with different decimal into the same precision." + ], + "type": { + "defined": "TokenMultiplier" + } }, { - name: 'depeg'; - docs: [ - 'Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price', - ]; - type: { - defined: 'Depeg'; - }; + "name": "depeg", + "docs": [ + "Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price" + ], + "type": { + "defined": "Depeg" + } }, { - name: 'last_amp_updated_timestamp'; - docs: [ - 'The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period', - ]; - type: 'u64'; - }, - ]; - }, - ]; - }; + "name": "last_amp_updated_timestamp", + "docs": [ + "The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period" + ], + "type": "u64" + } + ] + } + ] + } }, { - name: 'DepegType'; - docs: ['Type of depeg pool']; - type: { - kind: 'enum'; - variants: [ + "name": "DepegType", + "docs": [ + "Type of depeg pool" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'None'; + "name": "None" }, { - name: 'Marinade'; + "name": "Marinade" }, { - name: 'Lido'; + "name": "Lido" }, { - name: 'SplStake'; - }, - ]; - }; + "name": "SplStake" + } + ] + } }, { - name: 'PoolType'; - docs: ['Pool type']; - type: { - kind: 'enum'; - variants: [ + "name": "PoolType", + "docs": [ + "Pool type" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'Permissioned'; + "name": "Permissioned" }, { - name: 'Permissionless'; - }, - ]; - }; - }, - ]; - events: [ + "name": "Permissionless" + } + ] + } + } + ], + "events": [ { - name: 'AddLiquidity'; - fields: [ + "name": "AddLiquidity", + "fields": [ { - name: 'lpMintAmount'; - type: 'u64'; - index: false; + "name": "lpMintAmount", + "type": "u64", + "index": false }, { - name: 'tokenAAmount'; - type: 'u64'; - index: false; + "name": "tokenAAmount", + "type": "u64", + "index": false }, { - name: 'tokenBAmount'; - type: 'u64'; - index: false; - }, - ]; + "name": "tokenBAmount", + "type": "u64", + "index": false + } + ] }, { - name: 'RemoveLiquidity'; - fields: [ + "name": "RemoveLiquidity", + "fields": [ { - name: 'lpUnmintAmount'; - type: 'u64'; - index: false; + "name": "lpUnmintAmount", + "type": "u64", + "index": false }, { - name: 'tokenAOutAmount'; - type: 'u64'; - index: false; + "name": "tokenAOutAmount", + "type": "u64", + "index": false }, { - name: 'tokenBOutAmount'; - type: 'u64'; - index: false; - }, - ]; + "name": "tokenBOutAmount", + "type": "u64", + "index": false + } + ] }, { - name: 'Swap'; - fields: [ + "name": "Swap", + "fields": [ { - name: 'inAmount'; - type: 'u64'; - index: false; + "name": "inAmount", + "type": "u64", + "index": false }, { - name: 'outAmount'; - type: 'u64'; - index: false; + "name": "outAmount", + "type": "u64", + "index": false }, { - name: 'tradeFee'; - type: 'u64'; - index: false; + "name": "tradeFee", + "type": "u64", + "index": false }, { - name: 'adminFee'; - type: 'u64'; - index: false; + "name": "adminFee", + "type": "u64", + "index": false }, { - name: 'hostFee'; - type: 'u64'; - index: false; - }, - ]; + "name": "hostFee", + "type": "u64", + "index": false + } + ] }, { - name: 'SetPoolFees'; - fields: [ + "name": "SetPoolFees", + "fields": [ { - name: 'tradeFeeNumerator'; - type: 'u64'; - index: false; + "name": "tradeFeeNumerator", + "type": "u64", + "index": false }, { - name: 'tradeFeeDenominator'; - type: 'u64'; - index: false; + "name": "tradeFeeDenominator", + "type": "u64", + "index": false }, { - name: 'ownerTradeFeeNumerator'; - type: 'u64'; - index: false; + "name": "ownerTradeFeeNumerator", + "type": "u64", + "index": false }, { - name: 'ownerTradeFeeDenominator'; - type: 'u64'; - index: false; - }, - ]; + "name": "ownerTradeFeeDenominator", + "type": "u64", + "index": false + } + ] }, { - name: 'PoolInfo'; - fields: [ + "name": "PoolInfo", + "fields": [ { - name: 'tokenAAmount'; - type: 'u64'; - index: false; + "name": "tokenAAmount", + "type": "u64", + "index": false }, { - name: 'tokenBAmount'; - type: 'u64'; - index: false; + "name": "tokenBAmount", + "type": "u64", + "index": false }, { - name: 'virtualPrice'; - type: 'f64'; - index: false; + "name": "virtualPrice", + "type": "f64", + "index": false }, { - name: 'currentTimestamp'; - type: 'u64'; - index: false; - }, - ]; + "name": "currentTimestamp", + "type": "u64", + "index": false + } + ] }, { - name: 'TransferAdmin'; - fields: [ + "name": "TransferAdmin", + "fields": [ { - name: 'admin'; - type: 'publicKey'; - index: false; + "name": "admin", + "type": "publicKey", + "index": false }, { - name: 'newAdmin'; - type: 'publicKey'; - index: false; - }, - ]; + "name": "newAdmin", + "type": "publicKey", + "index": false + } + ] }, { - name: 'SetAdminFeeAccount'; - fields: [ + "name": "SetAdminFeeAccount", + "fields": [ { - name: 'adminTokenAFee'; - type: 'publicKey'; - index: false; + "name": "adminTokenAFee", + "type": "publicKey", + "index": false }, { - name: 'adminTokenBFee'; - type: 'publicKey'; - index: false; + "name": "adminTokenBFee", + "type": "publicKey", + "index": false }, { - name: 'newAdminTokenAFee'; - type: 'publicKey'; - index: false; + "name": "newAdminTokenAFee", + "type": "publicKey", + "index": false }, { - name: 'newAdminTokenBFee'; - type: 'publicKey'; - index: false; - }, - ]; + "name": "newAdminTokenBFee", + "type": "publicKey", + "index": false + } + ] }, { - name: 'OverrideCurveParam'; - fields: [ + "name": "OverrideCurveParam", + "fields": [ { - name: 'newAmp'; - type: 'u64'; - index: false; + "name": "newAmp", + "type": "u64", + "index": false }, { - name: 'updatedTimestamp'; - type: 'u64'; - index: false; - }, - ]; - }, - ]; - errors: [ + "name": "updatedTimestamp", + "type": "u64", + "index": false + } + ] + } + ], + "errors": [ { - code: 6000; - name: 'MathOverflow'; - msg: 'Math operation overflow'; + "code": 6000, + "name": "MathOverflow", + "msg": "Math operation overflow" }, { - code: 6001; - name: 'InvalidFee'; - msg: 'Invalid fee setup'; + "code": 6001, + "name": "InvalidFee", + "msg": "Invalid fee setup" }, { - code: 6002; - name: 'InvalidInvariant'; - msg: 'Invalid invariant d'; + "code": 6002, + "name": "InvalidInvariant", + "msg": "Invalid invariant d" }, { - code: 6003; - name: 'FeeCalculationFailure'; - msg: 'Fee calculation failure'; + "code": 6003, + "name": "FeeCalculationFailure", + "msg": "Fee calculation failure" }, { - code: 6004; - name: 'ExceededSlippage'; - msg: 'Exceeded slippage tolerance'; + "code": 6004, + "name": "ExceededSlippage", + "msg": "Exceeded slippage tolerance" }, { - code: 6005; - name: 'InvalidCalculation'; - msg: 'Invalid curve calculation'; + "code": 6005, + "name": "InvalidCalculation", + "msg": "Invalid curve calculation" }, { - code: 6006; - name: 'ZeroTradingTokens'; - msg: 'Given pool token amount results in zero trading tokens'; + "code": 6006, + "name": "ZeroTradingTokens", + "msg": "Given pool token amount results in zero trading tokens" }, { - code: 6007; - name: 'ConversionError'; - msg: 'Math conversion overflow'; + "code": 6007, + "name": "ConversionError", + "msg": "Math conversion overflow" }, { - code: 6008; - name: 'FaultyLpMint'; - msg: "LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply"; + "code": 6008, + "name": "FaultyLpMint", + "msg": "LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply" }, { - code: 6009; - name: 'MismatchedTokenMint'; - msg: 'Token mint mismatched'; + "code": 6009, + "name": "MismatchedTokenMint", + "msg": "Token mint mismatched" }, { - code: 6010; - name: 'MismatchedLpMint'; - msg: 'LP mint mismatched'; + "code": 6010, + "name": "MismatchedLpMint", + "msg": "LP mint mismatched" }, { - code: 6011; - name: 'MismatchedOwner'; - msg: 'Invalid lp token owner'; + "code": 6011, + "name": "MismatchedOwner", + "msg": "Invalid lp token owner" }, { - code: 6012; - name: 'InvalidVaultAccount'; - msg: 'Invalid vault account'; + "code": 6012, + "name": "InvalidVaultAccount", + "msg": "Invalid vault account" }, { - code: 6013; - name: 'InvalidVaultLpAccount'; - msg: 'Invalid vault lp account'; + "code": 6013, + "name": "InvalidVaultLpAccount", + "msg": "Invalid vault lp account" }, { - code: 6014; - name: 'InvalidPoolLpMintAccount'; - msg: 'Invalid pool lp mint account'; + "code": 6014, + "name": "InvalidPoolLpMintAccount", + "msg": "Invalid pool lp mint account" }, { - code: 6015; - name: 'PoolDisabled'; - msg: 'Pool disabled'; + "code": 6015, + "name": "PoolDisabled", + "msg": "Pool disabled" }, { - code: 6016; - name: 'InvalidAdminAccount'; - msg: 'Invalid admin account'; + "code": 6016, + "name": "InvalidAdminAccount", + "msg": "Invalid admin account" }, { - code: 6017; - name: 'InvalidAdminFeeAccount'; - msg: 'Invalid admin fee account'; + "code": 6017, + "name": "InvalidAdminFeeAccount", + "msg": "Invalid admin fee account" }, { - code: 6018; - name: 'SameAdminAccount'; - msg: 'Same admin account'; + "code": 6018, + "name": "SameAdminAccount", + "msg": "Same admin account" }, { - code: 6019; - name: 'IdenticalSourceDestination'; - msg: 'Identical user source and destination token account'; + "code": 6019, + "name": "IdenticalSourceDestination", + "msg": "Identical user source and destination token account" }, { - code: 6020; - name: 'ApyCalculationError'; - msg: 'Apy calculation error'; + "code": 6020, + "name": "ApyCalculationError", + "msg": "Apy calculation error" }, { - code: 6021; - name: 'InsufficientSnapshot'; - msg: 'Insufficient virtual price snapshot'; + "code": 6021, + "name": "InsufficientSnapshot", + "msg": "Insufficient virtual price snapshot" }, { - code: 6022; - name: 'NonUpdatableCurve'; - msg: 'Current curve is non-updatable'; + "code": 6022, + "name": "NonUpdatableCurve", + "msg": "Current curve is non-updatable" }, { - code: 6023; - name: 'MisMatchedCurve'; - msg: 'New curve is mismatched with old curve'; + "code": 6023, + "name": "MisMatchedCurve", + "msg": "New curve is mismatched with old curve" }, { - code: 6024; - name: 'InvalidAmplification'; - msg: 'Amplification is invalid'; + "code": 6024, + "name": "InvalidAmplification", + "msg": "Amplification is invalid" }, { - code: 6025; - name: 'UnsupportedOperation'; - msg: 'Operation is not supported'; + "code": 6025, + "name": "UnsupportedOperation", + "msg": "Operation is not supported" }, { - code: 6026; - name: 'ExceedMaxAChanges'; - msg: 'Exceed max amplification changes'; + "code": 6026, + "name": "ExceedMaxAChanges", + "msg": "Exceed max amplification changes" }, { - code: 6027; - name: 'InvalidRemainingAccountsLen'; - msg: 'Invalid remaining accounts length'; + "code": 6027, + "name": "InvalidRemainingAccountsLen", + "msg": "Invalid remaining accounts length" }, { - code: 6028; - name: 'InvalidRemainingAccounts'; - msg: 'Invalid remaining account'; + "code": 6028, + "name": "InvalidRemainingAccounts", + "msg": "Invalid remaining account" }, { - code: 6029; - name: 'MismatchedDepegMint'; - msg: "Token mint B doesn't matches depeg type token mint"; + "code": 6029, + "name": "MismatchedDepegMint", + "msg": "Token mint B doesn't matches depeg type token mint" }, { - code: 6030; - name: 'InvalidApyAccount'; - msg: 'Invalid APY account'; + "code": 6030, + "name": "InvalidApyAccount", + "msg": "Invalid APY account" }, { - code: 6031; - name: 'InvalidTokenMultiplier'; - msg: 'Invalid token multiplier'; + "code": 6031, + "name": "InvalidTokenMultiplier", + "msg": "Invalid token multiplier" }, { - code: 6032; - name: 'InvalidDepegInformation'; - msg: 'Invalid depeg information'; + "code": 6032, + "name": "InvalidDepegInformation", + "msg": "Invalid depeg information" }, { - code: 6033; - name: 'UpdateTimeConstraint'; - msg: 'Update time constraint violated'; + "code": 6033, + "name": "UpdateTimeConstraint", + "msg": "Update time constraint violated" }, { - code: 6034; - name: 'ExceedMaxFeeBps'; - msg: 'Exceeded max fee bps'; + "code": 6034, + "name": "ExceedMaxFeeBps", + "msg": "Exceeded max fee bps" }, { - code: 6035; - name: 'OwnerFeeOverHalfOfTradeFee'; - msg: 'Owner fee exceed half of trade fee'; + "code": 6035, + "name": "OwnerFeeOverHalfOfTradeFee", + "msg": "Owner fee exceed half of trade fee" }, { - code: 6036; - name: 'InvalidAdmin'; - msg: 'Invalid admin'; + "code": 6036, + "name": "InvalidAdmin", + "msg": "Invalid admin" }, { - code: 6037; - name: 'PoolIsNotPermissioned'; - msg: 'Pool is not permissioned'; + "code": 6037, + "name": "PoolIsNotPermissioned", + "msg": "Pool is not permissioned" }, { - code: 6038; - name: 'InvalidDepositAmount'; - msg: 'Invalid deposit amount'; + "code": 6038, + "name": "InvalidDepositAmount", + "msg": "Invalid deposit amount" }, { - code: 6039; - name: 'InvalidFeeOwner'; - msg: 'Invalid fee owner'; + "code": 6039, + "name": "InvalidFeeOwner", + "msg": "Invalid fee owner" }, { - code: 6040; - name: 'NonDepletedPool'; - msg: 'Pool is not depleted'; + "code": 6040, + "name": "NonDepletedPool", + "msg": "Pool is not depleted" }, { - code: 6041; - name: 'AmountNotPeg'; - msg: 'Token amount is not 1:1'; - }, - ]; + "code": 6041, + "name": "AmountNotPeg", + "msg": "Token amount is not 1:1" + } + ] }; export const IDL: Amm = { - version: '0.4.8', - name: 'amm', - docs: ['Program for AMM'], - instructions: [ + "version": "0.4.12", + "name": "amm", + "docs": [ + "Program for AMM" + ], + "instructions": [ { - name: 'initializePermissionedPool', - docs: ['Initialize a new permissioned pool.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: true, - docs: ['Pool account (arbitrary address)'], - }, - { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], - }, - { - name: 'tokenAMint', - isMut: false, - isSigner: false, - docs: ['Token A mint of the pool. Eg: USDT'], - }, - { - name: 'tokenBMint', - isMut: false, - isSigner: false, - docs: ['Token B mint of the pool. Eg: USDC'], - }, - { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], - }, - { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], - }, - { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault A'], - }, - { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault B'], - }, - { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: ['LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.'], - }, - { - name: 'adminTokenA', - isMut: true, - isSigner: false, - docs: ['Admin token account for pool token A mint. Used to bootstrap the pool with initial liquidity.'], - }, - { - name: 'adminTokenB', - isMut: true, - isSigner: false, - docs: ['Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.'], - }, - { - name: 'adminPoolLp', - isMut: true, - isSigner: false, - docs: [ - 'Admin pool LP token account. Used to receive LP during first deposit (initialize pool)', - 'Admin pool LP token account. Used to receive LP during first deposit (initialize pool)', - ], - }, - { - name: 'adminTokenAFee', - isMut: true, - isSigner: false, - docs: ['Admin fee token account for token A. Used to receive trading fee.'], - }, - { - name: 'adminTokenBFee', - isMut: true, - isSigner: false, - docs: ['Admin fee token account for token B. Used to receive trading fee.'], - }, - { - name: 'admin', - isMut: true, - isSigner: true, - docs: [ - 'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.', - ], - }, - { - name: 'feeOwner', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - docs: ['Rent account.'], - }, - { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.'], - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], - }, - { - name: 'associatedTokenProgram', - isMut: false, - isSigner: false, - docs: ['Associated token program.'], - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - docs: ['System program.'], - }, + "name": "initializePermissionedPool", + "docs": [ + "Initialize a new permissioned pool." ], - args: [ - { - name: 'curveType', - type: { - defined: 'CurveType', - }, - }, - { - name: 'tokenAAmount', - type: 'u64', - }, - { - name: 'tokenBAmount', - type: 'u64', - }, - ], - }, - { - name: 'initializePermissionlessPool', - docs: ['Initialize a new permissionless pool.'], - accounts: [ + "accounts": [ { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA address)'], + "name": "pool", + "isMut": true, + "isSigner": true, + "docs": [ + "Pool account (arbitrary address)" + ] }, { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'tokenAMint', - isMut: false, - isSigner: false, - docs: ['Token A mint of the pool. Eg: USDT'], + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint of the pool. Eg: USDT" + ] }, { - name: 'tokenBMint', - isMut: false, - isSigner: false, - docs: ['Token B mint of the pool. Eg: USDC'], + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint of the pool. Eg: USDC" + ] }, { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.'], + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.'], + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] }, { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] }, { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault A'], + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault B'], + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "adminTokenA", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token A mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: ['LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.'], + "name": "adminTokenB", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'payerTokenA', - isMut: true, - isSigner: false, - docs: ['Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity.'], + "name": "adminPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin pool LP token account. Used to receive LP during first deposit (initialize pool)", + "Admin pool LP token account. Used to receive LP during first deposit (initialize pool)" + ] }, { - name: 'payerTokenB', - isMut: true, - isSigner: false, - docs: ['Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.'], + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] }, { - name: 'payerPoolLp', - isMut: true, - isSigner: false, + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] }, { - name: 'adminTokenAFee', - isMut: true, - isSigner: false, - docs: ['Admin fee token account for token A. Used to receive trading fee.'], + "name": "admin", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool." + ] }, { - name: 'adminTokenBFee', - isMut: true, - isSigner: false, - docs: ['Admin fee token account for token B. Used to receive trading fee.'], + "name": "feeOwner", + "isMut": false, + "isSigner": false }, { - name: 'payer', - isMut: true, - isSigner: true, - docs: [ - 'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.', - ], + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": [ + "Rent account." + ] }, { - name: 'feeOwner', - isMut: false, - isSigner: false, + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'rent', - isMut: false, - isSigner: false, - docs: ['Rent account.'], + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.'], + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] }, { - name: 'associatedTokenProgram', - isMut: false, - isSigner: false, - docs: ['Associated token program.'], + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Associated token program." + ] }, { - name: 'systemProgram', - isMut: false, - isSigner: false, - docs: ['System program.'], - }, + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } ], - args: [ - { - name: 'curveType', - type: { - defined: 'CurveType', - }, - }, + "args": [ { - name: 'tokenAAmount', - type: 'u64', - }, - { - name: 'tokenBAmount', - type: 'u64', - }, - ], + "name": "curveType", + "type": { + "defined": "CurveType" + } + } + ] }, { - name: 'initializePermissionlessPoolWithFeeTier', - docs: ['Initialize a new permissionless pool with customized fee tier'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA address)'], - }, - { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], - }, + "name": "initializePermissionlessPool", + "docs": [ + "Initialize a new permissionless pool." + ], + "accounts": [ { - name: 'tokenAMint', - isMut: false, - isSigner: false, - docs: ['Token A mint of the pool. Eg: USDT'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA address)" + ] }, { - name: 'tokenBMint', - isMut: false, - isSigner: false, - docs: ['Token B mint of the pool. Eg: USDC'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.'], + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint of the pool. Eg: USDT" + ] }, { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.'], + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint of the pool. Eg: USDC" + ] }, { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault A'], + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] }, { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault B'], + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] }, { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] }, { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: ['LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.'], + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] }, { - name: 'payerTokenA', - isMut: true, - isSigner: false, - docs: ['Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity.'], + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'payerTokenB', - isMut: true, - isSigner: false, - docs: ['Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.'], + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'payerPoolLp', - isMut: true, - isSigner: false, + "name": "payerTokenA", + "isMut": true, + "isSigner": false, + "docs": [ + "Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'adminTokenAFee', - isMut: true, - isSigner: false, - docs: ['Admin fee token account for token A. Used to receive trading fee.'], + "name": "payerTokenB", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'adminTokenBFee', - isMut: true, - isSigner: false, - docs: ['Admin fee token account for token B. Used to receive trading fee.'], + "name": "payerPoolLp", + "isMut": true, + "isSigner": false }, { - name: 'payer', - isMut: true, - isSigner: true, - docs: [ - 'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.', - ], + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] }, { - name: 'feeOwner', - isMut: false, - isSigner: false, + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] }, { - name: 'rent', - isMut: false, - isSigner: false, - docs: ['Rent account.'], + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool." + ] }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.'], + "name": "feeOwner", + "isMut": false, + "isSigner": false }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": [ + "Rent account." + ] }, { - name: 'associatedTokenProgram', - isMut: false, - isSigner: false, - docs: ['Associated token program.'], + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'systemProgram', - isMut: false, - isSigner: false, - docs: ['System program.'], + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, - ], - args: [ { - name: 'curveType', - type: { - defined: 'CurveType', - }, + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] }, { - name: 'tradeFeeBps', - type: 'u64', + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] }, { - name: 'tokenAAmount', - type: 'u64', + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Associated token program." + ] }, { - name: 'tokenBAmount', - type: 'u64', - }, + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } ], - }, - { - name: 'enableOrDisablePool', - docs: ['Enable or disable a pool. A disabled pool allow only remove balanced liquidity operation.'], - accounts: [ + "args": [ { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], + "name": "curveType", + "type": { + "defined": "CurveType" + } }, { - name: 'admin', - isMut: false, - isSigner: true, - docs: ['Admin account. Must be owner of the pool.'], + "name": "tokenAAmount", + "type": "u64" }, - ], - args: [ { - name: 'enable', - type: 'bool', - }, - ], + "name": "tokenBAmount", + "type": "u64" + } + ] }, { - name: 'swap', - docs: [ - 'Swap token A to B, or vice versa. An amount of trading fee will be charged for liquidity provider, and the admin of the pool.', + "name": "initializePermissionlessPoolWithFeeTier", + "docs": [ + "Initialize a new permissionless pool with customized fee tier" ], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'userSourceToken', - isMut: true, - isSigner: false, - docs: [ - 'User token account. Token from this account will be transfer into the vault by the pool in exchange for another token of the pool.', - ], - }, + "accounts": [ { - name: 'userDestinationToken', - isMut: true, - isSigner: false, - docs: ['User token account. The exchanged token will be transfer into this account from the pool.'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA address)" + ] }, { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.'], + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint of the pool. Eg: USDT" + ] }, { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint of the pool. Eg: USDC" + ] }, { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['Lp token mint of vault a'], + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] }, { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['Lp token mint of vault b'], + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] }, { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] }, { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] }, { - name: 'adminTokenFee', - isMut: true, - isSigner: false, - docs: [ - "Admin fee token account. Used to receive trading fee. It's mint field must matched with user_source_token mint field.", - ], + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] }, { - name: 'user', - isMut: false, - isSigner: true, - docs: ['User account. Must be owner of user_source_token.'], + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.'], + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault." + ] }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], + "name": "payerTokenA", + "isMut": true, + "isSigner": false, + "docs": [ + "Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity." + ] }, - ], - args: [ { - name: 'inAmount', - type: 'u64', + "name": "payerTokenB", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity." + ] }, { - name: 'minimumOutAmount', - type: 'u64', + "name": "payerPoolLp", + "isMut": true, + "isSigner": false }, - ], - }, - { - name: 'removeLiquiditySingleSide', - docs: ['Withdraw only single token from the pool. Only supported by pool with stable swap curve.'], - accounts: [ { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] }, { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] }, { - name: 'userPoolLp', - isMut: true, - isSigner: false, - docs: ['User pool lp token account. LP will be burned from this account upon success liquidity removal.'], + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool." + ] }, { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "feeOwner", + "isMut": false, + "isSigner": false }, { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "rent", + "isMut": false, + "isSigner": false, + "docs": [ + "Rent account." + ] }, { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.'], + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.'], + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault A'], + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] }, { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault B'], + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] }, { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], + "name": "associatedTokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Associated token program." + ] }, { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], - }, + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } + ], + "args": [ { - name: 'userDestinationToken', - isMut: true, - isSigner: false, - docs: ['User token account to receive token upon success liquidity removal.'], + "name": "curveType", + "type": { + "defined": "CurveType" + } }, { - name: 'user', - isMut: false, - isSigner: true, - docs: ['User account. Must be owner of the user_pool_lp account.'], + "name": "tradeFeeBps", + "type": "u64" }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. The pool will deposit/withdraw liquidity from the vault.'], + "name": "tokenAAmount", + "type": "u64" }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], - }, + "name": "tokenBAmount", + "type": "u64" + } + ] + }, + { + "name": "enableOrDisablePool", + "docs": [ + "Enable or disable a pool. A disabled pool allow only remove balanced liquidity operation." ], - args: [ - { - name: 'poolTokenAmount', - type: 'u64', - }, - { - name: 'minimumOutAmount', - type: 'u64', - }, + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + } ], + "args": [ + { + "name": "enable", + "type": "bool" + } + ] }, { - name: 'addImbalanceLiquidity', - docs: ['Deposit tokens to the pool in an imbalance ratio. Only supported by pool with stable swap curve.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], - }, - { - name: 'userPoolLp', - isMut: true, - isSigner: false, - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.'], - }, - { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault a'], - }, - { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault b'], - }, - { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], - }, - { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], - }, - { - name: 'userAToken', - isMut: true, - isSigner: false, - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], - }, - { - name: 'userBToken', - isMut: true, - isSigner: false, - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], - }, + "name": "swap", + "docs": [ + "Swap token A to B, or vice versa. An amount of trading fee will be charged for liquidity provider, and the admin of the pool." + ], + "accounts": [ { - name: 'user', - isMut: false, - isSigner: true, - docs: ['User account. Must be owner of user_a_token, and user_b_token.'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.'], + "name": "userSourceToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token account. Token from this account will be transfer into the vault by the pool in exchange for another token of the pool." + ] }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], - }, + "name": "userDestinationToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token account. The exchanged token will be transfer into this account from the pool." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "Lp token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "Lp token mint of vault b" + ] + }, + { + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "adminTokenFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account. Used to receive trading fee. It's mint field must matched with user_source_token mint field." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_source_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } ], - args: [ - { - name: 'minimumPoolTokenAmount', - type: 'u64', - }, + "args": [ { - name: 'tokenAAmount', - type: 'u64', + "name": "inAmount", + "type": "u64" }, { - name: 'tokenBAmount', - type: 'u64', - }, - ], + "name": "minimumOutAmount", + "type": "u64" + } + ] }, { - name: 'removeBalanceLiquidity', - docs: [ - "Withdraw tokens from the pool in a balanced ratio. User will still able to withdraw from pool even the pool is disabled. This allow user to exit their liquidity when there's some unforeseen event happen.", + "name": "removeLiquiditySingleSide", + "docs": [ + "Withdraw only single token from the pool. Only supported by pool with stable swap curve." ], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], - }, - { - name: 'userPoolLp', - isMut: true, - isSigner: false, - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.'], - }, - { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.'], - }, + "accounts": [ { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault a'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault b'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], - }, + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "User pool lp token account. LP will be burned from this account upon success liquidity removal." + ] + }, + { + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault A" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault B" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userDestinationToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token account to receive token upon success liquidity removal." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of the user_pool_lp account." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. The pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], + "name": "poolTokenAmount", + "type": "u64" }, { - name: 'userAToken', - isMut: true, - isSigner: false, - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], - }, + "name": "minimumOutAmount", + "type": "u64" + } + ] + }, + { + "name": "addImbalanceLiquidity", + "docs": [ + "Deposit tokens to the pool in an imbalance ratio. Only supported by pool with stable swap curve." + ], + "accounts": [ { - name: 'userBToken', - isMut: true, - isSigner: false, - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'user', - isMut: false, - isSigner: true, - docs: ['User account. Must be owner of user_a_token, and user_b_token.'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.'], + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], - }, + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } ], - args: [ + "args": [ { - name: 'poolTokenAmount', - type: 'u64', + "name": "minimumPoolTokenAmount", + "type": "u64" }, { - name: 'minimumATokenOut', - type: 'u64', + "name": "tokenAAmount", + "type": "u64" }, { - name: 'minimumBTokenOut', - type: 'u64', - }, - ], + "name": "tokenBAmount", + "type": "u64" + } + ] }, { - name: 'addBalanceLiquidity', - docs: ['Deposit tokens to the pool in a balanced ratio.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], - }, - { - name: 'userPoolLp', - isMut: true, - isSigner: false, - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.'], - }, - { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, + "name": "removeBalanceLiquidity", + "docs": [ + "Withdraw tokens from the pool in a balanced ratio. User will still able to withdraw from pool even the pool is disabled. This allow user to exit their liquidity when there's some unforeseen event happen." + ], + "accounts": [ { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault a'], + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault b'], - }, + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], + "name": "poolTokenAmount", + "type": "u64" }, { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], + "name": "minimumATokenOut", + "type": "u64" }, { - name: 'userAToken', - isMut: true, - isSigner: false, - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], - }, + "name": "minimumBTokenOut", + "type": "u64" + } + ] + }, + { + "name": "addBalanceLiquidity", + "docs": [ + "Deposit tokens to the pool in a balanced ratio." + ], + "accounts": [ { - name: 'userBToken', - isMut: true, - isSigner: false, - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'user', - isMut: false, - isSigner: true, - docs: ['User account. Must be owner of user_a_token, and user_b_token.'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.'], + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], - }, + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } ], - args: [ + "args": [ { - name: 'poolTokenAmount', - type: 'u64', + "name": "poolTokenAmount", + "type": "u64" }, { - name: 'maximumTokenAAmount', - type: 'u64', + "name": "maximumTokenAAmount", + "type": "u64" }, { - name: 'maximumTokenBAmount', - type: 'u64', - }, - ], + "name": "maximumTokenBAmount", + "type": "u64" + } + ] }, { - name: 'setPoolFees', - docs: ['Update trading fee charged for liquidity provider, and admin.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'admin', - isMut: false, - isSigner: true, - docs: ['Admin account. Must be owner of the pool.'], - }, + "name": "setPoolFees", + "docs": [ + "Update trading fee charged for liquidity provider, and admin." ], - args: [ - { - name: 'fees', - type: { - defined: 'PoolFees', - }, - }, + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + } ], + "args": [ + { + "name": "fees", + "type": { + "defined": "PoolFees" + } + } + ] }, { - name: 'overrideCurveParam', - docs: [ - 'Update swap curve parameters. This function do not allow update of curve type. For example: stable swap curve to constant product curve. Only supported by pool with stable swap curve.', - 'Only amp is allowed to be override. The other attributes of stable swap curve will be ignored.', + "name": "overrideCurveParam", + "docs": [ + "Update swap curve parameters. This function do not allow update of curve type. For example: stable swap curve to constant product curve. Only supported by pool with stable swap curve.", + "Only amp is allowed to be override. The other attributes of stable swap curve will be ignored." ], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'admin', - isMut: false, - isSigner: true, - docs: ['Admin account. Must be owner of the pool.'], - }, + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + } ], - args: [ + "args": [ { - name: 'curveType', - type: { - defined: 'CurveType', - }, - }, - ], + "name": "curveType", + "type": { + "defined": "CurveType" + } + } + ] }, { - name: 'transferAdmin', - docs: ['Transfer the admin of the pool to new admin.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'admin', - isMut: false, - isSigner: true, - docs: ['Admin account. Must be owner of the pool.'], - }, - { - name: 'newAdmin', - isMut: false, - isSigner: true, - docs: ['New admin account.'], - }, + "name": "transferAdmin", + "docs": [ + "Transfer the admin of the pool to new admin." + ], + "accounts": [ + { + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "admin", + "isMut": false, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + }, + { + "name": "newAdmin", + "isMut": false, + "isSigner": true, + "docs": [ + "New admin account." + ] + } ], - args: [], + "args": [] }, { - name: 'setAdminFeeAccount', - docs: ['Update fee token account of the pool admin.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'newAdminTokenAFee', - isMut: true, - isSigner: false, - docs: ['New admin fee token account for pool token A. Used to receive trading fee.'], - }, - { - name: 'newAdminTokenBFee', - isMut: true, - isSigner: false, - docs: ['New admin fee token account for pool token B. Used to receive trading fee.'], - }, - { - name: 'admin', - isMut: false, - isSigner: true, - docs: ['Admin account. Must be owner of the pool.'], - }, + "name": "getPoolInfo", + "docs": [ + "Get the general information of the pool." ], - args: [], + "accounts": [ + { + "name": "pool", + "isMut": false, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] + }, + { + "name": "lpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] + }, + { + "name": "aVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + } + ], + "args": [] }, { - name: 'getPoolInfo', - docs: ['Get the general information of the pool.'], - accounts: [ + "name": "bootstrapLiquidity", + "docs": [ + "Bootstrap the pool when liquidity is depleted." + ], + "accounts": [ { - name: 'pool', - isMut: false, - isSigner: false, - docs: ['Pool account (PDA)'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account (PDA)" + ] }, { - name: 'lpMint', - isMut: false, - isSigner: false, - docs: ['LP token mint of the pool'], + "name": "lpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of the pool" + ] }, { - name: 'aVaultLp', - isMut: false, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], + "name": "userPoolLp", + "isMut": true, + "isSigner": false, + "docs": [ + "user pool lp token account. lp will be burned from this account upon success liquidity removal." + ] }, { - name: 'bVaultLp', - isMut: false, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, + "name": "aVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "bVaultLp", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." + ] + }, + { + "name": "aVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token a. token a of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "bVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Vault account for token b. token b of the pool will be deposit / withdraw from this vault account." + ] + }, + { + "name": "aVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault a" + ] + }, + { + "name": "bVaultLpMint", + "isMut": true, + "isSigner": false, + "docs": [ + "LP token mint of vault b" + ] + }, + { + "name": "aTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault A" + ] + }, + { + "name": "bTokenVault", + "isMut": true, + "isSigner": false, + "docs": [ + "Token vault account of vault B" + ] + }, + { + "name": "userAToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "userBToken", + "isMut": true, + "isSigner": false, + "docs": [ + "User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account." + ] + }, + { + "name": "user", + "isMut": false, + "isSigner": true, + "docs": [ + "User account. Must be owner of user_a_token, and user_b_token." + ] + }, + { + "name": "vaultProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault program. the pool will deposit/withdraw liquidity from the vault." + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + } + ], + "args": [ { - name: 'aVault', - isMut: false, - isSigner: false, - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.'], + "name": "tokenAAmount", + "type": "u64" }, { - name: 'bVault', - isMut: false, - isSigner: false, - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.'], - }, + "name": "tokenBAmount", + "type": "u64" + } + ] + }, + { + "name": "migrateFeeAccount", + "docs": [ + "Migrate old token fee owner to PDA" + ], + "accounts": [ { - name: 'aVaultLpMint', - isMut: false, - isSigner: false, - docs: ['LP token mint of vault a'], + "name": "pool", + "isMut": true, + "isSigner": false, + "docs": [ + "Pool account" + ] }, { - name: 'bVaultLpMint', - isMut: false, - isSigner: false, - docs: ['LP token mint of vault b'], - }, + "name": "aVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "A vault LP token account of the pool." + ] + }, + { + "name": "adminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ] + }, + { + "name": "adminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ] + }, + { + "name": "tokenAMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token A mint" + ] + }, + { + "name": "tokenBMint", + "isMut": false, + "isSigner": false, + "docs": [ + "Token B mint" + ] + }, + { + "name": "newAdminTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Token fee account. Controlled by pool a_vault_lp PDA." + ] + }, + { + "name": "newAdminTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Token fee account. Controlled by pool a_vault_lp PDA." + ] + }, + { + "name": "admin", + "isMut": true, + "isSigner": true, + "docs": [ + "Admin account. Must be owner of the pool." + ] + }, + { + "name": "treasuryTokenAFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Treasury token a fee ATA." + ] + }, + { + "name": "treasuryTokenBFee", + "isMut": true, + "isSigner": false, + "docs": [ + "Treasury token b fee ATA." + ] + }, + { + "name": "treasury", + "isMut": false, + "isSigner": true, + "docs": [ + "Treasury signer" + ] + }, + { + "name": "tokenProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "Token program." + ] + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] + } ], - args: [], + "args": [] }, { - name: 'bootstrapLiquidity', - docs: ['Bootstrap the pool when liquidity is depleted.'], - accounts: [ - { - name: 'pool', - isMut: true, - isSigner: false, - docs: ['Pool account (PDA)'], - }, - { - name: 'lpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of the pool'], - }, - { - name: 'userPoolLp', - isMut: true, - isSigner: false, - docs: ['user pool lp token account. lp will be burned from this account upon success liquidity removal.'], - }, - { - name: 'aVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'bVaultLp', - isMut: true, - isSigner: false, - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', - ], - }, - { - name: 'aVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token a. token a of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'bVault', - isMut: true, - isSigner: false, - docs: ['Vault account for token b. token b of the pool will be deposit / withdraw from this vault account.'], - }, - { - name: 'aVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault a'], - }, - { - name: 'bVaultLpMint', - isMut: true, - isSigner: false, - docs: ['LP token mint of vault b'], - }, - { - name: 'aTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault A'], - }, - { - name: 'bTokenVault', - isMut: true, - isSigner: false, - docs: ['Token vault account of vault B'], - }, + "name": "createMintMetadata", + "docs": [ + "Create mint metadata account for old pools" + ], + "accounts": [ { - name: 'userAToken', - isMut: true, - isSigner: false, - docs: [ - 'User token A account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], + "name": "pool", + "isMut": false, + "isSigner": false, + "docs": [ + "Pool account" + ] }, { - name: 'userBToken', - isMut: true, - isSigner: false, - docs: [ - 'User token B account. Token will be transfer from this account if it is add liquidity operation. Else, token will be transfer into this account.', - ], + "name": "lpMint", + "isMut": false, + "isSigner": false, + "docs": [ + "LP mint account of the pool" + ] }, { - name: 'user', - isMut: false, - isSigner: true, - docs: ['User account. Must be owner of user_a_token, and user_b_token.'], + "name": "aVaultLp", + "isMut": false, + "isSigner": false, + "docs": [ + "Vault A LP account of the pool" + ] }, { - name: 'vaultProgram', - isMut: false, - isSigner: false, - docs: ['Vault program. the pool will deposit/withdraw liquidity from the vault.'], + "name": "mintMetadata", + "isMut": true, + "isSigner": false }, { - name: 'tokenProgram', - isMut: false, - isSigner: false, - docs: ['Token program.'], + "name": "metadataProgram", + "isMut": false, + "isSigner": false }, - ], - args: [ { - name: 'tokenAAmount', - type: 'u64', + "name": "systemProgram", + "isMut": false, + "isSigner": false, + "docs": [ + "System program." + ] }, { - name: 'tokenBAmount', - type: 'u64', - }, + "name": "payer", + "isMut": true, + "isSigner": true, + "docs": [ + "Payer" + ] + } ], - }, + "args": [] + } ], - accounts: [ + "accounts": [ { - name: 'pool', - docs: ['State of pool account'], - type: { - kind: 'struct', - fields: [ + "name": "pool", + "docs": [ + "State of pool account" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'lpMint', - docs: ['LP token mint of the pool'], - type: 'publicKey', + "name": "lpMint", + "docs": [ + "LP token mint of the pool" + ], + "type": "publicKey" }, { - name: 'tokenAMint', - docs: ['Token A mint of the pool. Eg: USDT'], - type: 'publicKey', + "name": "tokenAMint", + "docs": [ + "Token A mint of the pool. Eg: USDT" + ], + "type": "publicKey" }, { - name: 'tokenBMint', - docs: ['Token B mint of the pool. Eg: USDC'], - type: 'publicKey', + "name": "tokenBMint", + "docs": [ + "Token B mint of the pool. Eg: USDC" + ], + "type": "publicKey" }, { - name: 'aVault', - docs: [ - 'Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.', + "name": "aVault", + "docs": [ + "Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account." ], - type: 'publicKey', + "type": "publicKey" }, { - name: 'bVault', - docs: [ - 'Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.', + "name": "bVault", + "docs": [ + "Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account." ], - type: 'publicKey', + "type": "publicKey" }, { - name: 'aVaultLp', - docs: [ - 'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', + "name": "aVaultLp", + "docs": [ + "LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault." ], - type: 'publicKey', + "type": "publicKey" }, { - name: 'bVaultLp', - docs: [ - 'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.', + "name": "bVaultLp", + "docs": [ + "LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault." ], - type: 'publicKey', + "type": "publicKey" }, { - name: 'aVaultLpBump', - docs: ['"A" vault lp bump. Used to create signer seeds.'], - type: 'u8', + "name": "aVaultLpBump", + "docs": [ + "\"A\" vault lp bump. Used to create signer seeds." + ], + "type": "u8" }, { - name: 'enabled', - docs: ['Flag to determine whether the pool is enabled, or disabled.'], - type: 'bool', + "name": "enabled", + "docs": [ + "Flag to determine whether the pool is enabled, or disabled." + ], + "type": "bool" }, { - name: 'adminTokenAFee', - docs: ['Admin fee token account for token A. Used to receive trading fee.'], - type: 'publicKey', + "name": "adminTokenAFee", + "docs": [ + "Admin fee token account for token A. Used to receive trading fee." + ], + "type": "publicKey" }, { - name: 'adminTokenBFee', - docs: ['Admin fee token account for token B. Used to receive trading fee.'], - type: 'publicKey', + "name": "adminTokenBFee", + "docs": [ + "Admin fee token account for token B. Used to receive trading fee." + ], + "type": "publicKey" }, { - name: 'admin', - docs: ['Owner of the pool.'], - type: 'publicKey', + "name": "admin", + "docs": [ + "Owner of the pool." + ], + "type": "publicKey" }, { - name: 'fees', - docs: ['Store the fee charges setting.'], - type: { - defined: 'PoolFees', - }, + "name": "fees", + "docs": [ + "Store the fee charges setting." + ], + "type": { + "defined": "PoolFees" + } }, { - name: 'poolType', - docs: ['Pool type'], - type: { - defined: 'PoolType', - }, + "name": "poolType", + "docs": [ + "Pool type" + ], + "type": { + "defined": "PoolType" + } }, { - name: 'stake', - docs: ['Stake pubkey of SPL stake pool'], - type: 'publicKey', + "name": "stake", + "docs": [ + "Stake pubkey of SPL stake pool" + ], + "type": "publicKey" }, { - name: 'padding', - docs: ['Padding for future pool field'], - type: { - defined: 'Padding', - }, + "name": "padding", + "docs": [ + "Padding for future pool field" + ], + "type": { + "defined": "Padding" + } }, { - name: 'curveType', - docs: ['The type of the swap curve supported by the pool.'], - type: { - defined: 'CurveType', - }, - }, - ], - }, - }, + "name": "curveType", + "docs": [ + "The type of the swap curve supported by the pool." + ], + "type": { + "defined": "CurveType" + } + } + ] + } + } ], - types: [ + "types": [ { - name: 'TokenMultiplier', - docs: ['Multiplier for the pool token. Used to normalized token with different decimal into the same precision.'], - type: { - kind: 'struct', - fields: [ + "name": "TokenMultiplier", + "docs": [ + "Multiplier for the pool token. Used to normalized token with different decimal into the same precision." + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'tokenAMultiplier', - docs: ['Multiplier for token A of the pool.'], - type: 'u64', + "name": "tokenAMultiplier", + "docs": [ + "Multiplier for token A of the pool." + ], + "type": "u64" }, { - name: 'tokenBMultiplier', - docs: ['Multiplier for token B of the pool.'], - type: 'u64', + "name": "tokenBMultiplier", + "docs": [ + "Multiplier for token B of the pool." + ], + "type": "u64" }, { - name: 'precisionFactor', - docs: [ - 'Record the highest token decimal in the pool. For example, Token A is 6 decimal, token B is 9 decimal. This will save value of 9.', + "name": "precisionFactor", + "docs": [ + "Record the highest token decimal in the pool. For example, Token A is 6 decimal, token B is 9 decimal. This will save value of 9." ], - type: 'u8', - }, - ], - }, + "type": "u8" + } + ] + } }, { - name: 'PoolFees', - docs: ['Information regarding fee charges'], - type: { - kind: 'struct', - fields: [ + "name": "PoolFees", + "docs": [ + "Information regarding fee charges" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'tradeFeeNumerator', - 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', + "name": "tradeFeeNumerator", + "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: 'u64', + "type": "u64" }, { - name: 'tradeFeeDenominator', - docs: ['Trade fee denominator'], - type: 'u64', + "name": "tradeFeeDenominator", + "docs": [ + "Trade fee denominator" + ], + "type": "u64" }, { - name: 'ownerTradeFeeNumerator', - docs: [ - 'Owner 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 owner of the program.', - 'Owner trade fee numerator', + "name": "ownerTradeFeeNumerator", + "docs": [ + "Owner 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 owner of the program.", + "Owner trade fee numerator" ], - type: 'u64', + "type": "u64" }, { - name: 'ownerTradeFeeDenominator', - docs: ['Owner trade fee denominator'], - type: 'u64', - }, - ], - }, + "name": "ownerTradeFeeDenominator", + "docs": [ + "Owner trade fee denominator" + ], + "type": "u64" + } + ] + } }, { - name: 'Depeg', - docs: ['Contains information for depeg pool'], - type: { - kind: 'struct', - fields: [ + "name": "Depeg", + "docs": [ + "Contains information for depeg pool" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'baseVirtualPrice', - docs: ['The virtual price of staking / interest bearing token'], - type: 'u64', + "name": "baseVirtualPrice", + "docs": [ + "The virtual price of staking / interest bearing token" + ], + "type": "u64" }, { - name: 'baseCacheUpdated', - docs: ['The virtual price of staking / interest bearing token'], - type: 'u64', + "name": "baseCacheUpdated", + "docs": [ + "The virtual price of staking / interest bearing token" + ], + "type": "u64" }, { - name: 'depegType', - docs: ['Type of the depeg pool'], - type: { - defined: 'DepegType', - }, - }, - ], - }, + "name": "depegType", + "docs": [ + "Type of the depeg pool" + ], + "type": { + "defined": "DepegType" + } + } + ] + } }, { - name: 'Padding', - docs: ['Padding for future pool fields'], - type: { - kind: 'struct', - fields: [ + "name": "Padding", + "docs": [ + "Padding for future pool fields" + ], + "type": { + "kind": "struct", + "fields": [ { - name: 'padding0', - docs: ['Padding 0'], - type: { - array: ['u8', 15], - }, + "name": "padding0", + "docs": [ + "Padding 0" + ], + "type": { + "array": [ + "u8", + 15 + ] + } }, { - name: 'padding', - docs: ['Padding 1'], - type: { - array: ['u128', 29], - }, - }, - ], - }, - }, - { - name: 'RoundDirection', - docs: ['Rounding direction'], - type: { - kind: 'enum', - variants: [ + "name": "padding", + "docs": [ + "Padding 1" + ], + "type": { + "array": [ + "u128", + 29 + ] + } + } + ] + } + }, + { + "name": "RoundDirection", + "docs": [ + "Rounding direction" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'Floor', + "name": "Floor" }, { - name: 'Ceiling', - }, - ], - }, + "name": "Ceiling" + } + ] + } }, { - name: 'TradeDirection', - docs: ['Trade (swap) direction'], - type: { - kind: 'enum', - variants: [ + "name": "TradeDirection", + "docs": [ + "Trade (swap) direction" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'AtoB', + "name": "AtoB" }, { - name: 'BtoA', - }, - ], - }, + "name": "BtoA" + } + ] + } }, { - name: 'NewCurveType', - docs: ['Type of the swap curve'], - type: { - kind: 'enum', - variants: [ + "name": "NewCurveType", + "docs": [ + "Type of the swap curve" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'ConstantProduct', + "name": "ConstantProduct" }, { - name: 'Stable', - fields: [ + "name": "Stable", + "fields": [ { - name: 'amp', - docs: ['Amplification coefficient'], - type: 'u64', + "name": "amp", + "docs": [ + "Amplification coefficient" + ], + "type": "u64" }, { - name: 'token_multiplier', - docs: [ - 'Multiplier for the pool token. Used to normalized token with different decimal into the same precision.', + "name": "token_multiplier", + "docs": [ + "Multiplier for the pool token. Used to normalized token with different decimal into the same precision." ], - type: { - defined: 'TokenMultiplier', - }, + "type": { + "defined": "TokenMultiplier" + } }, { - name: 'depeg', - docs: [ - 'Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price', + "name": "depeg", + "docs": [ + "Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price" ], - type: { - defined: 'Depeg', - }, + "type": { + "defined": "Depeg" + } }, { - name: 'last_amp_updated_timestamp', - docs: [ - 'The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period', + "name": "last_amp_updated_timestamp", + "docs": [ + "The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period" ], - type: 'u64', - }, - ], + "type": "u64" + } + ] }, { - name: 'NewCurve', - fields: [ + "name": "NewCurve", + "fields": [ { - name: 'field_one', - type: 'u64', + "name": "field_one", + "type": "u64" }, { - name: 'field_two', - type: 'u64', - }, - ], - }, - ], - }, - }, - { - name: 'CurveType', - docs: ['Type of the swap curve'], - type: { - kind: 'enum', - variants: [ + "name": "field_two", + "type": "u64" + } + ] + } + ] + } + }, + { + "name": "CurveType", + "docs": [ + "Type of the swap curve" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'ConstantProduct', + "name": "ConstantProduct" }, { - name: 'Stable', - fields: [ + "name": "Stable", + "fields": [ { - name: 'amp', - docs: ['Amplification coefficient'], - type: 'u64', + "name": "amp", + "docs": [ + "Amplification coefficient" + ], + "type": "u64" }, { - name: 'token_multiplier', - docs: [ - 'Multiplier for the pool token. Used to normalized token with different decimal into the same precision.', + "name": "token_multiplier", + "docs": [ + "Multiplier for the pool token. Used to normalized token with different decimal into the same precision." ], - type: { - defined: 'TokenMultiplier', - }, + "type": { + "defined": "TokenMultiplier" + } }, { - name: 'depeg', - docs: [ - 'Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price', + "name": "depeg", + "docs": [ + "Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price" ], - type: { - defined: 'Depeg', - }, + "type": { + "defined": "Depeg" + } }, { - name: 'last_amp_updated_timestamp', - docs: [ - 'The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period', + "name": "last_amp_updated_timestamp", + "docs": [ + "The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period" ], - type: 'u64', - }, - ], - }, - ], - }, + "type": "u64" + } + ] + } + ] + } }, { - name: 'DepegType', - docs: ['Type of depeg pool'], - type: { - kind: 'enum', - variants: [ + "name": "DepegType", + "docs": [ + "Type of depeg pool" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'None', + "name": "None" }, { - name: 'Marinade', + "name": "Marinade" }, { - name: 'Lido', + "name": "Lido" }, { - name: 'SplStake', - }, - ], - }, + "name": "SplStake" + } + ] + } }, { - name: 'PoolType', - docs: ['Pool type'], - type: { - kind: 'enum', - variants: [ + "name": "PoolType", + "docs": [ + "Pool type" + ], + "type": { + "kind": "enum", + "variants": [ { - name: 'Permissioned', + "name": "Permissioned" }, { - name: 'Permissionless', - }, - ], - }, - }, + "name": "Permissionless" + } + ] + } + } ], - events: [ + "events": [ { - name: 'AddLiquidity', - fields: [ + "name": "AddLiquidity", + "fields": [ { - name: 'lpMintAmount', - type: 'u64', - index: false, + "name": "lpMintAmount", + "type": "u64", + "index": false }, { - name: 'tokenAAmount', - type: 'u64', - index: false, + "name": "tokenAAmount", + "type": "u64", + "index": false }, { - name: 'tokenBAmount', - type: 'u64', - index: false, - }, - ], + "name": "tokenBAmount", + "type": "u64", + "index": false + } + ] }, { - name: 'RemoveLiquidity', - fields: [ + "name": "RemoveLiquidity", + "fields": [ { - name: 'lpUnmintAmount', - type: 'u64', - index: false, + "name": "lpUnmintAmount", + "type": "u64", + "index": false }, { - name: 'tokenAOutAmount', - type: 'u64', - index: false, + "name": "tokenAOutAmount", + "type": "u64", + "index": false }, { - name: 'tokenBOutAmount', - type: 'u64', - index: false, - }, - ], + "name": "tokenBOutAmount", + "type": "u64", + "index": false + } + ] }, { - name: 'Swap', - fields: [ + "name": "Swap", + "fields": [ { - name: 'inAmount', - type: 'u64', - index: false, + "name": "inAmount", + "type": "u64", + "index": false }, { - name: 'outAmount', - type: 'u64', - index: false, + "name": "outAmount", + "type": "u64", + "index": false }, { - name: 'tradeFee', - type: 'u64', - index: false, + "name": "tradeFee", + "type": "u64", + "index": false }, { - name: 'adminFee', - type: 'u64', - index: false, + "name": "adminFee", + "type": "u64", + "index": false }, { - name: 'hostFee', - type: 'u64', - index: false, - }, - ], + "name": "hostFee", + "type": "u64", + "index": false + } + ] }, { - name: 'SetPoolFees', - fields: [ + "name": "SetPoolFees", + "fields": [ { - name: 'tradeFeeNumerator', - type: 'u64', - index: false, + "name": "tradeFeeNumerator", + "type": "u64", + "index": false }, { - name: 'tradeFeeDenominator', - type: 'u64', - index: false, + "name": "tradeFeeDenominator", + "type": "u64", + "index": false }, { - name: 'ownerTradeFeeNumerator', - type: 'u64', - index: false, + "name": "ownerTradeFeeNumerator", + "type": "u64", + "index": false }, { - name: 'ownerTradeFeeDenominator', - type: 'u64', - index: false, - }, - ], + "name": "ownerTradeFeeDenominator", + "type": "u64", + "index": false + } + ] }, { - name: 'PoolInfo', - fields: [ + "name": "PoolInfo", + "fields": [ { - name: 'tokenAAmount', - type: 'u64', - index: false, + "name": "tokenAAmount", + "type": "u64", + "index": false }, { - name: 'tokenBAmount', - type: 'u64', - index: false, + "name": "tokenBAmount", + "type": "u64", + "index": false }, { - name: 'virtualPrice', - type: 'f64', - index: false, + "name": "virtualPrice", + "type": "f64", + "index": false }, { - name: 'currentTimestamp', - type: 'u64', - index: false, - }, - ], + "name": "currentTimestamp", + "type": "u64", + "index": false + } + ] }, { - name: 'TransferAdmin', - fields: [ + "name": "TransferAdmin", + "fields": [ { - name: 'admin', - type: 'publicKey', - index: false, + "name": "admin", + "type": "publicKey", + "index": false }, { - name: 'newAdmin', - type: 'publicKey', - index: false, - }, - ], + "name": "newAdmin", + "type": "publicKey", + "index": false + } + ] }, { - name: 'SetAdminFeeAccount', - fields: [ + "name": "SetAdminFeeAccount", + "fields": [ { - name: 'adminTokenAFee', - type: 'publicKey', - index: false, + "name": "adminTokenAFee", + "type": "publicKey", + "index": false }, { - name: 'adminTokenBFee', - type: 'publicKey', - index: false, + "name": "adminTokenBFee", + "type": "publicKey", + "index": false }, { - name: 'newAdminTokenAFee', - type: 'publicKey', - index: false, + "name": "newAdminTokenAFee", + "type": "publicKey", + "index": false }, { - name: 'newAdminTokenBFee', - type: 'publicKey', - index: false, - }, - ], + "name": "newAdminTokenBFee", + "type": "publicKey", + "index": false + } + ] }, { - name: 'OverrideCurveParam', - fields: [ + "name": "OverrideCurveParam", + "fields": [ { - name: 'newAmp', - type: 'u64', - index: false, + "name": "newAmp", + "type": "u64", + "index": false }, { - name: 'updatedTimestamp', - type: 'u64', - index: false, - }, - ], - }, + "name": "updatedTimestamp", + "type": "u64", + "index": false + } + ] + } ], - errors: [ + "errors": [ { - code: 6000, - name: 'MathOverflow', - msg: 'Math operation overflow', + "code": 6000, + "name": "MathOverflow", + "msg": "Math operation overflow" }, { - code: 6001, - name: 'InvalidFee', - msg: 'Invalid fee setup', + "code": 6001, + "name": "InvalidFee", + "msg": "Invalid fee setup" }, { - code: 6002, - name: 'InvalidInvariant', - msg: 'Invalid invariant d', + "code": 6002, + "name": "InvalidInvariant", + "msg": "Invalid invariant d" }, { - code: 6003, - name: 'FeeCalculationFailure', - msg: 'Fee calculation failure', + "code": 6003, + "name": "FeeCalculationFailure", + "msg": "Fee calculation failure" }, { - code: 6004, - name: 'ExceededSlippage', - msg: 'Exceeded slippage tolerance', + "code": 6004, + "name": "ExceededSlippage", + "msg": "Exceeded slippage tolerance" }, { - code: 6005, - name: 'InvalidCalculation', - msg: 'Invalid curve calculation', + "code": 6005, + "name": "InvalidCalculation", + "msg": "Invalid curve calculation" }, { - code: 6006, - name: 'ZeroTradingTokens', - msg: 'Given pool token amount results in zero trading tokens', + "code": 6006, + "name": "ZeroTradingTokens", + "msg": "Given pool token amount results in zero trading tokens" }, { - code: 6007, - name: 'ConversionError', - msg: 'Math conversion overflow', + "code": 6007, + "name": "ConversionError", + "msg": "Math conversion overflow" }, { - code: 6008, - name: 'FaultyLpMint', - msg: "LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply", + "code": 6008, + "name": "FaultyLpMint", + "msg": "LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply" }, { - code: 6009, - name: 'MismatchedTokenMint', - msg: 'Token mint mismatched', + "code": 6009, + "name": "MismatchedTokenMint", + "msg": "Token mint mismatched" }, { - code: 6010, - name: 'MismatchedLpMint', - msg: 'LP mint mismatched', + "code": 6010, + "name": "MismatchedLpMint", + "msg": "LP mint mismatched" }, { - code: 6011, - name: 'MismatchedOwner', - msg: 'Invalid lp token owner', + "code": 6011, + "name": "MismatchedOwner", + "msg": "Invalid lp token owner" }, { - code: 6012, - name: 'InvalidVaultAccount', - msg: 'Invalid vault account', + "code": 6012, + "name": "InvalidVaultAccount", + "msg": "Invalid vault account" }, { - code: 6013, - name: 'InvalidVaultLpAccount', - msg: 'Invalid vault lp account', + "code": 6013, + "name": "InvalidVaultLpAccount", + "msg": "Invalid vault lp account" }, { - code: 6014, - name: 'InvalidPoolLpMintAccount', - msg: 'Invalid pool lp mint account', + "code": 6014, + "name": "InvalidPoolLpMintAccount", + "msg": "Invalid pool lp mint account" }, { - code: 6015, - name: 'PoolDisabled', - msg: 'Pool disabled', + "code": 6015, + "name": "PoolDisabled", + "msg": "Pool disabled" }, { - code: 6016, - name: 'InvalidAdminAccount', - msg: 'Invalid admin account', + "code": 6016, + "name": "InvalidAdminAccount", + "msg": "Invalid admin account" }, { - code: 6017, - name: 'InvalidAdminFeeAccount', - msg: 'Invalid admin fee account', + "code": 6017, + "name": "InvalidAdminFeeAccount", + "msg": "Invalid admin fee account" }, { - code: 6018, - name: 'SameAdminAccount', - msg: 'Same admin account', + "code": 6018, + "name": "SameAdminAccount", + "msg": "Same admin account" }, { - code: 6019, - name: 'IdenticalSourceDestination', - msg: 'Identical user source and destination token account', + "code": 6019, + "name": "IdenticalSourceDestination", + "msg": "Identical user source and destination token account" }, { - code: 6020, - name: 'ApyCalculationError', - msg: 'Apy calculation error', + "code": 6020, + "name": "ApyCalculationError", + "msg": "Apy calculation error" }, { - code: 6021, - name: 'InsufficientSnapshot', - msg: 'Insufficient virtual price snapshot', + "code": 6021, + "name": "InsufficientSnapshot", + "msg": "Insufficient virtual price snapshot" }, { - code: 6022, - name: 'NonUpdatableCurve', - msg: 'Current curve is non-updatable', + "code": 6022, + "name": "NonUpdatableCurve", + "msg": "Current curve is non-updatable" }, { - code: 6023, - name: 'MisMatchedCurve', - msg: 'New curve is mismatched with old curve', + "code": 6023, + "name": "MisMatchedCurve", + "msg": "New curve is mismatched with old curve" }, { - code: 6024, - name: 'InvalidAmplification', - msg: 'Amplification is invalid', + "code": 6024, + "name": "InvalidAmplification", + "msg": "Amplification is invalid" }, { - code: 6025, - name: 'UnsupportedOperation', - msg: 'Operation is not supported', + "code": 6025, + "name": "UnsupportedOperation", + "msg": "Operation is not supported" }, { - code: 6026, - name: 'ExceedMaxAChanges', - msg: 'Exceed max amplification changes', + "code": 6026, + "name": "ExceedMaxAChanges", + "msg": "Exceed max amplification changes" }, { - code: 6027, - name: 'InvalidRemainingAccountsLen', - msg: 'Invalid remaining accounts length', + "code": 6027, + "name": "InvalidRemainingAccountsLen", + "msg": "Invalid remaining accounts length" }, { - code: 6028, - name: 'InvalidRemainingAccounts', - msg: 'Invalid remaining account', + "code": 6028, + "name": "InvalidRemainingAccounts", + "msg": "Invalid remaining account" }, { - code: 6029, - name: 'MismatchedDepegMint', - msg: "Token mint B doesn't matches depeg type token mint", + "code": 6029, + "name": "MismatchedDepegMint", + "msg": "Token mint B doesn't matches depeg type token mint" }, { - code: 6030, - name: 'InvalidApyAccount', - msg: 'Invalid APY account', + "code": 6030, + "name": "InvalidApyAccount", + "msg": "Invalid APY account" }, { - code: 6031, - name: 'InvalidTokenMultiplier', - msg: 'Invalid token multiplier', + "code": 6031, + "name": "InvalidTokenMultiplier", + "msg": "Invalid token multiplier" }, { - code: 6032, - name: 'InvalidDepegInformation', - msg: 'Invalid depeg information', + "code": 6032, + "name": "InvalidDepegInformation", + "msg": "Invalid depeg information" }, { - code: 6033, - name: 'UpdateTimeConstraint', - msg: 'Update time constraint violated', + "code": 6033, + "name": "UpdateTimeConstraint", + "msg": "Update time constraint violated" }, { - code: 6034, - name: 'ExceedMaxFeeBps', - msg: 'Exceeded max fee bps', + "code": 6034, + "name": "ExceedMaxFeeBps", + "msg": "Exceeded max fee bps" }, { - code: 6035, - name: 'OwnerFeeOverHalfOfTradeFee', - msg: 'Owner fee exceed half of trade fee', + "code": 6035, + "name": "OwnerFeeOverHalfOfTradeFee", + "msg": "Owner fee exceed half of trade fee" }, { - code: 6036, - name: 'InvalidAdmin', - msg: 'Invalid admin', + "code": 6036, + "name": "InvalidAdmin", + "msg": "Invalid admin" }, { - code: 6037, - name: 'PoolIsNotPermissioned', - msg: 'Pool is not permissioned', + "code": 6037, + "name": "PoolIsNotPermissioned", + "msg": "Pool is not permissioned" }, { - code: 6038, - name: 'InvalidDepositAmount', - msg: 'Invalid deposit amount', + "code": 6038, + "name": "InvalidDepositAmount", + "msg": "Invalid deposit amount" }, { - code: 6039, - name: 'InvalidFeeOwner', - msg: 'Invalid fee owner', + "code": 6039, + "name": "InvalidFeeOwner", + "msg": "Invalid fee owner" }, { - code: 6040, - name: 'NonDepletedPool', - msg: 'Pool is not depleted', + "code": 6040, + "name": "NonDepletedPool", + "msg": "Pool is not depleted" }, { - code: 6041, - name: 'AmountNotPeg', - msg: 'Token amount is not 1:1', - }, - ], + "code": 6041, + "name": "AmountNotPeg", + "msg": "Token amount is not 1:1" + } + ] }; diff --git a/ts-client/src/amm/index.ts b/ts-client/src/amm/index.ts index 0bc7d6bf..10bc8204 100644 --- a/ts-client/src/amm/index.ts +++ b/ts-client/src/amm/index.ts @@ -34,7 +34,7 @@ import { VaultProgram, WithdrawQuote, } from './types'; -import { ERROR, SEEDS, UNLOCK_AMOUNT_BUFFER, FEE_OWNER } from './constants'; +import { ERROR, SEEDS, UNLOCK_AMOUNT_BUFFER, FEE_OWNER, METAPLEX_PROGRAM } from './constants'; import { StableSwap, SwapCurve, TradeDirection } from './curve'; import { ConstantProductSwap } from './curve/constant-product'; import { @@ -55,6 +55,7 @@ import { generateCurveType, derivePoolAddress, chunkedFetchMultiplePoolAccount, + deriveMintMetadata, } from './utils'; type Opt = { @@ -253,6 +254,8 @@ export default class AmmImpl implements AmmImplementation { preInstructions = preInstructions.concat(wrapSOLInstruction(payer, payerTokenB, BigInt(tokenBAmount.toString()))); } + const [mintMetadata, _mintMetadataBump] = deriveMintMetadata(lpMint); + const createPermissionlessPoolTx = await ammProgram.methods .initializePermissionlessPoolWithFeeTier(curveType, tradeFeeBps, tokenAAmount, tokenBAmount) .accounts({ @@ -273,6 +276,8 @@ export default class AmmImpl implements AmmImplementation { payerPoolLp, aTokenVault, bTokenVault, + mintMetadata, + metadataProgram: METAPLEX_PROGRAM, feeOwner: FEE_OWNER, payer, rent: SYSVAR_RENT_PUBKEY, diff --git a/ts-client/src/amm/utils.ts b/ts-client/src/amm/utils.ts index 30eae345..bb3256bc 100644 --- a/ts-client/src/amm/utils.ts +++ b/ts-client/src/amm/utils.ts @@ -36,6 +36,7 @@ import { PERMISSIONLESS_AMP, STABLE_SWAP_DEFAULT_TRADE_FEE_BPS, CONSTANT_PRODUCT_DEFAULT_TRADE_FEE_BPS, + METAPLEX_PROGRAM, } from './constants'; import { ConstantProductSwap, StableSwap, SwapCurve, TradeDirection } from './curve'; import { @@ -563,6 +564,13 @@ export async function getTokensMintFromPoolAddress( }; } +export function deriveMintMetadata(lpMint: PublicKey) { + return PublicKey.findProgramAddressSync( + [Buffer.from('metadata'), METAPLEX_PROGRAM.toBuffer(), lpMint.toBuffer()], + METAPLEX_PROGRAM, + ); +} + export function derivePoolAddress( connection: Connection, tokenInfoA: TokenInfo,