@symmetry-hq/temp-v3-sdk 0.0.6 → 0.0.7

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.
@@ -56,6 +56,7 @@ export declare class SymmetryCore {
56
56
  amount: number;
57
57
  }[];
58
58
  rebalanceSlippageBps?: number;
59
+ perTradeRebalanceSlippageBps?: number;
59
60
  executionStartTime?: number;
60
61
  }): Promise<VersionedTxs>;
61
62
  updateTokenPricesTx(params: {
@@ -63,6 +64,27 @@ export declare class SymmetryCore {
63
64
  rebalanceIntent: RebalanceIntent;
64
65
  basket: Basket;
65
66
  }): Promise<VersionedTxs>;
67
+ executeSwap(params: {
68
+ keeper: PublicKey;
69
+ rebalanceIntent: RebalanceIntent;
70
+ mintFrom: PublicKey;
71
+ mintTo: PublicKey;
72
+ amount: number;
73
+ side: number;
74
+ }): Promise<VersionedTxs>;
75
+ mintTx(params: {
76
+ keeper: PublicKey;
77
+ buyer: PublicKey;
78
+ basket: PublicKey;
79
+ }): Promise<VersionedTxs>;
80
+ redeemTokensTx(params: {
81
+ keeper: PublicKey;
82
+ rebalanceIntent: RebalanceIntent;
83
+ }): Promise<VersionedTxs>;
84
+ claimBountyTx(params: {
85
+ keeper: PublicKey;
86
+ rebalanceIntent: RebalanceIntent;
87
+ }): Promise<VersionedTxs>;
66
88
  signAndSendVersionedTxs(params: {
67
89
  vtxs: VersionedTxs;
68
90
  wallet: Wallet;
package/dist/src/index.js CHANGED
@@ -28,6 +28,9 @@ const txUtils_1 = require("./txUtils");
28
28
  const decimal_js_1 = __importDefault(require("decimal.js"));
29
29
  const deposit_1 = require("./instructions/user/deposit");
30
30
  const priceUpdate_1 = require("./instructions/automation/priceUpdate");
31
+ const rebalanceSwap_1 = require("./instructions/automation/rebalanceSwap");
32
+ const withdraw_1 = require("./instructions/user/withdraw");
33
+ const claimBounty_1 = require("./instructions/automation/claimBounty");
31
34
  exports.COMPUTE_UNITS = 1000000;
32
35
  exports.PRIORITY_FEE = 100000;
33
36
  exports.JUPITER_API_KEY = "https://quote-api.jup.ag/v6/";
@@ -169,9 +172,11 @@ class SymmetryCore {
169
172
  }
170
173
  depositTx(params) {
171
174
  return __awaiter(this, void 0, void 0, function* () {
172
- let { buyer, basket, contributions, rebalanceSlippageBps, executionStartTime } = params;
175
+ let { buyer, basket, contributions, rebalanceSlippageBps, perTradeRebalanceSlippageBps, executionStartTime } = params;
173
176
  if (!rebalanceSlippageBps)
174
177
  rebalanceSlippageBps = 100;
178
+ if (!perTradeRebalanceSlippageBps)
179
+ perTradeRebalanceSlippageBps = 100;
175
180
  if (!executionStartTime)
176
181
  executionStartTime = 0;
177
182
  let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, buyer);
@@ -187,7 +192,8 @@ class SymmetryCore {
187
192
  basket,
188
193
  bountyMint: constants_1.BOUNTY_MINT,
189
194
  rebalanceIntentRentPayer: buyer,
190
- rebalanceSlippageBps: rebalanceSlippageBps,
195
+ rebalanceSlippageBps,
196
+ perTradeRebalanceSlippageBps,
191
197
  executionStartTime: executionStartTime,
192
198
  }),
193
199
  ]
@@ -205,7 +211,13 @@ class SymmetryCore {
205
211
  owner: buyer,
206
212
  basket: basket,
207
213
  }),
214
+ (0, priceUpdate_1.startPriceUpdatesIx)({
215
+ keeper: buyer,
216
+ basket: basket,
217
+ rebalanceIntent: rebalanceIntent,
218
+ }),
208
219
  ]);
220
+ // batchIxs = [batchIxs[batchIxs.length - 1]];
209
221
  let signers = [];
210
222
  let multipleLookupTableAddresses = [];
211
223
  for (let i = 0; i < batchIxs.length; i++) {
@@ -230,8 +242,7 @@ class SymmetryCore {
230
242
  let ixs = [];
231
243
  let signers = [];
232
244
  let multipleLookupTableAddresses = [];
233
- let batches = [];
234
- let batchSize = 5;
245
+ let batchSize = 7;
235
246
  for (let batchStart = 0; batchStart < basket.numTokens; batchStart += batchSize) {
236
247
  let allKeys = [];
237
248
  let tokenIndices = [];
@@ -265,8 +276,141 @@ class SymmetryCore {
265
276
  }),
266
277
  ]);
