diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9dfbe1..0a53fa0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,7 @@ on: pull_request: branches: - main - - release_0.2.0 - - zap_in + - release_0.2.1 env: SOLANA_CLI_VERSION: 2.1.0 diff --git a/Cargo.lock b/Cargo.lock index 7538b16..ebe94d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -729,8 +729,8 @@ checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "cp-amm" -version = "0.1.5" -source = "git+https://github.com/MeteoraAg/damm-v2?rev=689a3264484799d833c505523f4ff4e4990690aa#689a3264484799d833c505523f4ff4e4990690aa" +version = "0.1.6" +source = "git+https://github.com/MeteoraAg/damm-v2?rev=d9cef5aaec9cfa1a6d3b0b28d213c87c285127de#d9cef5aaec9cfa1a6d3b0b28d213c87c285127de" dependencies = [ "anchor-lang", "anchor-spl", @@ -739,6 +739,9 @@ dependencies = [ "num", "num-traits", "num_enum", + "pinocchio", + "pinocchio-token", + "pinocchio-token-2022", "ruint", "spl-token-metadata-interface", "static_assertions", @@ -1428,6 +1431,39 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pinocchio" +version = "0.9.0" +source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" + +[[package]] +name = "pinocchio-pubkey" +version = "0.3.0" +source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" +dependencies = [ + "five8_const", + "pinocchio", + "sha2-const-stable", +] + +[[package]] +name = "pinocchio-token" +version = "0.4.0" +source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" +dependencies = [ + "pinocchio", + "pinocchio-pubkey", +] + +[[package]] +name = "pinocchio-token-2022" +version = "0.1.0" +source = "git+https://github.com/anza-xyz/pinocchio.git?rev=17b0e862c01a868ea07ef81a2f8a9b4a504bdfed#17b0e862c01a868ea07ef81a2f8a9b4a504bdfed" +dependencies = [ + "pinocchio", + "pinocchio-pubkey", +] + [[package]] name = "polyval" version = "0.6.2" diff --git a/idls/damm_v2.json b/idls/damm_v2.json index a7bf2f7..fee333e 100644 --- a/idls/damm_v2.json +++ b/idls/damm_v2.json @@ -2,30 +2,19 @@ "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG", "metadata": { "name": "cp_amm", - "version": "0.1.5", + "version": "0.1.6", "spec": "0.1.0", "description": "Created with Anchor" }, "instructions": [ { "name": "add_liquidity", - "discriminator": [ - 181, - 157, - 89, - 67, - 143, - 182, - 52, - 72 - ], + "discriminator": [181, 157, 89, 67, 143, 182, 52, 72], "accounts": [ { "name": "pool", "writable": true, - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -33,80 +22,52 @@ }, { "name": "token_a_account", - "docs": [ - "The user token a account" - ], + "docs": ["The user token a account"], "writable": true }, { "name": "token_b_account", - "docs": [ - "The user token b account" - ], + "docs": ["The user token b account"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token a"], + "relations": ["pool"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token b"], + "relations": ["pool"] }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "event_authority", @@ -115,23 +76,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -154,16 +100,7 @@ }, { "name": "claim_partner_fee", - "discriminator": [ - 97, - 206, - 39, - 105, - 94, - 94, - 126, - 148 - ], + "discriminator": [97, 206, 39, 105, 94, 94, 126, 148], "accounts": [ { "name": "pool_authority", @@ -175,74 +112,48 @@ }, { "name": "token_a_account", - "docs": [ - "The treasury token a account" - ], + "docs": ["The treasury token a account"], "writable": true }, { "name": "token_b_account", - "docs": [ - "The treasury token b account" - ], + "docs": ["The treasury token b account"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token a"], + "relations": ["pool"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token b"], + "relations": ["pool"] }, { "name": "partner", "signer": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "event_authority", @@ -251,23 +162,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -290,16 +186,7 @@ }, { "name": "claim_position_fee", - "discriminator": [ - 180, - 38, - 154, - 17, - 133, - 33, - 162, - 211 - ], + "discriminator": [180, 38, 154, 17, 133, 33, 162, 211], "accounts": [ { "name": "pool_authority", @@ -307,9 +194,7 @@ }, { "name": "pool", - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -317,80 +202,52 @@ }, { "name": "token_a_account", - "docs": [ - "The user token a account" - ], + "docs": ["The user token a account"], "writable": true }, { "name": "token_b_account", - "docs": [ - "The user token b account" - ], + "docs": ["The user token b account"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token a"], + "relations": ["pool"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token b"], + "relations": ["pool"] }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "event_authority", @@ -399,23 +256,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -429,16 +271,7 @@ }, { "name": "claim_protocol_fee", - "discriminator": [ - 165, - 228, - 133, - 48, - 99, - 249, - 255, - 33 - ], + "discriminator": [165, 228, 133, 48, 99, 249, 255, 33], "accounts": [ { "name": "pool_authority", @@ -450,85 +283,38 @@ }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token a"], + "relations": ["pool"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token b"], + "relations": ["pool"] }, { "name": "token_a_account", - "docs": [ - "The treasury token a account" - ], + "docs": ["The treasury token a account"], "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 48, - 9, - 89, - 123, - 106, - 114, - 131, - 251, - 50, - 173, - 254, - 250, - 10, - 80, - 160, - 84, - 143, - 100, - 81, - 249, - 134, - 112, - 30, - 213, - 50, - 166, - 239, - 78, - 53, - 175, - 188, - 85 + 48, 9, 89, 123, 106, 114, 131, 251, 50, 173, 254, 250, 10, 80, + 160, 84, 143, 100, 81, 249, 134, 112, 30, 213, 50, 166, 239, + 78, 53, 175, 188, 85 ] }, { @@ -543,85 +329,25 @@ "program": { "kind": "const", "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, + 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, + 219, 233, 248, 89 ] } } }, { "name": "token_b_account", - "docs": [ - "The treasury token b account" - ], + "docs": ["The treasury token b account"], "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 48, - 9, - 89, - 123, - 106, - 114, - 131, - 251, - 50, - 173, - 254, - 250, - 10, - 80, - 160, - 84, - 143, - 100, - 81, - 249, - 134, - 112, - 30, - 213, - 50, - 166, - 239, - 78, - 53, - 175, - 188, - 85 + 48, 9, 89, 123, 106, 114, 131, 251, 50, 173, 254, 250, 10, 80, + 160, 84, 143, 100, 81, 249, 134, 112, 30, 213, 50, 166, 239, + 78, 53, 175, 188, 85 ] }, { @@ -636,69 +362,30 @@ "program": { "kind": "const", "value": [ - 140, - 151, - 37, - 143, - 78, - 36, - 137, - 241, - 187, - 61, - 16, - 41, - 20, - 142, - 13, - 131, - 11, - 90, - 19, - 153, - 218, - 255, - 16, - 132, - 4, - 142, - 123, - 216, - 219, - 233, - 248, - 89 + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, + 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216, + 219, 233, 248, 89 ] } } }, { - "name": "claim_fee_operator", - "docs": [ - "Claim fee operator" - ] + "name": "operator", + "docs": ["Claim fee operator"] }, { - "name": "operator", - "docs": [ - "Operator" - ], + "name": "whitelisted_address", + "docs": ["Operator"], "signer": true, - "relations": [ - "claim_fee_operator" - ] + "relations": ["operator"] }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "event_authority", @@ -707,23 +394,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -746,16 +418,7 @@ }, { "name": "claim_reward", - "discriminator": [ - 149, - 95, - 181, - 242, - 94, - 90, - 158, - 162 - ], + "discriminator": [149, 95, 181, 242, 94, 90, 158, 162], "accounts": [ { "name": "pool_authority", @@ -764,9 +427,7 @@ { "name": "pool", "writable": true, - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -774,9 +435,7 @@ }, { "name": "reward_vault", - "docs": [ - "The vault token account for reward token" - ], + "docs": ["The vault token account for reward token"], "writable": true }, { @@ -788,15 +447,11 @@ }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { @@ -809,23 +464,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -847,29 +487,24 @@ ] }, { - "name": "close_claim_fee_operator", - "discriminator": [ - 38, - 134, - 82, - 216, - 95, - 124, - 17, - 99 - ], + "name": "close_config", + "discriminator": [145, 9, 72, 157, 95, 125, 61, 85], "accounts": [ { - "name": "claim_fee_operator", + "name": "config", "writable": true }, { - "name": "rent_receiver", - "writable": true + "name": "operator" }, { - "name": "admin", - "signer": true + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] + }, + { + "name": "rent_receiver", + "writable": true }, { "name": "event_authority", @@ -878,23 +513,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -907,25 +527,15 @@ "args": [] }, { - "name": "close_config", - "discriminator": [ - 145, - 9, - 72, - 157, - 95, - 125, - 61, - 85 - ], + "name": "close_operator_account", + "discriminator": [171, 9, 213, 74, 120, 23, 3, 29], "accounts": [ { - "name": "config", + "name": "operator", "writable": true }, { "name": "admin", - "writable": true, "signer": true }, { @@ -939,23 +549,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -969,37 +564,22 @@ }, { "name": "close_position", - "discriminator": [ - 123, - 134, - 81, - 0, - 49, - 68, - 98, - 98 - ], + "discriminator": [123, 134, 81, 0, 49, 68, 98, 98], "accounts": [ { "name": "position_nft_mint", - "docs": [ - "position_nft_mint" - ], + "docs": ["position_nft_mint"], "writable": true }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ], + "docs": ["The token account for nft"], "writable": true }, { "name": "pool", "writable": true, - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -1015,9 +595,7 @@ }, { "name": "owner", - "docs": [ - "Owner of position" - ], + "docs": ["Owner of position"], "signer": true }, { @@ -1034,23 +612,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1064,25 +627,19 @@ }, { "name": "close_token_badge", - "discriminator": [ - 108, - 146, - 86, - 110, - 179, - 254, - 10, - 104 - ], + "discriminator": [108, 146, 86, 110, 179, 254, 10, 104], "accounts": [ { "name": "token_badge", "writable": true }, { - "name": "admin", - "writable": true, - "signer": true + "name": "operator" + }, + { + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] }, { "name": "rent_receiver", @@ -1095,23 +652,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1124,42 +666,22 @@ "args": [] }, { - "name": "create_claim_fee_operator", - "discriminator": [ - 169, - 62, - 207, - 107, - 58, - 187, - 162, - 109 - ], + "name": "create_config", + "docs": ["OPERATOR FUNCTIONS /////"], + "discriminator": [201, 207, 243, 114, 75, 111, 47, 189], "accounts": [ { - "name": "claim_fee_operator", + "name": "config", "writable": true, "pda": { "seeds": [ { "kind": "const", - "value": [ - 99, - 102, - 95, - 111, - 112, - 101, - 114, - 97, - 116, - 111, - 114 - ] + "value": [99, 111, 110, 102, 105, 103] }, { - "kind": "account", - "path": "operator" + "kind": "arg", + "path": "index" } ] } @@ -1168,7 +690,12 @@ "name": "operator" }, { - "name": "admin", + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] + }, + { + "name": "payer", "writable": true, "signer": true }, @@ -1183,23 +710,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1209,23 +721,24 @@ "name": "program" } ], - "args": [] + "args": [ + { + "name": "index", + "type": "u64" + }, + { + "name": "config_parameters", + "type": { + "defined": { + "name": "StaticConfigParameters" + } + } + } + ] }, { - "name": "create_config", - "docs": [ - "ADMIN FUNCTIONS /////" - ], - "discriminator": [ - 201, - 207, - 243, - 114, - 75, - 111, - 47, - 189 - ], + "name": "create_dynamic_config", + "discriminator": [81, 251, 122, 78, 66, 57, 208, 82], "accounts": [ { "name": "config", @@ -1234,14 +747,7 @@ "seeds": [ { "kind": "const", - "value": [ - 99, - 111, - 110, - 102, - 105, - 103 - ] + "value": [99, 111, 110, 102, 105, 103] }, { "kind": "arg", @@ -1251,7 +757,15 @@ } }, { - "name": "admin", + "name": "operator" + }, + { + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] + }, + { + "name": "payer", "writable": true, "signer": true }, @@ -1266,23 +780,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1301,50 +800,42 @@ "name": "config_parameters", "type": { "defined": { - "name": "StaticConfigParameters" + "name": "DynamicConfigParameters" } } } ] }, { - "name": "create_dynamic_config", - "discriminator": [ - 81, - 251, - 122, - 78, - 66, - 57, - 208, - 82 - ], + "name": "create_operator_account", + "docs": ["ADMIN FUNCTIONS /////"], + "discriminator": [221, 64, 246, 149, 240, 153, 229, 163], "accounts": [ { - "name": "config", + "name": "operator", "writable": true, "pda": { "seeds": [ { "kind": "const", - "value": [ - 99, - 111, - 110, - 102, - 105, - 103 - ] + "value": [111, 112, 101, 114, 97, 116, 111, 114] }, { - "kind": "arg", - "path": "index" + "kind": "account", + "path": "whitelisted_address" } ] } }, + { + "name": "whitelisted_address" + }, { "name": "admin", + "signer": true + }, + { + "name": "payer", "writable": true, "signer": true }, @@ -1359,23 +850,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1387,74 +863,35 @@ ], "args": [ { - "name": "index", - "type": "u64" - }, - { - "name": "config_parameters", - "type": { - "defined": { - "name": "DynamicConfigParameters" - } - } + "name": "permission", + "type": "u128" } ] }, { "name": "create_position", - "discriminator": [ - 48, - 215, - 197, - 153, - 96, - 203, - 180, - 133 - ], + "discriminator": [48, 215, 197, 153, 96, 203, 180, 133], "accounts": [ { "name": "owner" }, { "name": "position_nft_mint", - "docs": [ - "position_nft_mint" - ], + "docs": ["position_nft_mint"], "writable": true, "signer": true }, { "name": "position_nft_account", - "docs": [ - "position nft account" - ], + "docs": ["position nft account"], "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110, - 95, - 110, - 102, - 116, - 95, - 97, - 99, - 99, - 111, - 117, - 110, - 116 + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, + 97, 99, 99, 111, 117, 110, 116 ] }, { @@ -1475,16 +912,7 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] + "value": [112, 111, 115, 105, 116, 105, 111, 110] }, { "kind": "account", @@ -1499,9 +927,7 @@ }, { "name": "payer", - "docs": [ - "Address paying to create the position. Can be anyone" - ], + "docs": ["Address paying to create the position. Can be anyone"], "writable": true, "signer": true }, @@ -1523,23 +949,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1553,16 +964,7 @@ }, { "name": "create_token_badge", - "discriminator": [ - 88, - 206, - 0, - 91, - 60, - 175, - 151, - 118 - ], + "discriminator": [88, 206, 0, 91, 60, 175, 151, 118], "accounts": [ { "name": "token_badge", @@ -1571,19 +973,7 @@ "seeds": [ { "kind": "const", - "value": [ - 116, - 111, - 107, - 101, - 110, - 95, - 98, - 97, - 100, - 103, - 101 - ] + "value": [116, 111, 107, 101, 110, 95, 98, 97, 100, 103, 101] }, { "kind": "account", @@ -1596,7 +986,15 @@ "name": "token_mint" }, { - "name": "admin", + "name": "operator" + }, + { + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] + }, + { + "name": "payer", "writable": true, "signer": true }, @@ -1611,23 +1009,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1640,17 +1023,33 @@ "args": [] }, { - "name": "fund_reward", - "discriminator": [ - 188, - 50, - 249, - 165, - 93, - 151, - 38, - 63 + "name": "dummy_ix", + "discriminator": [234, 95, 176, 185, 7, 42, 35, 159], + "accounts": [ + { + "name": "pod_aligned_fee_time_scheduler" + }, + { + "name": "pod_aligned_fee_rate_limiter" + }, + { + "name": "pod_aligned_fee_market_cap_scheduler" + } ], + "args": [ + { + "name": "_ixs", + "type": { + "defined": { + "name": "DummyParams" + } + } + } + ] + }, + { + "name": "fund_reward", + "discriminator": [188, 50, 249, 165, 93, 151, 38, 63], "accounts": [ { "name": "pool", @@ -1681,23 +1080,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1724,59 +1108,28 @@ }, { "name": "initialize_customizable_pool", - "discriminator": [ - 20, - 161, - 241, - 24, - 189, - 221, - 180, - 2 - ], + "discriminator": [20, 161, 241, 24, 189, 221, 180, 2], "accounts": [ { "name": "creator" }, { "name": "position_nft_mint", - "docs": [ - "position_nft_mint" - ], + "docs": ["position_nft_mint"], "writable": true, "signer": true }, { "name": "position_nft_account", - "docs": [ - "position nft account" - ], + "docs": ["position nft account"], "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110, - 95, - 110, - 102, - 116, - 95, - 97, - 99, - 99, - 111, - 117, - 110, - 116 + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, + 97, 99, 99, 111, 117, 110, 116 ] }, { @@ -1788,9 +1141,7 @@ }, { "name": "payer", - "docs": [ - "Address paying to create the pool. Can be anyone" - ], + "docs": ["Address paying to create the pool. Can be anyone"], "writable": true, "signer": true }, @@ -1800,9 +1151,7 @@ }, { "name": "pool", - "docs": [ - "Initialize an account to store the pool state" - ], + "docs": ["Initialize an account to store the pool state"], "writable": true }, { @@ -1812,16 +1161,7 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] + "value": [112, 111, 115, 105, 116, 105, 111, 110] }, { "kind": "account", @@ -1832,39 +1172,21 @@ }, { "name": "token_a_mint", - "docs": [ - "Token a mint" - ] + "docs": ["Token a mint"] }, { "name": "token_b_mint", - "docs": [ - "Token b mint" - ] + "docs": ["Token b mint"] }, { "name": "token_a_vault", - "docs": [ - "Token a vault for the pool" - ], + "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 - ] + "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, { "kind": "account", @@ -1879,27 +1201,13 @@ }, { "name": "token_b_vault", - "docs": [ - "Token b vault for the pool" - ], + "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 - ] + "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, { "kind": "account", @@ -1914,29 +1222,21 @@ }, { "name": "payer_token_a", - "docs": [ - "payer token a account" - ], + "docs": ["payer token a account"], "writable": true }, { "name": "payer_token_b", - "docs": [ - "creator token b account" - ], + "docs": ["creator token b account"], "writable": true }, { "name": "token_a_program", - "docs": [ - "Program to create mint account and mint tokens" - ] + "docs": ["Program to create mint account and mint tokens"] }, { "name": "token_b_program", - "docs": [ - "Program to create mint account and mint tokens" - ] + "docs": ["Program to create mint account and mint tokens"] }, { "name": "token_2022_program", @@ -1956,23 +1256,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -1995,62 +1280,29 @@ }, { "name": "initialize_pool", - "docs": [ - "USER FUNCTIONS ////" - ], - "discriminator": [ - 95, - 180, - 10, - 172, - 84, - 174, - 232, - 40 - ], + "docs": ["USER FUNCTIONS ////"], + "discriminator": [95, 180, 10, 172, 84, 174, 232, 40], "accounts": [ { "name": "creator" }, { "name": "position_nft_mint", - "docs": [ - "position_nft_mint" - ], + "docs": ["position_nft_mint"], "writable": true, "signer": true }, { "name": "position_nft_account", - "docs": [ - "position nft account" - ], + "docs": ["position nft account"], "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110, - 95, - 110, - 102, - 116, - 95, - 97, - 99, - 99, - 111, - 117, - 110, - 116 + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, + 97, 99, 99, 111, 117, 110, 116 ] }, { @@ -2062,17 +1314,13 @@ }, { "name": "payer", - "docs": [ - "Address paying to create the pool. Can be anyone" - ], + "docs": ["Address paying to create the pool. Can be anyone"], "writable": true, "signer": true }, { "name": "config", - "docs": [ - "Which config the pool belongs to." - ] + "docs": ["Which config the pool belongs to."] }, { "name": "pool_authority", @@ -2080,9 +1328,7 @@ }, { "name": "pool", - "docs": [ - "Initialize an account to store the pool state" - ], + "docs": ["Initialize an account to store the pool state"], "writable": true }, { @@ -2092,16 +1338,7 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] + "value": [112, 111, 115, 105, 116, 105, 111, 110] }, { "kind": "account", @@ -2112,39 +1349,21 @@ }, { "name": "token_a_mint", - "docs": [ - "Token a mint" - ] + "docs": ["Token a mint"] }, { "name": "token_b_mint", - "docs": [ - "Token b mint" - ] + "docs": ["Token b mint"] }, { "name": "token_a_vault", - "docs": [ - "Token a vault for the pool" - ], + "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 - ] + "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, { "kind": "account", @@ -2159,27 +1378,13 @@ }, { "name": "token_b_vault", - "docs": [ - "Token b vault for the pool" - ], + "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 - ] + "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, { "kind": "account", @@ -2194,29 +1399,21 @@ }, { "name": "payer_token_a", - "docs": [ - "payer token a account" - ], + "docs": ["payer token a account"], "writable": true }, { "name": "payer_token_b", - "docs": [ - "creator token b account" - ], + "docs": ["creator token b account"], "writable": true }, { "name": "token_a_program", - "docs": [ - "Program to create mint account and mint tokens" - ] + "docs": ["Program to create mint account and mint tokens"] }, { "name": "token_b_program", - "docs": [ - "Program to create mint account and mint tokens" - ] + "docs": ["Program to create mint account and mint tokens"] }, { "name": "token_2022_program", @@ -2236,23 +1433,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2275,59 +1457,28 @@ }, { "name": "initialize_pool_with_dynamic_config", - "discriminator": [ - 149, - 82, - 72, - 197, - 253, - 252, - 68, - 15 - ], + "discriminator": [149, 82, 72, 197, 253, 252, 68, 15], "accounts": [ { "name": "creator" }, { "name": "position_nft_mint", - "docs": [ - "position_nft_mint" - ], + "docs": ["position_nft_mint"], "writable": true, "signer": true }, { "name": "position_nft_account", - "docs": [ - "position nft account" - ], + "docs": ["position nft account"], "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110, - 95, - 110, - 102, - 116, - 95, - 97, - 99, - 99, - 111, - 117, - 110, - 116 + 112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, + 97, 99, 99, 111, 117, 110, 116 ] }, { @@ -2339,24 +1490,18 @@ }, { "name": "payer", - "docs": [ - "Address paying to create the pool. Can be anyone" - ], + "docs": ["Address paying to create the pool. Can be anyone"], "writable": true, "signer": true }, { "name": "pool_creator_authority", "signer": true, - "relations": [ - "config" - ] + "relations": ["config"] }, { "name": "config", - "docs": [ - "Which config the pool belongs to." - ] + "docs": ["Which config the pool belongs to."] }, { "name": "pool_authority", @@ -2364,9 +1509,7 @@ }, { "name": "pool", - "docs": [ - "Initialize an account to store the pool state" - ], + "docs": ["Initialize an account to store the pool state"], "writable": true }, { @@ -2376,16 +1519,7 @@ "seeds": [ { "kind": "const", - "value": [ - 112, - 111, - 115, - 105, - 116, - 105, - 111, - 110 - ] + "value": [112, 111, 115, 105, 116, 105, 111, 110] }, { "kind": "account", @@ -2396,39 +1530,21 @@ }, { "name": "token_a_mint", - "docs": [ - "Token a mint" - ] + "docs": ["Token a mint"] }, { "name": "token_b_mint", - "docs": [ - "Token b mint" - ] + "docs": ["Token b mint"] }, { "name": "token_a_vault", - "docs": [ - "Token a vault for the pool" - ], + "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 - ] + "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, { "kind": "account", @@ -2443,27 +1559,13 @@ }, { "name": "token_b_vault", - "docs": [ - "Token b vault for the pool" - ], + "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 - ] + "value": [116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116] }, { "kind": "account", @@ -2478,29 +1580,21 @@ }, { "name": "payer_token_a", - "docs": [ - "payer token a account" - ], + "docs": ["payer token a account"], "writable": true }, { "name": "payer_token_b", - "docs": [ - "creator token b account" - ], + "docs": ["creator token b account"], "writable": true }, { "name": "token_a_program", - "docs": [ - "Program to create mint account and mint tokens" - ] + "docs": ["Program to create mint account and mint tokens"] }, { "name": "token_b_program", - "docs": [ - "Program to create mint account and mint tokens" - ] + "docs": ["Program to create mint account and mint tokens"] }, { "name": "token_2022_program", @@ -2520,23 +1614,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2559,16 +1638,7 @@ }, { "name": "initialize_reward", - "discriminator": [ - 95, - 135, - 192, - 196, - 242, - 129, - 230, - 68 - ], + "discriminator": [95, 135, 192, 196, 242, 129, 230, 68], "accounts": [ { "name": "pool_authority", @@ -2586,18 +1656,7 @@ { "kind": "const", "value": [ - 114, - 101, - 119, - 97, - 114, - 100, - 95, - 118, - 97, - 117, - 108, - 116 + 114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116 ] }, { @@ -2637,23 +1696,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2680,22 +1724,11 @@ }, { "name": "lock_position", - "discriminator": [ - 227, - 62, - 2, - 252, - 247, - 10, - 171, - 185 - ], + "discriminator": [227, 62, 2, 252, 247, 10, 171, 185], "accounts": [ { "name": "pool", - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -2708,15 +1741,11 @@ }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { @@ -2735,23 +1764,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2774,23 +1788,12 @@ }, { "name": "permanent_lock_position", - "discriminator": [ - 165, - 176, - 125, - 6, - 231, - 171, - 186, - 213 - ], + "discriminator": [165, 176, 125, 6, 231, 171, 186, 213], "accounts": [ { "name": "pool", "writable": true, - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -2798,15 +1801,11 @@ }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { @@ -2816,23 +1815,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -2851,22 +1835,11 @@ }, { "name": "refresh_vesting", - "discriminator": [ - 9, - 94, - 216, - 14, - 116, - 204, - 247, - 0 - ], + "discriminator": [9, 94, 216, 14, 116, 204, 247, 0], "accounts": [ { "name": "pool", - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -2874,9 +1847,7 @@ }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner" @@ -2886,16 +1857,7 @@ }, { "name": "remove_all_liquidity", - "discriminator": [ - 10, - 51, - 61, - 35, - 112, - 105, - 24, - 85 - ], + "discriminator": [10, 51, 61, 35, 112, 105, 24, 85], "accounts": [ { "name": "pool_authority", @@ -2904,9 +1866,7 @@ { "name": "pool", "writable": true, - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -2914,80 +1874,52 @@ }, { "name": "token_a_account", - "docs": [ - "The user token a account" - ], + "docs": ["The user token a account"], "writable": true }, { "name": "token_b_account", - "docs": [ - "The user token b account" - ], + "docs": ["The user token b account"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token a"], + "relations": ["pool"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token b"], + "relations": ["pool"] }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "event_authority", @@ -2996,23 +1928,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3035,16 +1952,7 @@ }, { "name": "remove_liquidity", - "discriminator": [ - 80, - 85, - 209, - 72, - 24, - 206, - 177, - 108 - ], + "discriminator": [80, 85, 209, 72, 24, 206, 177, 108], "accounts": [ { "name": "pool_authority", @@ -3053,9 +1961,7 @@ { "name": "pool", "writable": true, - "relations": [ - "position" - ] + "relations": ["position"] }, { "name": "position", @@ -3063,80 +1969,52 @@ }, { "name": "token_a_account", - "docs": [ - "The user token a account" - ], + "docs": ["The user token a account"], "writable": true }, { "name": "token_b_account", - "docs": [ - "The user token b account" - ], + "docs": ["The user token b account"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token a"], + "relations": ["pool"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ], - "relations": [ - "pool" - ] + "docs": ["The mint of token b"], + "relations": ["pool"] }, { "name": "position_nft_account", - "docs": [ - "The token account for nft" - ] + "docs": ["The token account for nft"] }, { "name": "owner", - "docs": [ - "owner of position" - ], + "docs": ["owner of position"], "signer": true }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "event_authority", @@ -3145,23 +2023,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3184,24 +2047,19 @@ }, { "name": "set_pool_status", - "discriminator": [ - 112, - 87, - 135, - 223, - 83, - 204, - 132, - 53 - ], + "discriminator": [112, 87, 135, 223, 83, 204, 132, 53], "accounts": [ { "name": "pool", "writable": true }, { - "name": "admin", - "signer": true + "name": "operator" + }, + { + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] }, { "name": "event_authority", @@ -3210,23 +2068,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3245,63 +2088,39 @@ }, { "name": "split_position", - "discriminator": [ - 172, - 241, - 221, - 138, - 161, - 29, - 253, - 42 - ], + "discriminator": [172, 241, 221, 138, 161, 29, 253, 42], "accounts": [ { "name": "pool", "writable": true, - "relations": [ - "first_position", - "second_position" - ] + "relations": ["first_position", "second_position"] }, { "name": "first_position", - "docs": [ - "The first position" - ], + "docs": ["The first position"], "writable": true }, { "name": "first_position_nft_account", - "docs": [ - "The token account for position nft" - ] + "docs": ["The token account for position nft"] }, { "name": "second_position", - "docs": [ - "The second position" - ], + "docs": ["The second position"], "writable": true }, { "name": "second_position_nft_account", - "docs": [ - "The token account for position nft" - ] + "docs": ["The token account for position nft"] }, { "name": "first_owner", - "docs": [ - "Owner of first position" - ], + "docs": ["Owner of first position"], "signer": true }, { "name": "second_owner", - "docs": [ - "Owner of second position" - ], + "docs": ["Owner of second position"], "signer": true }, { @@ -3311,23 +2130,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3350,63 +2154,39 @@ }, { "name": "split_position2", - "discriminator": [ - 221, - 147, - 228, - 207, - 140, - 212, - 17, - 119 - ], + "discriminator": [221, 147, 228, 207, 140, 212, 17, 119], "accounts": [ { "name": "pool", "writable": true, - "relations": [ - "first_position", - "second_position" - ] + "relations": ["first_position", "second_position"] }, { "name": "first_position", - "docs": [ - "The first position" - ], + "docs": ["The first position"], "writable": true }, { "name": "first_position_nft_account", - "docs": [ - "The token account for position nft" - ] + "docs": ["The token account for position nft"] }, { "name": "second_position", - "docs": [ - "The second position" - ], + "docs": ["The second position"], "writable": true }, { "name": "second_position_nft_account", - "docs": [ - "The token account for position nft" - ] + "docs": ["The token account for position nft"] }, { "name": "first_owner", - "docs": [ - "Owner of first position" - ], + "docs": ["Owner of first position"], "signer": true }, { "name": "second_owner", - "docs": [ - "Owner of second position" - ], + "docs": ["Owner of second position"], "signer": true }, { @@ -3416,23 +2196,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3451,16 +2216,7 @@ }, { "name": "swap", - "discriminator": [ - 248, - 198, - 158, - 145, - 225, - 117, - 135, - 200 - ], + "discriminator": [248, 198, 158, 145, 225, 117, 135, 200], "accounts": [ { "name": "pool_authority", @@ -3468,81 +2224,55 @@ }, { "name": "pool", - "docs": [ - "Pool account" - ], + "docs": ["Pool account"], "writable": true }, { "name": "input_token_account", - "docs": [ - "The user token account for input token" - ], + "docs": ["The user token account for input token"], "writable": true }, { "name": "output_token_account", - "docs": [ - "The user token account for output token" - ], + "docs": ["The user token account for output token"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ] + "docs": ["The mint of token a"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ] + "docs": ["The mint of token b"] }, { "name": "payer", - "docs": [ - "The user performing the swap" - ], + "docs": ["The user performing the swap"], "signer": true }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "referral_token_account", - "docs": [ - "referral token account" - ], + "docs": ["referral token account"], "writable": true, "optional": true }, @@ -3553,23 +2283,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3581,7 +2296,7 @@ ], "args": [ { - "name": "params", + "name": "_params", "type": { "defined": { "name": "SwapParameters" @@ -3592,16 +2307,7 @@ }, { "name": "swap2", - "discriminator": [ - 65, - 75, - 63, - 76, - 235, - 91, - 91, - 136 - ], + "discriminator": [65, 75, 63, 76, 235, 91, 91, 136], "accounts": [ { "name": "pool_authority", @@ -3609,81 +2315,55 @@ }, { "name": "pool", - "docs": [ - "Pool account" - ], + "docs": ["Pool account"], "writable": true }, { "name": "input_token_account", - "docs": [ - "The user token account for input token" - ], + "docs": ["The user token account for input token"], "writable": true }, { "name": "output_token_account", - "docs": [ - "The user token account for output token" - ], + "docs": ["The user token account for output token"], "writable": true }, { "name": "token_a_vault", - "docs": [ - "The vault token account for input token" - ], + "docs": ["The vault token account for input token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_b_vault", - "docs": [ - "The vault token account for output token" - ], + "docs": ["The vault token account for output token"], "writable": true, - "relations": [ - "pool" - ] + "relations": ["pool"] }, { "name": "token_a_mint", - "docs": [ - "The mint of token a" - ] + "docs": ["The mint of token a"] }, { "name": "token_b_mint", - "docs": [ - "The mint of token b" - ] + "docs": ["The mint of token b"] }, { "name": "payer", - "docs": [ - "The user performing the swap" - ], + "docs": ["The user performing the swap"], "signer": true }, { "name": "token_a_program", - "docs": [ - "Token a program" - ] + "docs": ["Token a program"] }, { "name": "token_b_program", - "docs": [ - "Token b program" - ] + "docs": ["Token b program"] }, { "name": "referral_token_account", - "docs": [ - "referral token account" - ], + "docs": ["referral token account"], "writable": true, "optional": true }, @@ -3694,23 +2374,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3722,7 +2387,7 @@ ], "args": [ { - "name": "params", + "name": "_params", "type": { "defined": { "name": "SwapParameters2" @@ -3732,17 +2397,53 @@ ] }, { - "name": "update_reward_duration", - "discriminator": [ - 138, - 174, - 196, - 169, - 213, - 235, - 254, - 107 + "name": "update_pool_fees", + "discriminator": [118, 217, 203, 179, 60, 8, 70, 89], + "accounts": [ + { + "name": "pool", + "writable": true + }, + { + "name": "operator" + }, + { + "name": "whitelisted_address", + "signer": true, + "relations": ["operator"] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 + ] + } + ] + } + }, + { + "name": "program" + } ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "UpdatePoolFeesParameters" + } + } + } + ] + }, + { + "name": "update_reward_duration", + "discriminator": [138, 174, 196, 169, 213, 235, 254, 107], "accounts": [ { "name": "pool", @@ -3759,23 +2460,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3798,16 +2484,7 @@ }, { "name": "update_reward_funder", - "discriminator": [ - 211, - 28, - 48, - 32, - 215, - 160, - 35, - 23 - ], + "discriminator": [211, 28, 48, 32, 215, 160, 35, 23], "accounts": [ { "name": "pool", @@ -3824,23 +2501,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3863,16 +2525,7 @@ }, { "name": "withdraw_ineligible_reward", - "discriminator": [ - 148, - 206, - 42, - 195, - 247, - 49, - 103, - 8 - ], + "discriminator": [148, 206, 42, 195, 247, 49, 103, 8], "accounts": [ { "name": "pool_authority", @@ -3907,23 +2560,8 @@ { "kind": "const", "value": [ - 95, - 95, - 101, - 118, - 101, - 110, - 116, - 95, - 97, - 117, - 116, - 104, - 111, - 114, - 105, - 116, - 121 + 95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, + 114, 105, 116, 121 ] } ] @@ -3943,435 +2581,134 @@ ], "accounts": [ { - "name": "ClaimFeeOperator", - "discriminator": [ - 166, - 48, - 134, - 86, - 34, - 200, - 188, - 150 - ] + "name": "Config", + "discriminator": [155, 12, 170, 224, 30, 250, 204, 130] }, { - "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 - ] + "discriminator": [241, 154, 109, 4, 17, 177, 109, 188] }, { "name": "Position", - "discriminator": [ - 170, - 188, - 143, - 228, - 122, - 64, - 247, - 208 - ] + "discriminator": [170, 188, 143, 228, 122, 64, 247, 208] }, { "name": "TokenBadge", - "discriminator": [ - 116, - 219, - 204, - 229, - 249, - 116, - 255, - 150 - ] + "discriminator": [116, 219, 204, 229, 249, 116, 255, 150] }, { "name": "Vesting", - "discriminator": [ - 100, - 149, - 66, - 138, - 95, - 200, - 128, - 241 - ] + "discriminator": [100, 149, 66, 138, 95, 200, 128, 241] } ], "events": [ - { - "name": "EvtAddLiquidity", - "discriminator": [ - 175, - 242, - 8, - 157, - 30, - 247, - 185, - 169 - ] - }, { "name": "EvtClaimPartnerFee", - "discriminator": [ - 118, - 99, - 77, - 10, - 226, - 1, - 1, - 87 - ] + "discriminator": [118, 99, 77, 10, 226, 1, 1, 87] }, { "name": "EvtClaimPositionFee", - "discriminator": [ - 198, - 182, - 183, - 52, - 97, - 12, - 49, - 56 - ] + "discriminator": [198, 182, 183, 52, 97, 12, 49, 56] }, { "name": "EvtClaimProtocolFee", - "discriminator": [ - 186, - 244, - 75, - 251, - 188, - 13, - 25, - 33 - ] + "discriminator": [186, 244, 75, 251, 188, 13, 25, 33] }, { "name": "EvtClaimReward", - "discriminator": [ - 218, - 86, - 147, - 200, - 235, - 188, - 215, - 231 - ] - }, - { - "name": "EvtCloseClaimFeeOperator", - "discriminator": [ - 111, - 39, - 37, - 55, - 110, - 216, - 194, - 23 - ] + "discriminator": [218, 86, 147, 200, 235, 188, 215, 231] }, { "name": "EvtCloseConfig", - "discriminator": [ - 36, - 30, - 239, - 45, - 58, - 132, - 14, - 5 - ] + "discriminator": [36, 30, 239, 45, 58, 132, 14, 5] }, { "name": "EvtClosePosition", - "discriminator": [ - 20, - 145, - 144, - 68, - 143, - 142, - 214, - 178 - ] - }, - { - "name": "EvtCreateClaimFeeOperator", - "discriminator": [ - 21, - 6, - 153, - 120, - 68, - 116, - 28, - 177 - ] + "discriminator": [20, 145, 144, 68, 143, 142, 214, 178] }, { "name": "EvtCreateConfig", - "discriminator": [ - 131, - 207, - 180, - 174, - 180, - 73, - 165, - 54 - ] + "discriminator": [131, 207, 180, 174, 180, 73, 165, 54] }, { "name": "EvtCreateDynamicConfig", - "discriminator": [ - 231, - 197, - 13, - 164, - 248, - 213, - 133, - 152 - ] + "discriminator": [231, 197, 13, 164, 248, 213, 133, 152] }, { "name": "EvtCreatePosition", - "discriminator": [ - 156, - 15, - 119, - 198, - 29, - 181, - 221, - 55 - ] + "discriminator": [156, 15, 119, 198, 29, 181, 221, 55] }, { "name": "EvtCreateTokenBadge", - "discriminator": [ - 141, - 120, - 134, - 116, - 34, - 28, - 114, - 160 - ] + "discriminator": [141, 120, 134, 116, 34, 28, 114, 160] }, { "name": "EvtFundReward", - "discriminator": [ - 104, - 233, - 237, - 122, - 199, - 191, - 121, - 85 - ] + "discriminator": [104, 233, 237, 122, 199, 191, 121, 85] }, { "name": "EvtInitializePool", - "discriminator": [ - 228, - 50, - 246, - 85, - 203, - 66, - 134, - 37 - ] + "discriminator": [228, 50, 246, 85, 203, 66, 134, 37] }, { "name": "EvtInitializeReward", - "discriminator": [ - 129, - 91, - 188, - 3, - 246, - 52, - 185, - 249 - ] + "discriminator": [129, 91, 188, 3, 246, 52, 185, 249] }, { "name": "EvtLiquidityChange", - "discriminator": [ - 197, - 171, - 78, - 127, - 224, - 211, - 87, - 13 - ] + "discriminator": [197, 171, 78, 127, 224, 211, 87, 13] }, { "name": "EvtLockPosition", - "discriminator": [ - 168, - 63, - 108, - 83, - 219, - 82, - 2, - 200 - ] + "discriminator": [168, 63, 108, 83, 219, 82, 2, 200] }, { "name": "EvtPermanentLockPosition", - "discriminator": [ - 145, - 143, - 162, - 218, - 218, - 80, - 67, - 11 - ] - }, - { - "name": "EvtRemoveLiquidity", - "discriminator": [ - 87, - 46, - 88, - 98, - 175, - 96, - 34, - 91 - ] + "discriminator": [145, 143, 162, 218, 218, 80, 67, 11] }, { "name": "EvtSetPoolStatus", - "discriminator": [ - 100, - 213, - 74, - 3, - 95, - 91, - 228, - 146 - ] + "discriminator": [100, 213, 74, 3, 95, 91, 228, 146] }, { "name": "EvtSplitPosition2", - "discriminator": [ - 165, - 32, - 203, - 174, - 72, - 100, - 233, - 103 - ] + "discriminator": [165, 32, 203, 174, 72, 100, 233, 103] }, { - "name": "EvtSwap", - "discriminator": [ - 27, - 60, - 21, - 213, - 138, - 170, - 187, - 147 - ] + "name": "EvtSwap2", + "discriminator": [189, 66, 51, 168, 38, 80, 117, 153] }, { - "name": "EvtSwap2", - "discriminator": [ - 189, - 66, - 51, - 168, - 38, - 80, - 117, - 153 - ] + "name": "EvtUpdatePoolFees", + "discriminator": [76, 165, 246, 102, 102, 217, 156, 44] }, { "name": "EvtUpdateRewardDuration", - "discriminator": [ - 149, - 135, - 65, - 231, - 129, - 153, - 65, - 57 - ] + "discriminator": [149, 135, 65, 231, 129, 153, 65, 57] }, { "name": "EvtUpdateRewardFunder", - "discriminator": [ - 76, - 154, - 208, - 13, - 40, - 115, - 246, - 146 - ] + "discriminator": [76, 154, 208, 13, 40, 115, 246, 146] }, { "name": "EvtWithdrawIneligibleReward", - "discriminator": [ - 248, - 215, - 184, - 78, - 31, - 180, - 179, - 168 - ] + "discriminator": [248, 215, 184, 78, 31, 180, 179, 168] } ], "errors": [ @@ -4627,7 +2964,7 @@ }, { "code": 6050, - "name": "InvalidFeeScheduler", + "name": "InvalidFeeTimeScheduler", "msg": "Invalid fee scheduler" }, { @@ -4639,6 +2976,41 @@ "code": 6052, "name": "InvalidPoolVersion", "msg": "Invalid pool version" + }, + { + "code": 6053, + "name": "InvalidAuthority", + "msg": "Invalid authority to do that action" + }, + { + "code": 6054, + "name": "InvalidPermission", + "msg": "Invalid permission" + }, + { + "code": 6055, + "name": "InvalidFeeMarketCapScheduler", + "msg": "Invalid fee market cap scheduler" + }, + { + "code": 6056, + "name": "CannotUpdateBaseFee", + "msg": "Cannot update base fee" + }, + { + "code": 6057, + "name": "InvalidDynamicFeeParameters", + "msg": "Invalid dynamic fee parameters" + }, + { + "code": 6058, + "name": "InvalidUpdatePoolFeesParameters", + "msg": "Invalid update pool fees parameters" + }, + { + "code": 6059, + "name": "MissingOperatorAccount", + "msg": "Missing operator account" } ], "types": [ @@ -4649,30 +3021,24 @@ "fields": [ { "name": "liquidity_delta", - "docs": [ - "delta liquidity" - ], + "docs": ["delta liquidity"], "type": "u128" }, { "name": "token_a_amount_threshold", - "docs": [ - "maximum token a amount" - ], + "docs": ["maximum token a amount"], "type": "u64" }, { "name": "token_b_amount_threshold", - "docs": [ - "maximum token b amount" - ], + "docs": ["maximum token b amount"], "type": "u64" } ] } }, { - "name": "BaseFeeConfig", + "name": "BaseFeeInfo", "serialization": "bytemuck", "repr": { "kind": "c" @@ -4681,44 +3047,54 @@ "kind": "struct", "fields": [ { - "name": "cliff_fee_numerator", - "type": "u64" - }, - { - "name": "base_fee_mode", - "type": "u8" - }, - { - "name": "padding", + "name": "data", "type": { - "array": [ - "u8", - 5 - ] + "array": ["u8", 32] } - }, + } + ] + } + }, + { + "name": "BaseFeeParameters", + "type": { + "kind": "struct", + "fields": [ { - "name": "first_factor", - "type": "u16" - }, + "name": "data", + "type": { + "array": ["u8", 30] + } + } + ] + } + }, + { + "name": "BaseFeeStruct", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ { - "name": "second_factor", + "name": "base_fee_info", "type": { - "array": [ - "u8", - 8 - ] + "defined": { + "name": "BaseFeeInfo" + } } }, { - "name": "third_factor", + "name": "padding_1", "type": "u64" } ] } }, { - "name": "BaseFeeParameters", + "name": "BorshFeeMarketCapScheduler", "type": { "kind": "struct", "fields": [ @@ -4727,35 +3103,49 @@ "type": "u64" }, { - "name": "first_factor", + "name": "number_of_period", "type": "u16" }, { - "name": "second_factor", - "type": { - "array": [ - "u8", - 8 - ] - } + "name": "sqrt_price_step_bps", + "type": "u32" + }, + { + "name": "scheduler_expiration_duration", + "type": "u32" }, { - "name": "third_factor", + "name": "reduction_factor", "type": "u64" }, { "name": "base_fee_mode", "type": "u8" + }, + { + "name": "padding", + "type": { + "array": ["u8", 3] + } } ] } }, { - "name": "BaseFeeStruct", - "serialization": "bytemuck", - "repr": { - "kind": "c" - }, + "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": [ @@ -4764,71 +3154,63 @@ "type": "u64" }, { - "name": "base_fee_mode", - "type": "u8" + "name": "fee_increment_bps", + "type": "u16" }, { - "name": "padding_0", - "type": { - "array": [ - "u8", - 5 - ] - } + "name": "max_limiter_duration", + "type": "u32" }, { - "name": "first_factor", - "type": "u16" + "name": "max_fee_bps", + "type": "u32" }, { - "name": "second_factor", - "type": { - "array": [ - "u8", - 8 - ] - } + "name": "reference_amount", + "type": "u64" }, { - "name": "third_factor", - "type": "u64" + "name": "base_fee_mode", + "type": "u8" }, { - "name": "padding_1", - "type": "u64" + "name": "padding", + "type": { + "array": ["u8", 3] + } } ] } }, { - "name": "ClaimFeeOperator", - "docs": [ - "Parameter that set by the protocol" - ], - "serialization": "bytemuck", - "repr": { - "kind": "c" - }, + "name": "BorshFeeTimeScheduler", "type": { "kind": "struct", "fields": [ { - "name": "operator", - "docs": [ - "operator" - ], - "type": "pubkey" + "name": "cliff_fee_numerator", + "type": "u64" }, { - "name": "_padding", - "docs": [ - "Reserve" - ], + "name": "number_of_period", + "type": "u16" + }, + { + "name": "period_frequency", + "type": "u64" + }, + { + "name": "reduction_factor", + "type": "u64" + }, + { + "name": "base_fee_mode", + "type": "u8" + }, + { + "name": "padding", "type": { - "array": [ - "u8", - 128 - ] + "array": ["u8", 3] } } ] @@ -4845,9 +3227,7 @@ "fields": [ { "name": "vault_config_key", - "docs": [ - "Vault config key" - ], + "docs": ["Vault config key"], "type": "pubkey" }, { @@ -4859,9 +3239,7 @@ }, { "name": "pool_fees", - "docs": [ - "Pool fee" - ], + "docs": ["Pool fee"], "type": { "defined": { "name": "PoolFeesConfig" @@ -4870,69 +3248,78 @@ }, { "name": "activation_type", - "docs": [ - "Activation type" - ], + "docs": ["Activation type"], "type": "u8" }, { "name": "collect_fee_mode", - "docs": [ - "Collect fee mode" - ], + "docs": ["Collect fee mode"], "type": "u8" }, { "name": "config_type", - "docs": [ - "Config type mode, 0 for static, 1 for dynamic" - ], + "docs": ["Config type mode, 0 for static, 1 for dynamic"], "type": "u8" }, { "name": "_padding_0", - "docs": [ - "padding 0" - ], + "docs": ["padding 0"], "type": { - "array": [ - "u8", - 5 - ] + "array": ["u8", 5] } }, { "name": "index", - "docs": [ - "config index" - ], + "docs": ["config index"], "type": "u64" }, { "name": "sqrt_min_price", - "docs": [ - "sqrt min price" - ], + "docs": ["sqrt min price"], "type": "u128" }, { "name": "sqrt_max_price", - "docs": [ - "sqrt max price" - ], + "docs": ["sqrt max price"], "type": "u128" }, { "name": "_padding_1", - "docs": [ - "Fee curve point", - "Padding for further use" - ], + "docs": ["Fee curve point", "Padding for further use"], "type": { - "array": [ - "u64", - 10 - ] + "array": ["u64", 10] + } + } + ] + } + }, + { + "name": "DummyParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "borsh_fee_time_scheduler_params", + "type": { + "defined": { + "name": "BorshFeeTimeScheduler" + } + } + }, + { + "name": "borsh_fee_rate_limiter_params", + "type": { + "defined": { + "name": "BorshFeeRateLimiter" + } + } + }, + { + "name": "borsh_fee_market_cap_scheduler_params", + "type": { + "defined": { + "name": "BorshFeeMarketCapScheduler" + } } } ] @@ -4966,10 +3353,7 @@ { "name": "padding", "type": { - "array": [ - "u8", - 7 - ] + "array": ["u8", 7] } }, { @@ -4999,10 +3383,7 @@ { "name": "padding_1", "type": { - "array": [ - "u8", - 8 - ] + "array": ["u8", 8] } }, { @@ -5064,10 +3445,7 @@ { "name": "padding", "type": { - "array": [ - "u8", - 7 - ] + "array": ["u8", 7] } }, { @@ -5117,50 +3495,6 @@ ] } }, - { - "name": "EvtAddLiquidity", - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "position", - "type": "pubkey" - }, - { - "name": "owner", - "type": "pubkey" - }, - { - "name": "params", - "type": { - "defined": { - "name": "AddLiquidityParameters" - } - } - }, - { - "name": "token_a_amount", - "type": "u64" - }, - { - "name": "token_b_amount", - "type": "u64" - }, - { - "name": "total_amount_a", - "type": "u64" - }, - { - "name": "total_amount_b", - "type": "u64" - } - ] - } - }, { "name": "EvtClaimPartnerFee", "type": { @@ -5262,56 +3596,31 @@ } }, { - "name": "EvtCloseClaimFeeOperator", - "docs": [ - "Close claim fee operator" - ], + "name": "EvtCloseConfig", + "docs": ["Close config"], "type": { "kind": "struct", "fields": [ { - "name": "claim_fee_operator", + "name": "config", + "docs": ["Config pubkey"], "type": "pubkey" }, { - "name": "operator", + "name": "admin", + "docs": ["admin pk"], "type": "pubkey" } ] } }, { - "name": "EvtCloseConfig", - "docs": [ - "Close config" - ], + "name": "EvtClosePosition", "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", + "name": "pool", "type": "pubkey" }, { @@ -5329,26 +3638,9 @@ ] } }, - { - "name": "EvtCreateClaimFeeOperator", - "docs": [ - "Create claim fee operator" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "operator", - "type": "pubkey" - } - ] - } - }, { "name": "EvtCreateConfig", - "docs": [ - "Create static config" - ], + "docs": ["Create static config"], "type": { "kind": "struct", "fields": [ @@ -5397,9 +3689,7 @@ }, { "name": "EvtCreateDynamicConfig", - "docs": [ - "Create dynamic config" - ], + "docs": ["Create dynamic config"], "type": { "kind": "struct", "fields": [ @@ -5444,9 +3734,7 @@ }, { "name": "EvtCreateTokenBadge", - "docs": [ - "Create token badge" - ], + "docs": ["Create token badge"], "type": { "kind": "struct", "fields": [ @@ -5757,42 +4045,6 @@ ] } }, - { - "name": "EvtRemoveLiquidity", - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "position", - "type": "pubkey" - }, - { - "name": "owner", - "type": "pubkey" - }, - { - "name": "params", - "type": { - "defined": { - "name": "RemoveLiquidityParameters" - } - } - }, - { - "name": "token_a_amount", - "type": "u64" - }, - { - "name": "token_b_amount", - "type": "u64" - } - ] - } - }, { "name": "EvtSetPoolStatus", "type": { @@ -5873,50 +4125,6 @@ ] } }, - { - "name": "EvtSwap", - "type": { - "kind": "struct", - "fields": [ - { - "name": "pool", - "type": "pubkey" - }, - { - "name": "trade_direction", - "type": "u8" - }, - { - "name": "has_referral", - "type": "bool" - }, - { - "name": "params", - "type": { - "defined": { - "name": "SwapParameters" - } - } - }, - { - "name": "swap_result", - "type": { - "defined": { - "name": "SwapResult" - } - } - }, - { - "name": "actual_amount_in", - "type": "u64" - }, - { - "name": "current_timestamp", - "type": "u64" - } - ] - } - }, { "name": "EvtSwap2", "type": { @@ -5981,6 +4189,30 @@ ] } }, + { + "name": "EvtUpdatePoolFees", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "operator", + "type": "pubkey" + }, + { + "name": "params", + "type": { + "defined": { + "name": "UpdatePoolFeesParameters" + } + } + } + ] + } + }, { "name": "EvtUpdateRewardDuration", "type": { @@ -6056,9 +4288,7 @@ "fields": [ { "name": "pool_fees", - "docs": [ - "pool fees" - ], + "docs": ["pool fees"], "type": { "defined": { "name": "PoolFeeParameters" @@ -6067,58 +4297,44 @@ }, { "name": "sqrt_min_price", - "docs": [ - "sqrt min price" - ], + "docs": ["sqrt min price"], "type": "u128" }, { "name": "sqrt_max_price", - "docs": [ - "sqrt max price" - ], + "docs": ["sqrt max price"], "type": "u128" }, { "name": "has_alpha_vault", - "docs": [ - "has alpha vault" - ], + "docs": ["has alpha vault"], "type": "bool" }, { "name": "liquidity", - "docs": [ - "initialize liquidity" - ], + "docs": ["initialize liquidity"], "type": "u128" }, { "name": "sqrt_price", "docs": [ - "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value" + "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value. Market cap fee scheduler minimum price will be derived from this value" ], "type": "u128" }, { "name": "activation_type", - "docs": [ - "activation type" - ], + "docs": ["activation type"], "type": "u8" }, { "name": "collect_fee_mode", - "docs": [ - "collect fee mode" - ], + "docs": ["collect fee mode"], "type": "u8" }, { "name": "activation_point", - "docs": [ - "activation point" - ], + "docs": ["activation point"], "type": { "option": "u64" } @@ -6133,9 +4349,7 @@ "fields": [ { "name": "liquidity", - "docs": [ - "initialize liquidity" - ], + "docs": ["initialize liquidity"], "type": "u128" }, { @@ -6147,9 +4361,7 @@ }, { "name": "activation_point", - "docs": [ - "activation point" - ], + "docs": ["activation point"], "type": { "option": "u64" } @@ -6157,6 +4369,154 @@ ] } }, + { + "name": "Operator", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "whitelisted_address", + "type": "pubkey" + }, + { + "name": "permission", + "type": "u128" + }, + { + "name": "padding", + "type": { + "array": ["u64", 2] + } + } + ] + } + }, + { + "name": "PodAlignedFeeMarketCapScheduler", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliff_fee_numerator", + "type": "u64" + }, + { + "name": "base_fee_mode", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": ["u8", 5] + } + }, + { + "name": "number_of_period", + "type": "u16" + }, + { + "name": "sqrt_price_step_bps", + "type": "u32" + }, + { + "name": "scheduler_expiration_duration", + "type": "u32" + }, + { + "name": "reduction_factor", + "type": "u64" + } + ] + } + }, + { + "name": "PodAlignedFeeRateLimiter", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliff_fee_numerator", + "type": "u64" + }, + { + "name": "base_fee_mode", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": ["u8", 5] + } + }, + { + "name": "fee_increment_bps", + "type": "u16" + }, + { + "name": "max_limiter_duration", + "type": "u32" + }, + { + "name": "max_fee_bps", + "type": "u32" + }, + { + "name": "reference_amount", + "type": "u64" + } + ] + } + }, + { + "name": "PodAlignedFeeTimeScheduler", + "serialization": "bytemuck", + "repr": { + "kind": "c" + }, + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliff_fee_numerator", + "type": "u64" + }, + { + "name": "base_fee_mode", + "type": "u8" + }, + { + "name": "padding", + "type": { + "array": ["u8", 5] + } + }, + { + "name": "number_of_period", + "type": "u16" + }, + { + "name": "period_frequency", + "type": "u64" + }, + { + "name": "reduction_factor", + "type": "u64" + } + ] + } + }, { "name": "Pool", "serialization": "bytemuck", @@ -6168,9 +4528,7 @@ "fields": [ { "name": "pool_fees", - "docs": [ - "Pool fee" - ], + "docs": ["Pool fee"], "type": { "defined": { "name": "PoolFeesStruct" @@ -6179,30 +4537,22 @@ }, { "name": "token_a_mint", - "docs": [ - "token a mint" - ], + "docs": ["token a mint"], "type": "pubkey" }, { "name": "token_b_mint", - "docs": [ - "token b mint" - ], + "docs": ["token b mint"], "type": "pubkey" }, { "name": "token_a_vault", - "docs": [ - "token a vault" - ], + "docs": ["token a vault"], "type": "pubkey" }, { "name": "token_b_vault", - "docs": [ - "token b vault" - ], + "docs": ["token b vault"], "type": "pubkey" }, { @@ -6214,16 +4564,12 @@ }, { "name": "partner", - "docs": [ - "partner" - ], + "docs": ["partner"], "type": "pubkey" }, { "name": "liquidity", - "docs": [ - "liquidity share" - ], + "docs": ["liquidity share"], "type": "u128" }, { @@ -6235,100 +4581,74 @@ }, { "name": "protocol_a_fee", - "docs": [ - "protocol a fee" - ], + "docs": ["protocol a fee"], "type": "u64" }, { "name": "protocol_b_fee", - "docs": [ - "protocol b fee" - ], + "docs": ["protocol b fee"], "type": "u64" }, { "name": "partner_a_fee", - "docs": [ - "partner a fee" - ], + "docs": ["partner a fee"], "type": "u64" }, { "name": "partner_b_fee", - "docs": [ - "partner b fee" - ], + "docs": ["partner b fee"], "type": "u64" }, { "name": "sqrt_min_price", - "docs": [ - "min price" - ], + "docs": ["min price"], "type": "u128" }, { "name": "sqrt_max_price", - "docs": [ - "max price" - ], + "docs": ["max price"], "type": "u128" }, { "name": "sqrt_price", - "docs": [ - "current price" - ], + "docs": ["current price"], "type": "u128" }, { "name": "activation_point", - "docs": [ - "Activation point, can be slot or timestamp" - ], + "docs": ["Activation point, can be slot or timestamp"], "type": "u64" }, { "name": "activation_type", - "docs": [ - "Activation type, 0 means by slot, 1 means by timestamp" - ], + "docs": ["Activation type, 0 means by slot, 1 means by timestamp"], "type": "u8" }, { "name": "pool_status", - "docs": [ - "pool status, 0: enable, 1 disable" - ], + "docs": ["pool status, 0: enable, 1 disable"], "type": "u8" }, { "name": "token_a_flag", - "docs": [ - "token a flag" - ], + "docs": ["token a flag"], "type": "u8" }, { "name": "token_b_flag", - "docs": [ - "token b flag" - ], + "docs": ["token b flag"], "type": "u8" }, { "name": "collect_fee_mode", "docs": [ - "0 is collect fee in both token, 1 only collect fee in token a, 2 only collect fee in token b" + "0 is collect fee in both token, 1 only collect fee only in token b" ], "type": "u8" }, { "name": "pool_type", - "docs": [ - "pool type" - ], + "docs": ["pool type"], "type": "u8" }, { @@ -6340,33 +4660,21 @@ }, { "name": "_padding_0", - "docs": [ - "padding" - ], + "docs": ["padding"], "type": "u8" }, { "name": "fee_a_per_liquidity", - "docs": [ - "cumulative" - ], + "docs": ["cumulative"], "type": { - "array": [ - "u8", - 32 - ] + "array": ["u8", 32] } }, { "name": "fee_b_per_liquidity", - "docs": [ - "cumulative" - ], + "docs": ["cumulative"], "type": { - "array": [ - "u8", - 32 - ] + "array": ["u8", 32] } }, { @@ -6375,9 +4683,7 @@ }, { "name": "metrics", - "docs": [ - "metrics" - ], + "docs": ["metrics"], "type": { "defined": { "name": "PoolMetrics" @@ -6386,28 +4692,19 @@ }, { "name": "creator", - "docs": [ - "pool creator" - ], + "docs": ["pool creator"], "type": "pubkey" }, { "name": "_padding_1", - "docs": [ - "Padding for further use" - ], + "docs": ["Padding for further use"], "type": { - "array": [ - "u64", - 6 - ] + "array": ["u64", 6] } }, { "name": "reward_infos", - "docs": [ - "Farming reward information" - ], + "docs": ["Farming reward information"], "type": { "array": [ { @@ -6424,40 +4721,22 @@ }, { "name": "PoolFeeParameters", - "docs": [ - "Information regarding fee charges" - ], + "docs": ["Information regarding fee charges"], "type": { "kind": "struct", "fields": [ { "name": "base_fee", - "docs": [ - "Base fee" - ], + "docs": ["Base fee"], "type": { "defined": { "name": "BaseFeeParameters" } } }, - { - "name": "padding", - "docs": [ - "padding" - ], - "type": { - "array": [ - "u8", - 3 - ] - } - }, { "name": "dynamic_fee", - "docs": [ - "dynamic fee" - ], + "docs": ["dynamic fee"], "type": { "option": { "defined": { @@ -6482,7 +4761,7 @@ "name": "base_fee", "type": { "defined": { - "name": "BaseFeeConfig" + "name": "BaseFeeInfo" } } }, @@ -6509,19 +4788,13 @@ { "name": "padding_0", "type": { - "array": [ - "u8", - 5 - ] + "array": ["u8", 5] } }, { "name": "padding_1", "type": { - "array": [ - "u64", - 5 - ] + "array": ["u64", 5] } } ] @@ -6568,35 +4841,24 @@ }, { "name": "partner_fee_percent", - "docs": [ - "partner fee" - ], + "docs": ["partner fee"], "type": "u8" }, { "name": "referral_fee_percent", - "docs": [ - "referral fee" - ], + "docs": ["referral fee"], "type": "u8" }, { "name": "padding_0", - "docs": [ - "padding" - ], + "docs": ["padding"], "type": { - "array": [ - "u8", - 5 - ] + "array": ["u8", 5] } }, { "name": "dynamic_fee", - "docs": [ - "dynamic fee" - ], + "docs": ["dynamic fee"], "type": { "defined": { "name": "DynamicFeeStruct" @@ -6604,16 +4866,8 @@ } }, { - "name": "padding_1", - "docs": [ - "padding" - ], - "type": { - "array": [ - "u64", - 2 - ] - } + "name": "init_sqrt_price", + "type": "u128" } ] } @@ -6677,75 +4931,51 @@ }, { "name": "nft_mint", - "docs": [ - "nft mint" - ], + "docs": ["nft mint"], "type": "pubkey" }, { "name": "fee_a_per_token_checkpoint", - "docs": [ - "fee a checkpoint" - ], + "docs": ["fee a checkpoint"], "type": { - "array": [ - "u8", - 32 - ] + "array": ["u8", 32] } }, { "name": "fee_b_per_token_checkpoint", - "docs": [ - "fee b checkpoint" - ], + "docs": ["fee b checkpoint"], "type": { - "array": [ - "u8", - 32 - ] + "array": ["u8", 32] } }, { "name": "fee_a_pending", - "docs": [ - "fee a pending" - ], + "docs": ["fee a pending"], "type": "u64" }, { "name": "fee_b_pending", - "docs": [ - "fee b pending" - ], + "docs": ["fee b pending"], "type": "u64" }, { "name": "unlocked_liquidity", - "docs": [ - "unlock liquidity" - ], + "docs": ["unlock liquidity"], "type": "u128" }, { "name": "vested_liquidity", - "docs": [ - "vesting liquidity" - ], + "docs": ["vesting liquidity"], "type": "u128" }, { "name": "permanent_locked_liquidity", - "docs": [ - "permanent locked liquidity" - ], + "docs": ["permanent locked liquidity"], "type": "u128" }, { "name": "metrics", - "docs": [ - "metrics" - ], + "docs": ["metrics"], "type": { "defined": { "name": "PositionMetrics" @@ -6754,9 +4984,7 @@ }, { "name": "reward_infos", - "docs": [ - "Farming reward information" - ], + "docs": ["Farming reward information"], "type": { "array": [ { @@ -6770,14 +4998,9 @@ }, { "name": "padding", - "docs": [ - "padding for future usage" - ], + "docs": ["padding for future usage"], "type": { - "array": [ - "u128", - 6 - ] + "array": ["u128", 6] } } ] @@ -6810,23 +5033,17 @@ "fields": [ { "name": "liquidity_delta", - "docs": [ - "delta liquidity" - ], + "docs": ["delta liquidity"], "type": "u128" }, { "name": "token_a_amount_threshold", - "docs": [ - "minimum token a amount" - ], + "docs": ["minimum token a amount"], "type": "u64" }, { "name": "token_b_amount_threshold", - "docs": [ - "minimum token b amount" - ], + "docs": ["minimum token b amount"], "type": "u64" } ] @@ -6846,28 +5063,19 @@ "fields": [ { "name": "initialized", - "docs": [ - "Indicates if the reward has been initialized" - ], + "docs": ["Indicates if the reward has been initialized"], "type": "u8" }, { "name": "reward_token_flag", - "docs": [ - "reward token flag" - ], + "docs": ["reward token flag"], "type": "u8" }, { "name": "_padding_0", - "docs": [ - "padding" - ], + "docs": ["padding"], "type": { - "array": [ - "u8", - 6 - ] + "array": ["u8", 6] } }, { @@ -6876,71 +5084,49 @@ "Padding to ensure `reward_rate: u128` is 16-byte aligned" ], "type": { - "array": [ - "u8", - 8 - ] + "array": ["u8", 8] } }, { "name": "mint", - "docs": [ - "Reward token mint." - ], + "docs": ["Reward token mint."], "type": "pubkey" }, { "name": "vault", - "docs": [ - "Reward vault token account." - ], + "docs": ["Reward vault token account."], "type": "pubkey" }, { "name": "funder", - "docs": [ - "Authority account that allows to fund rewards" - ], + "docs": ["Authority account that allows to fund rewards"], "type": "pubkey" }, { "name": "reward_duration", - "docs": [ - "reward duration" - ], + "docs": ["reward duration"], "type": "u64" }, { "name": "reward_duration_end", - "docs": [ - "reward duration end" - ], + "docs": ["reward duration end"], "type": "u64" }, { "name": "reward_rate", - "docs": [ - "reward rate" - ], + "docs": ["reward rate"], "type": "u128" }, { "name": "reward_per_token_stored", - "docs": [ - "Reward per token stored" - ], + "docs": ["Reward per token stored"], "type": { - "array": [ - "u8", - 32 - ] + "array": ["u8", 32] } }, { "name": "last_update_time", - "docs": [ - "The last time reward states were updated." - ], + "docs": ["The last time reward states were updated."], "type": "u64" }, { @@ -7063,14 +5249,9 @@ }, { "name": "padding", - "docs": [ - "padding for future" - ], + "docs": ["padding for future"], "type": { - "array": [ - "u8", - 16 - ] + "array": ["u8", 16] } } ] @@ -7185,49 +5366,12 @@ }, { "name": "swap_mode", - "docs": [ - "Swap mode, refer [SwapMode]" - ], + "docs": ["Swap mode, refer [SwapMode]"], "type": "u8" } ] } }, - { - "name": "SwapResult", - "docs": [ - "Encodes all results of swapping" - ], - "type": { - "kind": "struct", - "fields": [ - { - "name": "output_amount", - "type": "u64" - }, - { - "name": "next_sqrt_price", - "type": "u128" - }, - { - "name": "lp_fee", - "type": "u64" - }, - { - "name": "protocol_fee", - "type": "u64" - }, - { - "name": "partner_fee", - "type": "u64" - }, - { - "name": "referral_fee", - "type": "u64" - } - ] - } - }, { "name": "SwapResult2", "type": { @@ -7274,9 +5418,7 @@ }, { "name": "TokenBadge", - "docs": [ - "Parameter that set by the protocol" - ], + "docs": ["Parameter that set by the protocol"], "serialization": "bytemuck", "repr": { "kind": "c" @@ -7286,21 +5428,49 @@ "fields": [ { "name": "token_mint", - "docs": [ - "token mint" - ], + "docs": ["token mint"], "type": "pubkey" }, { "name": "_padding", + "docs": ["Reserve"], + "type": { + "array": ["u8", 128] + } + } + ] + } + }, + { + "name": "UpdatePoolFeesParameters", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cliff_fee_numerator", "docs": [ - "Reserve" + "Base fee update mode:", + "- None: skip base fee update", + "- Some: update new cliff_fee_numerator if base fee is static" ], "type": { - "array": [ - "u8", - 128 - ] + "option": "u64" + } + }, + { + "name": "dynamic_fee", + "docs": [ + "Dynamic fee update mode:", + "- None: skip dynamic fee update", + "- Some(with default value): disable dynamic fee", + "- Some(with non default value): enable dynamic fee if disabled or update dynamic fee if enabled" + ], + "type": { + "option": { + "defined": { + "name": "DynamicFeeParameters" + } + } } } ] @@ -7317,28 +5487,19 @@ "fields": [ { "name": "reward_per_token_checkpoint", - "docs": [ - "The latest update reward checkpoint" - ], + "docs": ["The latest update reward checkpoint"], "type": { - "array": [ - "u8", - 32 - ] + "array": ["u8", 32] } }, { "name": "reward_pendings", - "docs": [ - "Current pending rewards" - ], + "docs": ["Current pending rewards"], "type": "u64" }, { "name": "total_claimed_rewards", - "docs": [ - "Total claimed rewards" - ], + "docs": ["Total claimed rewards"], "type": "u64" } ] @@ -7384,19 +5545,13 @@ { "name": "padding", "type": { - "array": [ - "u8", - 14 - ] + "array": ["u8", 14] } }, { "name": "padding2", "type": { - "array": [ - "u128", - 4 - ] + "array": ["u128", 4] } } ] @@ -7432,5 +5587,82 @@ ] } } + ], + "constants": [ + { + "name": "BIN_STEP_BPS_DEFAULT", + "type": "u16", + "value": "1" + }, + { + "name": "BIN_STEP_U128_DEFAULT_LE_BYTES", + "type": { + "array": ["u8", 16] + }, + "value": "[203, 16, 199, 186, 184, 141, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { + "name": "CUSTOMIZABLE_POOL_PREFIX", + "type": "bytes", + "value": "[99, 112, 111, 111, 108]" + }, + { + "name": "FEE_DENOMINATOR", + "docs": [ + "Default fee denominator. DO NOT simply update it as it will break logic that depends on it as default value." + ], + "type": "u64", + "value": "1000000000" + }, + { + "name": "MAX_BASIS_POINT", + "docs": ["Max basis point. 100% in pct"], + "type": "u64", + "value": "10000" + }, + { + "name": "MAX_SQRT_PRICE_LE_BYTES", + "type": { + "array": ["u8", 16] + }, + "value": "[155, 87, 105, 78, 169, 26, 92, 132, 177, 196, 254, 255, 0, 0, 0, 0]" + }, + { + "name": "MIN_SQRT_PRICE_LE_BYTES", + "type": { + "array": ["u8", 16] + }, + "value": "[80, 59, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]" + }, + { + "name": "POOL_AUTHORITY_PREFIX", + "type": "bytes", + "value": "[112, 111, 111, 108, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]" + }, + { + "name": "POOL_PREFIX", + "type": "bytes", + "value": "[112, 111, 111, 108]" + }, + { + "name": "POSITION_NFT_ACCOUNT_PREFIX", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110, 95, 110, 102, 116, 95, 97, 99, 99, 111, 117, 110, 116]" + }, + { + "name": "POSITION_PREFIX", + "type": "bytes", + "value": "[112, 111, 115, 105, 116, 105, 111, 110]" + }, + { + "name": "SPLIT_POSITION_DENOMINATOR", + "type": "u32", + "value": "1000000000" + }, + { + "name": "TOKEN_VAULT_PREFIX", + "type": "bytes", + "value": "[116, 111, 107, 101, 110, 95, 118, 97, 117, 108, 116]" + } ] -} \ No newline at end of file +} diff --git a/programs/zap/Cargo.toml b/programs/zap/Cargo.toml index 580a97b..c38b181 100644 --- a/programs/zap/Cargo.toml +++ b/programs/zap/Cargo.toml @@ -25,6 +25,5 @@ bytemuck = { workspace = true, features = ["derive", "min_const_generics"] } dlmm = { path = "../../libs/dlmm" } damm-v2 = { git = "https://github.com/MeteoraAg/damm-v2", features = [ "cpi", - "no-entrypoint", -], rev = "689a3264484799d833c505523f4ff4e4990690aa", package="cp-amm" } +], rev = "d9cef5aaec9cfa1a6d3b0b28d213c87c285127de", package="cp-amm" } ruint = "1.3.0" \ No newline at end of file diff --git a/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_initialized_position.rs b/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_initialized_position.rs index e9be5c6..a4e6fd1 100644 --- a/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_initialized_position.rs +++ b/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_initialized_position.rs @@ -86,12 +86,22 @@ pub fn handle_zap_in_dlmm_for_initialized_position<'c: 'info, 'info>( let pre_user_amount_x = accessor::amount(&token_x_account_ai)?; let pre_user_amount_y = accessor::amount(&token_y_account_ai)?; - let amount_x = - calculate_transfer_fee_excluded_amount(&ctx.accounts.token_x_mint, max_deposit_x_amount)? - .amount; - let amount_y = - calculate_transfer_fee_excluded_amount(&ctx.accounts.token_y_mint, max_deposit_y_amount)? - .amount; + let amount_x = calculate_transfer_fee_excluded_amount( + &ctx.accounts + .token_x_mint + .to_account_info() + .try_borrow_data()?, + max_deposit_x_amount, + )? + .amount; + let amount_y = calculate_transfer_fee_excluded_amount( + &ctx.accounts + .token_y_mint + .to_account_info() + .try_borrow_data()?, + max_deposit_y_amount, + )? + .amount; let lb_pair = ctx.accounts.lb_pair.load()?; diff --git a/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_uninitialized_position.rs b/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_uninitialized_position.rs index ce5593d..37af6d3 100644 --- a/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_uninitialized_position.rs +++ b/programs/zap/src/instructions/zap_in_dlmm/ix_zap_in_dlmm_for_uninitialized_position.rs @@ -132,12 +132,22 @@ pub fn handle_zap_in_dlmm_for_uninitialized_position<'c: 'info, 'info>( let lb_pair = ctx.accounts.lb_pair.load()?; let lb_pair_active_id = lb_pair.active_id; - let amount_x = - calculate_transfer_fee_excluded_amount(&ctx.accounts.token_x_mint, max_deposit_x_amount)? - .amount; - let amount_y = - calculate_transfer_fee_excluded_amount(&ctx.accounts.token_y_mint, max_deposit_y_amount)? - .amount; + let amount_x = calculate_transfer_fee_excluded_amount( + &ctx.accounts + .token_x_mint + .to_account_info() + .try_borrow_data()?, + max_deposit_x_amount, + )? + .amount; + let amount_y = calculate_transfer_fee_excluded_amount( + &ctx.accounts + .token_y_mint + .to_account_info() + .try_borrow_data()?, + max_deposit_y_amount, + )? + .amount; let params = ZapInRebalancingParams { amount_x, diff --git a/programs/zap/src/utils/damm_v2_utils.rs b/programs/zap/src/utils/damm_v2_utils.rs index 6db2e11..94820b9 100644 --- a/programs/zap/src/utils/damm_v2_utils.rs +++ b/programs/zap/src/utils/damm_v2_utils.rs @@ -1,6 +1,9 @@ use anchor_lang::prelude::*; use damm_v2::{ - base_fee::{BaseFeeHandler, FeeRateLimiter}, + base_fee::{ + fee_rate_limiter::PodAlignedFeeRateLimiter, BaseFeeEnumReader, BaseFeeHandler, + BaseFeeHandlerBuilder, + }, constants::fee::get_max_fee_numerator, curve::{ get_delta_amount_a_unsigned, get_delta_amount_b_unsigned, get_next_sqrt_price_from_input, @@ -142,6 +145,8 @@ fn calculate_swap_result( current_point, pool.activation_point, trade_direction, + pool.pool_fees.init_sqrt_price, + pool.sqrt_price, )?; let actual_amount_in = if fee_mode.fees_on_input { let FeeOnAmountResult { amount, .. } = pool.pool_fees.get_fee_on_amount( @@ -245,7 +250,7 @@ fn validate_swap_result( } struct FeeHandler { - pub rate_limiter_handler: FeeRateLimiter, // avoid copy + pub rate_limiter_handler: PodAlignedFeeRateLimiter, // avoid copy pub variable_fee_numerator: u128, pub max_fee_numerator: u64, pub total_fee_numerator: u64, @@ -259,6 +264,8 @@ impl FeeHandler { current_point: u64, activation_point: u64, trade_direction: TradeDirection, + init_sqrt_price: u128, + current_sqrt_price: u128, ) -> Result { if self.is_rate_limiter { let base_fee_numerator = self @@ -268,6 +275,8 @@ impl FeeHandler { activation_point, trade_direction, input_amount, + init_sqrt_price, + current_sqrt_price, )?; get_total_fee_numerator( @@ -289,12 +298,19 @@ fn get_fee_handler( let variable_fee_numerator = pool.pool_fees.dynamic_fee.get_variable_fee()?; let max_fee_numerator = get_max_fee_numerator(pool.version)?; - let base_fee_mode = pool.pool_fees.base_fee.base_fee_mode; + let base_fee_mode = pool.pool_fees.base_fee.base_fee_info.get_base_fee_mode()?; match BaseFeeMode::try_from(base_fee_mode) { Ok(value) => { match value { - BaseFeeMode::FeeSchedulerLinear | BaseFeeMode::FeeSchedulerExponential => { - let base_fee_handler = pool.pool_fees.base_fee.get_base_fee_handler()?; + BaseFeeMode::FeeTimeSchedulerLinear + | BaseFeeMode::FeeTimeSchedulerExponential + | BaseFeeMode::FeeMarketCapSchedulerLinear + | BaseFeeMode::FeeMarketCapSchedulerExponential => { + let base_fee_handler = pool + .pool_fees + .base_fee + .base_fee_info + .get_base_fee_handler()?; // fee scheduler doesn't care for amount let base_fee_numerator = base_fee_handler .get_base_fee_numerator_from_included_fee_amount( @@ -302,6 +318,8 @@ fn get_fee_handler( pool.activation_point, trade_direction, 0, + pool.pool_fees.init_sqrt_price, + pool.sqrt_price, )?; let total_fee_numerator = get_total_fee_numerator( @@ -310,7 +328,7 @@ fn get_fee_handler( max_fee_numerator, )?; Ok(FeeHandler { - rate_limiter_handler: FeeRateLimiter::default(), + rate_limiter_handler: PodAlignedFeeRateLimiter::default(), variable_fee_numerator, max_fee_numerator, total_fee_numerator, @@ -318,7 +336,7 @@ fn get_fee_handler( }) } BaseFeeMode::RateLimiter => { - let rate_limiter_handler = pool.pool_fees.base_fee.get_fee_rate_limiter()?; + let rate_limiter_handler = pool.pool_fees.base_fee.to_fee_rate_limiter()?; Ok(FeeHandler { rate_limiter_handler, total_fee_numerator: 0, diff --git a/tests/common/damm_v2.ts b/tests/common/damm_v2.ts index cb7336f..5975c5a 100644 --- a/tests/common/damm_v2.ts +++ b/tests/common/damm_v2.ts @@ -1,6 +1,7 @@ import { AnchorProvider, BN, + BorshCoder, IdlAccounts, IdlTypes, Program, @@ -168,7 +169,7 @@ export async function createDammV2Pool( tokenBMint: PublicKey, amountA?: BN, amountB?: BN, - baseFeeParams?: any + baseFeeParams?: Buffer ): Promise { const program = createDammV2Program(); @@ -217,17 +218,23 @@ export async function createDammV2Pool( liquidityDelta = BN.min(liquidityFromA, liquidityFromB); } + const baseFee = { + data: Array.from( + baseFeeParams ?? + encodeFeeTimeSchedulerParams( + new BN(2_500_000), + 0, + new BN(0), + new BN(0), + BaseFeeMode.FeeTimeSchedulerLinear + ) + ), + }; + const transaction = await program.methods .initializeCustomizablePool({ poolFees: { - baseFee: baseFeeParams ?? { - cliffFeeNumerator: new BN(2_500_000), - firstFactor: 0, - secondFactor: Array.from(new BN(0).toArrayLike(Buffer, "le", 8)), - thirdFactor: new BN(0), - baseFeeMode: 0, - }, - padding: [], + baseFee, dynamicFee: null, }, sqrtMinPrice: MIN_SQRT_PRICE, @@ -510,12 +517,76 @@ export async function swap(params: { .transaction(); } -export function convertToRateLimiterSecondFactor( - maxLimiterDuration: BN, - maxFeeBps: BN -): number[] { - const buffer1 = maxLimiterDuration.toArrayLike(Buffer, "le", 4); - const buffer2 = maxFeeBps.toArrayLike(Buffer, "le", 4); - const buffer = Buffer.concat([buffer1, buffer2]); - return Array.from(buffer); +const FEE_PADDING = Array.from(Buffer.alloc(3)); +const cpAmmCoder = new BorshCoder(CpAmmIDL as CpAmm); + +export enum BaseFeeMode { + FeeTimeSchedulerLinear, + FeeTimeSchedulerExponential, + RateLimiter, + FeeMarketCapSchedulerLinear, + FeeMarketCapSchedulerExponential, +} + +export function encodeFeeTimeSchedulerParams( + cliffFeeNumerator: BN, + numberOfPeriod: number, + periodFrequency: BN, + reductionFactor: BN, + baseFeeMode: BaseFeeMode +): Buffer { + const feeTimeScheduler = { + cliff_fee_numerator: new BN(cliffFeeNumerator.toString()), + number_of_period: numberOfPeriod, + period_frequency: new BN(periodFrequency.toString()), + reduction_factor: new BN(reductionFactor.toString()), + base_fee_mode: baseFeeMode, + padding: FEE_PADDING, + }; + + return cpAmmCoder.types.encode("BorshFeeTimeScheduler", feeTimeScheduler); +} + +export function encodeFeeMarketCapSchedulerParams( + cliffFeeNumerator: BN, + numberOfPeriod: number, + sqrtPriceStepBps: number, + schedulerExpirationDuration: number, + reductionFactor: BN, + baseFeeMode: BaseFeeMode +): Buffer { + const feeMarketCapScheduler = { + cliff_fee_numerator: new BN(cliffFeeNumerator.toString()), + number_of_period: numberOfPeriod, + sqrt_price_step_bps: sqrtPriceStepBps, + scheduler_expiration_duration: schedulerExpirationDuration, + reduction_factor: new BN(reductionFactor.toString()), + base_fee_mode: baseFeeMode, + padding: FEE_PADDING, + }; + + return cpAmmCoder.types.encode( + "BorshFeeMarketCapScheduler", + feeMarketCapScheduler + ); +} + +export function encodeFeeRateLimiterParams( + cliffFeeNumerator: BN, + feeIncrementBps: number, + maxLimiterDuration: number, + maxFeeBps: number, + referenceAmount: BN +): Buffer { + const feeRateLimiter = { + cliff_fee_numerator: new BN(cliffFeeNumerator.toString()), + fee_increment_bps: feeIncrementBps, + max_limiter_duration: maxLimiterDuration, + max_fee_bps: maxFeeBps, + reference_amount: new BN(referenceAmount.toString()), + base_fee_mode: BaseFeeMode.RateLimiter, + padding: FEE_PADDING, + }; + + return cpAmmCoder.types.encode("BorshFeeRateLimiter", feeRateLimiter); } diff --git a/tests/common/idl/damm_v2.ts b/tests/common/idl/damm_v2.ts index 3a1691c..6b90f42 100644 --- a/tests/common/idl/damm_v2.ts +++ b/tests/common/idl/damm_v2.ts @@ -8,7 +8,7 @@ export type CpAmm = { address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"; metadata: { name: "cpAmm"; - version: "0.1.5"; + version: "0.1.6"; spec: "0.1.0"; description: "Created with Anchor"; }; @@ -537,14 +537,14 @@ export type CpAmm = { }; }, { - name: "claimFeeOperator"; + name: "operator"; docs: ["Claim fee operator"]; }, { - name: "operator"; - docs: ["Operator"]; + name: "whitelistedAddress"; + docs: ["operator"]; signer: true; - relations: ["claimFeeOperator"]; + relations: ["operator"]; }, { name: "tokenAProgram"; @@ -684,20 +684,24 @@ export type CpAmm = { ]; }, { - name: "closeClaimFeeOperator"; - discriminator: [38, 134, 82, 216, 95, 124, 17, 99]; + name: "closeConfig"; + discriminator: [145, 9, 72, 157, 95, 125, 61, 85]; accounts: [ { - name: "claimFeeOperator"; + name: "config"; writable: true; }, { - name: "rentReceiver"; - writable: true; + name: "operator"; }, { - name: "admin"; + name: "whitelistedAddress"; signer: true; + relations: ["operator"]; + }, + { + name: "rentReceiver"; + writable: true; }, { name: "eventAuthority"; @@ -735,16 +739,15 @@ export type CpAmm = { args: []; }, { - name: "closeConfig"; - discriminator: [145, 9, 72, 157, 95, 125, 61, 85]; + name: "closeOperatorAccount"; + discriminator: [171, 9, 213, 74, 120, 23, 3, 29]; accounts: [ { - name: "config"; + name: "operator"; writable: true; }, { name: "admin"; - writable: true; signer: true; }, { @@ -873,9 +876,12 @@ export type CpAmm = { writable: true; }, { - name: "admin"; - writable: true; + name: "operator"; + }, + { + name: "whitelistedAddress"; signer: true; + relations: ["operator"]; }, { name: "rentReceiver"; @@ -917,21 +923,22 @@ export type CpAmm = { args: []; }, { - name: "createClaimFeeOperator"; - discriminator: [169, 62, 207, 107, 58, 187, 162, 109]; + name: "createConfig"; + docs: ["OPERATOR FUNCTIONS /////"]; + discriminator: [201, 207, 243, 114, 75, 111, 47, 189]; accounts: [ { - name: "claimFeeOperator"; + name: "config"; writable: true; pda: { seeds: [ { kind: "const"; - value: [99, 102, 95, 111, 112, 101, 114, 97, 116, 111, 114]; + value: [99, 111, 110, 102, 105, 103]; }, { - kind: "account"; - path: "operator"; + kind: "arg"; + path: "index"; } ]; }; @@ -940,7 +947,12 @@ export type CpAmm = { name: "operator"; }, { - name: "admin"; + name: "whitelistedAddress"; + signer: true; + relations: ["operator"]; + }, + { + name: "payer"; writable: true; signer: true; }, @@ -981,12 +993,24 @@ export type CpAmm = { name: "program"; } ]; - args: []; + args: [ + { + name: "index"; + type: "u64"; + }, + { + name: "configParameters"; + type: { + defined: { + name: "staticConfigParameters"; + }; + }; + } + ]; }, { - name: "createConfig"; - docs: ["ADMIN FUNCTIONS /////"]; - discriminator: [201, 207, 243, 114, 75, 111, 47, 189]; + name: "createDynamicConfig"; + discriminator: [81, 251, 122, 78, 66, 57, 208, 82]; accounts: [ { name: "config"; @@ -1005,7 +1029,15 @@ export type CpAmm = { }; }, { - name: "admin"; + name: "operator"; + }, + { + name: "whitelistedAddress"; + signer: true; + relations: ["operator"]; + }, + { + name: "payer"; writable: true; signer: true; }, @@ -1055,34 +1087,42 @@ export type CpAmm = { name: "configParameters"; type: { defined: { - name: "staticConfigParameters"; + name: "dynamicConfigParameters"; }; }; } ]; }, { - name: "createDynamicConfig"; - discriminator: [81, 251, 122, 78, 66, 57, 208, 82]; + name: "createOperatorAccount"; + docs: ["ADMIN FUNCTIONS /////"]; + discriminator: [221, 64, 246, 149, 240, 153, 229, 163]; accounts: [ { - name: "config"; + name: "operator"; writable: true; pda: { seeds: [ { kind: "const"; - value: [99, 111, 110, 102, 105, 103]; + value: [111, 112, 101, 114, 97, 116, 111, 114]; }, { - kind: "arg"; - path: "index"; + kind: "account"; + path: "whitelistedAddress"; } ]; }; }, + { + name: "whitelistedAddress"; + }, { name: "admin"; + signer: true; + }, + { + name: "payer"; writable: true; signer: true; }, @@ -1125,16 +1165,8 @@ export type CpAmm = { ]; args: [ { - name: "index"; - type: "u64"; - }, - { - name: "configParameters"; - type: { - defined: { - name: "dynamicConfigParameters"; - }; - }; + name: "permission"; + type: "u128"; } ]; }, @@ -1289,7 +1321,15 @@ export type CpAmm = { name: "tokenMint"; }, { - name: "admin"; + name: "operator"; + }, + { + name: "whitelistedAddress"; + signer: true; + relations: ["operator"]; + }, + { + name: "payer"; writable: true; signer: true; }, @@ -1332,6 +1372,31 @@ export type CpAmm = { ]; 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: "fundReward"; discriminator: [188, 50, 249, 165, 93, 151, 38, 63]; @@ -2539,8 +2604,12 @@ export type CpAmm = { writable: true; }, { - name: "admin"; + name: "operator"; + }, + { + name: "whitelistedAddress"; signer: true; + relations: ["operator"]; }, { name: "eventAuthority"; @@ -2952,6 +3021,66 @@ export type CpAmm = { } ]; }, + { + name: "updatePoolFees"; + discriminator: [118, 217, 203, 179, 60, 8, 70, 89]; + accounts: [ + { + name: "pool"; + writable: true; + }, + { + name: "operator"; + }, + { + name: "whitelistedAddress"; + signer: true; + relations: ["operator"]; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ]; + } + ]; + }; + }, + { + name: "program"; + } + ]; + args: [ + { + name: "params"; + type: { + defined: { + name: "updatePoolFeesParameters"; + }; + }; + } + ]; + }, { name: "updateRewardDuration"; discriminator: [138, 174, 196, 169, 213, 235, 254, 107]; @@ -3136,14 +3265,26 @@ export type CpAmm = { } ]; accounts: [ - { - name: "claimFeeOperator"; - discriminator: [166, 48, 134, 86, 34, 200, 188, 150]; - }, { 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]; @@ -3162,10 +3303,6 @@ export type CpAmm = { } ]; events: [ - { - name: "evtAddLiquidity"; - discriminator: [175, 242, 8, 157, 30, 247, 185, 169]; - }, { name: "evtClaimPartnerFee"; discriminator: [118, 99, 77, 10, 226, 1, 1, 87]; @@ -3182,10 +3319,6 @@ export type CpAmm = { name: "evtClaimReward"; discriminator: [218, 86, 147, 200, 235, 188, 215, 231]; }, - { - name: "evtCloseClaimFeeOperator"; - discriminator: [111, 39, 37, 55, 110, 216, 194, 23]; - }, { name: "evtCloseConfig"; discriminator: [36, 30, 239, 45, 58, 132, 14, 5]; @@ -3194,10 +3327,6 @@ export type CpAmm = { name: "evtClosePosition"; discriminator: [20, 145, 144, 68, 143, 142, 214, 178]; }, - { - name: "evtCreateClaimFeeOperator"; - discriminator: [21, 6, 153, 120, 68, 116, 28, 177]; - }, { name: "evtCreateConfig"; discriminator: [131, 207, 180, 174, 180, 73, 165, 54]; @@ -3238,10 +3367,6 @@ export type CpAmm = { name: "evtPermanentLockPosition"; discriminator: [145, 143, 162, 218, 218, 80, 67, 11]; }, - { - name: "evtRemoveLiquidity"; - discriminator: [87, 46, 88, 98, 175, 96, 34, 91]; - }, { name: "evtSetPoolStatus"; discriminator: [100, 213, 74, 3, 95, 91, 228, 146]; @@ -3250,14 +3375,14 @@ export type CpAmm = { name: "evtSplitPosition2"; discriminator: [165, 32, 203, 174, 72, 100, 233, 103]; }, - { - name: "evtSwap"; - discriminator: [27, 60, 21, 213, 138, 170, 187, 147]; - }, { name: "evtSwap2"; discriminator: [189, 66, 51, 168, 38, 80, 117, 153]; }, + { + name: "evtUpdatePoolFees"; + discriminator: [76, 165, 246, 102, 102, 217, 156, 44]; + }, { name: "evtUpdateRewardDuration"; discriminator: [149, 135, 65, 231, 129, 153, 65, 57]; @@ -3524,7 +3649,7 @@ export type CpAmm = { }, { code: 6050; - name: "invalidFeeScheduler"; + name: "invalidFeeTimeScheduler"; msg: "Invalid fee scheduler"; }, { @@ -3536,6 +3661,41 @@ export type CpAmm = { code: 6052; name: "invalidPoolVersion"; msg: "Invalid pool version"; + }, + { + code: 6053; + name: "invalidAuthority"; + msg: "Invalid authority to do that action"; + }, + { + code: 6054; + name: "invalidPermission"; + msg: "Invalid permission"; + }, + { + code: 6055; + name: "invalidFeeMarketCapScheduler"; + msg: "Invalid fee market cap scheduler"; + }, + { + code: 6056; + name: "cannotUpdateBaseFee"; + msg: "Cannot update base fee"; + }, + { + code: 6057; + name: "invalidDynamicFeeParameters"; + msg: "Invalid dynamic fee parameters"; + }, + { + code: 6058; + name: "invalidUpdatePoolFeesParameters"; + msg: "Invalid update pool fees parameters"; + }, + { + code: 6059; + name: "missingOperatorAccount"; + msg: "Missing operator account"; } ]; types: [ @@ -3563,7 +3723,7 @@ export type CpAmm = { }; }, { - name: "baseFeeConfig"; + name: "baseFeeInfo"; serialization: "bytemuck"; repr: { kind: "c"; @@ -3572,32 +3732,10 @@ export type CpAmm = { kind: "struct"; fields: [ { - name: "cliffFeeNumerator"; - type: "u64"; - }, - { - name: "baseFeeMode"; - type: "u8"; - }, - { - name: "padding"; - type: { - array: ["u8", 5]; - }; - }, - { - name: "firstFactor"; - type: "u16"; - }, - { - name: "secondFactor"; + name: "data"; type: { - array: ["u8", 8]; + array: ["u8", 32]; }; - }, - { - name: "thirdFactor"; - type: "u64"; } ]; }; @@ -3608,26 +3746,10 @@ export type CpAmm = { kind: "struct"; fields: [ { - name: "cliffFeeNumerator"; - type: "u64"; - }, - { - name: "firstFactor"; - type: "u16"; - }, - { - name: "secondFactor"; + name: "data"; type: { - array: ["u8", 8]; + array: ["u8", 30]; }; - }, - { - name: "thirdFactor"; - type: "u64"; - }, - { - name: "baseFeeMode"; - type: "u8"; } ]; }; @@ -3642,60 +3764,138 @@ export type CpAmm = { kind: "struct"; fields: [ { - name: "cliffFeeNumerator"; - type: "u64"; + name: "baseFeeInfo"; + type: { + defined: { + name: "baseFeeInfo"; + }; + }; }, { - name: "baseFeeMode"; + 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: "padding0"; + name: "padding"; type: { - array: ["u8", 5]; + array: ["u8", 3]; }; + } + ]; + }; + }, + { + name: "borshFeeRateLimiter"; + docs: [ + "we denote reference_amount = x0, cliff_fee_numerator = c, fee_increment = i", + "if input_amount <= x0, then fee = input_amount * c", + "", + "if input_amount > x0, then input_amount = x0 + (a * x0 + b)", + "if a < max_index", + "then fee = x0 * c + x0 * (c + i) + .... + x0 * (c + i*a) + b * (c + i * (a+1))", + "then fee = x0 * (c + c*a + i*a*(a+1)/2) + b * (c + i * (a+1))", + "", + "if a >= max_index", + "if a = max_index + d, input_amount = x0 + max_index * x0 + (d * x0 + b)", + "then fee = x0 * (c + c*max_index + i*max_index*(max_index+1)/2) + (d * x0 + b) * MAX_FEE" + ]; + type: { + kind: "struct"; + fields: [ + { + name: "cliffFeeNumerator"; + type: "u64"; }, { - name: "firstFactor"; + name: "feeIncrementBps"; type: "u16"; }, { - name: "secondFactor"; - type: { - array: ["u8", 8]; - }; + name: "maxLimiterDuration"; + type: "u32"; }, { - name: "thirdFactor"; - type: "u64"; + name: "maxFeeBps"; + type: "u32"; }, { - name: "padding1"; + name: "referenceAmount"; type: "u64"; + }, + { + name: "baseFeeMode"; + type: "u8"; + }, + { + name: "padding"; + type: { + array: ["u8", 3]; + }; } ]; }; }, { - name: "claimFeeOperator"; - docs: ["Parameter that set by the protocol"]; - serialization: "bytemuck"; - repr: { - kind: "c"; - }; + name: "borshFeeTimeScheduler"; type: { kind: "struct"; fields: [ { - name: "operator"; - docs: ["operator"]; - type: "pubkey"; + name: "cliffFeeNumerator"; + type: "u64"; + }, + { + name: "numberOfPeriod"; + type: "u16"; + }, + { + name: "periodFrequency"; + type: "u64"; + }, + { + name: "reductionFactor"; + type: "u64"; + }, + { + name: "baseFeeMode"; + type: "u8"; }, { name: "padding"; - docs: ["Reserve"]; type: { - array: ["u8", 128]; + array: ["u8", 3]; }; } ]; @@ -3778,6 +3978,38 @@ export type CpAmm = { ]; }; }, + { + 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: { @@ -3948,50 +4180,6 @@ export type CpAmm = { ]; }; }, - { - name: "evtAddLiquidity"; - type: { - kind: "struct"; - fields: [ - { - name: "pool"; - type: "pubkey"; - }, - { - name: "position"; - type: "pubkey"; - }, - { - name: "owner"; - type: "pubkey"; - }, - { - name: "params"; - type: { - defined: { - name: "addLiquidityParameters"; - }; - }; - }, - { - name: "tokenAAmount"; - type: "u64"; - }, - { - name: "tokenBAmount"; - type: "u64"; - }, - { - name: "totalAmountA"; - type: "u64"; - }, - { - name: "totalAmountB"; - type: "u64"; - } - ]; - }; - }, { name: "evtClaimPartnerFee"; type: { @@ -4092,23 +4280,6 @@ export type CpAmm = { ]; }; }, - { - name: "evtCloseClaimFeeOperator"; - docs: ["Close claim fee operator"]; - type: { - kind: "struct"; - fields: [ - { - name: "claimFeeOperator"; - type: "pubkey"; - }, - { - name: "operator"; - type: "pubkey"; - } - ]; - }; - }, { name: "evtCloseConfig"; docs: ["Close config"]; @@ -4152,19 +4323,6 @@ export type CpAmm = { ]; }; }, - { - name: "evtCreateClaimFeeOperator"; - docs: ["Create claim fee operator"]; - type: { - kind: "struct"; - fields: [ - { - name: "operator"; - type: "pubkey"; - } - ]; - }; - }, { name: "evtCreateConfig"; docs: ["Create static config"]; @@ -4572,42 +4730,6 @@ export type CpAmm = { ]; }; }, - { - name: "evtRemoveLiquidity"; - type: { - kind: "struct"; - fields: [ - { - name: "pool"; - type: "pubkey"; - }, - { - name: "position"; - type: "pubkey"; - }, - { - name: "owner"; - type: "pubkey"; - }, - { - name: "params"; - type: { - defined: { - name: "removeLiquidityParameters"; - }; - }; - }, - { - name: "tokenAAmount"; - type: "u64"; - }, - { - name: "tokenBAmount"; - type: "u64"; - } - ]; - }; - }, { name: "evtSetPoolStatus"; type: { @@ -4688,50 +4810,6 @@ export type CpAmm = { ]; }; }, - { - name: "evtSwap"; - type: { - kind: "struct"; - fields: [ - { - name: "pool"; - type: "pubkey"; - }, - { - name: "tradeDirection"; - type: "u8"; - }, - { - name: "hasReferral"; - type: "bool"; - }, - { - name: "params"; - type: { - defined: { - name: "swapParameters"; - }; - }; - }, - { - name: "swapResult"; - type: { - defined: { - name: "swapResult"; - }; - }; - }, - { - name: "actualAmountIn"; - type: "u64"; - }, - { - name: "currentTimestamp"; - type: "u64"; - } - ]; - }; - }, { name: "evtSwap2"; type: { @@ -4786,12 +4864,36 @@ export type CpAmm = { type: "u64"; }, { - name: "reserveAAmount"; - type: "u64"; + name: "reserveAAmount"; + type: "u64"; + }, + { + name: "reserveBAmount"; + type: "u64"; + } + ]; + }; + }, + { + name: "evtUpdatePoolFees"; + type: { + kind: "struct"; + fields: [ + { + name: "pool"; + type: "pubkey"; + }, + { + name: "operator"; + type: "pubkey"; }, { - name: "reserveBAmount"; - type: "u64"; + name: "params"; + type: { + defined: { + name: "updatePoolFeesParameters"; + }; + }; } ]; }; @@ -4901,7 +5003,7 @@ export type CpAmm = { { name: "sqrtPrice"; docs: [ - "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value" + "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"; }, @@ -4952,6 +5054,154 @@ export type CpAmm = { ]; }; }, + { + 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"; @@ -5077,7 +5327,7 @@ export type CpAmm = { { name: "collectFeeMode"; docs: [ - "0 is collect fee in both token, 1 only collect fee in token a, 2 only collect fee in token b" + "0 is collect fee in both token, 1 only collect fee only in token b" ]; type: "u8"; }, @@ -5169,13 +5419,6 @@ export type CpAmm = { }; }; }, - { - name: "padding"; - docs: ["padding"]; - type: { - array: ["u8", 3]; - }; - }, { name: "dynamicFee"; docs: ["dynamic fee"]; @@ -5203,7 +5446,7 @@ export type CpAmm = { name: "baseFee"; type: { defined: { - name: "baseFeeConfig"; + name: "baseFeeInfo"; }; }; }, @@ -5308,11 +5551,8 @@ export type CpAmm = { }; }, { - name: "padding1"; - docs: ["padding"]; - type: { - array: ["u64", 2]; - }; + name: "initSqrtPrice"; + type: "u128"; } ]; }; @@ -5813,39 +6053,6 @@ export type CpAmm = { ]; }; }, - { - name: "swapResult"; - docs: ["Encodes all results of swapping"]; - type: { - kind: "struct"; - fields: [ - { - name: "outputAmount"; - type: "u64"; - }, - { - name: "nextSqrtPrice"; - type: "u128"; - }, - { - name: "lpFee"; - type: "u64"; - }, - { - name: "protocolFee"; - type: "u64"; - }, - { - name: "partnerFee"; - type: "u64"; - }, - { - name: "referralFee"; - type: "u64"; - } - ]; - }; - }, { name: "swapResult2"; type: { @@ -5915,6 +6122,41 @@ export type CpAmm = { ]; }; }, + { + 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: "userRewardInfo"; serialization: "bytemuck"; @@ -6027,4 +6269,81 @@ export type CpAmm = { }; } ]; + 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: "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: "u64"; + value: "10000"; + }, + { + name: "maxSqrtPriceLeBytes"; + type: { + array: ["u8", 16]; + }; + value: "[155, 87, 105, 78, 169, 26, 92, 132, 177, 196, 254, 255, 0, 0, 0, 0]"; + }, + { + 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]"; + } + ]; }; diff --git a/tests/fixtures/damm_v2.so b/tests/fixtures/damm_v2.so index abd3200..27ca88a 100755 Binary files a/tests/fixtures/damm_v2.so and b/tests/fixtures/damm_v2.so differ diff --git a/tests/test_zapin/zapin_dammv2.test.ts b/tests/test_zapin/zapin_dammv2.test.ts index 7416629..2d3daba 100644 --- a/tests/test_zapin/zapin_dammv2.test.ts +++ b/tests/test_zapin/zapin_dammv2.test.ts @@ -28,7 +28,6 @@ import { import ZapIDL from "../../target/idl/zap.json"; import DAMMV2IDL from "../../idls/damm_v2.json"; import { - convertToRateLimiterSecondFactor, createDammV2Pool, createDammV2Position, swap, @@ -37,12 +36,16 @@ import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { BN } from "@coral-xyz/anchor"; import { getDammV2Pool, getDammV2Position } from "../common/pda"; import { expect } from "chai"; -import fs from "fs"; +import { + BaseFeeMode, + encodeFeeMarketCapSchedulerParams, + encodeFeeRateLimiterParams, + encodeFeeTimeSchedulerParams, +} from "../common/damm_v2"; describe("Zap In damm V2", () => { let zapProgram: ZapProgram; let svm: LiteSVM; - let tokenMint: PublicKey; let user: Keypair; let admin: Keypair; let tokenAMint: PublicKey; @@ -97,15 +100,55 @@ describe("Zap In damm V2", () => { }); }); - it("zap in with pool has fee scheduler", async () => { - const baseFee = { - cliffFeeNumerator: new BN(500_000_000), // 50 % - firstFactor: 100, // 100 periods - secondFactor: Array.from(new BN(1).toArrayLike(Buffer, "le", 8)), - thirdFactor: new BN(4875000), - baseFeeMode: 0, // fee scheduler Linear mode - }; + it("zap in with pool has fee time scheduler linear", async () => { + const baseFee = encodeFeeTimeSchedulerParams( + new BN(500_000_000), // 50% cliff fee + 100, // 100 periods + new BN(1), // period frequency in slots + new BN(4875000), // 0.4875% reduction per period + BaseFeeMode.FeeTimeSchedulerLinear + ); + warpSlotBy(svm, new BN(10)); + + const pool = await createDammV2Pool( + svm, + admin, + tokenAMint, + tokenBMint, + undefined, + undefined, + baseFee + ); + + const { position, positionNftAccount } = await createDammV2Position( + svm, + user, + pool + ); + + const amountTokenA = new BN(LAMPORTS_PER_SOL); + const amountSwap = amountTokenA.divn(2); + await zapInFullFlow({ + svm, + user, + pool, + position, + positionNftAccount, + inputTokenMint: tokenAMint, + outputTokenMint: tokenBMint, + totalAmount: amountTokenA, + amountSwap, + }); + }); + it("zap in with pool has fee time scheduler exponential", async () => { + const baseFee = encodeFeeTimeSchedulerParams( + new BN(990_000_000), // 99% cliff fee + 10, // 10 periods + new BN(1), // period frequency in slots + new BN(1_000), // 10% decay per period + BaseFeeMode.FeeTimeSchedulerExponential + ); warpSlotBy(svm, new BN(10)); const pool = await createDammV2Pool( @@ -140,18 +183,13 @@ describe("Zap In damm V2", () => { }); it("zap in with pool has rate limiter", async () => { - let maxRateLimiterDuration = new BN(10); - let maxFeeBps = new BN(5000); - const baseFee = { - cliffFeeNumerator: new BN(10_000_000), // 100bps - firstFactor: 10, // 10 bps - secondFactor: convertToRateLimiterSecondFactor( - maxRateLimiterDuration, - maxFeeBps - ), - thirdFactor: new BN(LAMPORTS_PER_SOL), // 1 SOL, - baseFeeMode: 2, // rate limiter mode - }; + const baseFee = encodeFeeRateLimiterParams( + new BN(10_000_000), // 1% cliff fee + 10, // 10 bps fee increment + 10, // max limiter duration + 5000, // 50% max fee + new BN(LAMPORTS_PER_SOL) // reference amount: 1 SOL + ); const pool = await createDammV2Pool( svm, @@ -184,6 +222,88 @@ describe("Zap In damm V2", () => { }); }); + it("zap in with pool has fee market cap scheduler linear", async () => { + const baseFee = encodeFeeMarketCapSchedulerParams( + new BN(50_000_000), // 5% cliff fee + 20, // 20 periods + 50, // 0.5% price step + 5000, // scheduler expires after 5000 slots + new BN(1_000_000), // 0.1% reduction per period + BaseFeeMode.FeeMarketCapSchedulerLinear + ); + + const pool = await createDammV2Pool( + svm, + admin, + tokenAMint, + tokenBMint, + undefined, + undefined, + baseFee + ); + + const { position, positionNftAccount } = await createDammV2Position( + svm, + user, + pool + ); + + const amountTokenA = new BN(LAMPORTS_PER_SOL); + const amountSwap = amountTokenA.divn(2); + await zapInFullFlow({ + svm, + user, + pool, + position, + positionNftAccount, + inputTokenMint: tokenAMint, + outputTokenMint: tokenBMint, + totalAmount: amountTokenA, + amountSwap, + }); + }); + + it("zap in with pool has fee market cap scheduler exponential", async () => { + const baseFee = encodeFeeMarketCapSchedulerParams( + new BN(990_000_000), // 99% cliff fee + 10, // 10 periods + 50, // 0.5% sqrt price step between tiers (in bps) + 1000, // scheduler expires after 1000 slots + new BN(1_000), // 10% decay per period (1000/10000 in bps scale) + BaseFeeMode.FeeMarketCapSchedulerExponential + ); + + const pool = await createDammV2Pool( + svm, + admin, + tokenAMint, + tokenBMint, + undefined, + undefined, + baseFee + ); + + const { position, positionNftAccount } = await createDammV2Position( + svm, + user, + pool + ); + + const amountTokenA = new BN(LAMPORTS_PER_SOL); + const amountSwap = amountTokenA.divn(2); + await zapInFullFlow({ + svm, + user, + pool, + position, + positionNftAccount, + inputTokenMint: tokenAMint, + outputTokenMint: tokenBMint, + totalAmount: amountTokenA, + amountSwap, + }); + }); + it("zap in with pool low liquidity", async () => { const pool = await createDammV2Pool( svm,