@symmetry-hq/temp-v3-sdk 0.0.49 → 0.0.51

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.
@@ -441,6 +441,17 @@ export declare class SymmetryCore {
441
441
  min_bounty_amount?: number;
442
442
  max_bounty_amount?: number;
443
443
  }): Promise<TxPayloadBatchSequence>;
444
+ /**
445
+ * Locks deposits for a user and starts auction flow.
446
+ * @param {Object} params - The parameters for the lock deposits.
447
+ * @param {string} params.buyer - The public key of the buyer.
448
+ * @param {string} params.basket_mint - The mint public key of the basket.
449
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
450
+ */
451
+ lockDepositsTx(params: {
452
+ buyer: string;
453
+ basket_mint: string;
454
+ }): Promise<TxPayloadBatchSequence>;
444
455
  /**
445
456
  * Creates a rebalance intent for a user to withdraw tokens from a basket.
446
457
  * @param {{Object}} params - The parameters for the basket sale.
@@ -487,22 +498,6 @@ export declare class SymmetryCore {
487
498
  min_bounty_amount?: number;
488
499
  max_bounty_amount?: number;
489
500
  }): Promise<TxPayloadBatchSequence>;
490
- /**
491
- * Marks the start of price updates for a rebalance intent. Keepers will be able to
492
- *
493
- * update token prices for the rebalance intent after priceUpdateDelayAfterCreation seconds.
494
- *
495
- * @param {Object} params - The parameters for the start price updates.
496
- * @param {string} params.keeper - The public key of the keeper.
497
- * @param {string} params.basket - The public key of the basket.
498
- * @param {string} params.rebalance_intent - The public key of the rebalance intent.
499
- * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
500
- */
501
- startPriceUpdatesTx(params: {
502
- keeper: string;
503
- basket: string;
504
- rebalance_intent: string;
505
- }): Promise<TxPayloadBatchSequence>;
506
501
  /**
507
502
  * Build update token prices transactions.
508
503
  *
package/dist/src/index.js CHANGED
@@ -965,18 +965,12 @@ class SymmetryCore {
965
965
  if ((_h = rentPayerAi === null || rentPayerAi === void 0 ? void 0 : rentPayerAi.lamports) !== null && _h !== void 0 ? _h : 0 > 500000000)
966
966
  rebalanceIntentRentPayer = rentPayer;
967
967
  let bountyMint = basket.settings.bountyMint;
968
- let lockAndStartPriceUpdatesIxs = [
969
- (0, deposit_1.lockDepositsIx)({
970
- owner: buyer,
971
- basket: basket.ownAddress,
972
- })
973
- ];
974
- if (executionStartTime == 0)
975
- lockAndStartPriceUpdatesIxs.push((0, priceUpdate_1.startPriceUpdatesIx)({
976
- keeper: buyer,
977
- basket: basket.ownAddress,
978
- rebalanceIntent: rebalanceIntent,
979
- }));
968
+ // let lockDepositsIxs: TransactionInstruction[] = [
969
+ // lockDepositsIx({
970
+ // owner: buyer,
971
+ // basket: basket.ownAddress,
972
+ // })
973
+ // ];
980
974
  let txBatchData = { batches: [
981
975
  [{
982
976
  payer: buyer,
@@ -1023,16 +1017,44 @@ class SymmetryCore {
1023
1017
  lookupTables: [],
1024
1018
  };
1025
1019
  }),
1026
- [{
1020
+ // [{
1021
+ // payer: buyer,
1022
+ // instructions: [
1023
+ // ...lockDepositsIxs,
1024
+ // ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1025
+ // ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1026
+ // ],
1027
+ // lookupTables: [],
1028
+ // }]
1029
+ ] };
1030
+ let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1031
+ let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
1032
+ return txPayloadBatchSequence;
1033
+ });
1034
+ }
1035
+ /**
1036
+ * Locks deposits for a user and starts auction flow.
1037
+ * @param {Object} params - The parameters for the lock deposits.
1038
+ * @param {string} params.buyer - The public key of the buyer.
1039
+ * @param {string} params.basket_mint - The mint public key of the basket.
1040
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1041
+ */
1042
+ lockDepositsTx(params) {
1043
+ return __awaiter(this, void 0, void 0, function* () {
1044
+ let buyer = new web3_js_1.PublicKey(params.buyer);
1045
+ let basket = yield this.fetchBasket((0, pda_1.getBasketState)(new web3_js_1.PublicKey(params.basket_mint)).toBase58());
1046
+ let txBatchData = { batches: [[{
1027
1047
  payer: buyer,
1028
1048
  instructions: [
1029
- ...lockAndStartPriceUpdatesIxs,
1049
+ (0, deposit_1.lockDepositsIx)({
1050
+ owner: buyer,
1051
+ basket: basket.ownAddress,
1052
+ }),
1030
1053
  web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1031
1054
  web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1032
1055
  ],
1033
1056
  lookupTables: [],
1034
- }]
1035
- ] };
1057
+ }]] };
1036
1058
  let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1037
1059
  let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
1038
1060
  return txPayloadBatchSequence;
@@ -1148,20 +1170,6 @@ class SymmetryCore {
1148
1170
  lookupTables: [],
1149
1171
  }],
1150
1172
  ] };
1151
- if (executionStartTime == 0)
1152
- txBatchData.batches.push([{
1153
- payer: seller,
1154
- instructions: [
1155
- (0, priceUpdate_1.startPriceUpdatesIx)({
1156
- keeper: seller,
1157
- basket: basket.ownAddress,
1158
- rebalanceIntent: rebalanceIntent,
1159
- }),
1160
- web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1161
- web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1162
- ],
1163
- lookupTables: [],
1164
- }]);
1165
1173
  let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1166
1174
  let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
1167
1175
  return txPayloadBatchSequence;
@@ -1238,54 +1246,6 @@ class SymmetryCore {
1238
1246
  ],
1239
1247
  lookupTables: [],
1240
1248
  }]] };
