diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bd399a..0a3b57a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,6 @@ jobs: with: files: | programs/zap - protocol-zap zap-sdk anchor_build: @@ -67,8 +66,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo test --package zap shell: bash - - run: cargo test --package protocol-zap - shell: bash integration_test: runs-on: ubuntu-latest diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/Cargo.lock b/Cargo.lock index 49d32d6..7ccefcf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -624,21 +624,21 @@ dependencies = [ [[package]] name = "cp-amm" -version = "0.2.1" -source = "git+https://github.com/MeteoraAg/damm-v2?rev=b22a28f4fd9130aa3c46be3bd9633356e621f9eb#b22a28f4fd9130aa3c46be3bd9633356e621f9eb" +version = "0.2.3" +source = "git+https://github.com/MeteoraAg/damm-v2?rev=b66f6d04e6f64ff79e5a0037d5aedd5753c1886e#b66f6d04e6f64ff79e5a0037d5aedd5753c1886e" dependencies = [ "anchor-lang", "anchor-spl", "borsh", "bytemuck", "const-crypto", + "derive-variant-count", "num", "num-traits", "num_enum", - "pinocchio 0.9.0", + "pinocchio", "pinocchio-token", "pinocchio-token-2022", - "protocol-zap", "ruint", "solana-instruction", "spl-token-metadata-interface", @@ -761,6 +761,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive-variant-count" +version = "0.1.0" +source = "git+https://github.com/MeteoraAg/damm-v2?rev=b66f6d04e6f64ff79e5a0037d5aedd5753c1886e#b66f6d04e6f64ff79e5a0037d5aedd5753c1886e" +dependencies = [ + "quote", + "syn 2.0.117", +] + [[package]] name = "digest" version = "0.9.0" @@ -1036,13 +1045,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jupiter" -version = "0.1.0" -dependencies = [ - "anchor-lang", -] - [[package]] name = "keccak" version = "0.1.5" @@ -1322,30 +1324,13 @@ name = "pinocchio" version = "0.9.0" source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" -[[package]] -name = "pinocchio" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b971851087bc3699b001954ad02389d50c41405ece3548cbcafc88b3e20017a" - -[[package]] -name = "pinocchio-pubkey" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0225638cadcbebae8932cb7f49cb5da7c15c21beb19f048f05a5ca7d93f065" -dependencies = [ - "five8_const 0.1.4", - "pinocchio 0.9.2", - "sha2-const-stable", -] - [[package]] name = "pinocchio-pubkey" version = "0.3.0" source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" dependencies = [ "five8_const 0.1.4", - "pinocchio 0.9.0", + "pinocchio", "sha2-const-stable", ] @@ -1354,8 +1339,8 @@ name = "pinocchio-token" version = "0.4.0" source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" dependencies = [ - "pinocchio 0.9.0", - "pinocchio-pubkey 0.3.0 (git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed)", + "pinocchio", + "pinocchio-pubkey", ] [[package]] @@ -1363,8 +1348,8 @@ name = "pinocchio-token-2022" version = "0.1.0" source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" dependencies = [ - "pinocchio 0.9.0", - "pinocchio-pubkey 0.3.0 (git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed)", + "pinocchio", + "pinocchio-pubkey", ] [[package]] @@ -1432,20 +1417,6 @@ dependencies = [ "unarray", ] -[[package]] -name = "protocol-zap" -version = "0.1.0" -dependencies = [ - "borsh", - "jupiter", - "num_enum", - "pinocchio 0.9.2", - "pinocchio-pubkey 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ruint", - "thiserror 2.0.18", - "zap-sdk", -] - [[package]] name = "qstring" version = "0.7.2" diff --git a/Cargo.toml b/Cargo.toml index 3965407..1b910e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["programs/*", "libs/*", "zap-sdk", "protocol-zap"] +members = ["programs/*", "libs/*", "zap-sdk"] resolver = "2" [profile.release] @@ -31,9 +31,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [ # redirect git references from damm-v2 dependency to local workspace crates # to avoid duplicate crate entries at different revisions in Cargo.lock. [patch."https://github.com/MeteoraAg/zap-program"] -protocol-zap = { path = "protocol-zap" } zap-sdk = { path = "zap-sdk" } -jupiter = { path = "libs/jupiter" } [workspace.metadata.cli] solana = "3.1.10" diff --git a/idls/damm_v2.json b/idls/damm_v2.json index a70938b..20d9389 100644 --- a/idls/damm_v2.json +++ b/idls/damm_v2.json @@ -2,7 +2,7 @@ "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG", "metadata": { "name": "cp_amm", - "version": "0.2.0", + "version": "0.2.3", "spec": "0.1.0", "description": "Created with Anchor" }, @@ -57,8 +57,8 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { @@ -70,18 +70,7 @@ "docs": ["Token b program"] }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -151,8 +140,8 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { @@ -164,18 +153,7 @@ "docs": ["Token b program"] }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -184,89 +162,57 @@ "args": [] }, { - "name": "claim_protocol_fee", - "discriminator": [165, 228, 133, 48, 99, 249, 255, 33], + "name": "claim_protocol_fee2", + "discriminator": [235, 194, 54, 69, 65, 10, 236, 112], "accounts": [ { - "name": "pool_authority", - "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" - }, - { - "name": "pool", + "name": "receiver_token_account", + "docs": [ + "receiver token account for the claimed token. validated through the protocol_fee program" + ], "writable": true }, - { - "name": "token_a_vault", - "docs": ["The vault token account for input token"], - "writable": true, - "relations": ["pool"] - }, - { - "name": "token_b_vault", - "docs": ["The vault token account for output token"], - "writable": true, - "relations": ["pool"] - }, { "name": "token_a_mint", - "docs": ["The mint of token a"], "relations": ["pool"] }, { "name": "token_b_mint", - "docs": ["The mint of token b"], "relations": ["pool"] }, { - "name": "token_a_account", - "writable": true - }, - { - "name": "token_b_account", - "writable": true + "name": "token_a_program" }, { - "name": "operator", - "docs": ["Claim fee operator"] + "name": "token_b_program" }, { - "name": "signer", - "docs": ["Operator"], - "signer": true + "name": "pool", + "writable": true }, { - "name": "token_a_program", - "docs": ["Token a program"] + "name": "token_a_vault", + "writable": true, + "relations": ["pool"] }, { - "name": "token_b_program", - "docs": ["Token b program"] + "name": "token_b_vault", + "writable": true, + "relations": ["pool"] }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "pool_authority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" }, { - "name": "program" + "name": "signer", + "signer": true, + "address": "FkU5rQCWQM131skHCpcEbK8P1JrQGsBgqXe55w525SSF" } ], "args": [ { - "name": "max_amount_a", - "type": "u64" - }, - { - "name": "max_amount_b", + "name": "max_amount", "type": "u64" } ] @@ -305,26 +251,15 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { "name": "token_program" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -361,18 +296,7 @@ "writable": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -397,18 +321,7 @@ "writable": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -460,18 +373,7 @@ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -499,18 +401,7 @@ "writable": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -556,18 +447,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -625,18 +505,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -695,18 +564,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -794,18 +652,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -853,18 +700,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -996,18 +832,7 @@ "name": "token_program" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1172,18 +997,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1349,18 +1163,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1530,18 +1333,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1612,18 +1404,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1661,23 +1442,12 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1716,8 +1486,8 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { @@ -1730,18 +1500,7 @@ "address": "11111111111111111111111111111111" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1776,23 +1535,12 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1881,8 +1629,8 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { @@ -1894,18 +1642,7 @@ "docs": ["Token b program"] }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -1976,8 +1713,8 @@ "docs": ["The token account for nft"] }, { - "name": "owner", - "docs": ["owner of position"], + "name": "signer", + "docs": ["Signer"], "signer": true }, { @@ -1989,18 +1726,7 @@ "docs": ["Token b program"] }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2033,18 +1759,7 @@ "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2095,18 +1810,7 @@ "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2161,18 +1865,7 @@ "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2248,18 +1941,7 @@ "optional": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2339,18 +2021,7 @@ "optional": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2367,6 +2038,36 @@ } ] }, + { + "name": "update_delegate_permission", + "discriminator": [175, 165, 56, 64, 0, 251, 89, 47], + "accounts": [ + { + "name": "position", + "writable": true + }, + { + "name": "position_nft_account", + "docs": ["The token account for nft"] + }, + { + "name": "owner", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "permission", + "type": "u32" + } + ] + }, { "name": "update_pool_fees", "discriminator": [118, 217, 203, 179, 60, 8, 70, 89], @@ -2383,18 +2084,7 @@ "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2424,18 +2114,7 @@ "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2465,18 +2144,7 @@ "signer": true }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2494,8 +2162,8 @@ ] }, { - "name": "withdraw_ineligible_reward", - "discriminator": [148, 206, 42, 195, 247, 49, 103, 8], + "name": "withdraw_dead_liquidity_reward", + "discriminator": [121, 99, 224, 91, 178, 14, 22, 132], "accounts": [ { "name": "pool_authority", @@ -2524,18 +2192,7 @@ "name": "token_program" }, { - "name": "event_authority", - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, - 114, 105, 116, 121 - ] - } - ] - } + "name": "event_authority" }, { "name": "program" @@ -2549,8 +2206,8 @@ ] }, { - "name": "zap_protocol_fee", - "discriminator": [213, 155, 187, 34, 56, 182, 91, 240], + "name": "withdraw_ineligible_reward", + "discriminator": [148, 206, 42, 195, 247, 49, 103, 8], "accounts": [ { "name": "pool_authority", @@ -2561,38 +2218,34 @@ "writable": true }, { - "name": "token_vault", + "name": "reward_vault", "writable": true }, { - "name": "token_mint" + "name": "reward_mint" }, { - "name": "receiver_token", + "name": "funder_token_account", "writable": true }, { - "name": "operator", - "docs": ["zap claim fee operator"] + "name": "funder", + "signer": true }, { - "name": "signer", - "docs": ["Operator"], - "signer": true + "name": "token_program" }, { - "name": "token_program", - "docs": ["Token program"] + "name": "event_authority" }, { - "name": "sysvar_instructions", - "address": "Sysvar1nstructions1111111111111111111111111" + "name": "program" } ], "args": [ { - "name": "max_amount", - "type": "u64" + "name": "reward_index", + "type": "u8" } ] } @@ -2641,8 +2294,8 @@ "discriminator": [198, 182, 183, 52, 97, 12, 49, 56] }, { - "name": "EvtClaimProtocolFee", - "discriminator": [186, 244, 75, 251, 188, 13, 25, 33] + "name": "EvtClaimProtocolFee2", + "discriminator": [187, 133, 66, 9, 205, 161, 84, 13] }, { "name": "EvtClaimReward", @@ -2712,6 +2365,10 @@ "name": "EvtSwap2", "discriminator": [189, 66, 51, 168, 38, 80, 117, 153] }, + { + "name": "EvtUpdateDelegatePermission", + "discriminator": [66, 188, 75, 151, 150, 232, 87, 93] + }, { "name": "EvtUpdatePoolFees", "discriminator": [76, 165, 246, 102, 102, 217, 156, 44] @@ -2724,6 +2381,10 @@ "name": "EvtUpdateRewardFunder", "discriminator": [76, 154, 208, 13, 40, 115, 246, 146] }, + { + "name": "EvtWithdrawDeadLiquidityReward", + "discriminator": [228, 66, 150, 195, 42, 62, 163, 13] + }, { "name": "EvtWithdrawIneligibleReward", "discriminator": [248, 215, 184, 78, 31, 180, 179, 168] @@ -3069,6 +2730,21 @@ "code": 6067, "name": "InvalidCompoundingFeeBps", "msg": "Invalid compounding fee bps" + }, + { + "code": 6068, + "name": "InvalidClaimProtocolFeeAccounts", + "msg": "Invalid claim protocol fee accounts" + }, + { + "code": 6069, + "name": "TransferFeeExcludedAmountIsZero", + "msg": "Transfer fee excluded amount is zero" + }, + { + "code": 6070, + "name": "DelegatedAmountNonZero", + "msg": "Delegated amount is not zero" } ], "types": [ @@ -3564,7 +3240,7 @@ } }, { - "name": "EvtClaimProtocolFee", + "name": "EvtClaimProtocolFee2", "type": { "kind": "struct", "fields": [ @@ -3573,11 +3249,15 @@ "type": "pubkey" }, { - "name": "token_a_amount", - "type": "u64" + "name": "receiver_token_account", + "type": "pubkey" }, { - "name": "token_b_amount", + "name": "token_mint", + "type": "pubkey" + }, + { + "name": "amount", "type": "u64" } ] @@ -4273,6 +3953,32 @@ ] } }, + { + "name": "EvtUpdateDelegatePermission", + "type": { + "kind": "struct", + "fields": [ + { + "name": "position", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "permission", + "type": "u32" + }, + { + "name": "delegate", + "type": { + "option": "pubkey" + } + } + ] + } + }, { "name": "EvtUpdatePoolFees", "type": { @@ -4345,6 +4051,26 @@ ] } }, + { + "name": "EvtWithdrawDeadLiquidityReward", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "reward_mint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + } + ] + } + }, { "name": "EvtWithdrawIneligibleReward", "type": { @@ -5176,10 +4902,19 @@ } } }, + { + "name": "delegate_permission", + "docs": [ + "delegate permission bitmask (paired with SPL token Approve)" + ], + "type": "u32" + }, { "name": "padding", "docs": ["padding for future usage"], - "type": "u128" + "type": { + "array": ["u8", 12] + } } ] } @@ -5257,13 +4992,11 @@ } }, { - "name": "_padding_1", + "name": "dead_liquidity_reward_checkpoint", "docs": [ - "Padding to ensure `reward_rate: u128` is 16-byte aligned" + "Cumulative dead-liquidity reward (Compounding Pool only)" ], - "type": { - "array": ["u8", 8] - } + "type": "u64" }, { "name": "mint", @@ -5763,6 +5496,17 @@ } } } + }, + { + "name": "compounding_fee_bps", + "docs": [ + "Compounding fee update mode:", + "- None: skip compounding fee update", + "- Some: update compounding_fee_bps; pool must use CollectFeeMode::Compounding" + ], + "type": { + "option": "u16" + } } ] } diff --git a/libs/jupiter/Cargo.toml b/libs/jupiter/Cargo.toml deleted file mode 100644 index bdf23fd..0000000 --- a/libs/jupiter/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "jupiter" -version = "0.1.0" -description = "Created with Anchor" -edition = "2021" - -[lib] -doctest = false - -[lints] -workspace = true - -[features] -idl-build = ["anchor-lang/idl-build"] - -[dependencies] -anchor-lang = { workspace = true } diff --git a/libs/jupiter/src/lib.rs b/libs/jupiter/src/lib.rs deleted file mode 100644 index 5100bfe..0000000 --- a/libs/jupiter/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -use anchor_lang::prelude::*; - -declare_program!(jupiter); - -pub use jupiter::*; diff --git a/programs/zap/Cargo.toml b/programs/zap/Cargo.toml index c960aad..1a32070 100644 --- a/programs/zap/Cargo.toml +++ b/programs/zap/Cargo.toml @@ -31,6 +31,6 @@ bytemuck = { workspace = true, features = ["derive", "min_const_generics"] } dlmm = { path = "../../libs/dlmm" } damm-v2 = { git = "https://github.com/MeteoraAg/damm-v2", features = [ "cpi", -], rev = "b22a28f4fd9130aa3c46be3bd9633356e621f9eb", package = "cp-amm" } +], rev = "b66f6d04e6f64ff79e5a0037d5aedd5753c1886e", package = "cp-amm" } ruint = { workspace = true } zap-sdk = { path = "../../zap-sdk" } diff --git a/programs/zap/src/instructions/ix_zap_in_damm_v2.rs b/programs/zap/src/instructions/ix_zap_in_damm_v2.rs index 271f3a4..ffaa12f 100644 --- a/programs/zap/src/instructions/ix_zap_in_damm_v2.rs +++ b/programs/zap/src/instructions/ix_zap_in_damm_v2.rs @@ -129,7 +129,7 @@ impl<'info> ZapInDammv2Ctx<'info> { token_a_mint: self.token_a_mint.to_account_info(), token_b_mint: self.token_b_mint.to_account_info(), position_nft_account: self.position_nft_account.to_account_info(), - owner: self.owner.to_account_info(), + signer: self.owner.to_account_info(), token_a_program: self.token_a_program.to_account_info(), token_b_program: self.token_b_program.to_account_info(), event_authority: self.damm_event_authority.to_account_info(), diff --git a/protocol-zap/Cargo.toml b/protocol-zap/Cargo.toml deleted file mode 100644 index 7619cbf..0000000 --- a/protocol-zap/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "protocol-zap" -version = "0.1.0" -edition = "2021" - -[dependencies] -borsh = { workspace = true } -jupiter = { path = "../libs/jupiter" } -ruint = { workspace = true } -num_enum = { workspace = true } -pinocchio = { workspace = true } -pinocchio-pubkey = { workspace = true } -thiserror = { workspace = true } -zap-sdk = { path = "../zap-sdk" } - -[lints] -workspace = true diff --git a/protocol-zap/src/constants.rs b/protocol-zap/src/constants.rs deleted file mode 100644 index 0071ea5..0000000 --- a/protocol-zap/src/constants.rs +++ /dev/null @@ -1,32 +0,0 @@ -use pinocchio::pubkey::Pubkey; -use pinocchio_pubkey::pubkey; - -pub const JUP_V6_SHARED_ACCOUNT_ROUTE_AMOUNT_IN_REVERSE_OFFSET: usize = 1 + 2 + 8 + 8; // Due to jupiter parameters have dynamic length type (vec), we have to do parameters_data.length - JUP_V6_SHARED_ACCOUNT_ROUTE_AMOUNT_IN_REVERSE_OFFSET -pub const JUP_V6_SHARED_ACCOUNT_ROUTE_SOURCE_ACCOUNT_INDEX: usize = 3; -pub const JUP_V6_SHARED_ACCOUNT_ROUTE_DESTINATION_ACCOUNT_INDEX: usize = 6; - -pub const JUP_V6_ROUTE_AMOUNT_IN_REVERSE_OFFSET: usize = 1 + 2 + 8 + 8; -pub const JUP_V6_ROUTE_SOURCE_ACCOUNT_INDEX: usize = 2; -pub const JUP_V6_ROUTE_DESTINATION_ACCOUNT_INDEX: usize = 4; - -pub const DLMM_SWAP2_AMOUNT_IN_OFFSET: u16 = 8; -pub const DLMM_SWAP2_SOURCE_ACCOUNT_INDEX: usize = 4; -pub const DLMM_SWAP2_DESTINATION_ACCOUNT_INDEX: usize = 5; - -pub const DAMM_V2_SWAP_AMOUNT_IN_OFFSET: u16 = 8; -pub const DAMM_V2_SWAP_SOURCE_ACCOUNT_INDEX: usize = 2; -pub const DAMM_V2_SWAP_DESTINATION_ACCOUNT_INDEX: usize = 3; - -pub const ZAP: Pubkey = pubkey!("zapvX9M3uf5pvy4wRPAbQgdQsM1xmuiFnkfHKPvwMiz"); -pub const ZAP_OUT_DISC: [u8; 8] = [155, 108, 185, 112, 104, 210, 161, 64]; - -pub const USDC_ADDRESS: Pubkey = pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); - -pub const SOL_ADDRESS: Pubkey = pubkey!("So11111111111111111111111111111111111111112"); - -pub const MINTS_DISALLOWED_TO_ZAP_OUT: [Pubkey; 2] = [USDC_ADDRESS, SOL_ADDRESS]; - -pub const SPL_TOKEN_PROGRAM_ID: Pubkey = pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"); - -pub const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID: Pubkey = - pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"); diff --git a/protocol-zap/src/error.rs b/protocol-zap/src/error.rs deleted file mode 100644 index 4e0ae58..0000000 --- a/protocol-zap/src/error.rs +++ /dev/null @@ -1,37 +0,0 @@ -use num_enum::{IntoPrimitive, TryFromPrimitive}; -use pinocchio::program_error::ProgramError; -use thiserror::Error; - -#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(u32)] -pub enum ProtozolZapError { - #[error("Math operation overflow")] - MathOverflow = 0, - - #[error("Invalid zapout parameters")] - InvalidZapOutParameters = 1, - - #[error("Type cast error")] - TypeCastFailed = 2, - - #[error("Missing zap out instruction")] - MissingZapOutInstruction = 3, - - #[error("Invalid withdraw protocol fee zap accounts")] - InvalidWithdrawProtocolFeeZapAccounts = 4, - - #[error("SOL,USDC protocol fee cannot be withdrawn via zap")] - MintRestrictedFromZap = 5, - - #[error("CPI disabled")] - CpiDisabled = 6, - - #[error("Invalid zap accounts")] - InvalidZapAccounts = 7, -} - -impl From for ProgramError { - fn from(e: ProtozolZapError) -> Self { - ProgramError::Custom(e as u32) - } -} diff --git a/protocol-zap/src/lib.rs b/protocol-zap/src/lib.rs deleted file mode 100644 index 5cf5da5..0000000 --- a/protocol-zap/src/lib.rs +++ /dev/null @@ -1,62 +0,0 @@ -use borsh::{BorshDeserialize, BorshSerialize}; -use pinocchio::pubkey::Pubkey; -pub mod constants; -pub mod processors; -pub use processors::*; -use zap_sdk::constants::{ - DAMM_V2, DAMM_V2_SWAP_DISC, DLMM, DLMM_SWAP2_DISC, JUP_V6, JUP_V6_ROUTE_DISC, - JUP_V6_SHARED_ACCOUNT_ROUTE_DISC, -}; - -use crate::error::ProtozolZapError; -pub mod error; -pub mod safe_math; -pub mod tests; -pub mod utils; - -#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug)] -pub struct ZapOutParameters { - pub percentage: u8, - pub offset_amount_in: u16, - pub pre_user_token_balance: u64, - pub max_swap_amount: u64, // avoid the issue someone send token to user token account when user zap out - pub payload_data: Vec, -} - -pub struct RawZapOutAmmInfo { - source_index: usize, - destination_index: usize, - amount_in_offset: u16, -} - -pub trait ZapInfoProcessor { - fn validate_payload(&self, payload: &[u8]) -> Result<(), ProtozolZapError>; - fn extract_raw_zap_out_amm_info( - &self, - zap_params: &ZapOutParameters, - ) -> Result; -} - -const DAMM_V2_SWAP_DISC_REF: &[u8] = &DAMM_V2_SWAP_DISC; -const DLMM_SWAP2_DISC_REF: &[u8] = &DLMM_SWAP2_DISC; -const JUP_V6_ROUTE_DISC_REF: &[u8] = &JUP_V6_ROUTE_DISC; -const JUP_V6_SHARED_ACCOUNT_ROUTE_DISC_REF: &[u8] = &JUP_V6_SHARED_ACCOUNT_ROUTE_DISC; - -const DLMM_ADDRESS: Pubkey = DLMM.to_bytes(); -const DAMM_V2_ADDRESS: Pubkey = DAMM_V2.to_bytes(); -const JUP_V6_ADDRESS: Pubkey = JUP_V6.to_bytes(); - -pub fn get_zap_amm_processor( - amm_disc: &[u8], - amm_program_address: Pubkey, -) -> Result, ProtozolZapError> { - match (amm_disc, amm_program_address) { - (DLMM_SWAP2_DISC_REF, DLMM_ADDRESS) => Ok(Box::new(ZapDlmmInfoProcessor)), - (DAMM_V2_SWAP_DISC_REF, DAMM_V2_ADDRESS) => Ok(Box::new(ZapDammV2InfoProcessor)), - (JUP_V6_ROUTE_DISC_REF, JUP_V6_ADDRESS) => Ok(Box::new(ZapJupV6RouteInfoProcessor)), - (JUP_V6_SHARED_ACCOUNT_ROUTE_DISC_REF, JUP_V6_ADDRESS) => { - Ok(Box::new(ZapJupV6SharedRouteInfoProcessor)) - } - _ => Err(ProtozolZapError::InvalidZapOutParameters), - } -} diff --git a/protocol-zap/src/processors/damm_v2_zap.rs b/protocol-zap/src/processors/damm_v2_zap.rs deleted file mode 100644 index f81d79e..0000000 --- a/protocol-zap/src/processors/damm_v2_zap.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::{ - constants::{ - DAMM_V2_SWAP_AMOUNT_IN_OFFSET, DAMM_V2_SWAP_DESTINATION_ACCOUNT_INDEX, - DAMM_V2_SWAP_SOURCE_ACCOUNT_INDEX, - }, - error::ProtozolZapError, - RawZapOutAmmInfo, ZapInfoProcessor, ZapOutParameters, -}; - -pub struct ZapDammV2InfoProcessor; - -impl ZapInfoProcessor for ZapDammV2InfoProcessor { - fn validate_payload(&self, _payload: &[u8]) -> Result<(), ProtozolZapError> { - Ok(()) - } - - fn extract_raw_zap_out_amm_info( - &self, - _zap_params: &ZapOutParameters, - ) -> Result { - Ok(RawZapOutAmmInfo { - source_index: DAMM_V2_SWAP_SOURCE_ACCOUNT_INDEX, - destination_index: DAMM_V2_SWAP_DESTINATION_ACCOUNT_INDEX, - amount_in_offset: DAMM_V2_SWAP_AMOUNT_IN_OFFSET, - }) - } -} diff --git a/protocol-zap/src/processors/dlmm_zap.rs b/protocol-zap/src/processors/dlmm_zap.rs deleted file mode 100644 index abb22bd..0000000 --- a/protocol-zap/src/processors/dlmm_zap.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::{ - constants::{ - DLMM_SWAP2_AMOUNT_IN_OFFSET, DLMM_SWAP2_DESTINATION_ACCOUNT_INDEX, - DLMM_SWAP2_SOURCE_ACCOUNT_INDEX, - }, - error::ProtozolZapError, - RawZapOutAmmInfo, ZapInfoProcessor, ZapOutParameters, -}; - -pub struct ZapDlmmInfoProcessor; - -impl ZapInfoProcessor for ZapDlmmInfoProcessor { - fn validate_payload(&self, _payload: &[u8]) -> Result<(), ProtozolZapError> { - Ok(()) - } - - fn extract_raw_zap_out_amm_info( - &self, - _zap_params: &ZapOutParameters, - ) -> Result { - Ok(RawZapOutAmmInfo { - source_index: DLMM_SWAP2_SOURCE_ACCOUNT_INDEX, - destination_index: DLMM_SWAP2_DESTINATION_ACCOUNT_INDEX, - amount_in_offset: DLMM_SWAP2_AMOUNT_IN_OFFSET, - }) - } -} diff --git a/protocol-zap/src/processors/jup_v6_zap.rs b/protocol-zap/src/processors/jup_v6_zap.rs deleted file mode 100644 index c9fe2b7..0000000 --- a/protocol-zap/src/processors/jup_v6_zap.rs +++ /dev/null @@ -1,146 +0,0 @@ -use std::collections::{HashMap, HashSet}; - -use crate::{ - constants::{ - JUP_V6_ROUTE_AMOUNT_IN_REVERSE_OFFSET, JUP_V6_ROUTE_DESTINATION_ACCOUNT_INDEX, - JUP_V6_ROUTE_SOURCE_ACCOUNT_INDEX, JUP_V6_SHARED_ACCOUNT_ROUTE_AMOUNT_IN_REVERSE_OFFSET, - JUP_V6_SHARED_ACCOUNT_ROUTE_DESTINATION_ACCOUNT_INDEX, - JUP_V6_SHARED_ACCOUNT_ROUTE_SOURCE_ACCOUNT_INDEX, - }, - error::ProtozolZapError, - safe_math::{SafeCast, SafeMath}, - RawZapOutAmmInfo, ZapInfoProcessor, ZapOutParameters, -}; -use borsh::BorshDeserialize; -use jupiter::types::RoutePlanStep; -use jupiter::types::Swap; - -pub struct ZapJupV6RouteInfoProcessor; - -fn ensure_whitelisted_swap_leg(route_plan_steps: &[RoutePlanStep]) -> Result<(), ProtozolZapError> { - for step in route_plan_steps { - match step.swap { - Swap::Meteora - | Swap::MeteoraDammV2 - | Swap::MeteoraDammV2WithRemainingAccounts - | Swap::MeteoraDlmm - | Swap::MeteoraDlmmSwapV2 { .. } - | Swap::Mercurial - | Swap::Whirlpool { .. } - | Swap::WhirlpoolSwapV2 { .. } - | Swap::Raydium - | Swap::RaydiumV2 - | Swap::RaydiumCP - | Swap::RaydiumClmm - | Swap::RaydiumClmmV2 => { - // whitelisted swap leg - } - _ => return Err(ProtozolZapError::InvalidZapOutParameters), - } - } - - Ok(()) -} - -/// Validates that the route plan fully converges -/// - Every input index (original and intermediate) must be 100% consumed -/// - All swap paths must converge to exactly one terminal output -pub(crate) fn ensure_route_plan_fully_converges( - route_plan_steps: &[RoutePlanStep], -) -> Result<(), ProtozolZapError> { - let mut input_percent: HashMap = HashMap::new(); - let mut output_indices = HashSet::new(); - - for step in route_plan_steps { - let percent = input_percent.entry(step.input_index).or_insert(0); - *percent = percent - .checked_add(step.percent) - .ok_or_else(|| ProtozolZapError::MathOverflow)?; - output_indices.insert(step.output_index); - } - - // Verify each unique input_index sums to exactly 100% - if input_percent.values().any(|value| *value != 100) { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - // Count terminal outputs: unique outputs never used as inputs - let terminal_count = output_indices - .iter() - .filter(|idx| !input_percent.contains_key(idx)) - .count(); - - if terminal_count != 1 { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - Ok(()) -} - -impl ZapInfoProcessor for ZapJupV6RouteInfoProcessor { - fn validate_payload(&self, payload: &[u8]) -> Result<(), ProtozolZapError> { - let route_params = jupiter::client::args::Route::try_from_slice(payload) - .map_err(|_| ProtozolZapError::InvalidZapOutParameters)?; - ensure_whitelisted_swap_leg(&route_params.route_plan)?; - ensure_route_plan_fully_converges(&route_params.route_plan)?; - - // Ensure no platform_fee_bps is 0, so operator can't steal funds by providing their account as platform_fee_account - if route_params.platform_fee_bps != 0 { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - Ok(()) - } - - fn extract_raw_zap_out_amm_info( - &self, - zap_params: &ZapOutParameters, - ) -> Result { - let amount_in_offset = zap_params - .payload_data - .len() - .safe_sub(JUP_V6_ROUTE_AMOUNT_IN_REVERSE_OFFSET)? - .safe_cast()?; - - Ok(RawZapOutAmmInfo { - source_index: JUP_V6_ROUTE_SOURCE_ACCOUNT_INDEX, - destination_index: JUP_V6_ROUTE_DESTINATION_ACCOUNT_INDEX, - amount_in_offset, - }) - } -} - -pub struct ZapJupV6SharedRouteInfoProcessor; - -impl ZapInfoProcessor for ZapJupV6SharedRouteInfoProcessor { - fn validate_payload(&self, payload: &[u8]) -> Result<(), ProtozolZapError> { - let route_params = jupiter::client::args::SharedAccountsRoute::try_from_slice(payload) - .map_err(|_| ProtozolZapError::InvalidZapOutParameters)?; - ensure_whitelisted_swap_leg(&route_params.route_plan)?; - ensure_route_plan_fully_converges(&route_params.route_plan)?; - - // Ensure no platform_fee_bps is 0, so operator can't steal funds by providing their account as platform_fee_account - if route_params.platform_fee_bps != 0 { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - Ok(()) - } - - fn extract_raw_zap_out_amm_info( - &self, - zap_params: &ZapOutParameters, - ) -> Result { - let amount_in_offset = zap_params - .payload_data - .len() - .safe_sub(JUP_V6_SHARED_ACCOUNT_ROUTE_AMOUNT_IN_REVERSE_OFFSET)? - .safe_cast()?; - - Ok(RawZapOutAmmInfo { - source_index: JUP_V6_SHARED_ACCOUNT_ROUTE_SOURCE_ACCOUNT_INDEX, - destination_index: JUP_V6_SHARED_ACCOUNT_ROUTE_DESTINATION_ACCOUNT_INDEX, - amount_in_offset, - }) - } -} diff --git a/protocol-zap/src/processors/mod.rs b/protocol-zap/src/processors/mod.rs deleted file mode 100644 index 6d383b2..0000000 --- a/protocol-zap/src/processors/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod damm_v2_zap; -pub use damm_v2_zap::*; -pub mod dlmm_zap; -pub use dlmm_zap::*; -pub mod jup_v6_zap; -pub use jup_v6_zap::*; diff --git a/protocol-zap/src/safe_math.rs b/protocol-zap/src/safe_math.rs deleted file mode 100644 index c801863..0000000 --- a/protocol-zap/src/safe_math.rs +++ /dev/null @@ -1,124 +0,0 @@ -use crate::error::ProtozolZapError; -use pinocchio::msg; -use ruint::aliases::U256; -use std::panic::Location; - -/// safe math module -pub trait SafeMath: Sized { - /// safe add - fn safe_add(self, rhs: Self) -> Result; - /// safe mul - fn safe_mul(self, rhs: Self) -> Result; - /// safe div - fn safe_div(self, rhs: Self) -> Result; - /// safe sub - fn safe_sub(self, rhs: Self) -> Result; -} - -macro_rules! checked_impl { - ($t:ty, $offset:ty) => { - impl SafeMath<$offset> for $t { - #[inline(always)] - fn safe_add(self, v: $t) -> Result<$t, ProtozolZapError> { - match self.checked_add(v) { - Some(result) => Ok(result), - None => { - let caller = Location::caller(); - msg!(&format!( - "Math error thrown at {}:{}", - caller.file(), - caller.line() - )); - Err(ProtozolZapError::MathOverflow) - } - } - } - - #[inline(always)] - fn safe_sub(self, v: $t) -> Result<$t, ProtozolZapError> { - match self.checked_sub(v) { - Some(result) => Ok(result), - None => { - let caller = Location::caller(); - msg!(&format!( - "Math error thrown at {}:{}", - caller.file(), - caller.line() - )); - Err(ProtozolZapError::MathOverflow) - } - } - } - - #[inline(always)] - fn safe_mul(self, v: $t) -> Result<$t, ProtozolZapError> { - match self.checked_mul(v) { - Some(result) => Ok(result), - None => { - let caller = Location::caller(); - msg!(&format!( - "Math error thrown at {}:{}", - caller.file(), - caller.line() - )); - Err(ProtozolZapError::MathOverflow) - } - } - } - - #[inline(always)] - fn safe_div(self, v: $t) -> Result<$t, ProtozolZapError> { - match self.checked_div(v) { - Some(result) => Ok(result), - None => { - let caller = Location::caller(); - msg!(&format!( - "Math error thrown at {}:{}", - caller.file(), - caller.line() - )); - Err(ProtozolZapError::MathOverflow) - } - } - } - } - }; -} - -checked_impl!(u16, u32); -checked_impl!(i32, u32); -checked_impl!(u32, u32); -checked_impl!(u64, u32); -checked_impl!(i64, u32); -checked_impl!(u128, u32); -checked_impl!(i128, u32); -checked_impl!(usize, u32); -checked_impl!(U256, usize); - -pub trait SafeCast: Sized { - fn safe_cast(self) -> Result; -} - -macro_rules! try_into_impl { - ($t:ty, $v:ty) => { - impl SafeCast<$v> for $t { - #[track_caller] - fn safe_cast(self) -> Result<$v, ProtozolZapError> { - match self.try_into() { - Ok(result) => Ok(result), - Err(_) => { - let caller = Location::caller(); - msg!(&format!( - "TypeCast is failed at {}:{}", - caller.file(), - caller.line() - )); - Err(ProtozolZapError::TypeCastFailed) - } - } - } - } - }; -} - -try_into_impl!(usize, u16); diff --git a/protocol-zap/src/tests/jup_v6_tests.rs b/protocol-zap/src/tests/jup_v6_tests.rs deleted file mode 100644 index 3e3b240..0000000 --- a/protocol-zap/src/tests/jup_v6_tests.rs +++ /dev/null @@ -1,383 +0,0 @@ -use jupiter::types::{RoutePlanStep, Swap}; - -use crate::jup_v6_zap::ensure_route_plan_fully_converges; - -#[test] -fn test_ensure_route_plan_fully_converges_success() { - let route_plan_1_market = vec![RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 0, - output_index: 1, - }]; - assert!(ensure_route_plan_fully_converges(&route_plan_1_market).is_ok()); - - // Layer 1 Split into 3: 0 -> 1 (60%), 0 -> 2 (5%), 0 -> 3 (35%) - // Layer 2 Split into 3: 1 -> 5 (50%), 1 -> 6 (50%), 2 -> 6 (100%), 3 -> 6 (33%), 3 -> 7 (67%) - // Layer 3 Converge into 1: 5 -> 8 (100%), 6 -> 8 (100%), 7 -> 8 (100%) - let route_plan_funnel = vec![ - // Layer 1 - RoutePlanStep { - swap: Swap::MeteoraDammV2, - percent: 60, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 5, - input_index: 0, - output_index: 2, - }, - RoutePlanStep { - swap: Swap::MeteoraDlmm, - percent: 35, - input_index: 0, - output_index: 3, - }, - // Layer 2 - RoutePlanStep { - swap: Swap::RaydiumClmm, - percent: 50, - input_index: 1, - output_index: 5, - }, - RoutePlanStep { - swap: Swap::Mercurial, - percent: 50, - input_index: 1, - output_index: 6, - }, - RoutePlanStep { - swap: Swap::RaydiumClmmV2, - percent: 100, - input_index: 2, - output_index: 6, - }, - RoutePlanStep { - swap: Swap::RaydiumV2, - percent: 33, - input_index: 3, - output_index: 6, - }, - RoutePlanStep { - swap: Swap::RaydiumCP, - percent: 67, - input_index: 3, - output_index: 7, - }, - // Layer 3 - RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 5, - output_index: 8, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2WithRemainingAccounts, - percent: 100, - input_index: 6, - output_index: 8, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2, - percent: 100, - input_index: 7, - output_index: 8, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_funnel).is_ok()); - - let route_plan_sequential = vec![ - RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::RaydiumClmm, - percent: 100, - input_index: 1, - output_index: 2, - }, - RoutePlanStep { - swap: Swap::Mercurial, - percent: 100, - input_index: 2, - output_index: 3, - }, - RoutePlanStep { - swap: Swap::RaydiumCP, - percent: 100, - input_index: 3, - output_index: 4, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2, - percent: 100, - input_index: 4, - output_index: 5, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_sequential).is_ok()); - - // diamond: 1 -> 2 -> 4 -> 2 -> 1 - // Layer 1: 0 -> 1 (60%), 0 -> 2 (40%) - // Layer 2: 1 -> 3 (70%), 1 -> 4 (30%), 2 -> 5 (25%), 2 -> 6 (75%) - // Layer 3: 3 -> 7 (100%), 4 -> 7 (100%), 5 -> 8 (100%), 6 -> 8 (100%) - // Layer 4: 7 -> 9 (100%), 8 -> 9 (100%) - let route_plan_diamond = vec![ - // Layer 1: split 1 -> 2 - RoutePlanStep { - swap: Swap::Meteora, - percent: 60, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 40, - input_index: 0, - output_index: 2, - }, - // Layer 2: split 2 -> 4 - RoutePlanStep { - swap: Swap::MeteoraDlmm, - percent: 70, - input_index: 1, - output_index: 3, - }, - RoutePlanStep { - swap: Swap::RaydiumCP, - percent: 30, - input_index: 1, - output_index: 4, - }, - RoutePlanStep { - swap: Swap::RaydiumClmm, - percent: 25, - input_index: 2, - output_index: 5, - }, - RoutePlanStep { - swap: Swap::Mercurial, - percent: 75, - input_index: 2, - output_index: 6, - }, - // Layer 3: converge 4 -> 2 - RoutePlanStep { - swap: Swap::MeteoraDammV2, - percent: 100, - input_index: 3, - output_index: 7, - }, - RoutePlanStep { - swap: Swap::RaydiumV2, - percent: 100, - input_index: 4, - output_index: 7, - }, - RoutePlanStep { - swap: Swap::RaydiumClmmV2, - percent: 100, - input_index: 5, - output_index: 8, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2WithRemainingAccounts, - percent: 100, - input_index: 6, - output_index: 8, - }, - // Layer 4: converge 2 -> 1 - RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 7, - output_index: 9, - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 100, - input_index: 8, - output_index: 9, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_diamond).is_ok()); -} - -#[test] -fn test_ensure_route_plan_fully_converges_failure() { - let route_plan_1_market = vec![RoutePlanStep { - swap: Swap::Meteora, - percent: 50, - input_index: 0, - output_index: 1, - }]; - assert!(ensure_route_plan_fully_converges(&route_plan_1_market).is_err()); - - let route_plan_empty: Vec = vec![]; - assert!(ensure_route_plan_fully_converges(&route_plan_empty).is_err()); - - let route_plan_cycle = vec![ - RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 100, - input_index: 1, - output_index: 0, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_cycle).is_err()); - - let route_plan_over_100_pct = vec![ - RoutePlanStep { - swap: Swap::Meteora, - percent: 60, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 60, - input_index: 0, - output_index: 2, - }, - RoutePlanStep { - swap: Swap::MeteoraDlmm, - percent: 100, - input_index: 1, - output_index: 3, - }, - RoutePlanStep { - swap: Swap::RaydiumCP, - percent: 100, - input_index: 2, - output_index: 3, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_over_100_pct).is_err()); - - let route_plan_sequential = vec![ - RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::RaydiumClmm, - percent: 100, - input_index: 1, - output_index: 2, - }, - RoutePlanStep { - swap: Swap::Mercurial, - percent: 80, // not 100 - input_index: 2, - output_index: 3, - }, - RoutePlanStep { - swap: Swap::RaydiumCP, - percent: 100, - input_index: 3, - output_index: 4, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2, - percent: 100, - input_index: 4, - output_index: 5, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_sequential).is_err()); - - // Same as happy diamond but layer 4 outputs diverge: 7 -> 9, 8 -> 10 - // Two terminal outputs (9 and 10) - // Layer 1: 0 -> 1 (60%), 0 -> 2 (40%) - // Layer 2: 1 -> 3 (70%), 1 -> 4 (30%), 2 -> 5 (25%), 2 -> 6 (75%) - // Layer 3: 3 -> 7 (100%), 4 -> 7 (100%), 5 -> 8 (100%), 6 -> 8 (100%) - // Layer 4: 7 -> 9 (100%), 8 -> 10 (100%) <-- diverges - let route_plan_diamond = vec![ - RoutePlanStep { - swap: Swap::Meteora, - percent: 60, - input_index: 0, - output_index: 1, - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 40, - input_index: 0, - output_index: 2, - }, - RoutePlanStep { - swap: Swap::MeteoraDlmm, - percent: 70, - input_index: 1, - output_index: 3, - }, - RoutePlanStep { - swap: Swap::RaydiumCP, - percent: 30, - input_index: 1, - output_index: 4, - }, - RoutePlanStep { - swap: Swap::RaydiumClmm, - percent: 25, - input_index: 2, - output_index: 5, - }, - RoutePlanStep { - swap: Swap::Mercurial, - percent: 75, - input_index: 2, - output_index: 6, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2, - percent: 100, - input_index: 3, - output_index: 7, - }, - RoutePlanStep { - swap: Swap::RaydiumV2, - percent: 100, - input_index: 4, - output_index: 7, - }, - RoutePlanStep { - swap: Swap::RaydiumClmmV2, - percent: 100, - input_index: 5, - output_index: 8, - }, - RoutePlanStep { - swap: Swap::MeteoraDammV2WithRemainingAccounts, - percent: 100, - input_index: 6, - output_index: 8, - }, - RoutePlanStep { - swap: Swap::Meteora, - percent: 100, - input_index: 7, - output_index: 9, // two terminal outputs (9 and 10) - }, - RoutePlanStep { - swap: Swap::Raydium, - percent: 100, - input_index: 8, - output_index: 10, - }, - ]; - assert!(ensure_route_plan_fully_converges(&route_plan_diamond).is_err()); -} diff --git a/protocol-zap/src/tests/mod.rs b/protocol-zap/src/tests/mod.rs deleted file mode 100644 index c15fefb..0000000 --- a/protocol-zap/src/tests/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(test)] -pub mod jup_v6_tests; - -#[cfg(test)] -pub mod safe_math_tests; diff --git a/protocol-zap/src/tests/safe_math_tests.rs b/protocol-zap/src/tests/safe_math_tests.rs deleted file mode 100644 index 07e78be..0000000 --- a/protocol-zap/src/tests/safe_math_tests.rs +++ /dev/null @@ -1,30 +0,0 @@ -#[cfg(test)] -use crate::safe_math::SafeMath; - -#[test] -fn safe_add() { - assert_eq!(u64::MAX.safe_add(u64::MAX).is_err(), true); - assert_eq!(100u64.safe_add(100u64).is_ok(), true); - assert_eq!(100u64.safe_add(100u64).unwrap(), 200u64); -} - -#[test] -fn safe_sub() { - assert_eq!(0u64.safe_sub(u64::MAX).is_err(), true); - assert_eq!(200u64.safe_sub(100u64).is_ok(), true); - assert_eq!(200u64.safe_sub(100u64).unwrap(), 100u64); -} - -#[test] -fn safe_mul() { - assert_eq!(u64::MAX.safe_mul(u64::MAX).is_err(), true); - assert_eq!(100u64.safe_mul(100u64).is_ok(), true); - assert_eq!(100u64.safe_mul(100u64).unwrap(), 10000u64); -} - -#[test] -fn safe_div() { - assert_eq!(100u64.safe_div(0u64).is_err(), true); - assert_eq!(200u64.safe_div(100u64).is_ok(), true); - assert_eq!(200u64.safe_div(100u64), Ok(2u64)); -} diff --git a/protocol-zap/src/utils/mod.rs b/protocol-zap/src/utils/mod.rs deleted file mode 100644 index f1ee912..0000000 --- a/protocol-zap/src/utils/mod.rs +++ /dev/null @@ -1,209 +0,0 @@ -use crate::constants::{SOL_ADDRESS, USDC_ADDRESS}; -use crate::error::ProtozolZapError; -use crate::safe_math::SafeMath; -use crate::{constants, get_zap_amm_processor, RawZapOutAmmInfo, ZapOutParameters}; -use borsh::BorshDeserialize; -use pinocchio::pubkey::Pubkey; -use pinocchio::sysvars::instructions::{Instructions, IntrospectedInstruction}; -mod token; -use token::{get_associated_token_address, get_token_amount}; - -fn validate_zap_parameters( - zap_params: &ZapOutParameters, - max_claim_amount: u64, - amount_in_offset: u16, - claimer_token_account_data: &[u8], -) -> Result<(), ProtozolZapError> { - if zap_params.percentage != 100 { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - if zap_params.offset_amount_in != amount_in_offset { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - // Ensure no stealing from operator by setting a higher pre_token_balance than actual balance to steal fund - // Eg: Operator set 100 pre balance, but actual balance is 0 - // Actual claimed amount is 300 - // Zap will attempt to swap post - pre = 300 - 100 = 200 - // Leftover 100 will be stolen by operator - if zap_params.pre_user_token_balance != get_token_amount(claimer_token_account_data)? { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - // Ensure max swap amount is greater than or equal to max claim amount - // meaning operator must swap at least the amount of the claim amount - if zap_params.max_swap_amount < max_claim_amount { - return Err(ProtozolZapError::InvalidZapOutParameters); - } - - Ok(()) -} - -// Search for zap out instruction in the next instruction after the current one -fn search_and_validate_zap_out_instruction( - max_claim_amount: u64, - sysvar_instructions: &Instructions<&[u8]>, - claimer_token_account_key: &Pubkey, - claimer_token_account_data: &[u8], - treasury_address: &Pubkey, - treasury_paired_destination_token_address: &Pubkey, -) -> Result<(), ProtozolZapError> { - // Zap out instruction must be next to current instruction - let ix = sysvar_instructions - .get_instruction_relative(1) - .map_err(|_| ProtozolZapError::MissingZapOutInstruction)?; - - if *ix.get_program_id() != constants::ZAP { - return Err(ProtozolZapError::MissingZapOutInstruction); - } - - let disc = ix - .get_instruction_data() - .get(..8) - .ok_or_else(|| ProtozolZapError::InvalidZapOutParameters)?; - - if disc != constants::ZAP_OUT_DISC { - return Err(ProtozolZapError::MissingZapOutInstruction); - } - - let zap_params = ZapOutParameters::try_from_slice(&ix.get_instruction_data()[8..]) - .map_err(|_| ProtozolZapError::InvalidZapOutParameters)?; - - let ZapOutAmmInfo { - zap_user_token_in_address, - amm_source_token_address: source_token_address, - amm_destination_token_address: destination_token_address, - amount_in_offset, - } = extract_amm_accounts_and_info(&zap_params, ix)?; - - // Zap out from operator fee receiving account - validate_zap_parameters( - &zap_params, - max_claim_amount, - amount_in_offset, - claimer_token_account_data, - )?; - - // There's no validation to make sure that `user_token_in_account` is the same as `amm_source_token_address` - // Operator could steal the fund by providing a fake token account with 0 to bypass the zap swap invoke - // https://github.com/MeteoraAg/zap-program/blob/117e7d5586aa27cf97e6fde6266e25ee4e496f18/programs/zap/src/instructions/ix_zap_out.rs#L91 - if zap_user_token_in_address != *claimer_token_account_key { - return Err(ProtozolZapError::InvalidZapAccounts); - } - - // Zap out from operator fee receiving account - if source_token_address != *claimer_token_account_key { - return Err(ProtozolZapError::InvalidZapAccounts); - } - - let treasury_usdc_address = get_associated_token_address(&treasury_address, &USDC_ADDRESS); - let treasury_sol_address = get_associated_token_address(&treasury_address, &SOL_ADDRESS); - - // Zap to paired mint in the pool, or SOL, or USDC treasury - if destination_token_address != *treasury_paired_destination_token_address - && destination_token_address != treasury_usdc_address - && destination_token_address != treasury_sol_address - { - return Err(ProtozolZapError::InvalidZapAccounts); - } - - Ok(()) -} - -pub fn validate_zap_out_to_treasury( - claimed_amount: u64, - calling_program_id: &Pubkey, - claimer_token_account_key: &Pubkey, - claimer_token_account_data: &[u8], - sysvar_instructions_data: &[u8], - treasury_address: &Pubkey, - treasury_paired_destination_token_address: &Pubkey, -) -> Result<(), ProtozolZapError> { - let sysvar_instructions = unsafe { Instructions::new_unchecked(sysvar_instructions_data) }; - let current_index = sysvar_instructions.load_current_index(); - - let current_instruction = sysvar_instructions - .load_instruction_at(current_index.into()) - .map_err(|_| ProtozolZapError::InvalidZapAccounts)?; - - // Ensure the instruction is direct instruction call - if *current_instruction.get_program_id() != *calling_program_id { - return Err(ProtozolZapError::CpiDisabled); - } - - search_and_validate_zap_out_instruction( - claimed_amount, - &sysvar_instructions, - claimer_token_account_key, - claimer_token_account_data, - treasury_address, - treasury_paired_destination_token_address, - )?; - - Ok(()) -} -pub struct ZapOutAmmInfo { - // Account used to compare delta changes with pre_balance to decide swap amount - pub zap_user_token_in_address: Pubkey, - pub amm_source_token_address: Pubkey, - pub amm_destination_token_address: Pubkey, - pub amount_in_offset: u16, -} - -fn extract_amm_accounts_and_info( - zap_params: &ZapOutParameters, - zap_in_instruction: IntrospectedInstruction<'_>, -) -> Result { - // Accounts in ZapOutCtx - const ZAP_OUT_ACCOUNTS_LEN: usize = 2; - - let zap_user_token_in_address = zap_in_instruction - .get_account_meta_at(0) - .map_err(|_| ProtozolZapError::InvalidZapAccounts)? - .key; - - let zap_amm_program_address = zap_in_instruction - .get_account_meta_at(1) - .map_err(|_| ProtozolZapError::InvalidZapAccounts)? - .key; - - let amm_disc = zap_params - .payload_data - .get(..8) - .ok_or_else(|| ProtozolZapError::InvalidZapOutParameters)?; - - let zap_info_processor = get_zap_amm_processor(amm_disc, zap_amm_program_address)?; - - let amm_payload = zap_params - .payload_data - .get(8..) - .ok_or_else(|| ProtozolZapError::InvalidZapOutParameters)?; - - zap_info_processor.validate_payload(amm_payload)?; - - let RawZapOutAmmInfo { - source_index, - destination_index, - amount_in_offset, - } = zap_info_processor.extract_raw_zap_out_amm_info(zap_params)?; - - let offset_source_index = ZAP_OUT_ACCOUNTS_LEN.safe_add(source_index)?; - let source_token_address = zap_in_instruction - .get_account_meta_at(offset_source_index) - .map_err(|_| ProtozolZapError::InvalidZapAccounts)? - .key; - - let offset_destination_index = ZAP_OUT_ACCOUNTS_LEN.safe_add(destination_index)?; - let destination_token_address = zap_in_instruction - .get_account_meta_at(offset_destination_index) - .map_err(|_| ProtozolZapError::InvalidZapAccounts)? - .key; - - Ok(ZapOutAmmInfo { - zap_user_token_in_address, - amm_source_token_address: source_token_address, - amm_destination_token_address: destination_token_address, - amount_in_offset, - }) -} diff --git a/protocol-zap/src/utils/token.rs b/protocol-zap/src/utils/token.rs deleted file mode 100644 index eec07e7..0000000 --- a/protocol-zap/src/utils/token.rs +++ /dev/null @@ -1,24 +0,0 @@ -use crate::{ - constants::{SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID, SPL_TOKEN_PROGRAM_ID}, - error::ProtozolZapError, -}; -use pinocchio::pubkey::{find_program_address, Pubkey}; - -// Adapted from anchor_spl::token::accessor::amount -// https://github.com/solana-foundation/anchor/blob/2cb7ababa7dba3ac269fd2e60cfa06793ad2b989/spl/src/token.rs#L519 -pub(crate) fn get_token_amount(token_account_data: &[u8]) -> Result { - if token_account_data.len() < 72 { - return Err(ProtozolZapError::InvalidZapAccounts); - } - let mut amount_bytes = [0u8; 8]; - amount_bytes.copy_from_slice(&token_account_data[64..72]); - Ok(u64::from_le_bytes(amount_bytes)) -} - -// Adatpted from spl_associated_token_account::get_associated_token_address -// https://github.com/solana-labs/solana-program-library/blob/72bb80d76de5628749e9f06ed1a36d3986dab2a2/associated-token-account/client/src/address.rs#L56 -pub(crate) fn get_associated_token_address(wallet: &Pubkey, mint: &Pubkey) -> Pubkey { - let seeds: &[&[u8]] = &[wallet, &SPL_TOKEN_PROGRAM_ID, mint]; - let (address, _bump) = find_program_address(seeds, &SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID); - address -} diff --git a/tests/common/damm_v2.ts b/tests/common/damm_v2.ts index 0217526..80fa366 100644 --- a/tests/common/damm_v2.ts +++ b/tests/common/damm_v2.ts @@ -427,7 +427,7 @@ export async function createPositionAndAddLiquidity( pool, position, positionNftAccount, - owner: user.publicKey, + signer: user.publicKey, tokenAAccount, tokenBAccount, tokenAVault: poolState.tokenAVault, @@ -484,7 +484,7 @@ export async function removeLiquidity( pool, position, positionNftAccount, - owner: user, + signer: user, tokenAAccount, tokenBAccount, tokenAVault, diff --git a/tests/fixtures/damm_v2.so b/tests/fixtures/damm_v2.so index 362c8b8..63aba9e 100755 Binary files a/tests/fixtures/damm_v2.so and b/tests/fixtures/damm_v2.so differ diff --git a/tests/fixtures/damm_v2.ts b/tests/fixtures/damm_v2.ts new file mode 100644 index 0000000..6838a03 --- /dev/null +++ b/tests/fixtures/damm_v2.ts @@ -0,0 +1,7230 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/cp_amm.json`. + */ +export type CpAmm = { + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG", + "metadata": { + "name": "cpAmm", + "version": "0.2.3", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "addLiquidity", + "discriminator": [ + 181, + 157, + 89, + 67, + 143, + 182, + 52, + 72 + ], + "accounts": [ + { + "name": "pool", + "writable": true, + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "tokenAAccount", + "docs": [ + "The user token a account" + ], + "writable": true + }, + { + "name": "tokenBAccount", + "docs": [ + "The user token b account" + ], + "writable": true + }, + { + "name": "tokenAVault", + "docs": [ + "The vault token account for input token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "docs": [ + "The vault token account for output token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenAMint", + "docs": [ + "The mint of token a" + ], + "relations": [ + "pool" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "The mint of token b" + ], + "relations": [ + "pool" + ] + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Token a program" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Token b program" + ] + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "addLiquidityParameters" + } + } + } + ] + }, + { + "name": "claimPositionFee", + "discriminator": [ + 180, + 38, + 154, + 17, + 133, + 33, + 162, + 211 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "tokenAAccount", + "docs": [ + "The user token a account" + ], + "writable": true + }, + { + "name": "tokenBAccount", + "docs": [ + "The user token b account" + ], + "writable": true + }, + { + "name": "tokenAVault", + "docs": [ + "The vault token account for input token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "docs": [ + "The vault token account for output token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenAMint", + "docs": [ + "The mint of token a" + ], + "relations": [ + "pool" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "The mint of token b" + ], + "relations": [ + "pool" + ] + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Token a program" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Token b program" + ] + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "claimProtocolFee2", + "discriminator": [ + 235, + 194, + 54, + 69, + 65, + 10, + 236, + 112 + ], + "accounts": [ + { + "name": "receiverTokenAccount", + "docs": [ + "receiver token account for the claimed token. validated through the protocol_fee program" + ], + "writable": true + }, + { + "name": "tokenAMint", + "relations": [ + "pool" + ] + }, + { + "name": "tokenBMint", + "relations": [ + "pool" + ] + }, + { + "name": "tokenAProgram" + }, + { + "name": "tokenBProgram" + }, + { + "name": "pool", + "writable": true + }, + { + "name": "tokenAVault", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "signer", + "signer": true, + "address": "FkU5rQCWQM131skHCpcEbK8P1JrQGsBgqXe55w525SSF" + } + ], + "args": [ + { + "name": "maxAmount", + "type": "u64" + } + ] + }, + { + "name": "claimReward", + "discriminator": [ + 149, + 95, + 181, + 242, + 94, + 90, + 158, + 162 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "writable": true, + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "rewardVault", + "docs": [ + "The vault token account for reward token" + ], + "writable": true + }, + { + "name": "rewardMint" + }, + { + "name": "userTokenAccount", + "writable": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "tokenProgram" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "skipReward", + "type": "u8" + } + ] + }, + { + "name": "closeConfig", + "discriminator": [ + 145, + 9, + 72, + 157, + 95, + 125, + 61, + 85 + ], + "accounts": [ + { + "name": "config", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "rentReceiver", + "writable": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "closeOperatorAccount", + "discriminator": [ + 171, + 9, + 213, + 74, + 120, + 23, + 3, + 29 + ], + "accounts": [ + { + "name": "operator", + "writable": true + }, + { + "name": "signer", + "signer": true + }, + { + "name": "rentReceiver", + "writable": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "closePosition", + "discriminator": [ + 123, + 134, + 81, + 0, + 49, + 68, + 98, + 98 + ], + "accounts": [ + { + "name": "positionNftMint", + "docs": [ + "positionNftMint" + ], + "writable": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ], + "writable": true + }, + { + "name": "pool", + "writable": true, + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "rentReceiver", + "writable": true + }, + { + "name": "owner", + "docs": [ + "Owner of position" + ], + "signer": true + }, + { + "name": "tokenProgram", + "docs": [ + "Program to create NFT mint/token account and transfer for token22 account" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "closeTokenBadge", + "discriminator": [ + 108, + 146, + 86, + 110, + 179, + 254, + 10, + 104 + ], + "accounts": [ + { + "name": "tokenBadge", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "rentReceiver", + "writable": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "createConfig", + "docs": [ + "OPERATOR FUNCTIONS /////" + ], + "discriminator": [ + 201, + 207, + 243, + 114, + 75, + 111, + 47, + 189 + ], + "accounts": [ + { + "name": "config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "arg", + "path": "index" + } + ] + } + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "index", + "type": "u64" + }, + { + "name": "configParameters", + "type": { + "defined": { + "name": "staticConfigParameters" + } + } + } + ] + }, + { + "name": "createDynamicConfig", + "discriminator": [ + 81, + 251, + 122, + 78, + 66, + 57, + 208, + 82 + ], + "accounts": [ + { + "name": "config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "arg", + "path": "index" + } + ] + } + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "index", + "type": "u64" + }, + { + "name": "configParameters", + "type": { + "defined": { + "name": "dynamicConfigParameters" + } + } + } + ] + }, + { + "name": "createOperatorAccount", + "docs": [ + "ADMIN FUNCTIONS /////" + ], + "discriminator": [ + 221, + 64, + 246, + 149, + 240, + 153, + 229, + 163 + ], + "accounts": [ + { + "name": "operator", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 111, + 112, + 101, + 114, + 97, + 116, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "whitelistedAddress" + } + ] + } + }, + { + "name": "whitelistedAddress" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "permission", + "type": "u128" + } + ] + }, + { + "name": "createPosition", + "discriminator": [ + 48, + 215, + 197, + 153, + 96, + 203, + 180, + 133 + ], + "accounts": [ + { + "name": "owner" + }, + { + "name": "positionNftMint", + "docs": [ + "positionNftMint" + ], + "writable": true, + "signer": true + }, + { + "name": "positionNftAccount", + "docs": [ + "position nft account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "pool", + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "payer", + "docs": [ + "Address paying to create the position. Can be anyone" + ], + "writable": true, + "signer": true + }, + { + "name": "tokenProgram", + "docs": [ + "Program to create NFT mint/token account and transfer for token22 account" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "createTokenBadge", + "discriminator": [ + 88, + 206, + 0, + 91, + 60, + 175, + 151, + 118 + ], + "accounts": [ + { + "name": "tokenBadge", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 98, + 97, + 100, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "tokenMint" + } + ] + } + }, + { + "name": "tokenMint" + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "dummyIx", + "discriminator": [ + 234, + 95, + 176, + 185, + 7, + 42, + 35, + 159 + ], + "accounts": [ + { + "name": "podAlignedFeeTimeScheduler" + }, + { + "name": "podAlignedFeeRateLimiter" + }, + { + "name": "podAlignedFeeMarketCapScheduler" + } + ], + "args": [ + { + "name": "ixs", + "type": { + "defined": { + "name": "dummyParams" + } + } + } + ] + }, + { + "name": "fixConfigFeeParams", + "discriminator": [ + 38, + 30, + 216, + 81, + 250, + 177, + 243, + 254 + ], + "accounts": [ + { + "name": "config", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "baseFeeParameters" + } + } + } + ] + }, + { + "name": "fixPoolFeeParams", + "discriminator": [ + 132, + 98, + 81, + 196, + 44, + 58, + 120, + 193 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "baseFeeParameters" + } + } + } + ] + }, + { + "name": "fixPoolLayoutVersion", + "discriminator": [ + 166, + 158, + 69, + 35, + 81, + 167, + 200, + 215 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + } + ], + "args": [] + }, + { + "name": "fundReward", + "discriminator": [ + 188, + 50, + 249, + 165, + 93, + 151, + 38, + 63 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "rewardVault", + "writable": true + }, + { + "name": "rewardMint" + }, + { + "name": "funderTokenAccount", + "writable": true + }, + { + "name": "funder", + "signer": true + }, + { + "name": "tokenProgram" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "carryForward", + "type": "bool" + } + ] + }, + { + "name": "initializeCustomizablePool", + "discriminator": [ + 20, + 161, + 241, + 24, + 189, + 221, + 180, + 2 + ], + "accounts": [ + { + "name": "creator" + }, + { + "name": "positionNftMint", + "docs": [ + "positionNftMint" + ], + "writable": true, + "signer": true + }, + { + "name": "positionNftAccount", + "docs": [ + "position nft account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "payer", + "docs": [ + "Address paying to create the pool. Can be anyone" + ], + "writable": true, + "signer": true + }, + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "docs": [ + "Initialize an account to store the pool state" + ], + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "tokenAMint", + "docs": [ + "Token a mint" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "Token b mint" + ] + }, + { + "name": "tokenAVault", + "docs": [ + "Token a vault for the pool" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "tokenAMint" + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "tokenBVault", + "docs": [ + "Token b vault for the pool" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "tokenBMint" + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "payerTokenA", + "docs": [ + "payer token a account" + ], + "writable": true + }, + { + "name": "payerTokenB", + "docs": [ + "creator token b account" + ], + "writable": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Program to create mint account and mint tokens" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Program to create mint account and mint tokens" + ] + }, + { + "name": "token2022Program", + "docs": [ + "Program to create NFT mint/token account and transfer for token22 account" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "initializeCustomizablePoolParameters" + } + } + } + ] + }, + { + "name": "initializePool", + "docs": [ + "USER FUNCTIONS ////" + ], + "discriminator": [ + 95, + 180, + 10, + 172, + 84, + 174, + 232, + 40 + ], + "accounts": [ + { + "name": "creator" + }, + { + "name": "positionNftMint", + "docs": [ + "positionNftMint" + ], + "writable": true, + "signer": true + }, + { + "name": "positionNftAccount", + "docs": [ + "position nft account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "payer", + "docs": [ + "Address paying to create the pool. Can be anyone" + ], + "writable": true, + "signer": true + }, + { + "name": "config", + "docs": [ + "Which config the pool belongs to." + ] + }, + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "docs": [ + "Initialize an account to store the pool state" + ], + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "tokenAMint", + "docs": [ + "Token a mint" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "Token b mint" + ] + }, + { + "name": "tokenAVault", + "docs": [ + "Token a vault for the pool" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "tokenAMint" + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "tokenBVault", + "docs": [ + "Token b vault for the pool" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "tokenBMint" + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "payerTokenA", + "docs": [ + "payer token a account" + ], + "writable": true + }, + { + "name": "payerTokenB", + "docs": [ + "creator token b account" + ], + "writable": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Program to create mint account and mint tokens" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Program to create mint account and mint tokens" + ] + }, + { + "name": "token2022Program", + "docs": [ + "Program to create NFT mint/token account and transfer for token22 account" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "initializePoolParameters" + } + } + } + ] + }, + { + "name": "initializePoolWithDynamicConfig", + "discriminator": [ + 149, + 82, + 72, + 197, + 253, + 252, + 68, + 15 + ], + "accounts": [ + { + "name": "creator" + }, + { + "name": "positionNftMint", + "docs": [ + "positionNftMint" + ], + "writable": true, + "signer": true + }, + { + "name": "positionNftAccount", + "docs": [ + "position nft account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "payer", + "docs": [ + "Address paying to create the pool. Can be anyone" + ], + "writable": true, + "signer": true + }, + { + "name": "poolCreatorAuthority", + "signer": true, + "relations": [ + "config" + ] + }, + { + "name": "config", + "docs": [ + "Which config the pool belongs to." + ] + }, + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "docs": [ + "Initialize an account to store the pool state" + ], + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "positionNftMint" + } + ] + } + }, + { + "name": "tokenAMint", + "docs": [ + "Token a mint" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "Token b mint" + ] + }, + { + "name": "tokenAVault", + "docs": [ + "Token a vault for the pool" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "tokenAMint" + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "tokenBVault", + "docs": [ + "Token b vault for the pool" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "tokenBMint" + }, + { + "kind": "account", + "path": "pool" + } + ] + } + }, + { + "name": "payerTokenA", + "docs": [ + "payer token a account" + ], + "writable": true + }, + { + "name": "payerTokenB", + "docs": [ + "creator token b account" + ], + "writable": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Program to create mint account and mint tokens" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Program to create mint account and mint tokens" + ] + }, + { + "name": "token2022Program", + "docs": [ + "Program to create NFT mint/token account and transfer for token22 account" + ], + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "initializeCustomizablePoolParameters" + } + } + } + ] + }, + { + "name": "initializeReward", + "discriminator": [ + 95, + 135, + 192, + 196, + 242, + 129, + 230, + 68 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "writable": true + }, + { + "name": "rewardVault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 114, + 101, + 119, + 97, + 114, + 100, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "pool" + }, + { + "kind": "arg", + "path": "rewardIndex" + } + ] + } + }, + { + "name": "rewardMint" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "tokenProgram" + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "rewardDuration", + "type": "u64" + }, + { + "name": "funder", + "type": "pubkey" + } + ] + }, + { + "name": "lockInnerPosition", + "discriminator": [ + 72, + 19, + 49, + 204, + 18, + 122, + 23, + 90 + ], + "accounts": [ + { + "name": "pool", + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "vestingParameters" + } + } + } + ] + }, + { + "name": "lockPosition", + "discriminator": [ + 227, + 62, + 2, + 252, + 247, + 10, + 171, + 185 + ], + "accounts": [ + { + "name": "pool", + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "vesting", + "writable": true, + "signer": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "systemProgram", + "address": "11111111111111111111111111111111" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "vestingParameters" + } + } + } + ] + }, + { + "name": "permanentLockPosition", + "discriminator": [ + 165, + 176, + 125, + 6, + 231, + 171, + 186, + 213 + ], + "accounts": [ + { + "name": "pool", + "writable": true, + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "permanentLockLiquidity", + "type": "u128" + } + ] + }, + { + "name": "refreshVesting", + "discriminator": [ + 9, + 94, + 216, + 14, + 116, + 204, + 247, + 0 + ], + "accounts": [ + { + "name": "pool", + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "owner" + } + ], + "args": [] + }, + { + "name": "removeAllLiquidity", + "discriminator": [ + 10, + 51, + 61, + 35, + 112, + 105, + 24, + 85 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "writable": true, + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "tokenAAccount", + "docs": [ + "The user token a account" + ], + "writable": true + }, + { + "name": "tokenBAccount", + "docs": [ + "The user token b account" + ], + "writable": true + }, + { + "name": "tokenAVault", + "docs": [ + "The vault token account for input token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "docs": [ + "The vault token account for output token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenAMint", + "docs": [ + "The mint of token a" + ], + "relations": [ + "pool" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "The mint of token b" + ], + "relations": [ + "pool" + ] + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Token a program" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Token b program" + ] + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "tokenAAmountThreshold", + "type": "u64" + }, + { + "name": "tokenBAmountThreshold", + "type": "u64" + } + ] + }, + { + "name": "removeLiquidity", + "discriminator": [ + 80, + 85, + 209, + 72, + 24, + 206, + 177, + 108 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "writable": true, + "relations": [ + "position" + ] + }, + { + "name": "position", + "writable": true + }, + { + "name": "tokenAAccount", + "docs": [ + "The user token a account" + ], + "writable": true + }, + { + "name": "tokenBAccount", + "docs": [ + "The user token b account" + ], + "writable": true + }, + { + "name": "tokenAVault", + "docs": [ + "The vault token account for input token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "docs": [ + "The vault token account for output token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenAMint", + "docs": [ + "The mint of token a" + ], + "relations": [ + "pool" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "The mint of token b" + ], + "relations": [ + "pool" + ] + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "signer", + "docs": [ + "Signer" + ], + "signer": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Token a program" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Token b program" + ] + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "removeLiquidityParameters" + } + } + } + ] + }, + { + "name": "setPoolStatus", + "discriminator": [ + 112, + 87, + 135, + 223, + 83, + 204, + 132, + 53 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "status", + "type": "u8" + } + ] + }, + { + "name": "splitPosition", + "discriminator": [ + 172, + 241, + 221, + 138, + 161, + 29, + 253, + 42 + ], + "accounts": [ + { + "name": "pool", + "writable": true, + "relations": [ + "firstPosition", + "secondPosition" + ] + }, + { + "name": "firstPosition", + "docs": [ + "The first position" + ], + "writable": true + }, + { + "name": "firstPositionNftAccount", + "docs": [ + "The token account for position nft" + ] + }, + { + "name": "secondPosition", + "docs": [ + "The second position" + ], + "writable": true + }, + { + "name": "secondPositionNftAccount", + "docs": [ + "The token account for position nft" + ] + }, + { + "name": "firstOwner", + "docs": [ + "Owner of first position" + ], + "signer": true + }, + { + "name": "secondOwner", + "docs": [ + "Owner of second position" + ], + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "splitPositionParameters" + } + } + } + ] + }, + { + "name": "splitPosition2", + "discriminator": [ + 221, + 147, + 228, + 207, + 140, + 212, + 17, + 119 + ], + "accounts": [ + { + "name": "pool", + "writable": true, + "relations": [ + "firstPosition", + "secondPosition" + ] + }, + { + "name": "firstPosition", + "docs": [ + "The first position" + ], + "writable": true + }, + { + "name": "firstPositionNftAccount", + "docs": [ + "The token account for position nft" + ] + }, + { + "name": "secondPosition", + "docs": [ + "The second position" + ], + "writable": true + }, + { + "name": "secondPositionNftAccount", + "docs": [ + "The token account for position nft" + ] + }, + { + "name": "firstOwner", + "docs": [ + "Owner of first position" + ], + "signer": true + }, + { + "name": "secondOwner", + "docs": [ + "Owner of second position" + ], + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "numerator", + "type": "u32" + } + ] + }, + { + "name": "swap", + "discriminator": [ + 248, + 198, + 158, + 145, + 225, + 117, + 135, + 200 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "docs": [ + "Pool account" + ], + "writable": true + }, + { + "name": "inputTokenAccount", + "docs": [ + "The user token account for input token" + ], + "writable": true + }, + { + "name": "outputTokenAccount", + "docs": [ + "The user token account for output token" + ], + "writable": true + }, + { + "name": "tokenAVault", + "docs": [ + "The vault token account for input token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "docs": [ + "The vault token account for output token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenAMint", + "docs": [ + "The mint of token a" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "The mint of token b" + ] + }, + { + "name": "payer", + "docs": [ + "The user performing the swap" + ], + "signer": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Token a program" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Token b program" + ] + }, + { + "name": "referralTokenAccount", + "docs": [ + "referral token account" + ], + "writable": true, + "optional": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "swapParameters" + } + } + } + ] + }, + { + "name": "swap2", + "discriminator": [ + 65, + 75, + 63, + 76, + 235, + 91, + 91, + 136 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "docs": [ + "Pool account" + ], + "writable": true + }, + { + "name": "inputTokenAccount", + "docs": [ + "The user token account for input token" + ], + "writable": true + }, + { + "name": "outputTokenAccount", + "docs": [ + "The user token account for output token" + ], + "writable": true + }, + { + "name": "tokenAVault", + "docs": [ + "The vault token account for input token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenBVault", + "docs": [ + "The vault token account for output token" + ], + "writable": true, + "relations": [ + "pool" + ] + }, + { + "name": "tokenAMint", + "docs": [ + "The mint of token a" + ] + }, + { + "name": "tokenBMint", + "docs": [ + "The mint of token b" + ] + }, + { + "name": "payer", + "docs": [ + "The user performing the swap" + ], + "signer": true + }, + { + "name": "tokenAProgram", + "docs": [ + "Token a program" + ] + }, + { + "name": "tokenBProgram", + "docs": [ + "Token b program" + ] + }, + { + "name": "referralTokenAccount", + "docs": [ + "referral token account" + ], + "writable": true, + "optional": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "swapParameters2" + } + } + } + ] + }, + { + "name": "updateDelegatePermission", + "discriminator": [ + 175, + 165, + 56, + 64, + 0, + 251, + 89, + 47 + ], + "accounts": [ + { + "name": "position", + "writable": true + }, + { + "name": "positionNftAccount", + "docs": [ + "The token account for nft" + ] + }, + { + "name": "owner", + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "permission", + "type": "u32" + } + ] + }, + { + "name": "updatePoolFees", + "discriminator": [ + 118, + 217, + 203, + 179, + 60, + 8, + 70, + 89 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "signer", + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "updatePoolFeesParameters" + } + } + } + ] + }, + { + "name": "updateRewardDuration", + "discriminator": [ + 138, + 174, + 196, + 169, + 213, + 235, + 254, + 107 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "signer", + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "newDuration", + "type": "u64" + } + ] + }, + { + "name": "updateRewardFunder", + "discriminator": [ + 211, + 28, + 48, + 32, + 215, + 160, + 35, + 23 + ], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "signer", + "signer": true + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "newFunder", + "type": "pubkey" + } + ] + }, + { + "name": "withdrawDeadLiquidityReward", + "discriminator": [ + 121, + 99, + 224, + 91, + 178, + 14, + 22, + 132 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "writable": true + }, + { + "name": "rewardVault", + "writable": true + }, + { + "name": "rewardMint" + }, + { + "name": "funderTokenAccount", + "writable": true + }, + { + "name": "funder", + "signer": true + }, + { + "name": "tokenProgram" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + } + ] + }, + { + "name": "withdrawIneligibleReward", + "discriminator": [ + 148, + 206, + 42, + 195, + 247, + 49, + 103, + 8 + ], + "accounts": [ + { + "name": "poolAuthority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool", + "writable": true + }, + { + "name": "rewardVault", + "writable": true + }, + { + "name": "rewardMint" + }, + { + "name": "funderTokenAccount", + "writable": true + }, + { + "name": "funder", + "signer": true + }, + { + "name": "tokenProgram" + }, + { + "name": "eventAuthority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "rewardIndex", + "type": "u8" + } + ] + } + ], + "accounts": [ + { + "name": "config", + "discriminator": [ + 155, + 12, + 170, + 224, + 30, + 250, + 204, + 130 + ] + }, + { + "name": "operator", + "discriminator": [ + 219, + 31, + 188, + 145, + 69, + 139, + 204, + 117 + ] + }, + { + "name": "podAlignedFeeMarketCapScheduler", + "discriminator": [ + 251, + 130, + 208, + 253, + 245, + 27, + 145, + 203 + ] + }, + { + "name": "podAlignedFeeRateLimiter", + "discriminator": [ + 160, + 219, + 8, + 251, + 179, + 7, + 16, + 117 + ] + }, + { + "name": "podAlignedFeeTimeScheduler", + "discriminator": [ + 239, + 132, + 138, + 213, + 67, + 154, + 130, + 70 + ] + }, + { + "name": "pool", + "discriminator": [ + 241, + 154, + 109, + 4, + 17, + 177, + 109, + 188 + ] + }, + { + "name": "position", + "discriminator": [ + 170, + 188, + 143, + 228, + 122, + 64, + 247, + 208 + ] + }, + { + "name": "tokenBadge", + "discriminator": [ + 116, + 219, + 204, + 229, + 249, + 116, + 255, + 150 + ] + }, + { + "name": "vesting", + "discriminator": [ + 100, + 149, + 66, + 138, + 95, + 200, + 128, + 241 + ] + } + ], + "events": [ + { + "name": "evtClaimPositionFee", + "discriminator": [ + 198, + 182, + 183, + 52, + 97, + 12, + 49, + 56 + ] + }, + { + "name": "evtClaimProtocolFee2", + "discriminator": [ + 187, + 133, + 66, + 9, + 205, + 161, + 84, + 13 + ] + }, + { + "name": "evtClaimReward", + "discriminator": [ + 218, + 86, + 147, + 200, + 235, + 188, + 215, + 231 + ] + }, + { + "name": "evtCloseConfig", + "discriminator": [ + 36, + 30, + 239, + 45, + 58, + 132, + 14, + 5 + ] + }, + { + "name": "evtClosePosition", + "discriminator": [ + 20, + 145, + 144, + 68, + 143, + 142, + 214, + 178 + ] + }, + { + "name": "evtCreateConfig", + "discriminator": [ + 131, + 207, + 180, + 174, + 180, + 73, + 165, + 54 + ] + }, + { + "name": "evtCreateDynamicConfig", + "discriminator": [ + 231, + 197, + 13, + 164, + 248, + 213, + 133, + 152 + ] + }, + { + "name": "evtCreatePosition", + "discriminator": [ + 156, + 15, + 119, + 198, + 29, + 181, + 221, + 55 + ] + }, + { + "name": "evtCreateTokenBadge", + "discriminator": [ + 141, + 120, + 134, + 116, + 34, + 28, + 114, + 160 + ] + }, + { + "name": "evtFundReward", + "discriminator": [ + 104, + 233, + 237, + 122, + 199, + 191, + 121, + 85 + ] + }, + { + "name": "evtInitializePool", + "discriminator": [ + 228, + 50, + 246, + 85, + 203, + 66, + 134, + 37 + ] + }, + { + "name": "evtInitializeReward", + "discriminator": [ + 129, + 91, + 188, + 3, + 246, + 52, + 185, + 249 + ] + }, + { + "name": "evtLiquidityChange", + "discriminator": [ + 197, + 171, + 78, + 127, + 224, + 211, + 87, + 13 + ] + }, + { + "name": "evtLockPosition", + "discriminator": [ + 168, + 63, + 108, + 83, + 219, + 82, + 2, + 200 + ] + }, + { + "name": "evtPermanentLockPosition", + "discriminator": [ + 145, + 143, + 162, + 218, + 218, + 80, + 67, + 11 + ] + }, + { + "name": "evtSetPoolStatus", + "discriminator": [ + 100, + 213, + 74, + 3, + 95, + 91, + 228, + 146 + ] + }, + { + "name": "evtSplitPosition2", + "discriminator": [ + 165, + 32, + 203, + 174, + 72, + 100, + 233, + 103 + ] + }, + { + "name": "evtSplitPosition3", + "discriminator": [ + 232, + 117, + 190, + 218, + 85, + 162, + 207, + 78 + ] + }, + { + "name": "evtSwap2", + "discriminator": [ + 189, + 66, + 51, + 168, + 38, + 80, + 117, + 153 + ] + }, + { + "name": "evtUpdateDelegatePermission", + "discriminator": [ + 66, + 188, + 75, + 151, + 150, + 232, + 87, + 93 + ] + }, + { + "name": "evtUpdatePoolFees", + "discriminator": [ + 76, + 165, + 246, + 102, + 102, + 217, + 156, + 44 + ] + }, + { + "name": "evtUpdateRewardDuration", + "discriminator": [ + 149, + 135, + 65, + 231, + 129, + 153, + 65, + 57 + ] + }, + { + "name": "evtUpdateRewardFunder", + "discriminator": [ + 76, + 154, + 208, + 13, + 40, + 115, + 246, + 146 + ] + }, + { + "name": "evtWithdrawDeadLiquidityReward", + "discriminator": [ + 228, + 66, + 150, + 195, + 42, + 62, + 163, + 13 + ] + }, + { + "name": "evtWithdrawIneligibleReward", + "discriminator": [ + 248, + 215, + 184, + 78, + 31, + 180, + 179, + 168 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "mathOverflow", + "msg": "Math operation overflow" + }, + { + "code": 6001, + "name": "invalidFee", + "msg": "Invalid fee setup" + }, + { + "code": 6002, + "name": "exceededSlippage", + "msg": "Exceeded slippage tolerance" + }, + { + "code": 6003, + "name": "poolDisabled", + "msg": "Pool disabled" + }, + { + "code": 6004, + "name": "exceedMaxFeeBps", + "msg": "Exceeded max fee bps" + }, + { + "code": 6005, + "name": "invalidAdmin", + "msg": "Invalid admin" + }, + { + "code": 6006, + "name": "amountIsZero", + "msg": "Amount is zero" + }, + { + "code": 6007, + "name": "typeCastFailed", + "msg": "Type cast error" + }, + { + "code": 6008, + "name": "unableToModifyActivationPoint", + "msg": "Unable to modify activation point" + }, + { + "code": 6009, + "name": "invalidAuthorityToCreateThePool", + "msg": "Invalid authority to create the pool" + }, + { + "code": 6010, + "name": "invalidActivationType", + "msg": "Invalid activation type" + }, + { + "code": 6011, + "name": "invalidActivationPoint", + "msg": "Invalid activation point" + }, + { + "code": 6012, + "name": "invalidQuoteMint", + "msg": "Quote token must be SOL,USDC" + }, + { + "code": 6013, + "name": "invalidFeeCurve", + "msg": "Invalid fee curve" + }, + { + "code": 6014, + "name": "invalidPriceRange", + "msg": "Invalid Price Range" + }, + { + "code": 6015, + "name": "priceRangeViolation", + "msg": "Trade is over price range" + }, + { + "code": 6016, + "name": "invalidParameters", + "msg": "Invalid parameters" + }, + { + "code": 6017, + "name": "invalidCollectFeeMode", + "msg": "Invalid collect fee mode" + }, + { + "code": 6018, + "name": "invalidInput", + "msg": "Invalid input" + }, + { + "code": 6019, + "name": "cannotCreateTokenBadgeOnSupportedMint", + "msg": "Cannot create token badge on supported mint" + }, + { + "code": 6020, + "name": "invalidTokenBadge", + "msg": "Invalid token badge" + }, + { + "code": 6021, + "name": "invalidMinimumLiquidity", + "msg": "Invalid minimum liquidity" + }, + { + "code": 6022, + "name": "invalidVestingInfo", + "msg": "Invalid vesting information" + }, + { + "code": 6023, + "name": "insufficientLiquidity", + "msg": "Insufficient liquidity" + }, + { + "code": 6024, + "name": "invalidVestingAccount", + "msg": "Invalid vesting account" + }, + { + "code": 6025, + "name": "invalidPoolStatus", + "msg": "Invalid pool status" + }, + { + "code": 6026, + "name": "unsupportNativeMintToken2022", + "msg": "Unsupported native mint token2022" + }, + { + "code": 6027, + "name": "invalidRewardIndex", + "msg": "Invalid reward index" + }, + { + "code": 6028, + "name": "invalidRewardDuration", + "msg": "Invalid reward duration" + }, + { + "code": 6029, + "name": "rewardInitialized", + "msg": "Reward already initialized" + }, + { + "code": 6030, + "name": "rewardUninitialized", + "msg": "Reward not initialized" + }, + { + "code": 6031, + "name": "invalidRewardVault", + "msg": "Invalid reward vault" + }, + { + "code": 6032, + "name": "mustWithdrawnIneligibleReward", + "msg": "Must withdraw ineligible reward" + }, + { + "code": 6033, + "name": "identicalRewardDuration", + "msg": "Reward duration is the same" + }, + { + "code": 6034, + "name": "rewardCampaignInProgress", + "msg": "Reward campaign in progress" + }, + { + "code": 6035, + "name": "identicalFunder", + "msg": "Identical funder" + }, + { + "code": 6036, + "name": "invalidFunder", + "msg": "Invalid funder" + }, + { + "code": 6037, + "name": "rewardNotEnded", + "msg": "Reward not ended" + }, + { + "code": 6038, + "name": "feeInverseIsIncorrect", + "msg": "Fee inverse is incorrect" + }, + { + "code": 6039, + "name": "positionIsNotEmpty", + "msg": "Position is not empty" + }, + { + "code": 6040, + "name": "invalidPoolCreatorAuthority", + "msg": "Invalid pool creator authority" + }, + { + "code": 6041, + "name": "invalidConfigType", + "msg": "Invalid config type" + }, + { + "code": 6042, + "name": "invalidPoolCreator", + "msg": "Invalid pool creator" + }, + { + "code": 6043, + "name": "rewardVaultFrozenSkipRequired", + "msg": "Reward vault is frozen, must skip reward to proceed" + }, + { + "code": 6044, + "name": "invalidSplitPositionParameters", + "msg": "Invalid parameters for split position" + }, + { + "code": 6045, + "name": "unsupportPositionHasVestingLock", + "msg": "Unsupported split position has vesting lock" + }, + { + "code": 6046, + "name": "samePosition", + "msg": "Same position" + }, + { + "code": 6047, + "name": "invalidBaseFeeMode", + "msg": "Invalid base fee mode" + }, + { + "code": 6048, + "name": "invalidFeeRateLimiter", + "msg": "Invalid fee rate limiter" + }, + { + "code": 6049, + "name": "failToValidateSingleSwapInstruction", + "msg": "Fail to validate single swap instruction in rate limiter" + }, + { + "code": 6050, + "name": "invalidFeeTimeScheduler", + "msg": "Invalid fee scheduler" + }, + { + "code": 6051, + "name": "undeterminedError", + "msg": "Undetermined error" + }, + { + "code": 6052, + "name": "invalidPoolVersion", + "msg": "Invalid pool version" + }, + { + "code": 6053, + "name": "invalidAuthority", + "msg": "Invalid authority to do that action" + }, + { + "code": 6054, + "name": "invalidPermission", + "msg": "Invalid permission" + }, + { + "code": 6055, + "name": "invalidFeeMarketCapScheduler", + "msg": "Invalid fee market cap scheduler" + }, + { + "code": 6056, + "name": "cannotUpdateBaseFee", + "msg": "Cannot update base fee" + }, + { + "code": 6057, + "name": "invalidDynamicFeeParameters", + "msg": "Invalid dynamic fee parameters" + }, + { + "code": 6058, + "name": "invalidUpdatePoolFeesParameters", + "msg": "Invalid update pool fees parameters" + }, + { + "code": 6059, + "name": "missingOperatorAccount", + "msg": "Missing operator account" + }, + { + "code": 6060, + "name": "incorrectAta", + "msg": "Incorrect ATA" + }, + { + "code": 6061, + "name": "invalidZapOutParameters", + "msg": "Invalid zap out parameters" + }, + { + "code": 6062, + "name": "invalidWithdrawProtocolFeeZapAccounts", + "msg": "Invalid withdraw protocol fee zap accounts" + }, + { + "code": 6063, + "name": "mintRestrictedFromZap", + "msg": "SOL,USDC protocol fee cannot be withdrawn via zap" + }, + { + "code": 6064, + "name": "cpiDisabled", + "msg": "CPI disabled" + }, + { + "code": 6065, + "name": "missingZapOutInstruction", + "msg": "Missing zap out instruction" + }, + { + "code": 6066, + "name": "invalidZapAccounts", + "msg": "Invalid zap accounts" + }, + { + "code": 6067, + "name": "invalidCompoundingFeeBps", + "msg": "Invalid compounding fee bps" + }, + { + "code": 6068, + "name": "invalidClaimProtocolFeeAccounts", + "msg": "Invalid claim protocol fee accounts" + }, + { + "code": 6069, + "name": "transferFeeExcludedAmountIsZero", + "msg": "Transfer fee excluded amount is zero" + }, + { + "code": 6070, + "name": "delegatedAmountNonZero", + "msg": "Delegated amount is not zero" + } + ], + "types": [ + { + "name": "addLiquidityParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidityDelta", + "docs": [ + "delta liquidity" + ], + "type": "u128" + }, + { + "name": "tokenAAmountThreshold", + "docs": [ + "maximum token a amount" + ], + "type": "u64" + }, + { + "name": "tokenBAmountThreshold", + "docs": [ + "maximum token b amount" + ], + "type": "u64" + } + ] + } + }, + { + "name": "baseFeeInfo", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "data", + "type": { + "array": [ + "u8", + 32 + ] + } + } + ] + } + }, + { + "name": "baseFeeParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "data", + "type": { + "array": [ + "u8", + 27 + ] + } + } + ] + } + }, + { + "name": "baseFeeStruct", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "baseFeeInfo", + "type": { + "defined": { + "name": "baseFeeInfo" + } + } + }, + { + "name": "padding1", + "type": "u64" + } + ] + } + }, + { + "name": "borshFeeMarketCapScheduler", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "type": "u64" + }, + { + "name": "numberOfPeriod", + "type": "u16" + }, + { + "name": "sqrtPriceStepBps", + "type": "u32" + }, + { + "name": "schedulerExpirationDuration", + "type": "u32" + }, + { + "name": "reductionFactor", + "type": "u64" + }, + { + "name": "baseFeeMode", + "type": "u8" + } + ] + } + }, + { + "name": "borshFeeRateLimiter", + "docs": [ + "we denote reference_amount = x0, cliff_fee_numerator = c, fee_increment = i", + "if input_amount <= x0, then fee = input_amount * c", + "", + "if input_amount > x0, then input_amount = x0 + (a * x0 + b)", + "if a < max_index", + "then fee = x0 * c + x0 * (c + i) + .... + x0 * (c + i*a) + b * (c + i * (a+1))", + "then fee = x0 * (c + c*a + i*a*(a+1)/2) + b * (c + i * (a+1))", + "", + "if a >= max_index", + "if a = max_index + d, input_amount = x0 + max_index * x0 + (d * x0 + b)", + "then fee = x0 * (c + c*max_index + i*max_index*(max_index+1)/2) + (d * x0 + b) * MAX_FEE" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "type": "u64" + }, + { + "name": "feeIncrementBps", + "type": "u16" + }, + { + "name": "maxLimiterDuration", + "type": "u32" + }, + { + "name": "maxFeeBps", + "type": "u32" + }, + { + "name": "referenceAmount", + "type": "u64" + }, + { + "name": "baseFeeMode", + "type": "u8" + } + ] + } + }, + { + "name": "borshFeeTimeScheduler", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "type": "u64" + }, + { + "name": "numberOfPeriod", + "type": "u16" + }, + { + "name": "periodFrequency", + "type": "u64" + }, + { + "name": "reductionFactor", + "type": "u64" + }, + { + "name": "baseFeeMode", + "type": "u8" + } + ] + } + }, + { + "name": "config", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "vaultConfigKey", + "docs": [ + "Vault config key" + ], + "type": "pubkey" + }, + { + "name": "poolCreatorAuthority", + "docs": [ + "Only pool_creator_authority can use the current config to initialize new pool. When it's Pubkey::default, it's a public config." + ], + "type": "pubkey" + }, + { + "name": "poolFees", + "docs": [ + "Pool fee" + ], + "type": { + "defined": { + "name": "poolFeesConfig" + } + } + }, + { + "name": "activationType", + "docs": [ + "Activation type" + ], + "type": "u8" + }, + { + "name": "collectFeeMode", + "docs": [ + "Collect fee mode" + ], + "type": "u8" + }, + { + "name": "configType", + "docs": [ + "Config type mode, 0 for static, 1 for dynamic" + ], + "type": "u8" + }, + { + "name": "padding0", + "docs": [ + "padding 0" + ], + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "index", + "docs": [ + "config index" + ], + "type": "u64" + }, + { + "name": "sqrtMinPrice", + "docs": [ + "sqrt min price" + ], + "type": "u128" + }, + { + "name": "sqrtMaxPrice", + "docs": [ + "sqrt max price" + ], + "type": "u128" + }, + { + "name": "padding1", + "docs": [ + "Fee curve point", + "Padding for further use" + ], + "type": { + "array": [ + "u64", + 10 + ] + } + } + ] + } + }, + { + "name": "dummyParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "borshFeeTimeSchedulerParams", + "type": { + "defined": { + "name": "borshFeeTimeScheduler" + } + } + }, + { + "name": "borshFeeRateLimiterParams", + "type": { + "defined": { + "name": "borshFeeRateLimiter" + } + } + }, + { + "name": "borshFeeMarketCapSchedulerParams", + "type": { + "defined": { + "name": "borshFeeMarketCapScheduler" + } + } + } + ] + } + }, + { + "name": "dynamicConfigParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "poolCreatorAuthority", + "type": "pubkey" + } + ] + } + }, + { + "name": "dynamicFeeConfig", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "maxVolatilityAccumulator", + "type": "u32" + }, + { + "name": "variableFeeControl", + "type": "u32" + }, + { + "name": "binStep", + "type": "u16" + }, + { + "name": "filterPeriod", + "type": "u16" + }, + { + "name": "decayPeriod", + "type": "u16" + }, + { + "name": "reductionFactor", + "type": "u16" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 8 + ] + } + }, + { + "name": "binStepU128", + "type": "u128" + } + ] + } + }, + { + "name": "dynamicFeeParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "binStep", + "type": "u16" + }, + { + "name": "binStepU128", + "type": "u128" + }, + { + "name": "filterPeriod", + "type": "u16" + }, + { + "name": "decayPeriod", + "type": "u16" + }, + { + "name": "reductionFactor", + "type": "u16" + }, + { + "name": "maxVolatilityAccumulator", + "type": "u32" + }, + { + "name": "variableFeeControl", + "type": "u32" + } + ] + } + }, + { + "name": "dynamicFeeStruct", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "maxVolatilityAccumulator", + "type": "u32" + }, + { + "name": "variableFeeControl", + "type": "u32" + }, + { + "name": "binStep", + "type": "u16" + }, + { + "name": "filterPeriod", + "type": "u16" + }, + { + "name": "decayPeriod", + "type": "u16" + }, + { + "name": "reductionFactor", + "type": "u16" + }, + { + "name": "lastUpdateTimestamp", + "type": "u64" + }, + { + "name": "binStepU128", + "type": "u128" + }, + { + "name": "sqrtPriceReference", + "type": "u128" + }, + { + "name": "volatilityAccumulator", + "type": "u128" + }, + { + "name": "volatilityReference", + "type": "u128" + } + ] + } + }, + { + "name": "evtClaimPositionFee", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "feeAClaimed", + "type": "u64" + }, + { + "name": "feeBClaimed", + "type": "u64" + } + ] + } + }, + { + "name": "evtClaimProtocolFee2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "receiverTokenAccount", + "type": "pubkey" + }, + { + "name": "tokenMint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "evtClaimReward", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "mintReward", + "type": "pubkey" + }, + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "totalReward", + "type": "u64" + } + ] + } + }, + { + "name": "evtCloseConfig", + "docs": [ + "Close config" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "config", + "docs": [ + "Config pubkey" + ], + "type": "pubkey" + }, + { + "name": "admin", + "docs": [ + "admin pk" + ], + "type": "pubkey" + } + ] + } + }, + { + "name": "evtClosePosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "positionNftMint", + "type": "pubkey" + } + ] + } + }, + { + "name": "evtCreateConfig", + "docs": [ + "Create static config" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "poolFees", + "type": { + "defined": { + "name": "poolFeeParameters" + } + } + }, + { + "name": "vaultConfigKey", + "type": "pubkey" + }, + { + "name": "poolCreatorAuthority", + "type": "pubkey" + }, + { + "name": "activationType", + "type": "u8" + }, + { + "name": "sqrtMinPrice", + "type": "u128" + }, + { + "name": "sqrtMaxPrice", + "type": "u128" + }, + { + "name": "collectFeeMode", + "type": "u8" + }, + { + "name": "index", + "type": "u64" + }, + { + "name": "config", + "type": "pubkey" + } + ] + } + }, + { + "name": "evtCreateDynamicConfig", + "docs": [ + "Create dynamic config" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "config", + "type": "pubkey" + }, + { + "name": "poolCreatorAuthority", + "type": "pubkey" + }, + { + "name": "index", + "type": "u64" + } + ] + } + }, + { + "name": "evtCreatePosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "positionNftMint", + "type": "pubkey" + } + ] + } + }, + { + "name": "evtCreateTokenBadge", + "docs": [ + "Create token badge" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "tokenMint", + "type": "pubkey" + } + ] + } + }, + { + "name": "evtFundReward", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "mintReward", + "type": "pubkey" + }, + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "transferFeeExcludedAmountIn", + "type": "u64" + }, + { + "name": "rewardDurationEnd", + "type": "u64" + }, + { + "name": "preRewardRate", + "type": "u128" + }, + { + "name": "postRewardRate", + "type": "u128" + } + ] + } + }, + { + "name": "evtInitializePool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "tokenAMint", + "type": "pubkey" + }, + { + "name": "tokenBMint", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "payer", + "type": "pubkey" + }, + { + "name": "alphaVault", + "type": "pubkey" + }, + { + "name": "poolFees", + "type": { + "defined": { + "name": "poolFeeParameters" + } + } + }, + { + "name": "sqrtMinPrice", + "type": "u128" + }, + { + "name": "sqrtMaxPrice", + "type": "u128" + }, + { + "name": "activationType", + "type": "u8" + }, + { + "name": "collectFeeMode", + "type": "u8" + }, + { + "name": "liquidity", + "type": "u128" + }, + { + "name": "sqrtPrice", + "type": "u128" + }, + { + "name": "activationPoint", + "type": "u64" + }, + { + "name": "tokenAFlag", + "type": "u8" + }, + { + "name": "tokenBFlag", + "type": "u8" + }, + { + "name": "tokenAAmount", + "type": "u64" + }, + { + "name": "tokenBAmount", + "type": "u64" + }, + { + "name": "totalAmountA", + "type": "u64" + }, + { + "name": "totalAmountB", + "type": "u64" + }, + { + "name": "poolType", + "type": "u8" + } + ] + } + }, + { + "name": "evtInitializeReward", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "rewardMint", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "rewardDuration", + "type": "u64" + } + ] + } + }, + { + "name": "evtLiquidityChange", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "tokenAAmount", + "type": "u64" + }, + { + "name": "tokenBAmount", + "type": "u64" + }, + { + "name": "transferFeeIncludedTokenAAmount", + "type": "u64" + }, + { + "name": "transferFeeIncludedTokenBAmount", + "type": "u64" + }, + { + "name": "reserveAAmount", + "type": "u64" + }, + { + "name": "reserveBAmount", + "type": "u64" + }, + { + "name": "liquidityDelta", + "type": "u128" + }, + { + "name": "tokenAAmountThreshold", + "type": "u64" + }, + { + "name": "tokenBAmountThreshold", + "type": "u64" + }, + { + "name": "changeType", + "type": "u8" + } + ] + } + }, + { + "name": "evtLockPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "vesting", + "type": "pubkey" + }, + { + "name": "cliffPoint", + "type": "u64" + }, + { + "name": "periodFrequency", + "type": "u64" + }, + { + "name": "cliffUnlockLiquidity", + "type": "u128" + }, + { + "name": "liquidityPerPeriod", + "type": "u128" + }, + { + "name": "numberOfPeriod", + "type": "u16" + } + ] + } + }, + { + "name": "evtPermanentLockPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "position", + "type": "pubkey" + }, + { + "name": "lockLiquidityAmount", + "type": "u128" + }, + { + "name": "totalPermanentLockedLiquidity", + "type": "u128" + } + ] + } + }, + { + "name": "evtSetPoolStatus", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "status", + "type": "u8" + } + ] + } + }, + { + "name": "evtSplitPosition2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "firstOwner", + "type": "pubkey" + }, + { + "name": "secondOwner", + "type": "pubkey" + }, + { + "name": "firstPosition", + "type": "pubkey" + }, + { + "name": "secondPosition", + "type": "pubkey" + }, + { + "name": "currentSqrtPrice", + "type": "u128" + }, + { + "name": "amountSplits", + "type": { + "defined": { + "name": "splitAmountInfo" + } + } + }, + { + "name": "firstPositionInfo", + "type": { + "defined": { + "name": "splitPositionInfo" + } + } + }, + { + "name": "secondPositionInfo", + "type": { + "defined": { + "name": "splitPositionInfo" + } + } + }, + { + "name": "splitPositionParameters", + "type": { + "defined": { + "name": "splitPositionParameters2" + } + } + } + ] + } + }, + { + "name": "evtSplitPosition3", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "firstOwner", + "type": "pubkey" + }, + { + "name": "secondOwner", + "type": "pubkey" + }, + { + "name": "firstPosition", + "type": "pubkey" + }, + { + "name": "secondPosition", + "type": "pubkey" + }, + { + "name": "currentSqrtPrice", + "type": "u128" + }, + { + "name": "amountSplits", + "type": { + "defined": { + "name": "splitAmountInfo2" + } + } + }, + { + "name": "firstPositionInfo", + "type": { + "defined": { + "name": "splitPositionInfo2" + } + } + }, + { + "name": "secondPositionInfo", + "type": { + "defined": { + "name": "splitPositionInfo2" + } + } + }, + { + "name": "splitPositionParameters", + "type": { + "defined": { + "name": "splitPositionParameters3" + } + } + } + ] + } + }, + { + "name": "evtSwap2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "tradeDirection", + "type": "u8" + }, + { + "name": "collectFeeMode", + "type": "u8" + }, + { + "name": "hasReferral", + "type": "bool" + }, + { + "name": "params", + "type": { + "defined": { + "name": "swapParameters2" + } + } + }, + { + "name": "swapResult", + "type": { + "defined": { + "name": "swapResult2" + } + } + }, + { + "name": "includedTransferFeeAmountIn", + "type": "u64" + }, + { + "name": "includedTransferFeeAmountOut", + "type": "u64" + }, + { + "name": "excludedTransferFeeAmountOut", + "type": "u64" + }, + { + "name": "currentTimestamp", + "type": "u64" + }, + { + "name": "reserveAAmount", + "type": "u64" + }, + { + "name": "reserveBAmount", + "type": "u64" + } + ] + } + }, + { + "name": "evtUpdateDelegatePermission", + "type": { + "kind": "struct", + "fields": [ + { + "name": "position", + "type": "pubkey" + }, + { + "name": "owner", + "type": "pubkey" + }, + { + "name": "permission", + "type": "u32" + }, + { + "name": "delegate", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "evtUpdatePoolFees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "operator", + "type": "pubkey" + }, + { + "name": "params", + "type": { + "defined": { + "name": "updatePoolFeesParameters" + } + } + } + ] + } + }, + { + "name": "evtUpdateRewardDuration", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "oldRewardDuration", + "type": "u64" + }, + { + "name": "newRewardDuration", + "type": "u64" + } + ] + } + }, + { + "name": "evtUpdateRewardFunder", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "rewardIndex", + "type": "u8" + }, + { + "name": "oldFunder", + "type": "pubkey" + }, + { + "name": "newFunder", + "type": "pubkey" + } + ] + } + }, + { + "name": "evtWithdrawDeadLiquidityReward", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "rewardMint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "evtWithdrawIneligibleReward", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "rewardMint", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "initializeCustomizablePoolParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "poolFees", + "docs": [ + "pool fees" + ], + "type": { + "defined": { + "name": "poolFeeParameters" + } + } + }, + { + "name": "sqrtMinPrice", + "docs": [ + "sqrt min price" + ], + "type": "u128" + }, + { + "name": "sqrtMaxPrice", + "docs": [ + "sqrt max price" + ], + "type": "u128" + }, + { + "name": "hasAlphaVault", + "docs": [ + "has alpha vault" + ], + "type": "bool" + }, + { + "name": "liquidity", + "docs": [ + "initialize liquidity" + ], + "type": "u128" + }, + { + "name": "sqrtPrice", + "docs": [ + "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value. Market cap fee scheduler minimum price will be derived from this value" + ], + "type": "u128" + }, + { + "name": "activationType", + "docs": [ + "activation type" + ], + "type": "u8" + }, + { + "name": "collectFeeMode", + "docs": [ + "collect fee mode" + ], + "type": "u8" + }, + { + "name": "activationPoint", + "docs": [ + "activation point" + ], + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "initializePoolParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidity", + "docs": [ + "initialize liquidity" + ], + "type": "u128" + }, + { + "name": "sqrtPrice", + "docs": [ + "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value" + ], + "type": "u128" + }, + { + "name": "activationPoint", + "docs": [ + "activation point" + ], + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "innerVesting", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffPoint", + "type": "u64" + }, + { + "name": "periodFrequency", + "type": "u64" + }, + { + "name": "cliffUnlockLiquidity", + "type": "u128" + }, + { + "name": "liquidityPerPeriod", + "type": "u128" + }, + { + "name": "totalReleasedLiquidity", + "type": "u128" + }, + { + "name": "numberOfPeriod", + "type": "u16" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 14 + ] + } + } + ] + } + }, + { + "name": "operator", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "whitelistedAddress", + "type": "pubkey" + }, + { + "name": "permission", + "type": "u128" + }, + { + "name": "padding", + "type": { + "array": [ + "u64", + 2 + ] + } + } + ] + } + }, + { + "name": "podAlignedFeeMarketCapScheduler", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "type": "u64" + }, + { + "name": "baseFeeMode", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "numberOfPeriod", + "type": "u16" + }, + { + "name": "sqrtPriceStepBps", + "type": "u32" + }, + { + "name": "schedulerExpirationDuration", + "type": "u32" + }, + { + "name": "reductionFactor", + "type": "u64" + } + ] + } + }, + { + "name": "podAlignedFeeRateLimiter", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "type": "u64" + }, + { + "name": "baseFeeMode", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "feeIncrementBps", + "type": "u16" + }, + { + "name": "maxLimiterDuration", + "type": "u32" + }, + { + "name": "maxFeeBps", + "type": "u32" + }, + { + "name": "referenceAmount", + "type": "u64" + } + ] + } + }, + { + "name": "podAlignedFeeTimeScheduler", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "type": "u64" + }, + { + "name": "baseFeeMode", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": [ + "u8", + 5 + ] + } + }, + { + "name": "numberOfPeriod", + "type": "u16" + }, + { + "name": "periodFrequency", + "type": "u64" + }, + { + "name": "reductionFactor", + "type": "u64" + } + ] + } + }, + { + "name": "pool", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "poolFees", + "docs": [ + "Pool fee" + ], + "type": { + "defined": { + "name": "poolFeesStruct" + } + } + }, + { + "name": "tokenAMint", + "docs": [ + "token a mint" + ], + "type": "pubkey" + }, + { + "name": "tokenBMint", + "docs": [ + "token b mint" + ], + "type": "pubkey" + }, + { + "name": "tokenAVault", + "docs": [ + "token a vault" + ], + "type": "pubkey" + }, + { + "name": "tokenBVault", + "docs": [ + "token b vault" + ], + "type": "pubkey" + }, + { + "name": "whitelistedVault", + "docs": [ + "Whitelisted vault to be able to buy pool before activation_point" + ], + "type": "pubkey" + }, + { + "name": "padding0", + "docs": [ + "padding, previously partner pubkey, be careful when using this field" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "liquidity", + "docs": [ + "liquidity share" + ], + "type": "u128" + }, + { + "name": "padding1", + "docs": [ + "padding, previous reserve amount, be careful to use that field" + ], + "type": "u128" + }, + { + "name": "protocolAFee", + "docs": [ + "protocol a fee" + ], + "type": "u64" + }, + { + "name": "protocolBFee", + "docs": [ + "protocol b fee" + ], + "type": "u64" + }, + { + "name": "padding2", + "type": "u128" + }, + { + "name": "sqrtMinPrice", + "docs": [ + "min price" + ], + "type": "u128" + }, + { + "name": "sqrtMaxPrice", + "docs": [ + "max price" + ], + "type": "u128" + }, + { + "name": "sqrtPrice", + "docs": [ + "current price" + ], + "type": "u128" + }, + { + "name": "activationPoint", + "docs": [ + "Activation point, can be slot or timestamp" + ], + "type": "u64" + }, + { + "name": "activationType", + "docs": [ + "Activation type, 0 means by slot, 1 means by timestamp" + ], + "type": "u8" + }, + { + "name": "poolStatus", + "docs": [ + "pool status, 0: enable, 1 disable" + ], + "type": "u8" + }, + { + "name": "tokenAFlag", + "docs": [ + "token a flag" + ], + "type": "u8" + }, + { + "name": "tokenBFlag", + "docs": [ + "token b flag" + ], + "type": "u8" + }, + { + "name": "collectFeeMode", + "docs": [ + "0 is collect fee in both token, 1 only collect fee only in token b" + ], + "type": "u8" + }, + { + "name": "poolType", + "docs": [ + "pool type" + ], + "type": "u8" + }, + { + "name": "feeVersion", + "docs": [ + "pool fee version, 0: max_fee is still capped at 50%, 1: max_fee is capped at 99%" + ], + "type": "u8" + }, + { + "name": "padding3", + "docs": [ + "padding" + ], + "type": "u8" + }, + { + "name": "feeAPerLiquidity", + "docs": [ + "cumulative" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "feeBPerLiquidity", + "docs": [ + "cumulative" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "permanentLockLiquidity", + "type": "u128" + }, + { + "name": "metrics", + "docs": [ + "metrics" + ], + "type": { + "defined": { + "name": "poolMetrics" + } + } + }, + { + "name": "creator", + "docs": [ + "pool creator" + ], + "type": "pubkey" + }, + { + "name": "tokenAAmount", + "docs": [ + "token a amount" + ], + "type": "u64" + }, + { + "name": "tokenBAmount", + "docs": [ + "token b amount" + ], + "type": "u64" + }, + { + "name": "layoutVersion", + "docs": [ + "layout version: version 0: haven't track token_a_amount and token_b_amount, version 1: track token_a_amount and token_b_amount" + ], + "type": "u8" + }, + { + "name": "padding4", + "docs": [ + "Padding for further use" + ], + "type": { + "array": [ + "u8", + 7 + ] + } + }, + { + "name": "padding5", + "docs": [ + "Padding for further use" + ], + "type": { + "array": [ + "u64", + 3 + ] + } + }, + { + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ + { + "defined": { + "name": "rewardInfo" + } + }, + 2 + ] + } + } + ] + } + }, + { + "name": "poolFeeParameters", + "docs": [ + "Information regarding fee charges" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "baseFee", + "docs": [ + "Base fee" + ], + "type": { + "defined": { + "name": "baseFeeParameters" + } + } + }, + { + "name": "compoundingFeeBps", + "docs": [ + "compounding fee bps, only have value if CollectFeeMode::Compounding" + ], + "type": "u16" + }, + { + "name": "padding", + "docs": [ + "padding for future use" + ], + "type": "u8" + }, + { + "name": "dynamicFee", + "docs": [ + "dynamic fee" + ], + "type": { + "option": { + "defined": { + "name": "dynamicFeeParameters" + } + } + } + } + ] + } + }, + { + "name": "poolFeesConfig", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "baseFee", + "type": { + "defined": { + "name": "baseFeeInfo" + } + } + }, + { + "name": "dynamicFee", + "type": { + "defined": { + "name": "dynamicFeeConfig" + } + } + }, + { + "name": "protocolFeePercent", + "type": "u8" + }, + { + "name": "padding0", + "type": "u8" + }, + { + "name": "referralFeePercent", + "type": "u8" + }, + { + "name": "padding1", + "type": { + "array": [ + "u8", + 3 + ] + } + }, + { + "name": "compoundingFeeBps", + "docs": [ + "Compounding fee bps, only non-zero if collect_fee_mode is compounding" + ], + "type": "u16" + }, + { + "name": "padding2", + "type": { + "array": [ + "u64", + 5 + ] + } + } + ] + } + }, + { + "name": "poolFeesStruct", + "docs": [ + "Information regarding fee charges", + "trading_fee = amount * trade_fee_numerator / denominator", + "protocol_fee = trading_fee * protocol_fee_percentage / 100", + "referral_fee = protocol_fee * referral_percentage / 100" + ], + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "baseFee", + "docs": [ + "Trade fees are extra token amounts that are held inside the token", + "accounts during a trade, making the value of liquidity tokens rise.", + "Trade fee numerator" + ], + "type": { + "defined": { + "name": "baseFeeStruct" + } + } + }, + { + "name": "protocolFeePercent", + "docs": [ + "Protocol trading fees are extra token amounts that are held inside the token", + "accounts during a trade, with the equivalent in pool tokens minted to", + "the protocol of the program.", + "Protocol trade fee numerator" + ], + "type": "u8" + }, + { + "name": "padding0", + "docs": [ + "padding for future use" + ], + "type": "u8" + }, + { + "name": "referralFeePercent", + "docs": [ + "referral fee" + ], + "type": "u8" + }, + { + "name": "padding1", + "docs": [ + "padding" + ], + "type": { + "array": [ + "u8", + 3 + ] + } + }, + { + "name": "compoundingFeeBps", + "docs": [ + "compounding fee bps, only non-zero in CollectFeeMode::Compounding" + ], + "type": "u16" + }, + { + "name": "dynamicFee", + "docs": [ + "dynamic fee" + ], + "type": { + "defined": { + "name": "dynamicFeeStruct" + } + } + }, + { + "name": "initSqrtPrice", + "type": "u128" + } + ] + } + }, + { + "name": "poolMetrics", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "totalLpAFee", + "type": "u128" + }, + { + "name": "totalLpBFee", + "type": "u128" + }, + { + "name": "totalProtocolAFee", + "type": "u64" + }, + { + "name": "totalProtocolBFee", + "type": "u64" + }, + { + "name": "padding0", + "type": { + "array": [ + "u64", + 2 + ] + } + }, + { + "name": "totalPosition", + "type": "u64" + }, + { + "name": "padding", + "type": "u64" + } + ] + } + }, + { + "name": "position", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "nftMint", + "docs": [ + "nft mint" + ], + "type": "pubkey" + }, + { + "name": "feeAPerTokenCheckpoint", + "docs": [ + "fee a checkpoint" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "feeBPerTokenCheckpoint", + "docs": [ + "fee b checkpoint" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "feeAPending", + "docs": [ + "fee a pending" + ], + "type": "u64" + }, + { + "name": "feeBPending", + "docs": [ + "fee b pending" + ], + "type": "u64" + }, + { + "name": "unlockedLiquidity", + "docs": [ + "unlock liquidity" + ], + "type": "u128" + }, + { + "name": "vestedLiquidity", + "docs": [ + "vesting liquidity" + ], + "type": "u128" + }, + { + "name": "permanentLockedLiquidity", + "docs": [ + "permanent locked liquidity" + ], + "type": "u128" + }, + { + "name": "metrics", + "docs": [ + "metrics" + ], + "type": { + "defined": { + "name": "positionMetrics" + } + } + }, + { + "name": "rewardInfos", + "docs": [ + "Farming reward information" + ], + "type": { + "array": [ + { + "defined": { + "name": "userRewardInfo" + } + }, + 2 + ] + } + }, + { + "name": "innerVesting", + "docs": [ + "inner vesting info" + ], + "type": { + "defined": { + "name": "innerVesting" + } + } + }, + { + "name": "delegatePermission", + "docs": [ + "delegate permission bitmask (paired with SPL token Approve)" + ], + "type": "u32" + }, + { + "name": "padding", + "docs": [ + "padding for future usage" + ], + "type": { + "array": [ + "u8", + 12 + ] + } + } + ] + } + }, + { + "name": "positionMetrics", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "totalClaimedAFee", + "type": "u64" + }, + { + "name": "totalClaimedBFee", + "type": "u64" + } + ] + } + }, + { + "name": "removeLiquidityParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidityDelta", + "docs": [ + "delta liquidity" + ], + "type": "u128" + }, + { + "name": "tokenAAmountThreshold", + "docs": [ + "minimum token a amount" + ], + "type": "u64" + }, + { + "name": "tokenBAmountThreshold", + "docs": [ + "minimum token b amount" + ], + "type": "u64" + } + ] + } + }, + { + "name": "rewardInfo", + "docs": [ + "Stores the state relevant for tracking liquidity mining rewards" + ], + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "initialized", + "docs": [ + "Indicates if the reward has been initialized" + ], + "type": "u8" + }, + { + "name": "rewardTokenFlag", + "docs": [ + "reward token flag" + ], + "type": "u8" + }, + { + "name": "padding0", + "docs": [ + "padding" + ], + "type": { + "array": [ + "u8", + 6 + ] + } + }, + { + "name": "deadLiquidityRewardCheckpoint", + "docs": [ + "Cumulative dead-liquidity reward (Compounding Pool only)" + ], + "type": "u64" + }, + { + "name": "mint", + "docs": [ + "Reward token mint." + ], + "type": "pubkey" + }, + { + "name": "vault", + "docs": [ + "Reward vault token account." + ], + "type": "pubkey" + }, + { + "name": "funder", + "docs": [ + "Authority account that allows to fund rewards" + ], + "type": "pubkey" + }, + { + "name": "rewardDuration", + "docs": [ + "reward duration" + ], + "type": "u64" + }, + { + "name": "rewardDurationEnd", + "docs": [ + "reward duration end" + ], + "type": "u64" + }, + { + "name": "rewardRate", + "docs": [ + "reward rate" + ], + "type": "u128" + }, + { + "name": "rewardPerTokenStored", + "docs": [ + "Reward per token stored" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "lastUpdateTime", + "docs": [ + "The last time reward states were updated." + ], + "type": "u64" + }, + { + "name": "cumulativeSecondsWithEmptyLiquidityReward", + "docs": [ + "Accumulated seconds when the farm distributed rewards but the bin was empty.", + "These rewards will be carried over to the next reward time window." + ], + "type": "u64" + } + ] + } + }, + { + "name": "splitAmountInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "permanentLockedLiquidity", + "type": "u128" + }, + { + "name": "unlockedLiquidity", + "type": "u128" + }, + { + "name": "feeA", + "type": "u64" + }, + { + "name": "feeB", + "type": "u64" + }, + { + "name": "reward0", + "type": "u64" + }, + { + "name": "reward1", + "type": "u64" + } + ] + } + }, + { + "name": "splitAmountInfo2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "permanentLockedLiquidity", + "type": "u128" + }, + { + "name": "unlockedLiquidity", + "type": "u128" + }, + { + "name": "vestedLiquidity", + "type": "u128" + }, + { + "name": "feeA", + "type": "u64" + }, + { + "name": "feeB", + "type": "u64" + }, + { + "name": "reward0", + "type": "u64" + }, + { + "name": "reward1", + "type": "u64" + } + ] + } + }, + { + "name": "splitPositionInfo", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidity", + "type": "u128" + }, + { + "name": "feeA", + "type": "u64" + }, + { + "name": "feeB", + "type": "u64" + }, + { + "name": "reward0", + "type": "u64" + }, + { + "name": "reward1", + "type": "u64" + } + ] + } + }, + { + "name": "splitPositionInfo2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "unlockedLiquidity", + "type": "u128" + }, + { + "name": "permanentLockedLiquidity", + "type": "u128" + }, + { + "name": "vestedLiquidity", + "type": "u128" + }, + { + "name": "feeA", + "type": "u64" + }, + { + "name": "feeB", + "type": "u64" + }, + { + "name": "reward0", + "type": "u64" + }, + { + "name": "reward1", + "type": "u64" + } + ] + } + }, + { + "name": "splitPositionParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "unlockedLiquidityPercentage", + "docs": [ + "Percentage of unlocked liquidity to split to the second position" + ], + "type": "u8" + }, + { + "name": "permanentLockedLiquidityPercentage", + "docs": [ + "Percentage of permanent locked liquidity to split to the second position" + ], + "type": "u8" + }, + { + "name": "feeAPercentage", + "docs": [ + "Percentage of fee A pending to split to the second position" + ], + "type": "u8" + }, + { + "name": "feeBPercentage", + "docs": [ + "Percentage of fee B pending to split to the second position" + ], + "type": "u8" + }, + { + "name": "reward0Percentage", + "docs": [ + "Percentage of reward 0 pending to split to the second position" + ], + "type": "u8" + }, + { + "name": "reward1Percentage", + "docs": [ + "Percentage of reward 1 pending to split to the second position" + ], + "type": "u8" + }, + { + "name": "innerVestingLiquidityPercentage", + "docs": [ + "Percentage of inner vesting liquidity" + ], + "type": "u8" + }, + { + "name": "padding", + "docs": [ + "padding for future" + ], + "type": { + "array": [ + "u8", + 15 + ] + } + } + ] + } + }, + { + "name": "splitPositionParameters2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "unlockedLiquidityNumerator", + "type": "u32" + }, + { + "name": "permanentLockedLiquidityNumerator", + "type": "u32" + }, + { + "name": "feeANumerator", + "type": "u32" + }, + { + "name": "feeBNumerator", + "type": "u32" + }, + { + "name": "reward0Numerator", + "type": "u32" + }, + { + "name": "reward1Numerator", + "type": "u32" + } + ] + } + }, + { + "name": "splitPositionParameters3", + "type": { + "kind": "struct", + "fields": [ + { + "name": "unlockedLiquidityNumerator", + "type": "u32" + }, + { + "name": "permanentLockedLiquidityNumerator", + "type": "u32" + }, + { + "name": "feeANumerator", + "type": "u32" + }, + { + "name": "feeBNumerator", + "type": "u32" + }, + { + "name": "reward0Numerator", + "type": "u32" + }, + { + "name": "reward1Numerator", + "type": "u32" + }, + { + "name": "innerVestingLiquidityNumerator", + "type": "u32" + } + ] + } + }, + { + "name": "staticConfigParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "poolFees", + "type": { + "defined": { + "name": "poolFeeParameters" + } + } + }, + { + "name": "sqrtMinPrice", + "type": "u128" + }, + { + "name": "sqrtMaxPrice", + "type": "u128" + }, + { + "name": "vaultConfigKey", + "type": "pubkey" + }, + { + "name": "poolCreatorAuthority", + "type": "pubkey" + }, + { + "name": "activationType", + "type": "u8" + }, + { + "name": "collectFeeMode", + "type": "u8" + } + ] + } + }, + { + "name": "swapParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amountIn", + "type": "u64" + }, + { + "name": "minimumAmountOut", + "type": "u64" + } + ] + } + }, + { + "name": "swapParameters2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount0", + "docs": [ + "When it's exact in, partial fill, this will be amount_in. When it's exact out, this will be amount_out" + ], + "type": "u64" + }, + { + "name": "amount1", + "docs": [ + "When it's exact in, partial fill, this will be minimum_amount_out. When it's exact out, this will be maximum_amount_in" + ], + "type": "u64" + }, + { + "name": "swapMode", + "docs": [ + "Swap mode, refer [SwapMode]" + ], + "type": "u8" + } + ] + } + }, + { + "name": "swapResult2", + "type": { + "kind": "struct", + "fields": [ + { + "name": "includedFeeInputAmount", + "type": "u64" + }, + { + "name": "excludedFeeInputAmount", + "type": "u64" + }, + { + "name": "amountLeft", + "type": "u64" + }, + { + "name": "outputAmount", + "type": "u64" + }, + { + "name": "nextSqrtPrice", + "type": "u128" + }, + { + "name": "claimingFee", + "type": "u64" + }, + { + "name": "protocolFee", + "type": "u64" + }, + { + "name": "compoundingFee", + "type": "u64" + }, + { + "name": "referralFee", + "type": "u64" + } + ] + } + }, + { + "name": "tokenBadge", + "docs": [ + "Parameter that set by the protocol" + ], + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "tokenMint", + "docs": [ + "token mint" + ], + "type": "pubkey" + }, + { + "name": "padding", + "docs": [ + "Reserve" + ], + "type": { + "array": [ + "u8", + 128 + ] + } + } + ] + } + }, + { + "name": "updatePoolFeesParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffFeeNumerator", + "docs": [ + "Base fee update mode:", + "- None: skip base fee update", + "- Some: update new cliff_fee_numerator if base fee is static" + ], + "type": { + "option": "u64" + } + }, + { + "name": "dynamicFee", + "docs": [ + "Dynamic fee update mode:", + "- None: skip dynamic fee update", + "- Some(with default value): disable dynamic fee", + "- Some(with non default value): enable dynamic fee if disabled or update dynamic fee if enabled" + ], + "type": { + "option": { + "defined": { + "name": "dynamicFeeParameters" + } + } + } + }, + { + "name": "compoundingFeeBps", + "docs": [ + "Compounding fee update mode:", + "- None: skip compounding fee update", + "- Some: update compounding_fee_bps; pool must use CollectFeeMode::Compounding" + ], + "type": { + "option": "u16" + } + } + ] + } + }, + { + "name": "userRewardInfo", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "rewardPerTokenCheckpoint", + "docs": [ + "The latest update reward checkpoint" + ], + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "rewardPendings", + "docs": [ + "Current pending rewards" + ], + "type": "u64" + }, + { + "name": "totalClaimedRewards", + "docs": [ + "Total claimed rewards" + ], + "type": "u64" + } + ] + } + }, + { + "name": "vesting", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "position", + "type": "pubkey" + }, + { + "name": "innerVesting", + "type": { + "defined": { + "name": "innerVesting" + } + } + }, + { + "name": "padding2", + "type": { + "array": [ + "u128", + 4 + ] + } + } + ] + } + }, + { + "name": "vestingParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliffPoint", + "type": { + "option": "u64" + } + }, + { + "name": "periodFrequency", + "type": "u64" + }, + { + "name": "cliffUnlockLiquidity", + "type": "u128" + }, + { + "name": "liquidityPerPeriod", + "type": "u128" + }, + { + "name": "numberOfPeriod", + "type": "u16" + } + ] + } + } + ], + "constants": [ + { + "name": "binStepBpsDefault", + "type": "u16", + "value": "1" + }, + { + "name": "binStepU128DefaultLeBytes", + "type": { + "array": [ + "u8", + 16 + ] + }, + "value": "[203, 16, 199, 186, 184, 141, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { + "name": "currentPoolVersion", + "type": "u8", + "value": "1" + }, + { + "name": "customizablePoolPrefix", + "type": "bytes", + "value": "[99, 112, 111, 111, 108]" + }, + { + "name": "feeDenominator", + "docs": [ + "Default fee denominator. DO NOT simply update it as it will break logic that depends on it as default value." + ], + "type": "u64", + "value": "1000000000" + }, + { + "name": "maxBasisPoint", + "docs": [ + "Max basis point. 100% in pct" + ], + "type": "u16", + "value": "10000" + }, + { + "name": "maxFeeNumeratorV0", + "type": "u64", + "value": "500000000" + }, + { + "name": "maxFeeNumeratorV1", + "type": "u64", + "value": "990000000" + }, + { + "name": "maxSqrtPriceLeBytes", + "type": { + "array": [ + "u8", + 16 + ] + }, + "value": "[155, 87, 105, 78, 169, 26, 92, 132, 177, 196, 254, 255, 0, 0, 0, 0]" + }, + { + "name": "minFeeNumerator", + "type": "u64", + "value": "100000" + }, + { + "name": "minSqrtPriceLeBytes", + "type": { + "array": [ + "u8", + 16 + ] + }, + "value": "[80, 59, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { + "name": "poolAuthorityPrefix", + "type": "bytes", + "value": "[112, 111, 111, 108, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]" + }, + { + "name": "poolPrefix", + "type": "bytes", + "value": "[112, 111, 111, 108]" + }, + { + "name": "positionNftAccountPrefix", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, 110, 116]" + }, + { + "name": "positionPrefix", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110]" + }, + { + "name": "splitPositionDenominator", + "type": "u32", + "value": "1000000000" + }, + { + "name": "tokenVaultPrefix", + "type": "bytes", + "value": "[116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116]" + } + ] +};