@coffer_so/sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +283 -0
- package/dist/clients/AdminClient.d.ts +194 -0
- package/dist/clients/AdminClient.d.ts.map +1 -0
- package/dist/clients/AdminClient.js +482 -0
- package/dist/clients/AdminClient.js.map +1 -0
- package/dist/clients/CofferBackendClient.d.ts +877 -0
- package/dist/clients/CofferBackendClient.d.ts.map +1 -0
- package/dist/clients/CofferBackendClient.js +536 -0
- package/dist/clients/CofferBackendClient.js.map +1 -0
- package/dist/clients/CubeBackendClient.d.ts +877 -0
- package/dist/clients/CubeBackendClient.d.ts.map +1 -0
- package/dist/clients/CubeBackendClient.js +536 -0
- package/dist/clients/CubeBackendClient.js.map +1 -0
- package/dist/clients/CubicPoolClient.d.ts +120 -0
- package/dist/clients/CubicPoolClient.d.ts.map +1 -0
- package/dist/clients/CubicPoolClient.js +687 -0
- package/dist/clients/CubicPoolClient.js.map +1 -0
- package/dist/clients/PoolFactoryClient.d.ts +53 -0
- package/dist/clients/PoolFactoryClient.d.ts.map +1 -0
- package/dist/clients/PoolFactoryClient.js +91 -0
- package/dist/clients/PoolFactoryClient.js.map +1 -0
- package/dist/clients/RpcClient.d.ts +49 -0
- package/dist/clients/RpcClient.d.ts.map +1 -0
- package/dist/clients/RpcClient.js +135 -0
- package/dist/clients/RpcClient.js.map +1 -0
- package/dist/clients/SingleTokenDepositClient.d.ts +67 -0
- package/dist/clients/SingleTokenDepositClient.d.ts.map +1 -0
- package/dist/clients/SingleTokenDepositClient.js +105 -0
- package/dist/clients/SingleTokenDepositClient.js.map +1 -0
- package/dist/clients/contract-instructions.d.ts +24 -0
- package/dist/clients/contract-instructions.d.ts.map +1 -0
- package/dist/clients/contract-instructions.js +130 -0
- package/dist/clients/contract-instructions.js.map +1 -0
- package/dist/clients/index.d.ts +10 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +26 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/quote-math.d.ts +15 -0
- package/dist/clients/quote-math.d.ts.map +1 -0
- package/dist/clients/quote-math.js +98 -0
- package/dist/clients/quote-math.js.map +1 -0
- package/dist/clients/tx-builders.d.ts +231 -0
- package/dist/clients/tx-builders.d.ts.map +1 -0
- package/dist/clients/tx-builders.js +861 -0
- package/dist/clients/tx-builders.js.map +1 -0
- package/dist/clients/versioned.d.ts +34 -0
- package/dist/clients/versioned.d.ts.map +1 -0
- package/dist/clients/versioned.js +55 -0
- package/dist/clients/versioned.js.map +1 -0
- package/dist/config/index.d.ts +65 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +75 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/networks.d.ts +12 -0
- package/dist/config/networks.d.ts.map +1 -0
- package/dist/config/networks.js +51 -0
- package/dist/config/networks.js.map +1 -0
- package/dist/config/tokens.d.ts +19 -0
- package/dist/config/tokens.d.ts.map +1 -0
- package/dist/config/tokens.js +43 -0
- package/dist/config/tokens.js.map +1 -0
- package/dist/idl/cubic_pool.json +4203 -0
- package/dist/idl/index.d.ts +1769 -0
- package/dist/idl/index.d.ts.map +1 -0
- package/dist/idl/index.js +18 -0
- package/dist/idl/index.js.map +1 -0
- package/dist/idl/protocol_admin.json +2615 -0
- package/dist/idl/single_token_liquidity.json +1121 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +206 -0
- package/dist/index.js.map +1 -0
- package/dist/math/cubicMath.d.ts +40 -0
- package/dist/math/cubicMath.d.ts.map +1 -0
- package/dist/math/cubicMath.js +82 -0
- package/dist/math/cubicMath.js.map +1 -0
- package/dist/math/fixedPoint.d.ts +19 -0
- package/dist/math/fixedPoint.d.ts.map +1 -0
- package/dist/math/fixedPoint.js +86 -0
- package/dist/math/fixedPoint.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +30 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/logExp.d.ts +6 -0
- package/dist/math/logExp.d.ts.map +1 -0
- package/dist/math/logExp.js +68 -0
- package/dist/math/logExp.js.map +1 -0
- package/dist/math/lpLoss.d.ts +44 -0
- package/dist/math/lpLoss.d.ts.map +1 -0
- package/dist/math/lpLoss.js +103 -0
- package/dist/math/lpLoss.js.map +1 -0
- package/dist/math/maxSelloff.d.ts +164 -0
- package/dist/math/maxSelloff.d.ts.map +1 -0
- package/dist/math/maxSelloff.js +397 -0
- package/dist/math/maxSelloff.js.map +1 -0
- package/dist/math/singleToken.d.ts +54 -0
- package/dist/math/singleToken.d.ts.map +1 -0
- package/dist/math/singleToken.js +188 -0
- package/dist/math/singleToken.js.map +1 -0
- package/dist/math/slippage.d.ts +13 -0
- package/dist/math/slippage.d.ts.map +1 -0
- package/dist/math/slippage.js +44 -0
- package/dist/math/slippage.js.map +1 -0
- package/dist/math/surgeFee.d.ts +24 -0
- package/dist/math/surgeFee.d.ts.map +1 -0
- package/dist/math/surgeFee.js +85 -0
- package/dist/math/surgeFee.js.map +1 -0
- package/dist/math/weightedMath.d.ts +20 -0
- package/dist/math/weightedMath.d.ts.map +1 -0
- package/dist/math/weightedMath.js +66 -0
- package/dist/math/weightedMath.js.map +1 -0
- package/dist/parsers/borsh.d.ts +28 -0
- package/dist/parsers/borsh.d.ts.map +1 -0
- package/dist/parsers/borsh.js +104 -0
- package/dist/parsers/borsh.js.map +1 -0
- package/dist/parsers/contracts.d.ts +26 -0
- package/dist/parsers/contracts.d.ts.map +1 -0
- package/dist/parsers/contracts.js +62 -0
- package/dist/parsers/contracts.js.map +1 -0
- package/dist/parsers/events.d.ts +3 -0
- package/dist/parsers/events.d.ts.map +1 -0
- package/dist/parsers/events.js +281 -0
- package/dist/parsers/events.js.map +1 -0
- package/dist/parsers/index.d.ts +6 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +22 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/mintAccount.d.ts +24 -0
- package/dist/parsers/mintAccount.d.ts.map +1 -0
- package/dist/parsers/mintAccount.js +27 -0
- package/dist/parsers/mintAccount.js.map +1 -0
- package/dist/parsers/poolAccount.d.ts +141 -0
- package/dist/parsers/poolAccount.d.ts.map +1 -0
- package/dist/parsers/poolAccount.js +224 -0
- package/dist/parsers/poolAccount.js.map +1 -0
- package/dist/types/contracts.d.ts +1340 -0
- package/dist/types/contracts.d.ts.map +1 -0
- package/dist/types/contracts.js +3 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/events.d.ts +172 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +3 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/pool.d.ts +149 -0
- package/dist/types/pool.d.ts.map +1 -0
- package/dist/types/pool.js +3 -0
- package/dist/types/pool.js.map +1 -0
- package/dist/types/result.d.ts +24 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +11 -0
- package/dist/types/result.js.map +1 -0
- package/dist/types/tx.d.ts +261 -0
- package/dist/types/tx.d.ts.map +1 -0
- package/dist/types/tx.js +3 -0
- package/dist/types/tx.js.map +1 -0
- package/dist/utils/errors.d.ts +44 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +192 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/extensions.d.ts +98 -0
- package/dist/utils/extensions.d.ts.map +1 -0
- package/dist/utils/extensions.js +187 -0
- package/dist/utils/extensions.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/pda.d.ts +8 -0
- package/dist/utils/pda.d.ts.map +1 -0
- package/dist/utils/pda.js +27 -0
- package/dist/utils/pda.js.map +1 -0
- package/dist/utils/retry.d.ts +22 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +62 -0
- package/dist/utils/retry.js.map +1 -0
- package/package.json +54 -0
- package/src/clients/AdminClient.ts +608 -0
- package/src/clients/CofferBackendClient.ts +1413 -0
- package/src/clients/CubicPoolClient.ts +719 -0
- package/src/clients/PoolFactoryClient.ts +110 -0
- package/src/clients/RpcClient.ts +195 -0
- package/src/clients/SingleTokenDepositClient.ts +143 -0
- package/src/clients/contract-instructions.ts +115 -0
- package/src/clients/index.ts +9 -0
- package/src/clients/quote-math.ts +81 -0
- package/src/clients/tx-builders.ts +1096 -0
- package/src/clients/versioned.ts +80 -0
- package/src/config/index.ts +111 -0
- package/src/config/networks.ts +71 -0
- package/src/config/tokens.ts +52 -0
- package/src/idl/cubic_pool.json +4203 -0
- package/src/idl/index.ts +13 -0
- package/src/idl/protocol_admin.json +2615 -0
- package/src/idl/single_token_liquidity.json +1121 -0
- package/src/index.ts +262 -0
- package/src/math/cubicMath.ts +92 -0
- package/src/math/fixedPoint.ts +71 -0
- package/src/math/index.ts +13 -0
- package/src/math/logExp.ts +61 -0
- package/src/math/lpLoss.ts +160 -0
- package/src/math/maxSelloff.ts +564 -0
- package/src/math/singleToken.ts +251 -0
- package/src/math/slippage.ts +38 -0
- package/src/math/surgeFee.ts +101 -0
- package/src/math/weightedMath.ts +64 -0
- package/src/parsers/borsh.ts +106 -0
- package/src/parsers/contracts.ts +64 -0
- package/src/parsers/events.ts +275 -0
- package/src/parsers/index.ts +5 -0
- package/src/parsers/mintAccount.ts +44 -0
- package/src/parsers/poolAccount.ts +372 -0
- package/src/types/contracts.ts +238 -0
- package/src/types/events.ts +198 -0
- package/src/types/index.ts +5 -0
- package/src/types/pool.ts +147 -0
- package/src/types/result.ts +51 -0
- package/src/types/tx.ts +278 -0
- package/src/utils/errors.ts +210 -0
- package/src/utils/extensions.ts +196 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/pda.ts +58 -0
- package/src/utils/retry.ts +85 -0
|
@@ -0,0 +1,1121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"address": "7BpdUH1tzTSXLuQNo6YpjJ8Eagw8AkrS6cnkxiJdCFS2",
|
|
3
|
+
"metadata": {
|
|
4
|
+
"name": "single_token_liquidity",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"spec": "0.1.0",
|
|
7
|
+
"description": "1-token liquidity provisioning helper for Cubic Pool"
|
|
8
|
+
},
|
|
9
|
+
"instructions": [
|
|
10
|
+
{
|
|
11
|
+
"name": "deposit_single_token",
|
|
12
|
+
"docs": [
|
|
13
|
+
"Single-token liquidity-add into a Cubic Pool. See",
|
|
14
|
+
"`instructions/deposit_single_token.rs` for the",
|
|
15
|
+
"`remaining_accounts` layout.",
|
|
16
|
+
"",
|
|
17
|
+
"# Parameters",
|
|
18
|
+
"* `amount_in` — raw units of",
|
|
19
|
+
"`pool.token_mints[token_in_index]`.",
|
|
20
|
+
"* `token_in_index` — index in `pool.token_mints`.",
|
|
21
|
+
"* `minimum_bpt_amount` — final slippage guard on BPT received by the",
|
|
22
|
+
"user (> 0). This single guard bounds the whole zap (internal swaps",
|
|
23
|
+
"+ surge fees + join); per-leg swaps use `min_out = 0`.",
|
|
24
|
+
"",
|
|
25
|
+
"# Used by",
|
|
26
|
+
"SDK `SingleTokenClient`, frontend `useSingleTokenDeposit` hook."
|
|
27
|
+
],
|
|
28
|
+
"discriminator": [
|
|
29
|
+
166,
|
|
30
|
+
136,
|
|
31
|
+
166,
|
|
32
|
+
47,
|
|
33
|
+
199,
|
|
34
|
+
192,
|
|
35
|
+
86,
|
|
36
|
+
169
|
|
37
|
+
],
|
|
38
|
+
"accounts": [
|
|
39
|
+
{
|
|
40
|
+
"name": "pool",
|
|
41
|
+
"writable": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "helper"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "bpt_mint",
|
|
48
|
+
"writable": true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "helper_bpt_account",
|
|
52
|
+
"docs": [
|
|
53
|
+
"Helper's BPT account (where the freshly-minted BPT lands before",
|
|
54
|
+
"being forwarded to the user)."
|
|
55
|
+
],
|
|
56
|
+
"writable": true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "user_bpt_account",
|
|
60
|
+
"writable": true
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "user",
|
|
64
|
+
"writable": true,
|
|
65
|
+
"signer": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "cubic_pool_program"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "bpt_token_program"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"args": [
|
|
75
|
+
{
|
|
76
|
+
"name": "amount_in",
|
|
77
|
+
"type": "u64"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "token_in_index",
|
|
81
|
+
"type": "u8"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "minimum_bpt_amount",
|
|
85
|
+
"type": "u64"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "withdraw_sol",
|
|
91
|
+
"docs": [
|
|
92
|
+
"Recover lamports stranded on a pool's helper PDA.",
|
|
93
|
+
"",
|
|
94
|
+
"There is no rent-exempt floor to respect here, and that is deliberate",
|
|
95
|
+
"rather than an oversight: the helper carries no data and is",
|
|
96
|
+
"System-owned, so a full drain simply reclaims the account, and its",
|
|
97
|
+
"address is re-derivable from `[HELPER_SEED, pool]` whenever it is",
|
|
98
|
+
"needed again. An earlier revision documented a rent-exempt guard that",
|
|
99
|
+
"the handler never applied — see `StldError::WouldBreakRentExempt`,",
|
|
100
|
+
"retained unraised for IDL numbering.",
|
|
101
|
+
"",
|
|
102
|
+
"# Authority",
|
|
103
|
+
"Treasury PDA only — in practice via CPI from",
|
|
104
|
+
"`protocol_admin::stld_withdraw_sol`.",
|
|
105
|
+
"",
|
|
106
|
+
"# Parameters",
|
|
107
|
+
"* `amount` — lamports; `> 0` and `<= source.lamports()`."
|
|
108
|
+
],
|
|
109
|
+
"discriminator": [
|
|
110
|
+
145,
|
|
111
|
+
131,
|
|
112
|
+
74,
|
|
113
|
+
136,
|
|
114
|
+
65,
|
|
115
|
+
137,
|
|
116
|
+
42,
|
|
117
|
+
38
|
|
118
|
+
],
|
|
119
|
+
"accounts": [
|
|
120
|
+
{
|
|
121
|
+
"name": "config",
|
|
122
|
+
"docs": [
|
|
123
|
+
"Cubic-pool config whose `protocol_admin` is the authority for this",
|
|
124
|
+
"drain. In production it's the Treasury PDA of the `protocol-admin`",
|
|
125
|
+
"program."
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "pool",
|
|
130
|
+
"docs": [
|
|
131
|
+
"The pool whose helper PDA is being drained. It is NOT merely a seed",
|
|
132
|
+
"source: it must belong to the config that authorised this call.",
|
|
133
|
+
"",
|
|
134
|
+
"Without that binding, `config` and `pool` are independent inputs, and",
|
|
135
|
+
"the admin of config A could drain the helper of a pool governed by",
|
|
136
|
+
"config B — the helper PDA signs on nothing but its seeds, and those",
|
|
137
|
+
"seeds are derived from whichever pool the caller passes. That is the",
|
|
138
|
+
"same defect the audit raised as L-07 against cubic-pool's own",
|
|
139
|
+
"`withdraw_sol`, which binds `pool.config == config.key()`; this",
|
|
140
|
+
"instruction was rewritten for L-08 without picking the binding up.",
|
|
141
|
+
"",
|
|
142
|
+
"It is latent only while one Treasury PDA governs every config. Rotation",
|
|
143
|
+
"is deliberately unpinned (L-09), so configs are expected to diverge."
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "source",
|
|
148
|
+
"docs": [
|
|
149
|
+
"and dataless by construction; it signs its own outgoing transfer."
|
|
150
|
+
],
|
|
151
|
+
"writable": true
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "recipient",
|
|
155
|
+
"writable": true
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "authority",
|
|
159
|
+
"signer": true
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "system_program"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"args": [
|
|
166
|
+
{
|
|
167
|
+
"name": "amount",
|
|
168
|
+
"type": "u64"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"accounts": [
|
|
174
|
+
{
|
|
175
|
+
"name": "CubicPool",
|
|
176
|
+
"discriminator": [
|
|
177
|
+
137,
|
|
178
|
+
210,
|
|
179
|
+
42,
|
|
180
|
+
22,
|
|
181
|
+
209,
|
|
182
|
+
156,
|
|
183
|
+
43,
|
|
184
|
+
78
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "CubicPoolConfig",
|
|
189
|
+
"discriminator": [
|
|
190
|
+
4,
|
|
191
|
+
29,
|
|
192
|
+
243,
|
|
193
|
+
10,
|
|
194
|
+
142,
|
|
195
|
+
64,
|
|
196
|
+
232,
|
|
197
|
+
118
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"events": [
|
|
202
|
+
{
|
|
203
|
+
"name": "SingleTokenDeposit",
|
|
204
|
+
"discriminator": [
|
|
205
|
+
215,
|
|
206
|
+
54,
|
|
207
|
+
137,
|
|
208
|
+
104,
|
|
209
|
+
219,
|
|
210
|
+
39,
|
|
211
|
+
164,
|
|
212
|
+
235
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "StldSolWithdrawn",
|
|
217
|
+
"discriminator": [
|
|
218
|
+
24,
|
|
219
|
+
246,
|
|
220
|
+
27,
|
|
221
|
+
39,
|
|
222
|
+
222,
|
|
223
|
+
196,
|
|
224
|
+
135,
|
|
225
|
+
61
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"errors": [
|
|
230
|
+
{
|
|
231
|
+
"code": 6000,
|
|
232
|
+
"name": "ZeroAmount",
|
|
233
|
+
"msg": "Zero amount"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"code": 6001,
|
|
237
|
+
"name": "ZeroFeeAmount",
|
|
238
|
+
"msg": "Deprecated: swap fees are enforced by cubic-pool, not here"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"code": 6002,
|
|
242
|
+
"name": "SlippageTooLow",
|
|
243
|
+
"msg": "Deprecated: slippage is now the minimum_bpt_amount guard"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"code": 6003,
|
|
247
|
+
"name": "SlippageTooHigh",
|
|
248
|
+
"msg": "Deprecated: slippage is now the minimum_bpt_amount guard"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"code": 6004,
|
|
252
|
+
"name": "PoolDisabled",
|
|
253
|
+
"msg": "Pool disabled"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"code": 6005,
|
|
257
|
+
"name": "SwapsDisabled",
|
|
258
|
+
"msg": "Swaps disabled"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"code": 6006,
|
|
262
|
+
"name": "InvalidTokenCount",
|
|
263
|
+
"msg": "Invalid token count"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"code": 6007,
|
|
267
|
+
"name": "InvalidTokenIndex",
|
|
268
|
+
"msg": "Invalid token index"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"code": 6008,
|
|
272
|
+
"name": "InvalidAccountLayout",
|
|
273
|
+
"msg": "Invalid remaining_accounts layout"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"code": 6009,
|
|
277
|
+
"name": "InvalidMint",
|
|
278
|
+
"msg": "Invalid mint passed in remaining_accounts"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"code": 6010,
|
|
282
|
+
"name": "InvalidTokenProgram",
|
|
283
|
+
"msg": "Invalid token program passed in remaining_accounts"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"code": 6011,
|
|
287
|
+
"name": "InvalidVault",
|
|
288
|
+
"msg": "Invalid vault: must be ATA(pool, mint, token_program)"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"code": 6012,
|
|
292
|
+
"name": "InvalidHelperAta",
|
|
293
|
+
"msg": "Invalid helper ATA: must be ATA(helper_pda, mint, token_program)"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"code": 6013,
|
|
297
|
+
"name": "InvalidUserAta",
|
|
298
|
+
"msg": "User token account does not match expected owner/mint"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"code": 6014,
|
|
302
|
+
"name": "PoolNotSeeded",
|
|
303
|
+
"msg": "Pool not seeded: need at least one actual_balance > 0"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"code": 6015,
|
|
307
|
+
"name": "InvalidVirtualBalance",
|
|
308
|
+
"msg": "Virtual balance of zero for a token"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"code": 6016,
|
|
312
|
+
"name": "MathOverflow",
|
|
313
|
+
"msg": "Math overflow"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"code": 6017,
|
|
317
|
+
"name": "MathUnderflow",
|
|
318
|
+
"msg": "Math underflow"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"code": 6018,
|
|
322
|
+
"name": "ZeroExpectedOut",
|
|
323
|
+
"msg": "Deprecated: the zap measures real swap output instead of predicting it"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"code": 6019,
|
|
327
|
+
"name": "InsufficientBpt",
|
|
328
|
+
"msg": "Received BPT less than minimum_bpt_amount"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"code": 6020,
|
|
332
|
+
"name": "InvalidBptMint",
|
|
333
|
+
"msg": "Deprecated: enforced by the bpt_mint seeds constraint"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"code": 6021,
|
|
337
|
+
"name": "InvalidCubicPoolProgram",
|
|
338
|
+
"msg": "Invalid Cubic Pool program id"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"code": 6022,
|
|
342
|
+
"name": "InvalidUserBptAccount",
|
|
343
|
+
"msg": "User BPT account mismatch"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"code": 6023,
|
|
347
|
+
"name": "InvalidHelperBptAccount",
|
|
348
|
+
"msg": "Helper BPT account mismatch"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"code": 6024,
|
|
352
|
+
"name": "InvalidPoolOwner",
|
|
353
|
+
"msg": "Pool account is owned by a different program"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"code": 6025,
|
|
357
|
+
"name": "PoolHasZeroBalanceToken",
|
|
358
|
+
"msg": "Pool has at least one token with actual_balance = 0; single-token deposit unsupported in this state"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"code": 6026,
|
|
362
|
+
"name": "AmountTooSmall",
|
|
363
|
+
"msg": "amount_in is too small: truncation would leave a pool token with zero allocation"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"code": 6027,
|
|
367
|
+
"name": "Unauthorized",
|
|
368
|
+
"msg": "Unauthorized"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"code": 6028,
|
|
372
|
+
"name": "InvalidSourceOwner",
|
|
373
|
+
"msg": "Source account must be owned by this program"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"code": 6029,
|
|
377
|
+
"name": "WouldBreakRentExempt",
|
|
378
|
+
"msg": "Deprecated: the dataless helper PDA has no rent-exempt minimum"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"code": 6030,
|
|
382
|
+
"name": "TokenExtensionsUnsupported",
|
|
383
|
+
"msg": "Single-token deposit unsupported for pools with transfer-fee/hook tokens"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"code": 6031,
|
|
387
|
+
"name": "InsufficientHelperSol",
|
|
388
|
+
"msg": "Helper PDA does not hold that many lamports"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"code": 6032,
|
|
392
|
+
"name": "PoolTooLargeForZap",
|
|
393
|
+
"msg": "Pool has too many tokens for a single-token deposit; use add_liquidity"
|
|
394
|
+
}
|
|
395
|
+
],
|
|
396
|
+
"types": [
|
|
397
|
+
{
|
|
398
|
+
"name": "AssetConfig",
|
|
399
|
+
"docs": [
|
|
400
|
+
"`CubicPool` v4 — per-pool state for a weighted AMM with virtual liquidity.",
|
|
401
|
+
"",
|
|
402
|
+
"Storage layout: **Array-of-Structs (AoS)**. Per-token data lives in",
|
|
403
|
+
"`tokens: [TokenSlot; MAX_TOKENS]`. Each `TokenSlot` carries TWO nested",
|
|
404
|
+
"sub-structs:",
|
|
405
|
+
"",
|
|
406
|
+
"- `config: AssetConfig` — admin-controlled, rarely changes (mint,",
|
|
407
|
+
"token_program, weight, max_selloff, period).",
|
|
408
|
+
"- `dynamics: AssetDynamics` — auto-updated by user txs (balances,",
|
|
409
|
+
"protocol_fees_owed, sliding-window selloff state).",
|
|
410
|
+
"",
|
|
411
|
+
"This mirrors Solend / MarginFi / Kamino's `Reserve { config, ... }`",
|
|
412
|
+
"pattern. Reading per-token data is a single struct lookup; auditors",
|
|
413
|
+
"see at a glance which fields a user can mutate vs which need pool",
|
|
414
|
+
"admin authority.",
|
|
415
|
+
"",
|
|
416
|
+
"## Storage layout — DO NOT REORDER",
|
|
417
|
+
"Backends (`onchainPoolFetcher.ts`, indexer) read fields by raw offset.",
|
|
418
|
+
"Adding fields is OK if appended at the END (before the trailing",
|
|
419
|
+
"`reserved`) and `reserved` shrinks accordingly. Inserting in the",
|
|
420
|
+
"middle would require rewriting existing accounts.",
|
|
421
|
+
"",
|
|
422
|
+
"## Derived (not stored) state",
|
|
423
|
+
"- `bpt_mint` — derived as `[BPT_MINT_SEED, pool]` PDA.",
|
|
424
|
+
"- `bpt_total_supply`— read from `bpt_mint.supply` at runtime.",
|
|
425
|
+
"- `token_vaults[i]` — derived as ATA(pool, mint, tokens[i].config.token_program).",
|
|
426
|
+
"- `token_decimals` — read from each mint account at runtime."
|
|
427
|
+
],
|
|
428
|
+
"type": {
|
|
429
|
+
"kind": "struct",
|
|
430
|
+
"fields": [
|
|
431
|
+
{
|
|
432
|
+
"name": "mint",
|
|
433
|
+
"docs": [
|
|
434
|
+
"Token mint pubkey for this slot. `Pubkey::default()` past `token_count`."
|
|
435
|
+
],
|
|
436
|
+
"type": "pubkey"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "token_program",
|
|
440
|
+
"docs": [
|
|
441
|
+
"SPL Token or Token-2022 program ID for this token's vault/transfers."
|
|
442
|
+
],
|
|
443
|
+
"type": "pubkey"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"name": "normalized_weight",
|
|
447
|
+
"docs": [
|
|
448
|
+
"Normalised weight in basis points (sum across active slots == 10_000)."
|
|
449
|
+
],
|
|
450
|
+
"type": "u64"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "max_selloff_pct",
|
|
454
|
+
"docs": [
|
|
455
|
+
"Max cumulative sell volume of this token per sliding window,",
|
|
456
|
+
"expressed as a **percentage of the token's `virtual_balance`**",
|
|
457
|
+
"captured at window start, in units of `PERCENT_SCALE` (10_000 =",
|
|
458
|
+
"100%, so 1000 = 10%; resolution 0.01%). `0` disables the check for",
|
|
459
|
+
"this token. Must be `<= PERCENT_SCALE`. Set by pool_admin only.",
|
|
460
|
+
"",
|
|
461
|
+
"The absolute cap for a window is `floor(max_selloff_pct *",
|
|
462
|
+
"vb_snapshot / PERCENT_SCALE)`, where `vb_snapshot` is",
|
|
463
|
+
"`AssetDynamics::selloff_vb_snapshot` (taken at window open). Using a",
|
|
464
|
+
"per-window snapshot — not the live `virtual_balance` — prevents an",
|
|
465
|
+
"in-window base-inflation bypass (see `math::max_selloff`)."
|
|
466
|
+
],
|
|
467
|
+
"type": "u16"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"name": "max_selloff_period_length",
|
|
471
|
+
"docs": [
|
|
472
|
+
"Length of the sliding window in seconds. Ignored when",
|
|
473
|
+
"`max_selloff_pct == 0`. Set by pool_admin only."
|
|
474
|
+
],
|
|
475
|
+
"type": "u32"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"name": "variable_fee_threshold_pct",
|
|
479
|
+
"docs": [
|
|
480
|
+
"Variable sell-off **surge fee** curve (per token, `PERCENT_SCALE`",
|
|
481
|
+
"units; 10_000 = 100%). The fee rises as the token's max-selloff",
|
|
482
|
+
"window fills and is charged on `amount_out`, routed 100% to the",
|
|
483
|
+
"protocol bucket (`protocol_fees_owed`), never to LPs. See",
|
|
484
|
+
"`math::surge_fee`. The fee is active only when `max_selloff_pct > 0`",
|
|
485
|
+
"(it reads the window fill ratio) AND `fee_slope_high_pct > 0`.",
|
|
486
|
+
"",
|
|
487
|
+
"Window fill ratio at which the surge fee starts (below it the fee is",
|
|
488
|
+
"0). E.g. 8000 = surge begins at 80% window fill."
|
|
489
|
+
],
|
|
490
|
+
"type": "u16"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"name": "variable_fee_slope_low_pct",
|
|
494
|
+
"docs": [
|
|
495
|
+
"Surge fee at the threshold (lower point of the curve)."
|
|
496
|
+
],
|
|
497
|
+
"type": "u16"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "variable_fee_slope_high_pct",
|
|
501
|
+
"docs": [
|
|
502
|
+
"Surge fee at ~100% window fill (upper point of the curve). Must be",
|
|
503
|
+
"`>= fee_slope_low_pct` and `<= PERCENT_SCALE`."
|
|
504
|
+
],
|
|
505
|
+
"type": "u16"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "is_active",
|
|
509
|
+
"docs": [
|
|
510
|
+
"Per-token kill switch for the **input** side of swaps. When `false`,",
|
|
511
|
+
"swaps whose INPUT token is this one revert (`TokenInactive`); the",
|
|
512
|
+
"token can still be bought (as swap output) and liquidity ops are",
|
|
513
|
+
"unaffected. Defaults to `true` (active). Flipped by `set_token_active`",
|
|
514
|
+
"(pool-admin or protocol-admin/supervisor). Used to stop accepting a",
|
|
515
|
+
"compromised token without pausing the whole pool."
|
|
516
|
+
],
|
|
517
|
+
"type": "bool"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"name": "variable_fee_slope_mid_pct",
|
|
521
|
+
"docs": [
|
|
522
|
+
"Surge fee at the KINK — the middle of the three points that define the",
|
|
523
|
+
"curve. Between `variable_fee_threshold_pct` and this point the fee runs",
|
|
524
|
+
"linearly from `variable_fee_slope_low_pct` to here; beyond it, linearly",
|
|
525
|
+
"from here to `variable_fee_slope_high_pct` at full window fill.",
|
|
526
|
+
"",
|
|
527
|
+
"This is the \"target utilisation\" shape lending protocols use (Evaa,",
|
|
528
|
+
"Aave, Compound): gentle while the window fills normally, steep once it",
|
|
529
|
+
"is nearly exhausted. Must satisfy",
|
|
530
|
+
"`slope_low <= slope_mid <= slope_high` — a fee that fell as the window",
|
|
531
|
+
"filled would invert the brake."
|
|
532
|
+
],
|
|
533
|
+
"type": "u16"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"name": "variable_fee_kink_pct",
|
|
537
|
+
"docs": [
|
|
538
|
+
"Window fill at which the curve kinks, in WHOLE PERCENT (0..=100), not",
|
|
539
|
+
"`PERCENT_SCALE` units — one byte is all that was left, and 1% is ample",
|
|
540
|
+
"resolution for a breakpoint.",
|
|
541
|
+
"",
|
|
542
|
+
"`0` means \"no kink\": the curve degenerates to a single straight line",
|
|
543
|
+
"from `slope_low` at the threshold to `slope_high` at full fill, which",
|
|
544
|
+
"is what every pool written by the previous layout decodes as.",
|
|
545
|
+
"",
|
|
546
|
+
"Must sit strictly between the threshold and full fill when set."
|
|
547
|
+
],
|
|
548
|
+
"type": "u8"
|
|
549
|
+
}
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"name": "AssetDynamics",
|
|
555
|
+
"type": {
|
|
556
|
+
"kind": "struct",
|
|
557
|
+
"fields": [
|
|
558
|
+
{
|
|
559
|
+
"name": "virtual_balance",
|
|
560
|
+
"docs": [
|
|
561
|
+
"Virtual balance (raw token units) used by the cubic invariant",
|
|
562
|
+
"math. Decoupled from `actual_balance` to enable concentrated",
|
|
563
|
+
"liquidity. Updated by swap / add_liquidity / remove_liquidity."
|
|
564
|
+
],
|
|
565
|
+
"type": "u64"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"name": "actual_balance",
|
|
569
|
+
"docs": [
|
|
570
|
+
"The LP-owned portion of this token's vault, in raw units.",
|
|
571
|
+
"",
|
|
572
|
+
"It does NOT equal the vault's `amount`. The invariant is",
|
|
573
|
+
"`vault.amount == actual_balance + protocol_fees_owed`: protocol fees",
|
|
574
|
+
"sit in the same vault but are not LP capital, and `collect_protocol_fees`",
|
|
575
|
+
"pays them out without touching `actual_balance`. Sizing a withdrawal or",
|
|
576
|
+
"a deposit ratio against the raw vault balance would therefore hand LPs",
|
|
577
|
+
"the protocol's uncollected fees.",
|
|
578
|
+
"",
|
|
579
|
+
"Reads of the vault should either use this field or subtract",
|
|
580
|
+
"`protocol_fees_owed` explicitly; the two are only equal on a pool whose",
|
|
581
|
+
"fees have just been collected."
|
|
582
|
+
],
|
|
583
|
+
"type": "u64"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"name": "protocol_fees_owed",
|
|
587
|
+
"docs": [
|
|
588
|
+
"Accumulated protocol fees for this token (raw units), awaiting",
|
|
589
|
+
"`collect_protocol_fees`. Stored separately from `actual_balance`",
|
|
590
|
+
"so LP value isn't diluted by uncollected fees."
|
|
591
|
+
],
|
|
592
|
+
"type": "u64"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"name": "previous_selloff",
|
|
596
|
+
"docs": [
|
|
597
|
+
"Sliding-window rate limiter: amount sold in the PREVIOUS window",
|
|
598
|
+
"(Cloudflare-style approximation, Solend RateLimiter pattern)."
|
|
599
|
+
],
|
|
600
|
+
"type": "u64"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"name": "current_selloff",
|
|
604
|
+
"docs": [
|
|
605
|
+
"Amount sold in the CURRENT window."
|
|
606
|
+
],
|
|
607
|
+
"type": "u64"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"name": "window_start_timestamp",
|
|
611
|
+
"docs": [
|
|
612
|
+
"`Clock::unix_timestamp` when the current window started. Set to",
|
|
613
|
+
"`now()` at pool init."
|
|
614
|
+
],
|
|
615
|
+
"type": "i64"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"name": "selloff_vb_snapshot",
|
|
619
|
+
"docs": [
|
|
620
|
+
"Snapshot of this token's `virtual_balance` taken when the current",
|
|
621
|
+
"max-selloff window opened. The window's absolute cap is",
|
|
622
|
+
"`floor(config.max_selloff_pct * selloff_vb_snapshot / PERCENT_SCALE)`.",
|
|
623
|
+
"Snapshotting (rather than reading live `virtual_balance`) keeps the",
|
|
624
|
+
"cap un-inflatable within a window — selling raises the live vb, but",
|
|
625
|
+
"not this snapshot. `0` ⇒ uninitialised (re-captured on next check)."
|
|
626
|
+
],
|
|
627
|
+
"type": "u64"
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "CubicPool",
|
|
634
|
+
"type": {
|
|
635
|
+
"kind": "struct",
|
|
636
|
+
"fields": [
|
|
637
|
+
{
|
|
638
|
+
"name": "config",
|
|
639
|
+
"docs": [
|
|
640
|
+
"`CubicPoolConfig` this pool inherits governance from. Pinned at",
|
|
641
|
+
"init, used both as a PDA seed and at runtime in admin-instruction",
|
|
642
|
+
"constraints (`pool.config == config.key()`)."
|
|
643
|
+
],
|
|
644
|
+
"type": "pubkey"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
"name": "bump",
|
|
648
|
+
"docs": [
|
|
649
|
+
"Bump seed for the pool PDA. Stored so signer-seed reconstruction is",
|
|
650
|
+
"O(1) instead of an expensive `find_program_address` per CPI."
|
|
651
|
+
],
|
|
652
|
+
"type": "u8"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"name": "token_count",
|
|
656
|
+
"docs": [
|
|
657
|
+
"Number of active tokens in the pool, in [MIN_TOKENS, MAX_TOKENS] =",
|
|
658
|
+
"[2, 10]. Slots beyond `token_count` are zeroed and ignored."
|
|
659
|
+
],
|
|
660
|
+
"type": "u8"
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"name": "pool_id",
|
|
664
|
+
"docs": [
|
|
665
|
+
"User-chosen 64-bit salt baked into the PDA seeds, allowing multiple",
|
|
666
|
+
"pools per config without re-deploying. Unique per (config, pool_id)."
|
|
667
|
+
],
|
|
668
|
+
"type": "u64"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"name": "swap_fee_rate",
|
|
672
|
+
"docs": [
|
|
673
|
+
"Swap fee in hundredths of a basis point (precision",
|
|
674
|
+
"`SWAP_FEE_PRECISION` = 1_000_000). 100_000 = 10% (current cap)."
|
|
675
|
+
],
|
|
676
|
+
"type": "u32"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"name": "protocol_fee_rate",
|
|
680
|
+
"docs": [
|
|
681
|
+
"Share of each swap fee taken by the protocol, in basis points",
|
|
682
|
+
"(precision `PROTOCOL_FEE_PRECISION` = 10_000). 5_000 = 50% (cap)."
|
|
683
|
+
],
|
|
684
|
+
"type": "u16"
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
"name": "created_at",
|
|
688
|
+
"docs": [
|
|
689
|
+
"Pool creation `Clock::unix_timestamp`. Informational only."
|
|
690
|
+
],
|
|
691
|
+
"type": "i64"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"name": "pool_enabled",
|
|
695
|
+
"docs": [
|
|
696
|
+
"Master kill switch — when `false`, swaps and add/remove liquidity",
|
|
697
|
+
"all revert. Only `protocol_admin` can flip this."
|
|
698
|
+
],
|
|
699
|
+
"type": "bool"
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
"name": "swaps_enabled",
|
|
703
|
+
"docs": [
|
|
704
|
+
"Trading switch — `false` blocks swaps but still allows LP",
|
|
705
|
+
"add/remove. Either `pool_admin` or `config.protocol_admin` can flip."
|
|
706
|
+
],
|
|
707
|
+
"type": "bool"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"name": "pool_admin",
|
|
711
|
+
"docs": [
|
|
712
|
+
"Per-pool admin. Owns: rotate swap_fee_rate, toggle swaps_enabled,",
|
|
713
|
+
"set range_manager, set max_selloff, transfer/disable itself."
|
|
714
|
+
],
|
|
715
|
+
"type": "pubkey"
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
"name": "pending_pool_admin",
|
|
719
|
+
"docs": [
|
|
720
|
+
"Pending successor for `pool_admin` during a 2-step transfer."
|
|
721
|
+
],
|
|
722
|
+
"type": "pubkey"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "range_manager",
|
|
726
|
+
"docs": [
|
|
727
|
+
"Pubkey allowed to call `range_manager_update`. `Pubkey::default()`",
|
|
728
|
+
"⇒ no manager set."
|
|
729
|
+
],
|
|
730
|
+
"type": "pubkey"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"name": "range_manager_enabled",
|
|
734
|
+
"docs": [
|
|
735
|
+
"`false` ⇒ all `range_manager_update` calls revert."
|
|
736
|
+
],
|
|
737
|
+
"type": "bool"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"name": "range_manager_max_vb_change_pct",
|
|
741
|
+
"docs": [
|
|
742
|
+
"Max per-update change to a token's `virtual_balance`, as a",
|
|
743
|
+
"percentage of its current value, in `PERCENT_SCALE` units",
|
|
744
|
+
"(10_000 = 100%; 500 = 5%). Enforced per token in",
|
|
745
|
+
"`range_manager_update`."
|
|
746
|
+
],
|
|
747
|
+
"type": "u16"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
"name": "range_manager_max_weight_change_pct",
|
|
751
|
+
"docs": [
|
|
752
|
+
"Max per-update change to a token's `normalized_weight`, same",
|
|
753
|
+
"`PERCENT_SCALE` units."
|
|
754
|
+
],
|
|
755
|
+
"type": "u16"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "range_manager_min_update_interval_secs",
|
|
759
|
+
"type": "u32"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
"name": "range_manager_last_updated",
|
|
763
|
+
"type": "i64"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"name": "tokens",
|
|
767
|
+
"docs": [
|
|
768
|
+
"All per-token state. Slot `i` is for the i-th token. Slots past",
|
|
769
|
+
"`token_count` are zero-initialised and ignored."
|
|
770
|
+
],
|
|
771
|
+
"type": {
|
|
772
|
+
"array": [
|
|
773
|
+
{
|
|
774
|
+
"defined": {
|
|
775
|
+
"name": "TokenSlot"
|
|
776
|
+
}
|
|
777
|
+
},
|
|
778
|
+
10
|
|
779
|
+
]
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "lookup_table",
|
|
784
|
+
"docs": [
|
|
785
|
+
"Per-pool Address Lookup Table address. Holds pool-scoped accounts",
|
|
786
|
+
"(pool PDA, BPT mint, vaults, mints, token programs) so client SDKs",
|
|
787
|
+
"can build VersionedTransactions for `add_liquidity` / `remove_liquidity`",
|
|
788
|
+
"without hitting the 1232-byte legacy-tx ceiling on multi-token pools.",
|
|
789
|
+
"",
|
|
790
|
+
"`Pubkey::default()` ⇒ ALT not yet initialised. SDK falls back to",
|
|
791
|
+
"legacy tx (will only work for small pools). Set by `initialize_pool_alt`,",
|
|
792
|
+
"frozen on-chain so depositors don't worry about authority abuse."
|
|
793
|
+
],
|
|
794
|
+
"type": "pubkey"
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
"name": "banned_extensions",
|
|
798
|
+
"docs": [
|
|
799
|
+
"Token-2022 extension blocklist that was applied to THIS pool's tokens",
|
|
800
|
+
"at creation, in the same bit layout as",
|
|
801
|
+
"`CubicPoolConfig.banned_extensions` (bit `i` set ⇒ extension type `i`",
|
|
802
|
+
"is forbidden). Chosen by the pool **creator** at init: if they passed",
|
|
803
|
+
"an explicit override it is stored verbatim; otherwise the parent",
|
|
804
|
+
"config's default was copied here.",
|
|
805
|
+
"",
|
|
806
|
+
"Recorded for transparency so indexers / depositors can see exactly",
|
|
807
|
+
"which extension policy a pool's tokens were vetted against. It is a",
|
|
808
|
+
"snapshot only — the pool's token set is fixed at creation, so changing",
|
|
809
|
+
"this value later would not re-validate anything.",
|
|
810
|
+
"",
|
|
811
|
+
"NOTE (security): the creator chooses this bitmap freely ABOVE the",
|
|
812
|
+
"protocol floor — `constants::HARD_BANNED_EXTENSIONS`",
|
|
813
|
+
"(`PermanentDelegate`, `TransferHook`) is OR-ed in at creation and",
|
|
814
|
+
"cannot be cleared, so no pool can admit a mint that reaches vault",
|
|
815
|
+
"custody. Everything else is the creator's call, so LPs should still",
|
|
816
|
+
"read this field and decide whether they trust the remaining policy",
|
|
817
|
+
"before depositing. Pre-existing (pre-upgrade) pools read `0` here",
|
|
818
|
+
"until `migrate_to_v5` backfills them from the parent config."
|
|
819
|
+
],
|
|
820
|
+
"type": "u64"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
"name": "range_manager_max_leverage_bps",
|
|
824
|
+
"docs": [
|
|
825
|
+
"Absolute ceiling on `virtual_balance / actual_balance` that the range",
|
|
826
|
+
"manager may leave a token at, in basis points (10_000 = 1.0×). `0`",
|
|
827
|
+
"disables the band.",
|
|
828
|
+
"",
|
|
829
|
+
"The per-update percentage caps velocity, not distance: measured",
|
|
830
|
+
"against the live value each call, 5% steps compound to ~2.65× in 20",
|
|
831
|
+
"updates and ~131× in 100, so a manager — or a malfunctioning bot —",
|
|
832
|
+
"can walk the pool price arbitrarily far using only individually legal",
|
|
833
|
+
"moves. This band is the distance limit.",
|
|
834
|
+
"",
|
|
835
|
+
"Anchored to `actual_balance` rather than to a captured snapshot on",
|
|
836
|
+
"purpose: real reserves only move when capital actually enters or",
|
|
837
|
+
"leaves, so the baseline cannot go stale the way a stored snapshot",
|
|
838
|
+
"does. Tokens with `actual_balance == 0` (sidelined) are exempt —",
|
|
839
|
+
"there is no real capital to anchor against.",
|
|
840
|
+
"",
|
|
841
|
+
"Appended at the END (before `reserved`) per the layout rule above, so",
|
|
842
|
+
"every pre-existing field keeps its byte offset. Pre-upgrade pools",
|
|
843
|
+
"decode this as `0` (band disabled), which is the back-compatible",
|
|
844
|
+
"reading."
|
|
845
|
+
],
|
|
846
|
+
"type": "u32"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"name": "range_manager_min_leverage_bps",
|
|
850
|
+
"docs": [
|
|
851
|
+
"Lower half of the range manager's absolute envelope: the SMALLEST",
|
|
852
|
+
"`virtual_balance / actual_balance` ratio it may leave a token at, in",
|
|
853
|
+
"`PERCENT_SCALE` units. `0` disables the floor.",
|
|
854
|
+
"",
|
|
855
|
+
"The ceiling alone was not an envelope. Output is priced off VIRTUAL",
|
|
856
|
+
"balances, so DEPRESSING a token's virtual balance makes the pool",
|
|
857
|
+
"believe it holds less than it does, and a sale into that token moves",
|
|
858
|
+
"the price far more than it should — the seller takes the other side's",
|
|
859
|
+
"real reserves at a fabricated rate. Fifty individually-legal 5% steps",
|
|
860
|
+
"took a 1M/1M pool's virtual balance down to ~77k in testing, after",
|
|
861
|
+
"which selling 100k returned ~565k instead of ~91k. Every step passed",
|
|
862
|
+
"the ceiling, because the ceiling only ever looks upward.",
|
|
863
|
+
"",
|
|
864
|
+
"Checked on the same terms as the ceiling: only over the slots a call",
|
|
865
|
+
"actually writes, and skipped for sidelined tokens (`actual_balance ==",
|
|
866
|
+
"0`), which have no capital to anchor a ratio against."
|
|
867
|
+
],
|
|
868
|
+
"type": "u32"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
"name": "reserved",
|
|
872
|
+
"docs": [
|
|
873
|
+
"Forward-compat padding for pool-level fields. Shrank 24 → 20 when",
|
|
874
|
+
"`range_manager_max_leverage_bps` was carved out of it, then 20 → 16 for",
|
|
875
|
+
"`range_manager_min_leverage_bps`, keeping `LEN` at the",
|
|
876
|
+
"mainnet-compatible 1683."
|
|
877
|
+
],
|
|
878
|
+
"type": {
|
|
879
|
+
"array": [
|
|
880
|
+
"u8",
|
|
881
|
+
16
|
|
882
|
+
]
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
]
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"name": "CubicPoolConfig",
|
|
890
|
+
"docs": [
|
|
891
|
+
"`CubicPoolConfig` — protocol-level governance for every pool created",
|
|
892
|
+
"against this account.",
|
|
893
|
+
"",
|
|
894
|
+
"One config can host many pools (each pool stores `config: Pubkey`).",
|
|
895
|
+
"Per-pool admin (level-1: rotates `swap_fee_rate`, toggles `swaps_enabled`)",
|
|
896
|
+
"lives on `CubicPool::pool_admin`. This config carries only the",
|
|
897
|
+
"protocol-level admin (level-2) plus protocol-wide defaults."
|
|
898
|
+
],
|
|
899
|
+
"type": {
|
|
900
|
+
"kind": "struct",
|
|
901
|
+
"fields": [
|
|
902
|
+
{
|
|
903
|
+
"name": "protocol_admin",
|
|
904
|
+
"docs": [
|
|
905
|
+
"Protocol-level admin. Allowed to: pause pools, change",
|
|
906
|
+
"`protocol_fee_rate`, collect protocol fees, drain via",
|
|
907
|
+
"`debug_withdraw_liquidity`, update `banned_extensions`, withdraw",
|
|
908
|
+
"SOL from program-owned accounts, and rotate itself via the",
|
|
909
|
+
"pending/accept flow. Set to a designated authority (typically the",
|
|
910
|
+
"Treasury PDA of the `protocol-admin` program) at config init."
|
|
911
|
+
],
|
|
912
|
+
"type": "pubkey"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"name": "pending_protocol_admin",
|
|
916
|
+
"docs": [
|
|
917
|
+
"Pending successor for `protocol_admin` during a 2-step transfer.",
|
|
918
|
+
"`Pubkey::default()` ⇒ no transfer in flight."
|
|
919
|
+
],
|
|
920
|
+
"type": "pubkey"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
"name": "default_protocol_fee_rate",
|
|
924
|
+
"docs": [
|
|
925
|
+
"Default `protocol_fee_rate` (in basis points, max 5000 = 50%) seeded",
|
|
926
|
+
"onto every new pool created against this config. Pools may diverge",
|
|
927
|
+
"later via `set_protocol_fee_rate`."
|
|
928
|
+
],
|
|
929
|
+
"type": "u16"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"name": "banned_extensions",
|
|
933
|
+
"docs": [
|
|
934
|
+
"Bitmap of banned Token-2022 extension types. Bit N set ⇒ extension",
|
|
935
|
+
"type N is rejected at pool init. Maintained by `protocol_admin` via",
|
|
936
|
+
"`set_banned_extensions`. Defaults to `DEFAULT_BANNED_EXTENSIONS`",
|
|
937
|
+
"(TransferFee, ConfidentialTransfer, NonTransferable, …)."
|
|
938
|
+
],
|
|
939
|
+
"type": "u64"
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
"name": "hard_banned_extensions",
|
|
943
|
+
"docs": [
|
|
944
|
+
"Extension bits that **no pool creator may clear**, whatever",
|
|
945
|
+
"`banned_extensions_override` they pass to `initialize_cubic_pool`.",
|
|
946
|
+
"OR-ed into the effective bitmap at pool creation.",
|
|
947
|
+
"",
|
|
948
|
+
"`banned_extensions` above is only a *default* — a creator passing",
|
|
949
|
+
"`Some(0)` un-bans everything, which would let a mint with",
|
|
950
|
+
"`PermanentDelegate` (issuer can empty the vault) or an armed",
|
|
951
|
+
"`TransferHook` (issuer can make every exit revert) into pool custody,",
|
|
952
|
+
"with the loss landing on whoever supplied the other side.",
|
|
953
|
+
"",
|
|
954
|
+
"Seeded from `constants::HARD_BANNED_EXTENSIONS` at config creation",
|
|
955
|
+
"and movable only by `protocol_admin`. It is governance state rather",
|
|
956
|
+
"than a compile-time constant on purpose: several regulated",
|
|
957
|
+
"stablecoins (PYUSD, USDG, AUSD) ship `PermanentDelegate` for",
|
|
958
|
+
"compliance seizure, so listing them is a deliberate protocol",
|
|
959
|
+
"decision about trusting a named issuer — not something a pool",
|
|
960
|
+
"creator may self-authorise, and not something a hardcoded constant",
|
|
961
|
+
"should decide for every deployment.",
|
|
962
|
+
"",
|
|
963
|
+
"Pre-upgrade configs decode this as `0`; `initialize_config` seeds it",
|
|
964
|
+
"for new ones, and `set_banned_extensions` can set it explicitly."
|
|
965
|
+
],
|
|
966
|
+
"type": "u64"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
"name": "reserved",
|
|
970
|
+
"docs": [
|
|
971
|
+
"Forward-compatibility padding so future fields can be added without",
|
|
972
|
+
"migrating existing config accounts. Shrank 120 → 112 when",
|
|
973
|
+
"`hard_banned_extensions` was carved out of the tail."
|
|
974
|
+
],
|
|
975
|
+
"type": {
|
|
976
|
+
"array": [
|
|
977
|
+
"u8",
|
|
978
|
+
112
|
|
979
|
+
]
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"name": "SingleTokenDeposit",
|
|
987
|
+
"docs": [
|
|
988
|
+
"Emitted at the end of `deposit_single_token` with everything an",
|
|
989
|
+
"indexer needs to reconstruct the user-facing receipt without",
|
|
990
|
+
"re-fetching state.",
|
|
991
|
+
"",
|
|
992
|
+
"# Fields",
|
|
993
|
+
"* `helper` — helper PDA pubkey.",
|
|
994
|
+
"* `pool` — Cubic Pool PDA.",
|
|
995
|
+
"* `user` — depositor.",
|
|
996
|
+
"* `token_in_index` — index of the supplied token.",
|
|
997
|
+
"* `amount_in` — raw input.",
|
|
998
|
+
"* `allocations` — pre-CPI per-token slice plan.",
|
|
999
|
+
"* `deposited_amounts` — post-CPI helper balances actually fed",
|
|
1000
|
+
"to `add_liquidity` (after `cap_deposit_amounts_to_lp_ratio`).",
|
|
1001
|
+
"* `bpt_received` — BPT minted to the user.",
|
|
1002
|
+
"* `dust_refunded` — per-token refund helper → user, index",
|
|
1003
|
+
"aligned with `allocations` / `deposited_amounts`. Previously a single",
|
|
1004
|
+
"sum across every mint, which added raw amounts of different decimals",
|
|
1005
|
+
"together and produced a number that meant nothing."
|
|
1006
|
+
],
|
|
1007
|
+
"type": {
|
|
1008
|
+
"kind": "struct",
|
|
1009
|
+
"fields": [
|
|
1010
|
+
{
|
|
1011
|
+
"name": "helper",
|
|
1012
|
+
"type": "pubkey"
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
"name": "pool",
|
|
1016
|
+
"type": "pubkey"
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
"name": "user",
|
|
1020
|
+
"type": "pubkey"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"name": "token_in_index",
|
|
1024
|
+
"type": "u8"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
"name": "amount_in",
|
|
1028
|
+
"type": "u64"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
"name": "allocations",
|
|
1032
|
+
"type": {
|
|
1033
|
+
"vec": "u64"
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
"name": "deposited_amounts",
|
|
1038
|
+
"type": {
|
|
1039
|
+
"vec": "u64"
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
"name": "bpt_received",
|
|
1044
|
+
"type": "u64"
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
"name": "dust_refunded",
|
|
1048
|
+
"docs": [
|
|
1049
|
+
"Index-aligned with `allocations` / `deposited_amounts`. Summing raw",
|
|
1050
|
+
"amounts across mints of different decimals — the previous `u64` —",
|
|
1051
|
+
"is not a meaningful quantity."
|
|
1052
|
+
],
|
|
1053
|
+
"type": {
|
|
1054
|
+
"vec": "u64"
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
"name": "timestamp",
|
|
1059
|
+
"type": "i64"
|
|
1060
|
+
}
|
|
1061
|
+
]
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
"name": "StldSolWithdrawn",
|
|
1066
|
+
"docs": [
|
|
1067
|
+
"Emitted by `withdraw_sol` after lamports move out of a stld-owned",
|
|
1068
|
+
"account."
|
|
1069
|
+
],
|
|
1070
|
+
"type": {
|
|
1071
|
+
"kind": "struct",
|
|
1072
|
+
"fields": [
|
|
1073
|
+
{
|
|
1074
|
+
"name": "source",
|
|
1075
|
+
"type": "pubkey"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"name": "authority",
|
|
1079
|
+
"type": "pubkey"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
"name": "recipient",
|
|
1083
|
+
"type": "pubkey"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
"name": "amount",
|
|
1087
|
+
"type": "u64"
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
"name": "timestamp",
|
|
1091
|
+
"type": "i64"
|
|
1092
|
+
}
|
|
1093
|
+
]
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
"name": "TokenSlot",
|
|
1098
|
+
"type": {
|
|
1099
|
+
"kind": "struct",
|
|
1100
|
+
"fields": [
|
|
1101
|
+
{
|
|
1102
|
+
"name": "config",
|
|
1103
|
+
"type": {
|
|
1104
|
+
"defined": {
|
|
1105
|
+
"name": "AssetConfig"
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
"name": "dynamics",
|
|
1111
|
+
"type": {
|
|
1112
|
+
"defined": {
|
|
1113
|
+
"name": "AssetDynamics"
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
]
|
|
1121
|
+
}
|