1241
- if (executionStartTime == 0)
1242
- txBatchData.batches.push([{
1243
- payer: keeper,
1244
- instructions: [
1245
- (0, priceUpdate_1.startPriceUpdatesIx)({
1246
- keeper: keeper,
1247
- basket: basket.ownAddress,
1248
- rebalanceIntent: rebalanceIntent,
1249
- }),
1250
- web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1251
- web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1252
- ],
1253
- lookupTables: [],
1254
- }]);
1255
- let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1256
- let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
1257
- return txPayloadBatchSequence;
1258
- });
1259
- }
1260
- /**
1261
- * Marks the start of price updates for a rebalance intent. Keepers will be able to
1262
- *
1263
- * update token prices for the rebalance intent after priceUpdateDelayAfterCreation seconds.
1264
- *
1265
- * @param {Object} params - The parameters for the start price updates.
1266
- * @param {string} params.keeper - The public key of the keeper.
1267
- * @param {string} params.basket - The public key of the basket.
1268
- * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1269
- * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1270
- */
1271
- startPriceUpdatesTx(params) {
1272
- return __awaiter(this, void 0, void 0, function* () {
1273
- let keeper = new web3_js_1.PublicKey(params.keeper);
1274
- let basket = new web3_js_1.PublicKey(params.basket);
1275
- let rebalanceIntent = new web3_js_1.PublicKey(params.rebalance_intent);
1276
- let txBatchData = { batches: [[{
1277
- payer: keeper,
1278
- instructions: [
1279
- (0, priceUpdate_1.startPriceUpdatesIx)({
1280
- keeper: keeper,
1281
- basket: basket,
1282
- rebalanceIntent: rebalanceIntent,
1283
- }),
1284
- web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: constants_1.COMPUTE_UNITS }),
1285
- web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.sdkParams.priorityFee }),
1286
- ],
1287
- lookupTables: [],
1288
- }]] };
1289
1249
  let versionedTxs = yield (0, txUtils_1.prepareVersionedTxs)(this.sdkParams.connection, txBatchData);
1290
1250
  let txPayloadBatchSequence = (0, txUtils_1.prepareTxPayloadBatchSequence)(txBatchData, versionedTxs);
1291
1251
  return txPayloadBatchSequence;