267
278
  signers.push([]);
268
- multipleLookupTableAddresses.push([]);
269
- batches.push(1);
279
+ multipleLookupTableAddresses.push([basket.lookupTables.active[0], basket.lookupTables.active[1]]);
280
+ break;
281
+ }
282
+ let vtxs = yield (0, txUtils_1.prepareV0Transactions)({
283
+ connection: this.sdkParams.connection,
284
+ payer: keeper,
285
+ priorityFee: this.sdkParams.priorityFee,
286
+ multipleIxs: ixs,
287
+ multipleLookupTableAddresses: multipleLookupTableAddresses,
288
+ signers: signers,
289
+ batches: [ixs.length],
290
+ });
291
+ return vtxs;
292
+ });
293
+ }
294
+ executeSwap(params) {
295
+ return __awaiter(this, void 0, void 0, function* () {
296
+ let { keeper, rebalanceIntent, mintFrom, mintTo, amount, side } = params;
297
+ let ix = (0, rebalanceSwap_1.rebalanceSwapIx)({
298
+ keeper: keeper,
299
+ basket: rebalanceIntent.basket,
300
+ mintFrom: mintFrom,
301
+ mintTo: mintTo,
302
+ amount: amount,
303
+ side: side,
304
+ });
305
+ let vtxs = yield (0, txUtils_1.prepareV0Transactions)({
306
+ connection: this.sdkParams.connection,
307
+ payer: keeper,
308
+ priorityFee: this.sdkParams.priorityFee,
309
+ multipleIxs: [[ix]],
310
+ multipleLookupTableAddresses: [],
311
+ signers: [[]],
312
+ batches: [1],
313
+ });
314
+ return vtxs;
315
+ });
316
+ }
317
+ mintTx(params) {
318
+ return __awaiter(this, void 0, void 0, function* () {
319
+ let { keeper, buyer, basket } = params;
320
+ let ix = (0, deposit_1.mintBasketIx)({
321
+ keeper: keeper,
322
+ basket: basket,
323
+ buyer: buyer,
324
+ });
325
+ let vtxs = yield (0, txUtils_1.prepareV0Transactions)({
326
+ connection: this.sdkParams.connection,
327
+ payer: keeper,
328
+ priorityFee: this.sdkParams.priorityFee,
329
+ multipleIxs: [[ix]],
330
+ multipleLookupTableAddresses: [],
331
+ signers: [[]],
332
+ batches: [1],
333
+ });
334
+ return vtxs;
335
+ });
336
+ }
337
+ redeemTokensTx(params) {
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ let { keeper, rebalanceIntent } = params;
340
+ let batchSize = 7;
341
+ let ixs = [];
342
+ let signers = [];
343
+ let multipleLookupTableAddresses = [];
344
+ for (let batchStart = 0; batchStart < rebalanceIntent.tokens.length; batchStart += batchSize) {
345
+ let tokenMints = [];
346
+ for (let i = batchStart; i < rebalanceIntent.tokens.length && i < batchStart + batchSize; i++)
347
+ if (rebalanceIntent.tokens[i].amount.gt(new anchor_1.BN(0)))
348
+ tokenMints.push(rebalanceIntent.tokens[i].mint);
349
+ if (tokenMints.length > 0) {
350
+ ixs.push([
351
+ (0, withdraw_1.redeemTokensIx)({
352
+ keeper: keeper,
353
+ basket: rebalanceIntent.basket,
354
+ owner: rebalanceIntent.owner,
355
+ tokenMints: tokenMints,
356
+ })
357
+ ]);
358
+ signers.push([]);
359
+ multipleLookupTableAddresses.push([]);
360
+ }
361
+ }
362
+ let vtxs = yield (0, txUtils_1.prepareV0Transactions)({
363
+ connection: this.sdkParams.connection,
364
+ payer: keeper,
365
+ priorityFee: this.sdkParams.priorityFee,
366
+ multipleIxs: ixs,
367
+ multipleLookupTableAddresses: multipleLookupTableAddresses,
368
+ signers: signers,
369
+ batches: [ixs.length],
370
+ });
371
+ return vtxs;
372
+ });
373
+ }
374
+ claimBountyTx(params) {
375
+ return __awaiter(this, void 0, void 0, function* () {
376
+ let { keeper, rebalanceIntent } = params;
377
+ let keepersArray = [];
378
+ if (!rebalanceIntent.startPriceUpdateTask.completedBy.equals(web3_js_1.PublicKey.default))
379
+ keepersArray.push(rebalanceIntent.startPriceUpdateTask.completedBy);
380
+ if (!rebalanceIntent.finishPriceUpdateTask.completedBy.equals(web3_js_1.PublicKey.default))
381
+ keepersArray.push(rebalanceIntent.finishPriceUpdateTask.completedBy);
382
+ if (!rebalanceIntent.mintBasketTask.completedBy.equals(web3_js_1.PublicKey.default))
383
+ keepersArray.push(rebalanceIntent.mintBasketTask.completedBy);
384
+ for (let i = 0; i < rebalanceIntent.priceUpdateTasks.length; i++)
385
+ if (!rebalanceIntent.priceUpdateTasks[i].completedBy.equals(web3_js_1.PublicKey.default))
386
+ keepersArray.push(rebalanceIntent.priceUpdateTasks[i].completedBy);
387
+ for (let i = 0; i < rebalanceIntent.tokenSettlementTasks.length; i++)
388
+ if (!rebalanceIntent.tokenSettlementTasks[i].completedBy.equals(web3_js_1.PublicKey.default))
389
+ keepersArray.push(rebalanceIntent.tokenSettlementTasks[i].completedBy);
390
+ keepersArray = Array.from(new Set(keepersArray));
391
+ let batchSize = 10;
392
+ let ixs = [];
393
+ let signers = [];
394
+ let multipleLookupTableAddresses = [];
395
+ for (let batchStart = 0; batchStart < keepersArray.length; batchStart += batchSize) {
396
+ let keepers = [];
397
+ for (let i = batchStart; i < keepersArray.length && i < batchStart + batchSize; i++)
398
+ keepers.push(keepersArray[i]);
399
+ if (keepers.length > 0) {
400
+ ixs.push([
401
+ (0, claimBounty_1.claimBountyIx)({
402
+ keeper: keeper,
403
+ basket: rebalanceIntent.basket, //@ts-ignore
404
+ intent: rebalanceIntent.ownAddress,
405
+ bountyMint: rebalanceIntent.bounty.bountyMint,
406
+ bountyDepositor: rebalanceIntent.bounty.bountyDepositor,
407
+ rentPayer: rebalanceIntent.rentPayer,
408
+ keepers: keepers,
409
+ })
410
+ ]);
411
+ signers.push([]);
412
+ multipleLookupTableAddresses.push([]);
413
+ }
270
414
  }
271
415
  let vtxs = yield (0, txUtils_1.prepareV0Transactions)({
272
416
  connection: this.sdkParams.connection,
@@ -275,7 +419,7 @@ class SymmetryCore {
275
419
  multipleIxs: ixs,
276
420
  multipleLookupTableAddresses: multipleLookupTableAddresses,
277
421
  signers: signers,
278
- batches: batches,
422
+ batches: [ixs.length],
279
423
  });
280
424
  return vtxs;
281
425
  });
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.editPrivateBasketSettingsIx = editPrivateBasketSettingsIx;
4
4
  exports.createEditBasketIntentIx = createEditBasketIntentIx;
5
5
  exports.editBasketIx = editBasketIx;
6
- const intent_1 = require("../../layouts/intents/intent");
7
6
  const web3_js_1 = require("@solana/web3.js");
7
+ const intent_1 = require("../../layouts/intents/intent");
8
+ const web3_js_2 = require("@solana/web3.js");
8
9
  const constants_1 = require("../../constants");
9
10
  const pda_1 = require("../pda");
10
11
  const spl_token_1 = require("@solana/spl-token");
11
12
  const config_1 = require("../../layouts/config");
12
13
  const anchor_1 = require("@coral-xyz/anchor");
13
- const web3_js_2 = require("@solana/web3.js");
14
+ const web3_js_3 = require("@solana/web3.js");
14
15
  const oracle_1 = require("../../layouts/oracle");
15
16
  const EDIT_PRIVATE_BASKET_SETTINGS_DISCRIMINATOR = Buffer.from([202, 54, 138, 17, 3, 104, 128, 229]);
16
17
  const CREATE_EDIT_BASKET_INTENT_DISCRIMINATOR = Buffer.from([82, 150, 58, 227, 153, 129, 20, 30]);
@@ -53,7 +54,7 @@ function editPrivateBasketSettingsIx(params) {
53
54
  { pubkey: globalConfig, isSigner: false, isWritable: false },
54
55
  { pubkey: constants_1.METADATA_PROGRAM_ID, isSigner: false, isWritable: false }
55
56
  ];
56
- return new web3_js_1.TransactionInstruction({
57
+ return new web3_js_2.TransactionInstruction({
57
58
  keys,
58
59
  programId: constants_1.BASKETS_V3_PROGRAM_ID,
59
60
  data
@@ -79,6 +80,10 @@ function createEditBasketIntentIx(params) {
79
80
  break;
80
81
  case intent_1.TaskType.EditManagerSettings: // 3
81
82
  let startIndex = 0;
83
+ while (editData.managerSettings.managersWeightBps.length < config_1.MAX_MANAGERS_PER_BASKET) {
84
+ editData.managerSettings.managersWeightBps.push(0);
85
+ editData.managerSettings.managers.push(web3_js_1.PublicKey.default);
86
+ }
82
87
  for (let i = 0; i < config_1.MAX_MANAGERS_PER_BASKET; i++) {
83
88
  let managerWeight = editData.managerSettings.managersWeightBps[i];
84
89
  editDataBuf.writeUInt16LE(managerWeight, startIndex);
@@ -93,7 +98,9 @@ function createEditBasketIntentIx(params) {
93
98
  intent_1.AuthorityBitmasksLayout.encode(editData.authorityBitmasks, authorityBitmasksBuffer);
94
99
  editDataBuf.set(authorityBitmasksBuffer, startIndex);
95
100
  startIndex += intent_1.AuthorityBitmasksLayout.span;
96
- editDataBuf.writeBigUint64LE(editData.managerSettings.modificationDelay, startIndex);
101
+ let modificationDelayBN = editData.managerSettings.modificationDelay;
102
+ editDataBuf.writeBigUint64LE(BigInt(modificationDelayBN.toString()), startIndex);
103
+ startIndex += 8;
97
104
  break;
98
105
  case intent_1.TaskType.EditAutomationSettings: // 4
99
106
  config_1.AutomationSettingsLayout.encode(editData, editDataBuf);
@@ -111,7 +118,21 @@ function createEditBasketIntentIx(params) {
111
118
  intent_1.UpdateWeightsDelayLayout.encode(editData, editDataBuf);
112
119
  break;
113
120
  case intent_1.TaskType.AddToken: // 9
114
- oracle_1.OracleAggregatorLayout.encode(editData.oracleAggregator, editDataBuf);
121
+ let data = editData.oracleAggregator;
122
+ while (data.oracles.length < constants_1.MAX_ORACLES_PER_TOKEN) {
123
+ data.oracles.push({
124
+ oracleSettings: oracle_1.DEFAULT_ORACLE_SETTINGS,
125
+ accountsToLoadLutIds: [],
126
+ accountsToLoadLutIndices: [],
127
+ });
128
+ }
129
+ for (let i = 0; i < data.oracles.length; i++) {
130
+ while (data.oracles[i].accountsToLoadLutIds.length < oracle_1.MAX_ACCOUNTS_PER_ORACLE) {
131
+ data.oracles[i].accountsToLoadLutIds.push(0);
132
+ data.oracles[i].accountsToLoadLutIndices.push(0);
133
+ }
134
+ }
135
+ oracle_1.OracleAggregatorLayout.encode(data, editDataBuf);
115
136
  additionalAccounts.push({
116
137
  pubkey: editData.tokenMint,
117
138
  isWritable: false,
@@ -132,11 +153,13 @@ function createEditBasketIntentIx(params) {
132
153
  isWritable: true,
133
154
  isSigner: false
134
155
  });
135
- additionalAccounts.push({
136
- pubkey: editData.oracleAccount,
137
- isWritable: false,
138
- isSigner: false
139
- });
156
+ for (let i = 0; i < editData.oracleAccounts.length; i++) {
157
+ additionalAccounts.push({
158
+ pubkey: editData.oracleAccounts[i],
159
+ isWritable: false,
160
+ isSigner: false
161
+ });
162
+ }
140
163
  break;
141
164
  case intent_1.TaskType.UpdateWeights: // 10
142
165
  intent_1.UpdateWeightsLayout.encode(editData, editDataBuf);
@@ -162,13 +185,13 @@ function createEditBasketIntentIx(params) {
162
185
  { pubkey: managerBountyATA, isSigner: false, isWritable: true },
163
186
  { pubkey: bountyVault, isSigner: false, isWritable: true },
164
187
  { pubkey: bountyVaultATA, isSigner: false, isWritable: true },
165
- { pubkey: web3_js_2.SystemProgram.programId, isSigner: false, isWritable: false },
188
+ { pubkey: web3_js_3.SystemProgram.programId, isSigner: false, isWritable: false },
166
189
  { pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
167
190
  { pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
168
191
  { pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
169
192
  ];
170
193
  keys.push(...additionalAccounts);
171
- return new web3_js_1.TransactionInstruction({
194
+ return new web3_js_2.TransactionInstruction({
172
195
  keys,
173
196
  programId: constants_1.BASKETS_V3_PROGRAM_ID,
174
197
  data,
@@ -198,7 +221,7 @@ function editBasketIx(params) {
198
221
  { pubkey: managerBountyATA, isSigner: false, isWritable: true },
199
222
  { pubkey: bountyVault, isSigner: false, isWritable: true },
200
223
  { pubkey: bountyVaultATA, isSigner: false, isWritable: true },
201
- { pubkey: web3_js_2.SystemProgram.programId, isSigner: false, isWritable: false },
224
+ { pubkey: web3_js_3.SystemProgram.programId, isSigner: false, isWritable: false },
202
225
  { pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
203
226
  { pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
204
227
  { pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
@@ -210,7 +233,7 @@ function editBasketIx(params) {
210
233
  keys.push({ pubkey: constants_1.METADATA_PROGRAM_ID, isSigner: false, isWritable: false });
211
234
  }
212
235
  ;
213
- return new web3_js_1.TransactionInstruction({
236
+ return new web3_js_2.TransactionInstruction({
214
237
  keys,
215
238
  programId: constants_1.BASKETS_V3_PROGRAM_ID,
216
239
  data,
@@ -11,6 +11,7 @@ export declare function depositStateIx(params: {
11
11
  bountyMint: PublicKey;
12
12
  rebalanceIntentRentPayer: PublicKey;
13
13
  rebalanceSlippageBps: number;
14
+ perTradeRebalanceSlippageBps: number;
14
15
  executionStartTime: number;
15
16
  }): TransactionInstruction;
16
17
  export declare function depositTokensIx(params: {
@@ -53,7 +53,7 @@ function resizeRebalanceIntentIx(rebalanceIntent) {
53
53
  });
54
54
  }
55
55
  function depositStateIx(params) {
56
- const { buyer, basket, bountyMint, rebalanceIntentRentPayer, rebalanceSlippageBps, executionStartTime, } = params;
56
+ const { buyer, basket, bountyMint, rebalanceIntentRentPayer, rebalanceSlippageBps, perTradeRebalanceSlippageBps, executionStartTime, } = params;
57
57
  let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, buyer);
58
58
  let basketTokenMint = (0, pda_1.getBasketTokenMintPda)(basket);
59
59
  let globalConfig = (0, pda_1.getGlobalConfigPda)();
@@ -64,11 +64,13 @@ function depositStateIx(params) {
64
64
  let buyerBasketAta = (0, pda_1.getAta)(buyer, basketTokenMint);
65
65
  const rebalanceIntentRentPayerBuf = rebalanceIntentRentPayer.toBuffer();
66
66
  const rebalanceSlippageBuf = Buffer.from(new anchor_1.BN(rebalanceSlippageBps).toArray("le", 2));
67
+ const perTradeRebalanceSlippageBuf = Buffer.from(new anchor_1.BN(perTradeRebalanceSlippageBps).toArray("le", 2));
67
68
  const executionStartBuf = Buffer.from(new anchor_1.BN(executionStartTime).toArray("le", 8));
68
69
  const data = Buffer.concat([
69
70
  CREATE_DEPOSIT_STATE_DISCRIMINATOR,
70
71
  rebalanceIntentRentPayerBuf,
71
72
  rebalanceSlippageBuf,
73
+ perTradeRebalanceSlippageBuf,
72
74
  executionStartBuf
73
75
  ]);
74
76
  const keys = [
@@ -5,6 +5,7 @@ export declare function createWithdrawStateIx(params: {
5
5
  basket: PublicKey;
6
6
  withdrawAmount: number;
7
7
  rebalanceSlippageBps: number;
8
+ perTradeRebalanceSlippageBps: number;
8
9
  executionStartTime: number;
9
10
  bountyMint: PublicKey;
10
11
  }): TransactionInstruction;
@@ -11,7 +11,7 @@ const web3_js_2 = require("@solana/web3.js");
11
11
  const CREATE_WITHDRAW_STATE_DISCRIMINATOR = Buffer.from([161, 45, 253, 59, 110, 240, 65, 3]);
12
12
  const REDEEM_TOKENS_DISCRIMINATOR = Buffer.from([83, 49, 112, 2, 105, 193, 106, 126]);
13
13
  function createWithdrawStateIx(params) {
14
- const { seller, basket, withdrawAmount, rebalanceSlippageBps, executionStartTime, bountyMint, } = params;
14
+ const { seller, basket, withdrawAmount, rebalanceSlippageBps, perTradeRebalanceSlippageBps, executionStartTime, bountyMint, } = params;
15
15
  let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, seller);
16
16
  let rentPayerPda = (0, pda_1.getRentPayerPda)();
17
17
  let basketTokenMint = (0, pda_1.getBasketTokenMintPda)(basket);
@@ -25,6 +25,7 @@ function createWithdrawStateIx(params) {
25
25
  CREATE_WITHDRAW_STATE_DISCRIMINATOR,
26
26
  Buffer.from(new anchor_1.BN(withdrawAmount).toArray("le", 8)),
27
27
  Buffer.from(new anchor_1.BN(rebalanceSlippageBps).toArray("le", 2)),
28
+ Buffer.from(new anchor_1.BN(perTradeRebalanceSlippageBps).toArray("le", 2)),
28
29
  Buffer.from(new anchor_1.BN(executionStartTime).toArray("le", 8)),
29
30
  ]);
30
31
  const keys = [
@@ -67,10 +68,8 @@ function redeemTokensIx(params) {
67
68
  // remaining accounts
68
69
  params.tokenMints.forEach((mint) => {
69
70
  keys.push({ pubkey: mint, isWritable: false, isSigner: false });
70
- const ownerAta = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, owner);
71
- keys.push({ pubkey: ownerAta, isWritable: true, isSigner: false });
72
- const basketAta = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, basket);
73
- keys.push({ pubkey: basketAta, isWritable: true, isSigner: false });
71
+ keys.push({ pubkey: (0, pda_1.getAta)(owner, mint), isWritable: true, isSigner: false });
72
+ keys.push({ pubkey: (0, pda_1.getAta)(basket, mint), isWritable: true, isSigner: false });
74
73
  });
75
74
  const discriminator = REDEEM_TOKENS_DISCRIMINATOR;
76
75
  const data = discriminator;
@@ -11,6 +11,7 @@ export declare enum BasketType {
11
11
  Public = 1
12
12
  }
13
13
  export interface ScheduleSettings {
14
+ cycleStartTime: BN;
14
15
  cycleDuration: BN;
15
16
  depositsStart: BN;
16
17
  depositsEnd: BN;
@@ -23,16 +24,20 @@ export interface ScheduleSettings {
23
24
  export declare const ScheduleSettingsLayout: any;
24
25
  export interface FeeSettings {
25
26
  hostDepositFeeBps: number;
27
+ hostWithdrawFeeBps: number;
26
28
  hostManagementFeeBps: number;
27
29
  hostPerformanceFeeBps: number;
28
30
  creatorDepositFeeBps: number;
31
+ creatorWithdrawFeeBps: number;
29
32
  creatorManagementFeeBps: number;
30
33
  creatorPerformanceFeeBps: number;
31
34
  managersDepositFeeBps: number;
35
+ managerWithdrawFeeBps: number;
32
36
  managersManagementFeeBps: number;
33
37
  managersPerformanceFeeBps: number;
34
38
  basketDepositFeeBps: number;
35
39
  basketWithdrawFeeBps: number;
40
+ extraData: number[];
36
41
  modificationDelay: BN;
37
42
  }
38
43
  export declare const FeeSettingsLayout: any;
@@ -44,15 +49,19 @@ export interface ManagerSettings {
44
49
  export declare const ManagerSettingsLayout: any;
45
50
  export interface AutomationSettings {
46
51
  allowAutomation: number;
47
- rebalanceSlippageBps: number;
48
- rebalanceThresholdBps: number;
49
- rebalanceIntervalSeconds: BN;
52
+ rebalanceSlippageThresholdBps: number;
53
+ perTradeRebalanceSlippageThresholdBps: number;
54
+ rebalanceActivationThresholdAbsBps: number;
55
+ rebalanceActivationThresholdRelBps: number;
56
+ rebalanceActivationCooldown: BN;
57
+ extraData: PublicKey[];
50
58
  modificationDelay: BN;
51
59
  }
52
60
  export declare const AutomationSettingsLayout: any;
53
61
  export interface LpSettings {
54
- lpThresholdBps: number;
55
62
  allowLp: number;
63
+ lpThresholdBps: number;
64
+ extraData: number[];
56
65
  modificationDelay: BN;
57
66
  }
58
67
  export declare const LpSettingsLayout: any;
@@ -98,6 +107,7 @@ export declare const BasketSettingsLayout: any;
98
107
  export interface GlobalConfig {
99
108
  admin: PublicKey;
100
109
  owners: PublicKey[];
110
+ allowInteractions: number;
101
111
  allowCreation: number;
102
112
  allowManagement: number;
103
113
  allowAutomation: number;
@@ -109,10 +119,16 @@ export interface GlobalConfig {
109
119
  maxPerformanceFeeBps: number;
110
120
  symmetryFeeCollector: PublicKey;
111
121
  symmetryDepositFeeBps: number;
122
+ symmetryDepositFeeShareBps: number;
112
123
  symmetryWithdrawFeeBps: number;
113
- symmetryRebalanceFeeBps: number;
124
+ symmetryWithdrawFeeShareBps: number;
114
125
  symmetryManagementFeeBps: number;
126
+ symmetryManagementFeeShareBps: number;
115
127
  symmetryPerformanceFeeBps: number;
128
+ symmetryPerformanceFeeShareBps: number;
129
+ symmetryTradeFeeBps: number;
130
+ symmetryLimitOrderFeeBps: number;
131
+ symmetryFeesExtraData: number[];
116
132
  bountyMint: PublicKey;
117
133
  minBountyForBasketAutomation: BN;
118
134
  bountyBondAmount: BN;
@@ -128,5 +144,6 @@ export interface GlobalConfig {
128
144
  priceUpdateDelayAfterCreation: BN;
129
145
  priceUpdateLifetime: BN;
130
146
  priceUpdateReexecutionDelay: BN;
147
+ extraData: BN[];
131
148
  }
132
149
  export declare const GlobalConfigLayout: any;
@@ -16,6 +16,7 @@ var BasketType;
16
16
  ;
17
17
  ;
18
18
  exports.ScheduleSettingsLayout = (0, borsh_1.struct)([
19
+ (0, borsh_1.u64)('cycleStartTime'),
19
20
  (0, borsh_1.u64)('cycleDuration'),
20
21
  (0, borsh_1.u64)('depositsStart'),
21
22
  (0, borsh_1.u64)('depositsEnd'),
@@ -28,16 +29,20 @@ exports.ScheduleSettingsLayout = (0, borsh_1.struct)([
28
29
  ;
29
30
  exports.FeeSettingsLayout = (0, borsh_1.struct)([
30
31
  (0, borsh_1.u16)('hostDepositFeeBps'),
32
+ (0, borsh_1.u16)('hostWithdrawFeeBps'),
31
33
  (0, borsh_1.u16)('hostManagementFeeBps'),
32
34
  (0, borsh_1.u16)('hostPerformanceFeeBps'),
33
35
  (0, borsh_1.u16)('creatorDepositFeeBps'),
36
+ (0, borsh_1.u16)('creatorWithdrawFeeBps'),
34
37
  (0, borsh_1.u16)('creatorManagementFeeBps'),
35
38
  (0, borsh_1.u16)('creatorPerformanceFeeBps'),
36
39
  (0, borsh_1.u16)('managersDepositFeeBps'),
40
+ (0, borsh_1.u16)('managerWithdrawFeeBps'),
37
41
  (0, borsh_1.u16)('managersManagementFeeBps'),
38
42
  (0, borsh_1.u16)('managersPerformanceFeeBps'),
39
43
  (0, borsh_1.u16)('basketDepositFeeBps'),
40
44
  (0, borsh_1.u16)('basketWithdrawFeeBps'),
45
+ (0, borsh_1.array)((0, borsh_1.u8)(), 32, 'extraData'),
41
46
  (0, borsh_1.u64)('modificationDelay'),
42
47
  ]);
43
48
  exports.ManagerSettingsLayout = (0, borsh_1.struct)([
@@ -48,15 +53,19 @@ exports.ManagerSettingsLayout = (0, borsh_1.struct)([
48
53
  ;
49
54
  exports.AutomationSettingsLayout = (0, borsh_1.struct)([
50
55
  (0, borsh_1.u8)('allowAutomation'),
51
- (0, borsh_1.u16)('rebalanceSlippageBps'),
52
- (0, borsh_1.u16)('rebalanceThresholdBps'),
53
- (0, borsh_1.u64)('rebalanceIntervalSeconds'),
56
+ (0, borsh_1.u16)('rebalanceSlippageThresholdBps'),
57
+ (0, borsh_1.u16)('perTradeRebalanceSlippageThresholdBps'),
58
+ (0, borsh_1.u16)('rebalanceActivationThresholdAbsBps'),
59
+ (0, borsh_1.u16)('rebalanceActivationThresholdRelBps'),
60
+ (0, borsh_1.u64)('rebalanceActivationCooldown'),
61
+ (0, borsh_1.array)((0, borsh_1.publicKey)(), 4, 'extraData'),
54
62
  (0, borsh_1.u64)('modificationDelay'),
55
63
  ]);
56
64
  ;
57
65
  exports.LpSettingsLayout = (0, borsh_1.struct)([
58
- (0, borsh_1.u16)('lpThresholdBps'),
59
66
  (0, borsh_1.u8)('allowLp'),
67
+ (0, borsh_1.u16)('lpThresholdBps'),
68
+ (0, borsh_1.array)((0, borsh_1.u8)(), 32, 'extraData'),
60
69
  (0, borsh_1.u64)('modificationDelay'),
61
70
  ]);
62
71
  ;
@@ -101,6 +110,7 @@ exports.BasketSettingsLayout = (0, borsh_1.struct)([
101
110
  exports.GlobalConfigLayout = (0, borsh_1.struct)([
102
111
  (0, borsh_1.publicKey)('admin'),
103
112
  (0, borsh_1.array)((0, borsh_1.publicKey)(), 3, 'owners'),
113
+ (0, borsh_1.u8)('allowInteractions'),
104
114
  (0, borsh_1.u8)('allowCreation'),
105
115
  (0, borsh_1.u8)('allowManagement'),
106
116
  (0, borsh_1.u8)('allowAutomation'),
@@ -112,10 +122,16 @@ exports.GlobalConfigLayout = (0, borsh_1.struct)([
112
122
  (0, borsh_1.u16)('maxPerformanceFeeBps'),
113
123
  (0, borsh_1.publicKey)('symmetryFeeCollector'),
114
124
  (0, borsh_1.u16)('symmetryDepositFeeBps'),
125
+ (0, borsh_1.u16)('symmetryDepositFeeShareBps'),
115
126
  (0, borsh_1.u16)('symmetryWithdrawFeeBps'),
116
- (0, borsh_1.u16)('symmetryRebalanceFeeBps'),
127
+ (0, borsh_1.u16)('symmetryWithdrawFeeShareBps'),
117
128
  (0, borsh_1.u16)('symmetryManagementFeeBps'),
129
+ (0, borsh_1.u16)('symmetryManagementFeeShareBps'),
118
130
  (0, borsh_1.u16)('symmetryPerformanceFeeBps'),
131
+ (0, borsh_1.u16)('symmetryPerformanceFeeShareBps'),
132
+ (0, borsh_1.u16)('symmetryTradeFeeBps'),
133
+ (0, borsh_1.u16)('symmetryLimitOrderFeeBps'),
134
+ (0, borsh_1.array)((0, borsh_1.u16)(), 16, 'symmetryFeesExtraData'),
119
135
  (0, borsh_1.publicKey)('bountyMint'),
120
136
  (0, borsh_1.u64)('minBountyForBasketAutomation'),
121
137
  (0, borsh_1.u64)('bountyBondAmount'),
@@ -131,4 +147,5 @@ exports.GlobalConfigLayout = (0, borsh_1.struct)([
131
147
  (0, borsh_1.u64)('priceUpdateDelayAfterCreation'),
132
148
  (0, borsh_1.u64)('priceUpdateLifetime'),
133
149
  (0, borsh_1.u64)('priceUpdateReexecutionDelay'),
150
+ (0, borsh_1.array)((0, borsh_1.u64)(), 32, 'extraData'),
134
151
  ]);
@@ -78,7 +78,7 @@ export declare const UpdateWeightsDelayLayout: any;
78
78
  export interface AddToken {
79
79
  oracleAggregator: OracleAggregator;
80
80
  tokenMint: PublicKey;
81
- oracleAccount: PublicKey;
81
+ oracleAccounts: PublicKey[];
82
82
  }
83
83
  export declare const AddTokenLayout: any;
84
84
  export interface UpdateWeights {
@@ -12,8 +12,9 @@ export declare enum RebalanceType {
12
12
  export declare enum RebalanceAction {
13
13
  NotActive = 0,
14
14
  DepositTokens = 1,
15
- UpdatePrices = 2,
16
- AuctionLive = 3
15
+ StartPriceUpdates = 2,
16
+ UpdatePrices = 3,
17
+ AuctionLive = 4
17
18
  }
18
19
  export interface AuctionTimestamps {
19
20
  startTime: BN;
@@ -42,7 +43,8 @@ export interface RebalanceIntent {
42
43
  rebalanceType: RebalanceType;
43
44
  currentAction: RebalanceAction;
44
45
  executionStartTime: BN;
45
- rebalanceSlippageBps: number;
46
+ rebalanceThresholdSlippageBps: number;
47
+ perTradeRebalanceThresholdSlippageBps: number;
46
48
  initialTvl: Fraction;
47
49
  auctionUpdateTimestamp: BN;
48
50
  auctions: AuctionTimestamps;
@@ -17,8 +17,9 @@ var RebalanceAction;
17
17
  (function (RebalanceAction) {
18
18
  RebalanceAction[RebalanceAction["NotActive"] = 0] = "NotActive";
19
19
  RebalanceAction[RebalanceAction["DepositTokens"] = 1] = "DepositTokens";
20
- RebalanceAction[RebalanceAction["UpdatePrices"] = 2] = "UpdatePrices";
21
- RebalanceAction[RebalanceAction["AuctionLive"] = 3] = "AuctionLive";
20
+ RebalanceAction[RebalanceAction["StartPriceUpdates"] = 2] = "StartPriceUpdates";
21
+ RebalanceAction[RebalanceAction["UpdatePrices"] = 3] = "UpdatePrices";
22
+ RebalanceAction[RebalanceAction["AuctionLive"] = 4] = "AuctionLive";
22
23
  })(RebalanceAction || (exports.RebalanceAction = RebalanceAction = {}));
23
24
  ;
24
25
  ;
@@ -48,7 +49,8 @@ exports.RebalanceIntentLayout = (0, borsh_1.struct)([
48
49
  (0, borsh_1.u8)('rebalanceType'),
49
50
  (0, borsh_1.u8)('currentAction'),
50
51
  (0, borsh_1.u64)('executionStartTime'),
51
- (0, borsh_1.u16)('rebalanceSlippageBps'),
52
+ (0, borsh_1.u16)('rebalanceThresholdSlippageBps'),
53
+ (0, borsh_1.u16)('perTradeRebalanceThresholdSlippageBps'),
52
54
  fraction_1.FractionLayout.replicate('initialTvl'),
53
55
  (0, borsh_1.u64)('auctionUpdateTimestamp'),
54
56
  (0, borsh_1.array)(exports.AuctionTimestampsLayout, 3, 'auctions'),