@meteora-ag/dynamic-bonding-curve-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/README.md +53 -0
- package/dist/index.cjs +14641 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5024 -0
- package/dist/index.d.ts +5024 -0
- package/dist/index.js +14641 -0
- package/dist/index.js.map +1 -0
- package/docs.md +317 -0
- package/eslint.config.mjs +4 -0
- package/package.json +46 -0
- package/src/client.ts +1848 -0
- package/src/common.ts +275 -0
- package/src/constants.ts +42 -0
- package/src/derive.ts +488 -0
- package/src/design.ts +394 -0
- package/src/idl/damm-v1/idl.json +4615 -0
- package/src/idl/damm-v1/idl.ts +1158 -0
- package/src/idl/damm-v2/idl.json +6322 -0
- package/src/idl/damm-v2/idl.ts +5224 -0
- package/src/idl/dynamic-bonding-curve/idl.json +5351 -0
- package/src/idl/dynamic-bonding-curve/idl.ts +4428 -0
- package/src/idl/dynamic-vault/idl.json +1723 -0
- package/src/idl/dynamic-vault/idl.ts +295 -0
- package/src/index.ts +7 -0
- package/src/math/curve.ts +230 -0
- package/src/math/feeMath.ts +286 -0
- package/src/math/safeMath.ts +88 -0
- package/src/math/swapQuote.ts +464 -0
- package/src/math/utilsMath.ts +154 -0
- package/src/types.ts +465 -0
- package/src/utils.ts +252 -0
- package/tests/math/curveMath.test.ts +79 -0
- package/tests/math/feeMath.test.ts +22 -0
- package/tests/math/feeMode.test.ts +97 -0
- package/tests/math/pool.test.ts +46 -0
- package/tests/math/swapQuote.test.ts +248 -0
- package/tests/utils/defaults.ts +90 -0
- package/tests/utils/test-helpers.ts +110 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
3
|
+
*
|
|
4
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
5
|
+
* IDL can be found at `target/idl/dynamic_amm.json`.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Program IDL in camelCase format in order to be used in JS/TS.
|
|
9
|
+
*
|
|
10
|
+
* Note that this is only a type helper and is not the actual IDL. The original
|
|
11
|
+
* IDL can be found at `target/idl/dynamic_amm.json`.
|
|
12
|
+
*/
|
|
13
|
+
export type DammV1 = {
|
|
14
|
+
address: 'Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB'
|
|
15
|
+
metadata: {
|
|
16
|
+
name: 'dynamicAmm'
|
|
17
|
+
version: '0.1.0'
|
|
18
|
+
spec: '0.1.0'
|
|
19
|
+
description: 'Created with Anchor'
|
|
20
|
+
}
|
|
21
|
+
docs: ['Program for AMM']
|
|
22
|
+
instructions: [
|
|
23
|
+
{
|
|
24
|
+
name: 'claimFee'
|
|
25
|
+
docs: ['Claim fee']
|
|
26
|
+
discriminator: [169, 32, 79, 137, 136, 232, 70, 137]
|
|
27
|
+
accounts: [
|
|
28
|
+
{
|
|
29
|
+
name: 'pool'
|
|
30
|
+
writable: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'lpMint'
|
|
34
|
+
writable: true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'lockEscrow'
|
|
38
|
+
writable: true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'owner'
|
|
42
|
+
writable: true
|
|
43
|
+
signer: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'sourceTokens'
|
|
47
|
+
writable: true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'escrowVault'
|
|
51
|
+
writable: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'tokenProgram'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'aTokenVault'
|
|
58
|
+
writable: true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'bTokenVault'
|
|
62
|
+
writable: true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'aVault'
|
|
66
|
+
writable: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'bVault'
|
|
70
|
+
writable: true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'aVaultLp'
|
|
74
|
+
writable: true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'bVaultLp'
|
|
78
|
+
writable: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'aVaultLpMint'
|
|
82
|
+
writable: true
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'bVaultLpMint'
|
|
86
|
+
writable: true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'userAToken'
|
|
90
|
+
writable: true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'userBToken'
|
|
94
|
+
writable: true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'vaultProgram'
|
|
98
|
+
},
|
|
99
|
+
]
|
|
100
|
+
args: [
|
|
101
|
+
{
|
|
102
|
+
name: 'maxAmount'
|
|
103
|
+
type: 'u64'
|
|
104
|
+
},
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'createLockEscrow'
|
|
109
|
+
docs: ['Create lock account']
|
|
110
|
+
discriminator: [54, 87, 165, 19, 69, 227, 218, 224]
|
|
111
|
+
accounts: [
|
|
112
|
+
{
|
|
113
|
+
name: 'pool'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'lockEscrow'
|
|
117
|
+
writable: true
|
|
118
|
+
pda: {
|
|
119
|
+
seeds: [
|
|
120
|
+
{
|
|
121
|
+
kind: 'const'
|
|
122
|
+
value: [
|
|
123
|
+
108,
|
|
124
|
+
111,
|
|
125
|
+
99,
|
|
126
|
+
107,
|
|
127
|
+
95,
|
|
128
|
+
101,
|
|
129
|
+
115,
|
|
130
|
+
99,
|
|
131
|
+
114,
|
|
132
|
+
111,
|
|
133
|
+
119,
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
kind: 'account'
|
|
138
|
+
path: 'pool'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
kind: 'account'
|
|
142
|
+
path: 'owner'
|
|
143
|
+
},
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'owner'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: 'lpMint'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'payer'
|
|
155
|
+
writable: true
|
|
156
|
+
signer: true
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'systemProgram'
|
|
160
|
+
},
|
|
161
|
+
]
|
|
162
|
+
args: []
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'initializePermissionlessConstantProductPoolWithConfig2'
|
|
166
|
+
docs: ['Initialize permissionless pool with config 2']
|
|
167
|
+
discriminator: [48, 149, 220, 130, 61, 11, 9, 178]
|
|
168
|
+
accounts: [
|
|
169
|
+
{
|
|
170
|
+
name: 'pool'
|
|
171
|
+
docs: ['Pool account (PDA address)']
|
|
172
|
+
writable: true
|
|
173
|
+
pda: {
|
|
174
|
+
seeds: [
|
|
175
|
+
{
|
|
176
|
+
kind: 'account'
|
|
177
|
+
path: 'tokenAMint'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
kind: 'account'
|
|
181
|
+
path: 'tokenBMint'
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
kind: 'account'
|
|
185
|
+
path: 'config'
|
|
186
|
+
},
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'config'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'lpMint'
|
|
195
|
+
docs: ['LP token mint of the pool']
|
|
196
|
+
writable: true
|
|
197
|
+
pda: {
|
|
198
|
+
seeds: [
|
|
199
|
+
{
|
|
200
|
+
kind: 'const'
|
|
201
|
+
value: [108, 112, 95, 109, 105, 110, 116]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
kind: 'account'
|
|
205
|
+
path: 'pool'
|
|
206
|
+
},
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'tokenAMint'
|
|
212
|
+
docs: ['Token A mint of the pool. Eg: USDT']
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: 'tokenBMint'
|
|
216
|
+
docs: ['Token B mint of the pool. Eg: USDC']
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'aVault'
|
|
220
|
+
writable: true
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'bVault'
|
|
224
|
+
writable: true
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: 'aTokenVault'
|
|
228
|
+
docs: ['Token vault account of vault A']
|
|
229
|
+
writable: true
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'bTokenVault'
|
|
233
|
+
docs: ['Token vault account of vault B']
|
|
234
|
+
writable: true
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'aVaultLpMint'
|
|
238
|
+
docs: ['LP token mint of vault A']
|
|
239
|
+
writable: true
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'bVaultLpMint'
|
|
243
|
+
docs: ['LP token mint of vault B']
|
|
244
|
+
writable: true
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'aVaultLp'
|
|
248
|
+
docs: [
|
|
249
|
+
'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.',
|
|
250
|
+
]
|
|
251
|
+
writable: true
|
|
252
|
+
pda: {
|
|
253
|
+
seeds: [
|
|
254
|
+
{
|
|
255
|
+
kind: 'account'
|
|
256
|
+
path: 'aVault'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
kind: 'account'
|
|
260
|
+
path: 'pool'
|
|
261
|
+
},
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: 'bVaultLp'
|
|
267
|
+
docs: [
|
|
268
|
+
'LP token account of vault B. Used to receive/burn vault LP upon deposit/withdraw from the vault.',
|
|
269
|
+
]
|
|
270
|
+
writable: true
|
|
271
|
+
pda: {
|
|
272
|
+
seeds: [
|
|
273
|
+
{
|
|
274
|
+
kind: 'account'
|
|
275
|
+
path: 'bVault'
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
kind: 'account'
|
|
279
|
+
path: 'pool'
|
|
280
|
+
},
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'payerTokenA'
|
|
286
|
+
docs: [
|
|
287
|
+
'Payer token account for pool token A mint. Used to bootstrap the pool with initial liquidity.',
|
|
288
|
+
]
|
|
289
|
+
writable: true
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'payerTokenB'
|
|
293
|
+
docs: [
|
|
294
|
+
'Admin token account for pool token B mint. Used to bootstrap the pool with initial liquidity.',
|
|
295
|
+
]
|
|
296
|
+
writable: true
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'payerPoolLp'
|
|
300
|
+
writable: true
|
|
301
|
+
pda: {
|
|
302
|
+
seeds: [
|
|
303
|
+
{
|
|
304
|
+
kind: 'account'
|
|
305
|
+
path: 'payer'
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
kind: 'const'
|
|
309
|
+
value: [
|
|
310
|
+
6,
|
|
311
|
+
221,
|
|
312
|
+
246,
|
|
313
|
+
225,
|
|
314
|
+
215,
|
|
315
|
+
101,
|
|
316
|
+
161,
|
|
317
|
+
147,
|
|
318
|
+
217,
|
|
319
|
+
203,
|
|
320
|
+
225,
|
|
321
|
+
70,
|
|
322
|
+
206,
|
|
323
|
+
235,
|
|
324
|
+
121,
|
|
325
|
+
172,
|
|
326
|
+
28,
|
|
327
|
+
180,
|
|
328
|
+
133,
|
|
329
|
+
237,
|
|
330
|
+
95,
|
|
331
|
+
91,
|
|
332
|
+
55,
|
|
333
|
+
145,
|
|
334
|
+
58,
|
|
335
|
+
140,
|
|
336
|
+
245,
|
|
337
|
+
133,
|
|
338
|
+
126,
|
|
339
|
+
255,
|
|
340
|
+
0,
|
|
341
|
+
169,
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
kind: 'account'
|
|
346
|
+
path: 'lpMint'
|
|
347
|
+
},
|
|
348
|
+
]
|
|
349
|
+
program: {
|
|
350
|
+
kind: 'const'
|
|
351
|
+
value: [
|
|
352
|
+
140,
|
|
353
|
+
151,
|
|
354
|
+
37,
|
|
355
|
+
143,
|
|
356
|
+
78,
|
|
357
|
+
36,
|
|
358
|
+
137,
|
|
359
|
+
241,
|
|
360
|
+
187,
|
|
361
|
+
61,
|
|
362
|
+
16,
|
|
363
|
+
41,
|
|
364
|
+
20,
|
|
365
|
+
142,
|
|
366
|
+
13,
|
|
367
|
+
131,
|
|
368
|
+
11,
|
|
369
|
+
90,
|
|
370
|
+
19,
|
|
371
|
+
153,
|
|
372
|
+
218,
|
|
373
|
+
255,
|
|
374
|
+
16,
|
|
375
|
+
132,
|
|
376
|
+
4,
|
|
377
|
+
142,
|
|
378
|
+
123,
|
|
379
|
+
216,
|
|
380
|
+
219,
|
|
381
|
+
233,
|
|
382
|
+
248,
|
|
383
|
+
89,
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: 'protocolTokenAFee'
|
|
390
|
+
docs: [
|
|
391
|
+
'Protocol fee token account for token A. Used to receive trading fee.',
|
|
392
|
+
]
|
|
393
|
+
writable: true
|
|
394
|
+
pda: {
|
|
395
|
+
seeds: [
|
|
396
|
+
{
|
|
397
|
+
kind: 'const'
|
|
398
|
+
value: [102, 101, 101]
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
kind: 'account'
|
|
402
|
+
path: 'tokenAMint'
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
kind: 'account'
|
|
406
|
+
path: 'pool'
|
|
407
|
+
},
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: 'protocolTokenBFee'
|
|
413
|
+
docs: [
|
|
414
|
+
'Protocol fee token account for token B. Used to receive trading fee.',
|
|
415
|
+
]
|
|
416
|
+
writable: true
|
|
417
|
+
pda: {
|
|
418
|
+
seeds: [
|
|
419
|
+
{
|
|
420
|
+
kind: 'const'
|
|
421
|
+
value: [102, 101, 101]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
kind: 'account'
|
|
425
|
+
path: 'tokenBMint'
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
kind: 'account'
|
|
429
|
+
path: 'pool'
|
|
430
|
+
},
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: 'payer'
|
|
436
|
+
docs: [
|
|
437
|
+
'Admin account. This account will be the admin of the pool, and the payer for PDA during initialize pool.',
|
|
438
|
+
]
|
|
439
|
+
writable: true
|
|
440
|
+
signer: true
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: 'rent'
|
|
444
|
+
docs: ['Rent account.']
|
|
445
|
+
address: 'SysvarRent111111111111111111111111111111111'
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
name: 'mintMetadata'
|
|
449
|
+
writable: true
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: 'metadataProgram'
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: 'vaultProgram'
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: 'tokenProgram'
|
|
459
|
+
docs: ['Token program.']
|
|
460
|
+
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
name: 'associatedTokenProgram'
|
|
464
|
+
docs: ['Associated token program.']
|
|
465
|
+
address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
name: 'systemProgram'
|
|
469
|
+
docs: ['System program.']
|
|
470
|
+
address: '11111111111111111111111111111111'
|
|
471
|
+
},
|
|
472
|
+
]
|
|
473
|
+
args: [
|
|
474
|
+
{
|
|
475
|
+
name: 'tokenAAmount'
|
|
476
|
+
type: 'u64'
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: 'tokenBAmount'
|
|
480
|
+
type: 'u64'
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
name: 'activationPoint'
|
|
484
|
+
type: {
|
|
485
|
+
option: 'u64'
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: 'lock'
|
|
492
|
+
docs: ['Lock Lp token']
|
|
493
|
+
discriminator: [21, 19, 208, 43, 237, 62, 255, 87]
|
|
494
|
+
accounts: [
|
|
495
|
+
{
|
|
496
|
+
name: 'pool'
|
|
497
|
+
writable: true
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: 'lpMint'
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: 'lockEscrow'
|
|
504
|
+
writable: true
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name: 'owner'
|
|
508
|
+
writable: true
|
|
509
|
+
signer: true
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: 'sourceTokens'
|
|
513
|
+
writable: true
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: 'escrowVault'
|
|
517
|
+
writable: true
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: 'tokenProgram'
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: 'aVault'
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: 'bVault'
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: 'aVaultLp'
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: 'bVaultLp'
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
name: 'aVaultLpMint'
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: 'bVaultLpMint'
|
|
539
|
+
},
|
|
540
|
+
]
|
|
541
|
+
args: [
|
|
542
|
+
{
|
|
543
|
+
name: 'amount'
|
|
544
|
+
type: 'u64'
|
|
545
|
+
},
|
|
546
|
+
]
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
name: 'partnerClaimFee'
|
|
550
|
+
docs: ['Partner claim fee']
|
|
551
|
+
discriminator: [57, 53, 176, 30, 123, 70, 52, 64]
|
|
552
|
+
accounts: [
|
|
553
|
+
{
|
|
554
|
+
name: 'pool'
|
|
555
|
+
docs: ['Pool account (PDA)']
|
|
556
|
+
writable: true
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: 'aVaultLp'
|
|
560
|
+
relations: ['pool']
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: 'protocolTokenAFee'
|
|
564
|
+
writable: true
|
|
565
|
+
relations: ['pool']
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: 'protocolTokenBFee'
|
|
569
|
+
writable: true
|
|
570
|
+
relations: ['pool']
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: 'partnerTokenA'
|
|
574
|
+
writable: true
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: 'partnerTokenB'
|
|
578
|
+
writable: true
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: 'tokenProgram'
|
|
582
|
+
address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
name: 'partnerAuthority'
|
|
586
|
+
signer: true
|
|
587
|
+
},
|
|
588
|
+
]
|
|
589
|
+
args: [
|
|
590
|
+
{
|
|
591
|
+
name: 'maxAmountA'
|
|
592
|
+
type: 'u64'
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
name: 'maxAmountB'
|
|
596
|
+
type: 'u64'
|
|
597
|
+
},
|
|
598
|
+
]
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
name: 'swap'
|
|
602
|
+
docs: [
|
|
603
|
+
'Swap token A to B, or vice versa. An amount of trading fee will be charged for liquidity provider, and the admin of the pool.',
|
|
604
|
+
]
|
|
605
|
+
discriminator: [248, 198, 158, 145, 225, 117, 135, 200]
|
|
606
|
+
accounts: [
|
|
607
|
+
{
|
|
608
|
+
name: 'pool'
|
|
609
|
+
writable: true
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: 'userSourceToken'
|
|
613
|
+
writable: true
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: 'userDestinationToken'
|
|
617
|
+
writable: true
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
name: 'aVault'
|
|
621
|
+
writable: true
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: 'bVault'
|
|
625
|
+
writable: true
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: 'aTokenVault'
|
|
629
|
+
writable: true
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: 'bTokenVault'
|
|
633
|
+
writable: true
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
name: 'aVaultLpMint'
|
|
637
|
+
writable: true
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: 'bVaultLpMint'
|
|
641
|
+
writable: true
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: 'aVaultLp'
|
|
645
|
+
writable: true
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
name: 'bVaultLp'
|
|
649
|
+
writable: true
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: 'protocolTokenFee'
|
|
653
|
+
writable: true
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: 'user'
|
|
657
|
+
signer: true
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: 'vaultProgram'
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: 'tokenProgram'
|
|
664
|
+
},
|
|
665
|
+
]
|
|
666
|
+
args: [
|
|
667
|
+
{
|
|
668
|
+
name: 'inAmount'
|
|
669
|
+
type: 'u64'
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
name: 'minimumOutAmount'
|
|
673
|
+
type: 'u64'
|
|
674
|
+
},
|
|
675
|
+
]
|
|
676
|
+
},
|
|
677
|
+
]
|
|
678
|
+
accounts: [
|
|
679
|
+
{
|
|
680
|
+
name: 'config'
|
|
681
|
+
discriminator: [155, 12, 170, 224, 30, 250, 204, 130]
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'pool'
|
|
685
|
+
discriminator: [241, 154, 109, 4, 17, 177, 109, 188]
|
|
686
|
+
},
|
|
687
|
+
]
|
|
688
|
+
types: [
|
|
689
|
+
{
|
|
690
|
+
name: 'bootstrapping'
|
|
691
|
+
type: {
|
|
692
|
+
kind: 'struct'
|
|
693
|
+
fields: [
|
|
694
|
+
{
|
|
695
|
+
name: 'activationPoint'
|
|
696
|
+
docs: ['Activation point, can be slot or timestamp']
|
|
697
|
+
type: 'u64'
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
name: 'whitelistedVault'
|
|
701
|
+
docs: [
|
|
702
|
+
'Whitelisted vault to be able to buy pool before open slot',
|
|
703
|
+
]
|
|
704
|
+
type: 'pubkey'
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
name: 'poolCreator'
|
|
708
|
+
type: 'pubkey'
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
name: 'activationType'
|
|
712
|
+
docs: [
|
|
713
|
+
'Activation type, 0 means by slot, 1 means by timestamp',
|
|
714
|
+
]
|
|
715
|
+
type: 'u8'
|
|
716
|
+
},
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
name: 'config'
|
|
722
|
+
type: {
|
|
723
|
+
kind: 'struct'
|
|
724
|
+
fields: [
|
|
725
|
+
{
|
|
726
|
+
name: 'poolFees'
|
|
727
|
+
type: {
|
|
728
|
+
defined: {
|
|
729
|
+
name: 'poolFees'
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
name: 'activationDuration'
|
|
735
|
+
type: 'u64'
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
name: 'vaultConfigKey'
|
|
739
|
+
type: 'pubkey'
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
name: 'poolCreatorAuthority'
|
|
743
|
+
type: 'pubkey'
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
name: 'activationType'
|
|
747
|
+
type: 'u8'
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
name: 'partnerFeeNumerator'
|
|
751
|
+
type: 'u64'
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: 'padding'
|
|
755
|
+
type: {
|
|
756
|
+
array: ['u8', 219]
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
]
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: 'curveType'
|
|
764
|
+
docs: ['Type of the swap curve']
|
|
765
|
+
type: {
|
|
766
|
+
kind: 'enum'
|
|
767
|
+
variants: [
|
|
768
|
+
{
|
|
769
|
+
name: 'constantProduct'
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
name: 'stable'
|
|
773
|
+
fields: [
|
|
774
|
+
{
|
|
775
|
+
name: 'amp'
|
|
776
|
+
docs: ['Amplification coefficient']
|
|
777
|
+
type: 'u64'
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
name: 'tokenMultiplier'
|
|
781
|
+
docs: [
|
|
782
|
+
'Multiplier for the pool token. Used to normalized token with different decimal into the same precision.',
|
|
783
|
+
]
|
|
784
|
+
type: {
|
|
785
|
+
defined: {
|
|
786
|
+
name: 'tokenMultiplier'
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: 'depeg'
|
|
792
|
+
docs: [
|
|
793
|
+
'Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price',
|
|
794
|
+
]
|
|
795
|
+
type: {
|
|
796
|
+
defined: {
|
|
797
|
+
name: 'depeg'
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
name: 'lastAmpUpdatedTimestamp'
|
|
803
|
+
docs: [
|
|
804
|
+
'The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period',
|
|
805
|
+
]
|
|
806
|
+
type: 'u64'
|
|
807
|
+
},
|
|
808
|
+
]
|
|
809
|
+
},
|
|
810
|
+
]
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
name: 'depeg'
|
|
815
|
+
docs: ['Contains information for depeg pool']
|
|
816
|
+
type: {
|
|
817
|
+
kind: 'struct'
|
|
818
|
+
fields: [
|
|
819
|
+
{
|
|
820
|
+
name: 'baseVirtualPrice'
|
|
821
|
+
docs: [
|
|
822
|
+
'The virtual price of staking / interest bearing token',
|
|
823
|
+
]
|
|
824
|
+
type: 'u64'
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
name: 'baseCacheUpdated'
|
|
828
|
+
docs: [
|
|
829
|
+
'The virtual price of staking / interest bearing token',
|
|
830
|
+
]
|
|
831
|
+
type: 'u64'
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
name: 'depegType'
|
|
835
|
+
docs: ['Type of the depeg pool']
|
|
836
|
+
type: {
|
|
837
|
+
defined: {
|
|
838
|
+
name: 'depegType'
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
},
|
|
842
|
+
]
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
name: 'depegType'
|
|
847
|
+
docs: ['Type of depeg pool']
|
|
848
|
+
type: {
|
|
849
|
+
kind: 'enum'
|
|
850
|
+
variants: [
|
|
851
|
+
{
|
|
852
|
+
name: 'none'
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
name: 'marinade'
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
name: 'lido'
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
name: 'splStake'
|
|
862
|
+
},
|
|
863
|
+
]
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
name: 'padding'
|
|
868
|
+
docs: ['Padding for future pool fields']
|
|
869
|
+
type: {
|
|
870
|
+
kind: 'struct'
|
|
871
|
+
fields: [
|
|
872
|
+
{
|
|
873
|
+
name: 'padding0'
|
|
874
|
+
docs: ['Padding 0']
|
|
875
|
+
type: {
|
|
876
|
+
array: ['u8', 6]
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: 'padding1'
|
|
881
|
+
docs: ['Padding 1']
|
|
882
|
+
type: {
|
|
883
|
+
array: ['u64', 21]
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
name: 'padding2'
|
|
888
|
+
docs: ['Padding 2']
|
|
889
|
+
type: {
|
|
890
|
+
array: ['u64', 21]
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
]
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
name: 'partnerInfo'
|
|
898
|
+
type: {
|
|
899
|
+
kind: 'struct'
|
|
900
|
+
fields: [
|
|
901
|
+
{
|
|
902
|
+
name: 'feeNumerator'
|
|
903
|
+
type: 'u64'
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: 'partnerAuthority'
|
|
907
|
+
type: 'pubkey'
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
name: 'pendingFeeA'
|
|
911
|
+
type: 'u64'
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
name: 'pendingFeeB'
|
|
915
|
+
type: 'u64'
|
|
916
|
+
},
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: 'pool'
|
|
922
|
+
docs: ['State of pool account']
|
|
923
|
+
type: {
|
|
924
|
+
kind: 'struct'
|
|
925
|
+
fields: [
|
|
926
|
+
{
|
|
927
|
+
name: 'lpMint'
|
|
928
|
+
docs: ['LP token mint of the pool']
|
|
929
|
+
type: 'pubkey'
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
name: 'tokenAMint'
|
|
933
|
+
docs: ['Token A mint of the pool. Eg: USDT']
|
|
934
|
+
type: 'pubkey'
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: 'tokenBMint'
|
|
938
|
+
docs: ['Token B mint of the pool. Eg: USDC']
|
|
939
|
+
type: 'pubkey'
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
name: 'aVault'
|
|
943
|
+
docs: [
|
|
944
|
+
'Vault account for token A. Token A of the pool will be deposit / withdraw from this vault account.',
|
|
945
|
+
]
|
|
946
|
+
type: 'pubkey'
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
name: 'bVault'
|
|
950
|
+
docs: [
|
|
951
|
+
'Vault account for token B. Token B of the pool will be deposit / withdraw from this vault account.',
|
|
952
|
+
]
|
|
953
|
+
type: 'pubkey'
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
name: 'aVaultLp'
|
|
957
|
+
docs: [
|
|
958
|
+
'LP token account of vault A. Used to receive/burn the vault LP upon deposit/withdraw from the vault.',
|
|
959
|
+
]
|
|
960
|
+
type: 'pubkey'
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
name: 'bVaultLp'
|
|
964
|
+
docs: [
|
|
965
|
+
'LP token account of vault B. Used to receive/burn the vault LP upon deposit/withdraw from the vault.',
|
|
966
|
+
]
|
|
967
|
+
type: 'pubkey'
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: 'aVaultLpBump'
|
|
971
|
+
docs: [
|
|
972
|
+
'"A" vault lp bump. Used to create signer seeds.',
|
|
973
|
+
]
|
|
974
|
+
type: 'u8'
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
name: 'enabled'
|
|
978
|
+
docs: [
|
|
979
|
+
'Flag to determine whether the pool is enabled, or disabled.',
|
|
980
|
+
]
|
|
981
|
+
type: 'bool'
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
name: 'protocolTokenAFee'
|
|
985
|
+
docs: [
|
|
986
|
+
'Protocol fee token account for token A. Used to receive trading fee.',
|
|
987
|
+
]
|
|
988
|
+
type: 'pubkey'
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
name: 'protocolTokenBFee'
|
|
992
|
+
docs: [
|
|
993
|
+
'Protocol fee token account for token B. Used to receive trading fee.',
|
|
994
|
+
]
|
|
995
|
+
type: 'pubkey'
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: 'feeLastUpdatedAt'
|
|
999
|
+
docs: ['Fee last updated timestamp']
|
|
1000
|
+
type: 'u64'
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
name: 'padding0'
|
|
1004
|
+
type: {
|
|
1005
|
+
array: ['u8', 24]
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
name: 'fees'
|
|
1010
|
+
docs: ['Store the fee charges setting.']
|
|
1011
|
+
type: {
|
|
1012
|
+
defined: {
|
|
1013
|
+
name: 'poolFees'
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
name: 'poolType'
|
|
1019
|
+
docs: ['Pool type']
|
|
1020
|
+
type: {
|
|
1021
|
+
defined: {
|
|
1022
|
+
name: 'poolType'
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
name: 'stake'
|
|
1028
|
+
docs: ['Stake pubkey of SPL stake pool']
|
|
1029
|
+
type: 'pubkey'
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
name: 'totalLockedLp'
|
|
1033
|
+
docs: ['Total locked lp token']
|
|
1034
|
+
type: 'u64'
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: 'bootstrapping'
|
|
1038
|
+
docs: ['Bootstrapping config']
|
|
1039
|
+
type: {
|
|
1040
|
+
defined: {
|
|
1041
|
+
name: 'bootstrapping'
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
name: 'partnerInfo'
|
|
1047
|
+
type: {
|
|
1048
|
+
defined: {
|
|
1049
|
+
name: 'partnerInfo'
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: 'padding'
|
|
1055
|
+
docs: ['Padding for future pool field']
|
|
1056
|
+
type: {
|
|
1057
|
+
defined: {
|
|
1058
|
+
name: 'padding'
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
name: 'curveType'
|
|
1064
|
+
docs: [
|
|
1065
|
+
'The type of the swap curve supported by the pool.',
|
|
1066
|
+
]
|
|
1067
|
+
type: {
|
|
1068
|
+
defined: {
|
|
1069
|
+
name: 'curveType'
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
]
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
name: 'poolFees'
|
|
1078
|
+
docs: ['Information regarding fee charges']
|
|
1079
|
+
type: {
|
|
1080
|
+
kind: 'struct'
|
|
1081
|
+
fields: [
|
|
1082
|
+
{
|
|
1083
|
+
name: 'tradeFeeNumerator'
|
|
1084
|
+
docs: [
|
|
1085
|
+
'Trade fees are extra token amounts that are held inside the token',
|
|
1086
|
+
'accounts during a trade, making the value of liquidity tokens rise.',
|
|
1087
|
+
'Trade fee numerator',
|
|
1088
|
+
]
|
|
1089
|
+
type: 'u64'
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
name: 'tradeFeeDenominator'
|
|
1093
|
+
docs: ['Trade fee denominator']
|
|
1094
|
+
type: 'u64'
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: 'protocolTradeFeeNumerator'
|
|
1098
|
+
docs: [
|
|
1099
|
+
'Owner trading fees are extra token amounts that are held inside the token',
|
|
1100
|
+
'accounts during a trade, with the equivalent in pool tokens minted to',
|
|
1101
|
+
'the owner of the program.',
|
|
1102
|
+
'Owner trade fee numerator',
|
|
1103
|
+
]
|
|
1104
|
+
type: 'u64'
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
name: 'protocolTradeFeeDenominator'
|
|
1108
|
+
docs: ['Owner trade fee denominator']
|
|
1109
|
+
type: 'u64'
|
|
1110
|
+
},
|
|
1111
|
+
]
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
name: 'poolType'
|
|
1116
|
+
docs: ['Pool type']
|
|
1117
|
+
type: {
|
|
1118
|
+
kind: 'enum'
|
|
1119
|
+
variants: [
|
|
1120
|
+
{
|
|
1121
|
+
name: 'permissioned'
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
name: 'permissionless'
|
|
1125
|
+
},
|
|
1126
|
+
]
|
|
1127
|
+
}
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
name: 'tokenMultiplier'
|
|
1131
|
+
docs: [
|
|
1132
|
+
'Multiplier for the pool token. Used to normalized token with different decimal into the same precision.',
|
|
1133
|
+
]
|
|
1134
|
+
type: {
|
|
1135
|
+
kind: 'struct'
|
|
1136
|
+
fields: [
|
|
1137
|
+
{
|
|
1138
|
+
name: 'tokenAMultiplier'
|
|
1139
|
+
docs: ['Multiplier for token A of the pool.']
|
|
1140
|
+
type: 'u64'
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
name: 'tokenBMultiplier'
|
|
1144
|
+
docs: ['Multiplier for token B of the pool.']
|
|
1145
|
+
type: 'u64'
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
name: 'precisionFactor'
|
|
1149
|
+
docs: [
|
|
1150
|
+
'Record the highest token decimal in the pool. For example, Token A is 6 decimal, token B is 9 decimal. This will save value of 9.',
|
|
1151
|
+
]
|
|
1152
|
+
type: 'u8'
|
|
1153
|
+
},
|
|
1154
|
+
]
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
]
|
|
1158
|
+
}
|