@@ -1719,8 +1679,8 @@ class SymmetryCore {
1719
1679
  keepersArray.push(rebalanceIntent.auctionCreationTask.completedBy.toBase58());
1720
1680
  if (!rebalanceIntent.cancelRebalanceTask.completedBy.equals(web3_js_1.PublicKey.default))
1721
1681
  keepersArray.push(rebalanceIntent.cancelRebalanceTask.completedBy.toBase58());
1722
- if (!rebalanceIntent.startPriceUpdateTask.completedBy.equals(web3_js_1.PublicKey.default))
1723
- keepersArray.push(rebalanceIntent.startPriceUpdateTask.completedBy.toBase58());
1682
+ if (!rebalanceIntent.placeholderTask.completedBy.equals(web3_js_1.PublicKey.default))
1683
+ keepersArray.push(rebalanceIntent.placeholderTask.completedBy.toBase58());
1724
1684
  if (!rebalanceIntent.finishPriceUpdateTask.completedBy.equals(web3_js_1.PublicKey.default))
1725
1685
  keepersArray.push(rebalanceIntent.finishPriceUpdateTask.completedBy.toBase58());
1726
1686
  if (!rebalanceIntent.mintBasketTask.completedBy.equals(web3_js_1.PublicKey.default))
@@ -1,10 +1,5 @@
1
1
  import { PublicKey, TransactionInstruction } from '@solana/web3.js';
2
2
  import { OraclePriceOnChain } from '../../layouts/oracle';
3
- export declare function startPriceUpdatesIx(params: {
4
- keeper: PublicKey;
5
- basket: PublicKey;
6
- rebalanceIntent: PublicKey;
7
- }): TransactionInstruction;
8
3
  export declare function updateTokenPricesIx(params: {
9
4
  keeper: PublicKey;
10
5
  basket: PublicKey;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startPriceUpdatesIx = startPriceUpdatesIx;
4
3
  exports.updateTokenPricesIx = updateTokenPricesIx;
5
4
  exports.updateTokenPricesCustomIx = updateTokenPricesCustomIx;
6
5
  const web3_js_1 = require("@solana/web3.js");
@@ -9,24 +8,8 @@ const oracle_1 = require("../../layouts/oracle");
9
8
  const pda_1 = require("../pda");
10
9
  const anchor_1 = require("@coral-xyz/anchor");
11
10
  const spl_token_1 = require("@solana/spl-token");
12
- const START_PRICE_UPDATES_DISCRIMINATOR = Buffer.from([240, 67, 241, 88, 0, 32, 224, 184]);
13
11
  const UPDATE_TOKEN_PRICES_DISCRIMINATOR = Buffer.from([147, 87, 140, 33, 214, 189, 181, 242]);
14
12
  const UPDATE_TOKEN_PRICES_CUSTOM_DISCRIMINATOR = Buffer.from([71, 100, 35, 136, 116, 239, 54, 126]);
15
- function startPriceUpdatesIx(params) {
16
- const keys = [
17
- { pubkey: params.keeper, isSigner: true, isWritable: true },
18
- { pubkey: params.basket, isSigner: false, isWritable: true },
19
- { pubkey: params.rebalanceIntent, isSigner: false, isWritable: true },
20
- { pubkey: (0, pda_1.getGlobalConfigPda)(), isSigner: false, isWritable: false },
21
- ];
22
- const data = START_PRICE_UPDATES_DISCRIMINATOR;
23
- return new web3_js_1.TransactionInstruction({
24
- keys,
25
- programId: constants_1.BASKETS_V3_PROGRAM_ID,
26
- data,
27
- });
28
- }
29
- ;
30
13
  function updateTokenPricesIx(params) {
31
14
  var _a;
32
15
  let globalConfig = (0, pda_1.getGlobalConfigPda)();
@@ -97,7 +97,7 @@ function createEditBasketIntentIx(params) {
97
97
  let startIndex = 0;
98
98
  for (let i = 0; i < config_1.MAX_MANAGERS_PER_BASKET; i++) {
99
99
  editDataBuf.writeUInt16LE(managersWeights[i], startIndex);
100
- if (managers[i] !== web3_js_1.PublicKey.default) {
100
+ if (!managers[i].equals(web3_js_1.PublicKey.default)) {
101
101
  additionalAccounts.push({
102
102
  pubkey: managers[i],
103
103
  isWritable: true,
@@ -360,6 +360,7 @@ function createEditBasketIntentIx(params) {
360
360
  amountFrom: new anchor_1.BN(makeDirectSwapData.amount_from),
361
361
  amountTo: new anchor_1.BN(makeDirectSwapData.amount_to),
362
362
  };
363
+ config_1.MakeDirectSwapLayout.encode(makeDirectSwap, editDataBuf);
363
364
  break;
364
365
  default:
365
366
  break;
@@ -53,9 +53,11 @@ function depositTokensIx(params) {
53
53
  function lockDepositsIx(params) {
54
54
  const { owner, basket } = params;
55
55
  let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, owner);
56
+ let globalConfig = (0, pda_1.getGlobalConfigPda)();
56
57
  const keys = [
57
58
  { pubkey: params.owner, isSigner: true, isWritable: true },
58
59
  { pubkey: rebalanceIntent, isSigner: false, isWritable: true },
60
+ { pubkey: globalConfig, isSigner: false, isWritable: false },
59
61
  ];
60
62
  return new web3_js_1.TransactionInstruction({
61
63
  keys,
@@ -184,7 +184,6 @@ class KeeperMonitor {
184
184
  return __awaiter(this, void 0, void 0, function* () {
185
185
  var _a, _b;
186
186
  let nextCheckTime = 0;
187
- let numTriesStartPriceUpdates = 0;
188
187
  let numTriesUpdatePrices = 0;
189
188
  let numTriesMint = 0;
190
189
  let numTriesRedeemTokens = 0;
@@ -203,31 +202,6 @@ class KeeperMonitor {
203
202
  continue;
204
203
  if (intent.formatted.current_action == "deposit_tokens")
205
204
  continue;
206
- if (intent.formatted.current_action == "start_price_updates") {
207
- if (intent.formatted.execution_start_time > now) {
208
- nextCheckTime = intent.formatted.execution_start_time;
209
- continue;
210
- }
211
- if (numTriesStartPriceUpdates >= 3)
212
- break;
213
- numTriesStartPriceUpdates += 1;
214
- try {
215
- let tx = yield this.params.symmetryCore.startPriceUpdatesTx({
216
- keeper: this.params.wallet.publicKey.toBase58(),
217
- basket: intent.basket.toBase58(),
218
- rebalance_intent: intent.ownAddress.toBase58(),
219
- });
220
- let res = yield this.params.symmetryCore.signAndSendTxPayloadBatchSequence({ txPayloadBatchSequence: tx, wallet: this.params.wallet, simulateTransactions: true });
221
- console.log("Start Price Updates - ", pubkey, " : ", res);
222
- nextCheckTime = (Date.now() / 1000) + 15;
223
- }
224
- catch (e) {
225
- if (numTriesStartPriceUpdates == 3) {
226
- console.log("Stop monitoring - ", pubkey, " : ", e);
227
- }
228
- }
229
- continue;
230
- }
231
205
  if (intent.formatted.current_action == "update_prices" && intent.formatted.last_action_timestamp > now) {
232
206
  nextCheckTime = intent.formatted.last_action_timestamp;
233
207
  continue;
@@ -105,7 +105,7 @@ export interface FormattedBasket {
105
105
  start_price: number;
106
106
  high_watermark: number;
107
107
  active_rebalance: number;
108
- active_deposits: number;
108
+ active_withdraws: number;
109
109
  active_managements: number;
110
110
  last_automation_execution_timestamp: number;
111
111
  creator_settings: FormattedCreatorSettings;
@@ -149,7 +149,7 @@ export interface BasketSettings {
149
149
  startPrice: Fraction;
150
150
  highWaterMark: Fraction;
151
151
  activeRebalance: BN;
152
- activeDeposits: BN;
152
+ activeWithdraws: BN;
153
153
  activeManagements: BN;
154
154
  lastAutomationExecutionTimestamp: BN;
155
155
  managers: ManagerSettings;
@@ -150,7 +150,7 @@ exports.BasketSettingsLayout = (0, borsh_1.struct)([
150
150
  fraction_1.FractionLayout.replicate('startPrice'),
151
151
  fraction_1.FractionLayout.replicate('highWaterMark'),
152
152
  (0, borsh_1.u64)('activeRebalance'),
153
- (0, borsh_1.u64)('activeDeposits'),
153
+ (0, borsh_1.u64)('activeWithdraws'),
154
154
  (0, borsh_1.u64)('activeManagements'),
155
155
  (0, borsh_1.u64)('lastAutomationExecutionTimestamp'),
156
156
  exports.ManagerSettingsLayout.replicate('managers'),
@@ -11,13 +11,6 @@ exports.INTENT_STATUS_STRINGS = new Map([
11
11
  [3, "completed"],
12
12
  ]);
13
13
  exports.TASK_TYPE_STRINGS = new Map([
14
- [0, "unknown"],
15
- [1, "edit_creator"],
16
- [2, "edit_manager_settings"],
17
- [3, "edit_fee_settings"],
18
- [4, "edit_schedule_settings"],
19
- [5, "edit_automation_settings"],
20
- [6, "edit_lp_settings"],
21
14
  [0, "unknown"],
22
15
  [1, "edit_creator"],
23
16
  [2, "edit_manager_settings"],
@@ -29,12 +22,12 @@ exports.TASK_TYPE_STRINGS = new Map([
29
22
  [8, "edit_deposits_settings"],
30
23
  [9, "edit_force_rebalance_settings"],
31
24
  [10, "edit_custom_rebalance_settings"],
32
- [101, "edit_add_token_delay"],
33
- [102, "edit_update_weights_delay"],
34
- [103, "edit_make_direct_swap_delay"],
35
- [201, "add_token"],
36
- [202, "update_weights"],
37
- [203, "make_direct_swap"],
25
+ [11, "edit_add_token_delay"],
26
+ [12, "edit_update_weights_delay"],
27
+ [13, "edit_make_direct_swap_delay"],
28
+ [14, "add_token"],
29
+ [15, "update_weights"],
30
+ [16, "make_direct_swap"],
38
31
  ]);
39
32
  exports.INTENT_TASK_DATA_SIZE = 600;
40
33
  var IntentStatus;
@@ -16,7 +16,7 @@ export declare enum RebalanceType {
16
16
  export declare enum RebalanceAction {
17
17
  NotActive = 0,
18
18
  DepositTokens = 1,
19
- StartPriceUpdates = 2,
19
+ PlaceholderAction = 2,
20
20
  UpdatePrices = 3,
21
21
  Auction = 4
22
22
  }
@@ -41,7 +41,7 @@ export interface TaskCompletion {
41
41
  export declare const TaskCompletionLayout: any;
42
42
  export type FormattedRebalanceType = "deposit" | "withdraw" | "basket" | "basket_custom";
43
43
  export declare const REBALANCE_TYPE_STRINGS: Map<number, FormattedRebalanceType>;
44
- export type FormattedRebalanceAction = "not_active" | "deposit_tokens" | "start_price_updates" | "update_prices" | "auction";
44
+ export type FormattedRebalanceAction = "not_active" | "deposit_tokens" | "placeholder_action" | "update_prices" | "auction";
45
45
  export declare const REBALANCE_ACTION_STRINGS: Map<number, FormattedRebalanceAction>;
46
46
  export interface FormattedOraclePrice {
47
47
  price: number;
@@ -92,7 +92,7 @@ export interface FormattedRebalanceIntent {
92
92
  bounty_left: number;
93
93
  };
94
94
  bounty_adjustment_amount: number;
95
- start_price_update_task: FormattedTaskCompletion;
95
+ placeholder_task: FormattedTaskCompletion;
96
96
  price_update_tasks: FormattedTaskCompletion[];
97
97
  finish_price_update_task: FormattedTaskCompletion;
98
98
  auction_creation_task: FormattedTaskCompletion;
@@ -121,7 +121,7 @@ export interface RebalanceIntent {
121
121
  lastActionTimestamp: BN;
122
122
  bounty: Bounty;
123
123
  bountyAdjustmentAmount: BN;
124
- startPriceUpdateTask: TaskCompletion;
124
+ placeholderTask: TaskCompletion;
125
125
  priceUpdateTasks: TaskCompletion[];
126
126
  finishPriceUpdateTask: TaskCompletion;
127
127
  auctionCreationTask: TaskCompletion;
@@ -19,7 +19,7 @@ var RebalanceAction;
19
19
  (function (RebalanceAction) {
20
20
  RebalanceAction[RebalanceAction["NotActive"] = 0] = "NotActive";
21
21
  RebalanceAction[RebalanceAction["DepositTokens"] = 1] = "DepositTokens";
22
- RebalanceAction[RebalanceAction["StartPriceUpdates"] = 2] = "StartPriceUpdates";
22
+ RebalanceAction[RebalanceAction["PlaceholderAction"] = 2] = "PlaceholderAction";
23
23
  RebalanceAction[RebalanceAction["UpdatePrices"] = 3] = "UpdatePrices";
24
24
  RebalanceAction[RebalanceAction["Auction"] = 4] = "Auction";
25
25
  })(RebalanceAction || (exports.RebalanceAction = RebalanceAction = {}));
@@ -52,7 +52,7 @@ exports.REBALANCE_TYPE_STRINGS = new Map([
52
52
  exports.REBALANCE_ACTION_STRINGS = new Map([
53
53
  [0, "not_active"],
54
54
  [1, "deposit_tokens"],
55
- [2, "start_price_updates"],
55
+ [2, "placeholder_action"],
56
56
  [3, "update_prices"],
57
57
  [4, "auction"],
58
58
  ]);
@@ -78,7 +78,7 @@ exports.RebalanceIntentLayout = (0, borsh_1.struct)([
78
78
  (0, borsh_1.u64)('lastActionTimestamp'),
79
79
  bounty_1.BountyLayout.replicate('bounty'),
80
80
  (0, borsh_1.u64)('bountyAdjustmentAmount'),
81
- exports.TaskCompletionLayout.replicate('startPriceUpdateTask'),
81
+ exports.TaskCompletionLayout.replicate('placeholderTask'),
82
82
  (0, borsh_1.array)(exports.TaskCompletionLayout, constants_1.MAX_SUPPORTED_TOKENS_PER_BASKET, 'priceUpdateTasks'),
83
83
  exports.TaskCompletionLayout.replicate('finishPriceUpdateTask'),
84
84
  exports.TaskCompletionLayout.replicate('auctionCreationTask'),
@@ -266,7 +266,7 @@ function addFieldsToBasket(basket) {
266
266
  start_price: (0, fraction_1.fractionToDecimal)(basket.settings.startPrice).toNumber(),
267
267
  high_watermark: (0, fraction_1.fractionToDecimal)(basket.settings.highWaterMark).toNumber(),
268
268
  active_rebalance: parseInt(basket.settings.activeRebalance.toString()),
269
- active_deposits: parseInt(basket.settings.activeDeposits.toString()),
269
+ active_withdraws: parseInt(basket.settings.activeWithdraws.toString()),
270
270
  active_managements: parseInt(basket.settings.activeManagements.toString()),
271
271
  last_automation_execution_timestamp: parseInt(basket.settings.lastAutomationExecutionTimestamp.toString()),
272
272
  creator_settings: creator_settings,
@@ -24,7 +24,6 @@ const fraction_1 = require("../../layouts/fraction");
24
24
  function decodeTaskDataForType(intent) {
25
25
  let taskType = (0, intent_1.taskTypeFromU8)(intent.taskType);
26
26
  let taskData = intent.taskData;
27
- console.log("intent: ", intent);
28
27
  switch (taskType) {
29
28
  case intent_1.TaskType.EditCreator:
30
29
  let editCreator = config_1.EditCreatorLayout.decode(Buffer.from(taskData.slice(0, config_1.EditCreatorLayout.getSpan())));
@@ -23,7 +23,6 @@ const txUtils_1 = require("../../txUtils");
23
23
  const anchor_1 = require("@coral-xyz/anchor");
24
24
  function computeRebalanceIntentBountyAmount(rebalance_type, num_tokens, bounty_bond, bounty_per_task, bounty_per_price_update_task_max) {
25
25
  let num_tasks = 0;
26
- num_tasks += 1; // StartPriceUpdates;
27
26
  num_tasks += 1; // FinishPriceUpdates;
28
27
  num_tasks += 1; // CancelRebalance;
29
28
  if (rebalance_type == rebalanceIntent_1.RebalanceType.Deposit) {
@@ -120,10 +119,10 @@ function addFieldsToRebalanceIntent(rebalanceIntent) {
120
119
  bounty_left: parseInt(rebalanceIntent.bounty.bountyLeft.toString()),
121
120
  },
122
121
  bounty_adjustment_amount: parseInt(rebalanceIntent.bountyAdjustmentAmount.toString()),
123
- start_price_update_task: {
124
- completed_by: rebalanceIntent.startPriceUpdateTask.completedBy.toBase58(),
125
- completed_bounty: parseInt(rebalanceIntent.startPriceUpdateTask.completedBounty.toString()),
126
- completed_time: parseInt(rebalanceIntent.startPriceUpdateTask.completedTime.toString()),
122
+ placeholder_task: {
123
+ completed_by: rebalanceIntent.placeholderTask.completedBy.toBase58(),
124
+ completed_bounty: parseInt(rebalanceIntent.placeholderTask.completedBounty.toString()),
125
+ completed_time: parseInt(rebalanceIntent.placeholderTask.completedTime.toString()),
127
126
  },
128
127
  price_update_tasks: rebalanceIntent.priceUpdateTasks.map(task => ({
129
128
  completed_by: task.completedBy.toBase58(),
package/dist/test.js CHANGED
@@ -80,7 +80,6 @@ function testStates() {
80
80
  sellBasket: false, // TESTED
81
81
  rebalanceBasket: false, // TESTED
82
82
  rebalanceBasketCustom: false, // NOT TESTED
83
- startPriceUpdates: false, // TESTED
84
83
  updateTokenPrices: false, // TESTED
85
84
  updateTokenPricesCustom: false, // NOT TESTED
86
85
  rebalanceSwapAll: false, // TESTED
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symmetry-hq/temp-v3-sdk",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "Symmetry Baskets V3 SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  } from './constants';
15
15
  import { claimBountyIx } from './instructions/automation/claimBounty';
16
16
  import { flashDepositIx, flashWithdrawIx } from './instructions/automation/flashSwap';
17
- import { startPriceUpdatesIx, updateTokenPricesIx } from './instructions/automation/priceUpdate';
17
+ import { updateTokenPricesIx } from './instructions/automation/priceUpdate';
18
18
  import {
19
19
  cancelRebalanceIx, createRebalanceIntentIx, initRebalanceIntentIx, resizeRebalanceIntentIx
20
20
  } from './instructions/automation/rebalanceIntent';
@@ -1032,18 +1032,12 @@ export class SymmetryCore {
1032
1032
  rebalanceIntentRentPayer = rentPayer;
1033
1033
  let bountyMint = basket.settings.bountyMint;
1034
1034
 
1035
- let lockAndStartPriceUpdatesIxs: TransactionInstruction[] = [
1036
- lockDepositsIx({
1037
- owner: buyer,
1038
- basket: basket.ownAddress,
1039
- })
1040
- ];
1041
- if (executionStartTime == 0)
1042
- lockAndStartPriceUpdatesIxs.push(startPriceUpdatesIx({
1043
- keeper: buyer,
1044
- basket: basket.ownAddress,
1045
- rebalanceIntent: rebalanceIntent,
1046
- }));
1035
+ // let lockDepositsIxs: TransactionInstruction[] = [
1036
+ // lockDepositsIx({
1037
+ // owner: buyer,
1038
+ // basket: basket.ownAddress,
1039
+ // })
1040
+ // ];
1047
1041
 
1048
1042
  let txBatchData: TxBatchData = {batches: [
1049
1043
  [{
@@ -1091,15 +1085,15 @@ export class SymmetryCore {
1091
1085
  lookupTables: [],
1092
1086
  };
1093
1087
  }),
1094
- [{
1095
- payer: buyer,
1096
- instructions: [
1097
- ...lockAndStartPriceUpdatesIxs,
1098
- ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1099
- ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1100
- ],
1101
- lookupTables: [],
1102
- }]
1088
+ // [{
1089
+ // payer: buyer,
1090
+ // instructions: [
1091
+ // ...lockDepositsIxs,
1092
+ // ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1093
+ // ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1094
+ // ],
1095
+ // lookupTables: [],
1096
+ // }]
1103
1097
  ]};
1104
1098
 
1105
1099
  let versionedTxs = await prepareVersionedTxs(this.sdkParams.connection, txBatchData);
@@ -1107,6 +1101,36 @@ export class SymmetryCore {
1107
1101
  return txPayloadBatchSequence;
1108
1102
  }
1109
1103
 
1104
+ /**
1105
+ * Locks deposits for a user and starts auction flow.
1106
+ * @param {Object} params - The parameters for the lock deposits.
1107
+ * @param {string} params.buyer - The public key of the buyer.
1108
+ * @param {string} params.basket_mint - The mint public key of the basket.
1109
+ * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1110
+ */
1111
+ async lockDepositsTx(params: {
1112
+ buyer: string,
1113
+ basket_mint: string,
1114
+ }): Promise<TxPayloadBatchSequence> {
1115
+ let buyer = new PublicKey(params.buyer);
1116
+ let basket = await this.fetchBasket(getBasketState(new PublicKey(params.basket_mint)).toBase58());
1117
+ let txBatchData: TxBatchData = {batches: [[{
1118
+ payer: buyer,
1119
+ instructions: [
1120
+ lockDepositsIx({
1121
+ owner: buyer,
1122
+ basket: basket.ownAddress,
1123
+ }),
1124
+ ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1125
+ ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1126
+ ],
1127
+ lookupTables: [],
1128
+ }]]};
1129
+ let versionedTxs = await prepareVersionedTxs(this.sdkParams.connection, txBatchData);
1130
+ let txPayloadBatchSequence = prepareTxPayloadBatchSequence(txBatchData, versionedTxs);
1131
+ return txPayloadBatchSequence;
1132
+ }
1133
+
1110
1134
  /**
1111
1135
  * Creates a rebalance intent for a user to withdraw tokens from a basket.
1112
1136
  * @param {{Object}} params - The parameters for the basket sale.
@@ -1250,21 +1274,6 @@ export class SymmetryCore {
1250
1274
  }],
1251
1275
  ]};
1252
1276
 
1253
- if (executionStartTime == 0)
1254
- txBatchData.batches.push([{
1255
- payer: seller,
1256
- instructions: [
1257
- startPriceUpdatesIx({
1258
- keeper: seller,
1259
- basket: basket.ownAddress,
1260
- rebalanceIntent: rebalanceIntent,
1261
- }),
1262
- ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1263
- ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1264
- ],
1265
- lookupTables: [],
1266
- }]);
1267
-
1268
1277
  let versionedTxs = await prepareVersionedTxs(this.sdkParams.connection, txBatchData);
1269
1278
  let txPayloadBatchSequence = prepareTxPayloadBatchSequence(txBatchData, versionedTxs);
1270
1279
  return txPayloadBatchSequence;
@@ -1366,58 +1375,6 @@ export class SymmetryCore {
1366
1375
  lookupTables: [],
1367
1376
  }]]};
1368
1377
 
1369
- if (executionStartTime == 0)
1370
- txBatchData.batches.push([{
1371
- payer: keeper,
1372
- instructions: [
1373
- startPriceUpdatesIx({
1374
- keeper: keeper,
1375
- basket: basket.ownAddress,
1376
- rebalanceIntent: rebalanceIntent,
1377
- }),
1378
- ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1379
- ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1380
- ],
1381
- lookupTables: [],
1382
- }]);
1383
-
1384
- let versionedTxs = await prepareVersionedTxs(this.sdkParams.connection, txBatchData);
1385
- let txPayloadBatchSequence = prepareTxPayloadBatchSequence(txBatchData, versionedTxs);
1386
- return txPayloadBatchSequence;
1387
- }
1388
-
1389
- /**
1390
- * Marks the start of price updates for a rebalance intent. Keepers will be able to
1391
- *
1392
- * update token prices for the rebalance intent after priceUpdateDelayAfterCreation seconds.
1393
- *
1394
- * @param {Object} params - The parameters for the start price updates.
1395
- * @param {string} params.keeper - The public key of the keeper.
1396
- * @param {string} params.basket - The public key of the basket.
1397
- * @param {string} params.rebalance_intent - The public key of the rebalance intent.
1398
- * @returns {Promise<TxPayloadBatchSequence>} The transaction payload batch sequence.
1399
- */
1400
- async startPriceUpdatesTx(params: {
1401
- keeper: string,
1402
- basket: string,
1403
- rebalance_intent: string,
1404
- }): Promise<TxPayloadBatchSequence> {
1405
- let keeper = new PublicKey(params.keeper);
1406
- let basket = new PublicKey(params.basket);
1407
- let rebalanceIntent = new PublicKey(params.rebalance_intent);
1408
- let txBatchData: TxBatchData = {batches: [[{
1409
- payer: keeper,
1410
- instructions: [
1411
- startPriceUpdatesIx({
1412
- keeper: keeper,
1413
- basket: basket,
1414
- rebalanceIntent: rebalanceIntent,
1415
- }),
1416
- ComputeBudgetProgram.setComputeUnitLimit({units: COMPUTE_UNITS}),
1417
- ComputeBudgetProgram.setComputeUnitPrice({microLamports: this.sdkParams.priorityFee}),
1418
- ],
1419
- lookupTables: [],
1420
- }]]};
1421
1378
  let versionedTxs = await prepareVersionedTxs(this.sdkParams.connection, txBatchData);
1422
1379
  let txPayloadBatchSequence = prepareTxPayloadBatchSequence(txBatchData, versionedTxs);
1423
1380
  return txPayloadBatchSequence;
@@ -1891,8 +1848,8 @@ export class SymmetryCore {
1891
1848
  keepersArray.push(rebalanceIntent.auctionCreationTask.completedBy.toBase58());
1892
1849
  if (!rebalanceIntent.cancelRebalanceTask.completedBy.equals(PublicKey.default))
1893
1850
  keepersArray.push(rebalanceIntent.cancelRebalanceTask.completedBy.toBase58());
1894
- if (!rebalanceIntent.startPriceUpdateTask.completedBy.equals(PublicKey.default))
1895
- keepersArray.push(rebalanceIntent.startPriceUpdateTask.completedBy.toBase58());
1851
+ if (!rebalanceIntent.placeholderTask.completedBy.equals(PublicKey.default))
1852
+ keepersArray.push(rebalanceIntent.placeholderTask.completedBy.toBase58());
1896
1853
  if (!rebalanceIntent.finishPriceUpdateTask.completedBy.equals(PublicKey.default))
1897
1854
  keepersArray.push(rebalanceIntent.finishPriceUpdateTask.completedBy.toBase58());
1898
1855
  if (!rebalanceIntent.mintBasketTask.completedBy.equals(PublicKey.default))
@@ -8,35 +8,10 @@ import { getAta, getBasketFeesPda, getGlobalConfigPda, getRebalanceIntentPda } f
8
8
  import { BN } from '@coral-xyz/anchor';
9
9
  import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
10
10
 
11
- const START_PRICE_UPDATES_DISCRIMINATOR = Buffer.from([240, 67, 241, 88, 0, 32, 224, 184]);
12
11
  const UPDATE_TOKEN_PRICES_DISCRIMINATOR = Buffer.from([147, 87, 140, 33, 214, 189, 181, 242]);
13
12
  const UPDATE_TOKEN_PRICES_CUSTOM_DISCRIMINATOR = Buffer.from([71, 100, 35, 136, 116, 239, 54, 126]);
14
13
 
15
14
 
16
- export function startPriceUpdatesIx(params: {
17
- keeper: PublicKey,
18
- basket: PublicKey,
19
- rebalanceIntent: PublicKey
20
- }): TransactionInstruction {
21
-
22
- const keys = [
23
- { pubkey: params.keeper, isSigner: true, isWritable: true },
24
- { pubkey: params.basket, isSigner: false, isWritable: true },
25
- { pubkey: params.rebalanceIntent, isSigner: false, isWritable: true },
26
- { pubkey: getGlobalConfigPda(), isSigner: false, isWritable: false },
27
- ];
28
-
29
- const data = START_PRICE_UPDATES_DISCRIMINATOR;
30
-
31
- return new TransactionInstruction({
32
- keys,
33
- programId: BASKETS_V3_PROGRAM_ID,
34
- data,
35
- });
36
- };
37
-
38
-
39
-
40
15
  export function updateTokenPricesIx(params: {
41
16
  keeper: PublicKey,
42
17
  basket: PublicKey,
@@ -15,7 +15,7 @@ import {
15
15
  AuthorityBitmasks,
16
16
  AuthorityBitmasksLayout,
17
17
  AutomationSettings, AutomationSettingsLayout, EditAddTokenDelay, EditAddTokenDelayLayout, EditCreator, EditCreatorLayout, EditMakeDirectSwapDelay, EditMakeDirectSwapDelayLayout, EditUpdateWeightsDelay, EditUpdateWeightsDelayLayout, FeeSettings, FeeSettingsLayout, LpSettings,
18
- LpSettingsLayout, MakeDirectSwap, ManagerSettings, ManagerSettingsLayout, MAX_MANAGERS_PER_BASKET,
18
+ LpSettingsLayout, MakeDirectSwap, MakeDirectSwapLayout, ManagerSettings, ManagerSettingsLayout, MAX_MANAGERS_PER_BASKET,
19
19
  MetadataParams,
20
20
  MetadataSettings, MetadataSettingsLayout, ScheduleSettings, ScheduleSettingsLayout,
21
21
  UpdateWeights,
@@ -164,7 +164,7 @@ export function createEditBasketIntentIx(params: {
164
164
  let startIndex = 0;
165
165
  for (let i = 0; i < MAX_MANAGERS_PER_BASKET; i++) {
166
166
  editDataBuf.writeUInt16LE(managersWeights[i], startIndex);
167
- if (managers[i] !== PublicKey.default) {
167
+ if (!managers[i].equals(PublicKey.default)) {
168
168
  additionalAccounts.push({
169
169
  pubkey: managers[i],
170
170
  isWritable: true,
@@ -443,6 +443,7 @@ export function createEditBasketIntentIx(params: {
443
443
  amountFrom: new BN(makeDirectSwapData.amount_from),
444
444
  amountTo: new BN(makeDirectSwapData.amount_to),
445
445
  }
446
+ MakeDirectSwapLayout.encode(makeDirectSwap, editDataBuf);
446
447
  break;
447
448
 
448
449
  default:
@@ -81,10 +81,12 @@ export function lockDepositsIx(params: {
81
81
  }): TransactionInstruction {
82
82
  const { owner, basket } = params;
83
83
  let rebalanceIntent = getRebalanceIntentPda(basket, owner);
84
+ let globalConfig = getGlobalConfigPda();
84
85
 
85
86
  const keys = [
86
87
  { pubkey: params.owner, isSigner: true , isWritable: true},
87
88
  { pubkey: rebalanceIntent, isSigner: false, isWritable: true },
89
+ { pubkey: globalConfig, isSigner: false, isWritable: false },
88
90
  ];
89
91
 
90
92
  return new TransactionInstruction({
@@ -167,7 +167,6 @@ export class KeeperMonitor {
167
167
 
168
168
  async monitorRebalanceIntent(pubkey: string) {
169
169
  let nextCheckTime = 0;
170
- let numTriesStartPriceUpdates = 0;
171
170
  let numTriesUpdatePrices = 0;
172
171
  let numTriesMint = 0;
173
172
  let numTriesRedeemTokens = 0;
@@ -183,22 +182,6 @@ export class KeeperMonitor {
183
182
  nextCheckTime = now + 35;
184
183
  if (intent.formatted!.current_action == "not_active") continue;
185
184
  if (intent.formatted!.current_action == "deposit_tokens") continue;
186
- if (intent.formatted!.current_action == "start_price_updates") {
187
- if (intent.formatted!.execution_start_time > now)
188
- { nextCheckTime = intent.formatted!.execution_start_time; continue; }
189
- if (numTriesStartPriceUpdates >= 3) break;
190
- numTriesStartPriceUpdates += 1; try {
191
- let tx = await this.params.symmetryCore.startPriceUpdatesTx({
192
- keeper: this.params.wallet.publicKey.toBase58(),
193
- basket: intent.basket.toBase58(),
194
- rebalance_intent: intent.ownAddress!.toBase58(),
195
- });
196
- let res = await this.params.symmetryCore.signAndSendTxPayloadBatchSequence({txPayloadBatchSequence: tx, wallet: this.params.wallet, simulateTransactions: true});
197
- console.log("Start Price Updates - ", pubkey, " : ", res);
198
- nextCheckTime = (Date.now() / 1000) + 15;
199
- } catch (e) { if (numTriesStartPriceUpdates == 3) { console.log("Stop monitoring - ", pubkey, " : ", e); } }
200
- continue;
201
- }
202
185
  if (intent.formatted!.current_action == "update_prices" && intent.formatted!.last_action_timestamp > now)
203
186
  { nextCheckTime = intent.formatted!.last_action_timestamp; continue; }
204
187
  if (intent.formatted!.current_action == "update_prices") {
@@ -100,7 +100,7 @@ export interface FormattedBasket {
100
100
  start_price: number;
101
101
  high_watermark: number;
102
102
  active_rebalance: number;
103
- active_deposits: number;
103
+ active_withdraws: number;
104
104
  active_managements: number;
105
105
  last_automation_execution_timestamp: number;
106
106
  creator_settings: FormattedCreatorSettings;
@@ -295,7 +295,7 @@ export interface BasketSettings {
295
295
  highWaterMark: Fraction,
296
296
 
297
297
  activeRebalance: BN; // u64
298
- activeDeposits: BN; // u64
298
+ activeWithdraws: BN; // u64
299
299
  activeManagements: BN; // u64
300
300
 
301
301
  lastAutomationExecutionTimestamp: BN; // u64
@@ -365,7 +365,7 @@ export const BasketSettingsLayout = struct<BasketSettings>([
365
365
  FractionLayout.replicate('highWaterMark'),
366
366
 
367
367
  u64('activeRebalance'),
368
- u64('activeDeposits'),
368
+ u64('activeWithdraws'),
369
369
  u64('activeManagements'),
370
370
 
371
371
  u64('lastAutomationExecutionTimestamp'),
@@ -15,13 +15,6 @@ export const INTENT_STATUS_STRINGS: Map<number, FormattedIntentStatus> = new Map
15
15
 
16
16
  export type FormattedTaskType = "unknown" | "edit_creator" | "edit_manager_settings" | "edit_fee_settings" | "edit_schedule_settings" | "edit_automation_settings" | "edit_lp_settings" | "edit_metadata_settings" | "edit_deposits_settings" | "edit_force_rebalance_settings" | "edit_custom_rebalance_settings" | "edit_add_token_delay" | "edit_update_weights_delay" | "edit_make_direct_swap_delay" | "add_token" | "update_weights" | "make_direct_swap";
17
17
  export const TASK_TYPE_STRINGS: Map<number, FormattedTaskType> = new Map([
18
- [0, "unknown"],
19
- [1, "edit_creator"],
20
- [2, "edit_manager_settings"],
21
- [3, "edit_fee_settings"],
22
- [4, "edit_schedule_settings"],
23
- [5, "edit_automation_settings"],
24
- [6, "edit_lp_settings"],
25
18
  [0, "unknown"],
26
19
  [1, "edit_creator"],
27
20
  [2, "edit_manager_settings"],
@@ -33,12 +26,12 @@ export const TASK_TYPE_STRINGS: Map<number, FormattedTaskType> = new Map([
33
26
  [8, "edit_deposits_settings"],
34
27
  [9, "edit_force_rebalance_settings"],
35
28
  [10, "edit_custom_rebalance_settings"],
36
- [101, "edit_add_token_delay"],
37
- [102, "edit_update_weights_delay"],
38
- [103, "edit_make_direct_swap_delay"],
39
- [201, "add_token"],
40
- [202, "update_weights"],
41
- [203, "make_direct_swap"],
29
+ [11, "edit_add_token_delay"],
30
+ [12, "edit_update_weights_delay"],
31
+ [13, "edit_make_direct_swap_delay"],
32
+ [14, "add_token"],
33
+ [15, "update_weights"],
34
+ [16, "make_direct_swap"],
42
35
  ]);
43
36
 
44
37
  export interface FormattedBountySchedule {
@@ -19,7 +19,7 @@ export enum RebalanceType {
19
19
  export enum RebalanceAction {
20
20
  NotActive,
21
21
  DepositTokens,
22
- StartPriceUpdates,
22
+ PlaceholderAction,
23
23
  UpdatePrices,
24
24
  Auction
25
25
  };
@@ -70,11 +70,11 @@ export const REBALANCE_TYPE_STRINGS: Map<number, FormattedRebalanceType> = new M
70
70
  [3, "basket_custom"],
71
71
  ]);
72
72
 
73
- export type FormattedRebalanceAction = "not_active" | "deposit_tokens" | "start_price_updates" | "update_prices" | "auction";
73
+ export type FormattedRebalanceAction = "not_active" | "deposit_tokens" | "placeholder_action" | "update_prices" | "auction";
74
74
  export const REBALANCE_ACTION_STRINGS: Map<number, FormattedRebalanceAction> = new Map([
75
75
  [0, "not_active"],
76
76
  [1, "deposit_tokens"],
77
- [2, "start_price_updates"],
77
+ [2, "placeholder_action"],
78
78
  [3, "update_prices"],
79
79
  [4, "auction"],
80
80
  ]);
@@ -131,7 +131,7 @@ export interface FormattedRebalanceIntent {
131
131
  bounty_left: number;
132
132
  };
133
133
  bounty_adjustment_amount: number;
134
- start_price_update_task: FormattedTaskCompletion;
134
+ placeholder_task: FormattedTaskCompletion;
135
135
  price_update_tasks: FormattedTaskCompletion[];
136
136
  finish_price_update_task: FormattedTaskCompletion;
137
137
  auction_creation_task: FormattedTaskCompletion;
@@ -165,7 +165,7 @@ export interface RebalanceIntent {
165
165
  bounty: Bounty; // u64
166
166
  bountyAdjustmentAmount: BN; // u64
167
167
 
168
- startPriceUpdateTask: TaskCompletion;
168
+ placeholderTask: TaskCompletion;
169
169
  priceUpdateTasks: TaskCompletion[]; // MAX_SUPPORTED_TOKENS_PER_BASKET
170
170
  finishPriceUpdateTask: TaskCompletion;
171
171
 
@@ -206,7 +206,7 @@ export const RebalanceIntentLayout = struct<RebalanceIntent>([
206
206
  BountyLayout.replicate('bounty'),
207
207
  u64('bountyAdjustmentAmount'),
208
208
 
209
- TaskCompletionLayout.replicate('startPriceUpdateTask'),
209
+ TaskCompletionLayout.replicate('placeholderTask'),
210
210
  array(TaskCompletionLayout, MAX_SUPPORTED_TOKENS_PER_BASKET, 'priceUpdateTasks'),
211
211
  TaskCompletionLayout.replicate('finishPriceUpdateTask'),
212
212
 
@@ -275,7 +275,7 @@ export function addFieldsToBasket(basket: Basket): Basket {
275
275
  start_price: fractionToDecimal(basket.settings.startPrice).toNumber(),
276
276
  high_watermark: fractionToDecimal(basket.settings.highWaterMark).toNumber(),
277
277
  active_rebalance: parseInt(basket.settings.activeRebalance.toString()),
278
- active_deposits: parseInt(basket.settings.activeDeposits.toString()),
278
+ active_withdraws: parseInt(basket.settings.activeWithdraws.toString()),
279
279
  active_managements: parseInt(basket.settings.activeManagements.toString()),
280
280
  last_automation_execution_timestamp: parseInt(basket.settings.lastAutomationExecutionTimestamp.toString()),
281
281
  creator_settings: creator_settings,
@@ -16,7 +16,6 @@ import { fractionToDecimal } from '../../layouts/fraction';
16
16
  function decodeTaskDataForType(intent: Intent): Settings {
17
17
  let taskType = taskTypeFromU8(intent.taskType);
18
18
  let taskData = intent.taskData;
19
- console.log("intent: ", intent);
20
19
  switch (taskType) {
21
20
  case TaskType.EditCreator:
22
21
  let editCreator: EditCreator = EditCreatorLayout.decode(Buffer.from(taskData.slice(0, EditCreatorLayout.getSpan())));
@@ -16,7 +16,6 @@ export function computeRebalanceIntentBountyAmount(
16
16
  bounty_per_price_update_task_max: number,
17
17
  ): number {
18
18
  let num_tasks = 0;
19
- num_tasks += 1; // StartPriceUpdates;
20
19
  num_tasks += 1; // FinishPriceUpdates;
21
20
  num_tasks += 1; // CancelRebalance;
22
21
  if (rebalance_type == RebalanceType.Deposit) {
@@ -118,10 +117,10 @@ export function addFieldsToRebalanceIntent(rebalanceIntent: RebalanceIntent): Re
118
117
  bounty_left: parseInt(rebalanceIntent.bounty.bountyLeft.toString()),
119
118
  },
120
119
  bounty_adjustment_amount: parseInt(rebalanceIntent.bountyAdjustmentAmount.toString()),
121
- start_price_update_task: {
122
- completed_by: rebalanceIntent.startPriceUpdateTask.completedBy.toBase58(),
123
- completed_bounty: parseInt(rebalanceIntent.startPriceUpdateTask.completedBounty.toString()),
124
- completed_time: parseInt(rebalanceIntent.startPriceUpdateTask.completedTime.toString()),
120
+ placeholder_task: {
121
+ completed_by: rebalanceIntent.placeholderTask.completedBy.toBase58(),
122
+ completed_bounty: parseInt(rebalanceIntent.placeholderTask.completedBounty.toString()),
123
+ completed_time: parseInt(rebalanceIntent.placeholderTask.completedTime.toString()),
125
124
  },
126
125
  price_update_tasks: rebalanceIntent.priceUpdateTasks.map(task => ({
127
126
  completed_by: task.completedBy.toBase58(),
package/test.ts CHANGED
@@ -89,7 +89,6 @@ async function testStates() {
89
89
  rebalanceBasket: false, // TESTED
90
90
  rebalanceBasketCustom: false, // NOT TESTED
91
91
 
92
- startPriceUpdates: false, // TESTED
93
92
  updateTokenPrices: false, // TESTED
94
93
  updateTokenPricesCustom: false, // NOT TESTED
95
94