@elemental-stv-core/sdk 0.9.3 → 0.11.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.
Files changed (38) hide show
  1. package/dist/common/buffer.d.ts +3 -0
  2. package/dist/common/buffer.js +19 -0
  3. package/dist/elemental-lend/instructions.d.ts +14 -0
  4. package/dist/elemental-lend/instructions.js +18 -6
  5. package/dist/elemental-lend/protocol-actions.d.ts +6 -0
  6. package/dist/elemental-lend/protocol-actions.js +21 -10
  7. package/dist/jlpd-strategy/accounts.d.ts +4 -1
  8. package/dist/jlpd-strategy/accounts.js +6 -1
  9. package/dist/jlpd-strategy/adapter.d.ts +16 -6
  10. package/dist/jlpd-strategy/adapter.js +21 -9
  11. package/dist/jlpd-strategy/base-to-base-swap.d.ts +74 -0
  12. package/dist/jlpd-strategy/base-to-base-swap.js +199 -0
  13. package/dist/jlpd-strategy/constants.d.ts +11 -3
  14. package/dist/jlpd-strategy/constants.js +19 -10
  15. package/dist/jlpd-strategy/index.d.ts +1 -0
  16. package/dist/jlpd-strategy/index.js +1 -0
  17. package/dist/jlpd-strategy/instructions.d.ts +49 -0
  18. package/dist/jlpd-strategy/instructions.js +55 -0
  19. package/dist/jlpd-strategy/jlp-data.d.ts +11 -0
  20. package/dist/jlpd-strategy/jlp-data.js +15 -0
  21. package/dist/jlpd-strategy/settle-yield.d.ts +20 -1
  22. package/dist/jlpd-strategy/settle-yield.js +9 -6
  23. package/dist/jlpd-strategy/swap-jlp.d.ts +26 -0
  24. package/dist/jlpd-strategy/swap-jlp.js +74 -10
  25. package/dist/jlpd-strategy/types.d.ts +3 -1
  26. package/dist/p-stv-core/accounts.d.ts +38 -3
  27. package/dist/p-stv-core/accounts.js +93 -2
  28. package/dist/p-stv-core/constants.d.ts +37 -2
  29. package/dist/p-stv-core/constants.js +41 -4
  30. package/dist/p-stv-core/events.js +49 -10
  31. package/dist/p-stv-core/instructions.d.ts +245 -2
  32. package/dist/p-stv-core/instructions.js +226 -13
  33. package/dist/p-stv-core/pda.d.ts +15 -0
  34. package/dist/p-stv-core/pda.js +25 -0
  35. package/dist/p-stv-core/remaining-accounts.d.ts +4 -1
  36. package/dist/p-stv-core/remaining-accounts.js +17 -2
  37. package/dist/p-stv-core/types.d.ts +74 -4
  38. package/package.json +1 -1
@@ -23,6 +23,7 @@ const constants_2 = require("../p-stv-core/constants");
23
23
  const pda_3 = require("../elemental-lend/pda");
24
24
  const jupiter_lend_1 = require("../elemental-lend/jupiter-lend");
25
25
  const instructions_2 = require("../elemental-lend/instructions");
26
+ const accounts_3 = require("../elemental-lend/accounts");
26
27
  // ---------------------------------------------------------------------------
27
28
  // Helpers
28
29
  // ---------------------------------------------------------------------------
@@ -33,7 +34,7 @@ const JUPITER_API_BASE = "https://api.jup.ag/swap/v1";
33
34
  * limits. Read once instead of per-call so the env var is consistent across
34
35
  * the lifetime of the process.
35
36
  */
36
- const JUPITER_API_KEY = process.env.NEXT_PUBLIC_JUPITER_API_KEY;
37
+ const JUPITER_API_KEY = process.env.NEXT_PUBLIC_JUPITER_API_KEY ?? process.env.JUPITER_API_KEY;
37
38
  function toBigInt(v) {
38
39
  if (typeof v === "bigint")
39
40
  return v;
@@ -53,7 +54,7 @@ function toBigInt(v) {
53
54
  * 4-byte jupiter_data_len (LE), ...jupiter_data_bytes]
54
55
  */
55
56
  function createSwapJlpIx(args, programId = constants_1.PROGRAM_ID) {
56
- const { manager, config, managerRole, strategyState, strategyBaseAta, strategyJlpAta, vaultJlpAta, baseMint, jlpMint, tokenProgram, jupiterProgram, direction, amount, minOut, jupiterData, remainingAccounts = [], } = args;
57
+ const { manager, config, managerRole, strategyState, strategyBaseAta, strategyJlpAta, vaultJlpAta, baseMint, jlpMint, tokenProgram, jupiterProgram, priceOracle, jlpPool, jlpMintAccount, direction, amount, minOut, jupiterData, remainingAccounts = [], } = args;
57
58
  const amountBi = toBigInt(amount);
58
59
  const minOutBi = toBigInt(minOut);
59
60
  // Serialize instruction data
@@ -83,11 +84,22 @@ function createSwapJlpIx(args, programId = constants_1.PROGRAM_ID) {
83
84
  { pubkey: jlpMint, isSigner: false, isWritable: false },
84
85
  { pubkey: tokenProgram, isSigner: false, isWritable: false },
85
86
  { pubkey: jupiterProgram, isSigner: false, isWritable: false },
87
+ { pubkey: priceOracle, isSigner: false, isWritable: false },
88
+ { pubkey: jlpPool, isSigner: false, isWritable: false },
89
+ { pubkey: jlpMintAccount, isSigner: false, isWritable: false },
86
90
  ...remainingAccounts,
87
91
  ];
88
92
  return new web3_js_1.TransactionInstruction({ keys, programId, data });
89
93
  }
90
94
  // ---------------------------------------------------------------------------
95
+ // Stable-asset detection
96
+ // ---------------------------------------------------------------------------
97
+ /** Mints that use a hardcoded $1 price on-chain (oracle account ignored). */
98
+ const STABLE_MINTS = new Set(constants_1.JLPD_POOLS.filter((p) => p.name === "USDC" || p.name === "JupUSD").map((p) => p.mint));
99
+ function isStableMint(mint) {
100
+ return STABLE_MINTS.has(mint.toBase58());
101
+ }
102
+ // ---------------------------------------------------------------------------
91
103
  // Jupiter API helpers
92
104
  // ---------------------------------------------------------------------------
93
105
  /**
@@ -123,9 +135,13 @@ async function getJupiterSwapQuote(args) {
123
135
  *
124
136
  * @param quoteResponse The quote from getJupiterSwapQuote
125
137
  * @param userPublicKey The account that signs the swap -- for JLPD this is the strategy_state PDA
138
+ * @param destinationTokenAccount Optional override for the destination token account.
139
+ * For base_to_base_swap: must be base_out_ata (ATA owned by strategy_state_OUT) so
140
+ * Jupiter routes output tokens there instead of to userPublicKey's default ATA.
141
+ * For swap_jlp: omit — Jupiter defaults destination to userPublicKey's ATA which is correct.
126
142
  */
127
143
  async function getJupiterSwapInstructions(args) {
128
- const { quoteResponse, userPublicKey } = args;
144
+ const { quoteResponse, userPublicKey, destinationTokenAccount } = args;
129
145
  const url = `${JUPITER_API_BASE}/swap-instructions`;
130
146
  const body = {
131
147
  quoteResponse,
@@ -134,6 +150,9 @@ async function getJupiterSwapInstructions(args) {
134
150
  dynamicComputeUnitLimit: true,
135
151
  skipUserAccountsRpcCalls: true,
136
152
  };
153
+ if (destinationTokenAccount !== undefined) {
154
+ body["destinationTokenAccount"] = destinationTokenAccount.toBase58();
155
+ }
137
156
  const headers = {
138
157
  "Content-Type": "application/json",
139
158
  };
@@ -214,22 +233,53 @@ async function buildSwapJlpTransaction(args) {
214
233
  const strategyBaseAta = (0, ata_1.findAta)(baseMint, strategyState, tokenProgram);
215
234
  const strategyJlpAta = (0, ata_1.findAta)(jlpMint, strategyState, tokenProgram);
216
235
  const vaultJlpAta = (0, ata_1.findAta)(jlpMint, config, tokenProgram);
217
- // 2. Determine input/output mints for the Jupiter quote
236
+ // 2. Resolve oracle + pending swap_arb. Fetch the strategy state once if we need
237
+ // the stored price_oracle (volatile asset, no override) OR swap_arb (BaseToJlp).
238
+ const needOracleFetch = !isStableMint(baseMint) && args.priceOracle === undefined;
239
+ const needArb = direction === "BaseToJlp";
240
+ const state = needOracleFetch || needArb
241
+ ? await (0, accounts_1.fetchJlpStrategyState)(connection, baseMint, programId)
242
+ : null;
243
+ let priceOracle;
244
+ if (isStableMint(baseMint)) {
245
+ priceOracle = web3_js_1.PublicKey.default;
246
+ }
247
+ else if (args.priceOracle !== undefined) {
248
+ priceOracle = args.priceOracle;
249
+ }
250
+ else {
251
+ priceOracle = state.priceOracle;
252
+ }
253
+ // 3. BaseToJlp folds pending swap_arb into the Jupiter input:
254
+ // total_in = amount + swap_arb (signed; an unfavorable b2b banked a negative
255
+ // deficit that reduces it). The on-chain handler pins base-spent == total_in,
256
+ // so the Jupiter route MUST be quoted for total_in. The instruction `amount`
257
+ // stays = principal (the program credits base_loaned with principal only).
258
+ let quoteAmount = amount;
259
+ if (direction === "BaseToJlp" && state) {
260
+ const arb = BigInt(state.swapArb.toString()); // signed i64
261
+ const totalIn = amount + arb;
262
+ if (totalIn <= 0n) {
263
+ throw new Error(`swap_arb deficit (${arb}) cancels principal (${amount}); cannot Base->JLP — wait for a settle or larger amount.`);
264
+ }
265
+ quoteAmount = totalIn;
266
+ }
267
+ // 4. Determine input/output mints for the Jupiter quote
218
268
  const inputMint = direction === "BaseToJlp" ? baseMint : jlpMint;
219
269
  const outputMint = direction === "BaseToJlp" ? jlpMint : baseMint;
220
- // 3. Get Jupiter quote
270
+ // 5. Get Jupiter quote (for total_in on BaseToJlp; principal otherwise)
221
271
  const quote = await getJupiterSwapQuote({
222
272
  inputMint,
223
273
  outputMint,
224
- amount,
274
+ amount: quoteAmount,
225
275
  slippageBps,
226
276
  });
227
- // 4. Get Jupiter swap instructions (strategy_state PDA signs via CPI)
277
+ // 5. Get Jupiter swap instructions (strategy_state PDA signs via CPI)
228
278
  const jupSwap = await getJupiterSwapInstructions({
229
279
  quoteResponse: quote,
230
280
  userPublicKey: strategyState,
231
281
  });
232
- // 5. Build the swap_jlp instruction
282
+ // 6. Build the swap_jlp instruction
233
283
  const minOut = BigInt(quote.otherAmountThreshold);
234
284
  const swapJlpIx = createSwapJlpIx({
235
285
  manager,
@@ -243,13 +293,16 @@ async function buildSwapJlpTransaction(args) {
243
293
  jlpMint,
244
294
  tokenProgram,
245
295
  jupiterProgram: constants_1.JUPITER_PROGRAM,
296
+ priceOracle,
297
+ jlpPool: constants_1.JLP_POOL_ACCOUNT,
298
+ jlpMintAccount: jlpMint,
246
299
  direction,
247
300
  amount,
248
301
  minOut,
249
302
  jupiterData: jupSwap.swapInstructionData,
250
303
  remainingAccounts: jupSwap.remainingAccounts,
251
304
  }, programId);
252
- // 6. Fetch ALTs
305
+ // 7. Fetch ALTs
253
306
  const addressLookupTables = await fetchAddressLookupTables(connection, jupSwap.addressLookupTableAddresses);
254
307
  return {
255
308
  instructions: [swapJlpIx],
@@ -401,8 +454,12 @@ async function buildJlpToBaseRebalance(args) {
401
454
  const [jlpdStvPosition] = (0, pda_1.findStvPositionPda)(stvAddress, programId);
402
455
  const strategyBaseAta = (0, ata_1.findAta)(baseMint, strategyState, tokenProgram);
403
456
  const vaultAta = (0, ata_1.findAta)(baseMint, stvAddress, tokenProgram);
404
- // Build lend remaining_accounts for auto-sweep after withdraw
457
+ // Build lend remaining_accounts for auto-sweep after withdraw:
458
+ // [4 fixed lend, protocolAumCount protocol-AUM accounts]
459
+ // The protocol-AUM accounts feed the pre-sweep update_aum refresh; on-chain lend
460
+ // rejects an incomplete tail, so we must cover the strategy's full protocol set.
405
461
  const lendAccounts = [];
462
+ let lendProtocolAumCount = 0;
406
463
  const DEFAULT_PUBKEY = web3_js_1.PublicKey.default;
407
464
  if (!stv.lendProgram.equals(DEFAULT_PUBKEY)) {
408
465
  const [lendStrategyState] = (0, pda_3.findStrategyStatePda)(baseMint, stv.lendProgram);
@@ -414,6 +471,12 @@ async function buildJlpToBaseRebalance(args) {
414
471
  lendStvPosition: lendPosition,
415
472
  lendBaseAta,
416
473
  }));
474
+ const lendState = await (0, accounts_3.fetchLendStrategyState)(connection, baseMint, stv.lendProgram).catch(() => null);
475
+ if (lendState) {
476
+ const protocolAumAccounts = await (0, accounts_3.buildProtocolAccountsForAum)(connection, lendState, lendStrategyState, tokenProgram);
477
+ lendProtocolAumCount = protocolAumAccounts.length;
478
+ lendAccounts.push(...protocolAumAccounts);
479
+ }
417
480
  }
418
481
  const [configPda] = (0, pda_2.findConfigPda)(pStvProgramId);
419
482
  const withdrawIx = (0, instructions_1.createWithdrawFromStrategyIx)({
@@ -429,6 +492,7 @@ async function buildJlpToBaseRebalance(args) {
429
492
  strategyBaseAta,
430
493
  tokenProgram,
431
494
  shares: new bn_js_1.default(sharesToWithdraw.toString()),
495
+ protocolAumCount: lendProtocolAumCount,
432
496
  remainingAccounts: lendAccounts,
433
497
  }, pStvProgramId);
434
498
  // Build Jupiter Lend deposit instruction to route funds from Elemental Lend → Jupiter Lend.
@@ -22,9 +22,11 @@ export interface ManagerRole {
22
22
  manager: PublicKey;
23
23
  bump: number;
24
24
  }
25
- /** JLP StrategyState (160 bytes) — extends standard 104-byte header */
25
+ /** JLP StrategyState (224 bytes) — extends standard 104-byte header */
26
26
  export interface JlpStrategyState extends StrategyStateHeader {
27
27
  baseLoaned: BN;
28
+ swapArb: BN;
29
+ priceOracle: PublicKey;
28
30
  }
29
31
  export type { StvPosition } from "../common/strategy-interface";
30
32
  export interface ConfigInitializedEvent {
@@ -1,7 +1,7 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import BN from "bn.js";
3
3
  import type { SolanaConnection } from "../common/connection";
4
- import { GlobalConfig, Stv, WithdrawRequest, ManagerRole } from "./types";
4
+ import { GlobalConfig, Stv, WithdrawRequest, DelayedDepositRequest, ManagerRole } from "./types";
5
5
  /**
6
6
  * GlobalConfig — singleton protocol registry. Total 56 bytes.
7
7
  *
@@ -50,7 +50,14 @@ export declare function deserializeGlobalConfig(data: Buffer): GlobalConfig;
50
50
  * [357..358] version u8
51
51
  * [358..359] bump u8
52
52
  * [359..360] _padding [u8; 1]
53
- * [360..664] _reserved [u8; 304]
53
+ * [360..362] depositFeeBps u16
54
+ * [362..364] withdrawalFeeBps u16
55
+ * [364..368] pendingDepositCount u32
56
+ * [368..376] pendingDepositBase u64 (delayed deposit principal not yet active)
57
+ * [376..408] feeReceiverEvAta Pubkey (pinned canonical fee receiver evX ATA)
58
+ * [408..416] lockedSeedShares u64 (C-1 supply floor)
59
+ * [416..417] withdrawalMode u8 (0=instant, 1=X, 2=X+1)
60
+ * [417..664] _reserved [u8; 247]
54
61
  */
55
62
  export declare function deserializeStv(data: Buffer): Stv;
56
63
  /**
@@ -65,9 +72,34 @@ export declare function deserializeStv(data: Buffer): Stv;
65
72
  * [ 88.. 92] epochId u32
66
73
  * [ 92.. 96] claimAvailableAfter u32 (unix seconds)
67
74
  * [ 96.. 97] bump u8
68
- * [ 97..168] _reserved [u8; 71]
75
+ * [ 97.. 98] version u8
76
+ * [ 98.. 99] requestFlags u8 (bit0 WR_FLAG_MIGRATE: 0=withdraw, 1=migrate)
77
+ * [ 99..104] _padding [u8; 5]
78
+ * [104..112] destVaultId u64 (migrate: dest STV vault_id; withdraw: 0)
79
+ * [112..120] minDestShares u64 (migrate: slippage floor; withdraw: 0)
80
+ * [120..168] _reserved0 [u8; 48]
69
81
  */
70
82
  export declare function deserializeWithdrawRequest(data: Buffer): WithdrawRequest;
83
+ /**
84
+ * WithdrawRequest kind from `requestFlags` bit 0.
85
+ * Returns `"migrate"` when WR_FLAG_MIGRATE (0x01) is set, else `"withdraw"`.
86
+ */
87
+ export declare function withdrawRequestKind(wr: WithdrawRequest): "withdraw" | "migrate";
88
+ /**
89
+ * DelayedDepositRequest — per-(STV, user, epoch) pending deposit. Total 152 bytes.
90
+ *
91
+ * Layout (offsets include the 8-byte discriminator):
92
+ * [ 0.. 8] discriminator (sha256("account:DelayedDepositRequest")[..8])
93
+ * [ 8.. 40] stv Pubkey
94
+ * [ 40.. 72] user Pubkey
95
+ * [ 72.. 80] amount u64
96
+ * [ 80.. 84] epochId u32 (offset_of == 80, asserted on-chain)
97
+ * [ 84.. 85] bump u8
98
+ * [ 85.. 86] version u8
99
+ * [ 86.. 88] _padding [u8; 2]
100
+ * [ 88..152] _reserved [u8; 64]
101
+ */
102
+ export declare function deserializeDelayedDepositRequest(data: Buffer): DelayedDepositRequest;
71
103
  /**
72
104
  * ManagerRole — per-(STV, manager) authorization record. Total 80 bytes.
73
105
  *
@@ -85,7 +117,10 @@ export declare function fetchStv(connection: SolanaConnection, vaultId: number |
85
117
  export declare function fetchStvByAddress(connection: SolanaConnection, address: PublicKey): Promise<Stv>;
86
118
  export declare function fetchWithdrawRequest(connection: SolanaConnection, stv: PublicKey, user: PublicKey, epochId: number, programId?: PublicKey): Promise<WithdrawRequest>;
87
119
  export declare function fetchWithdrawRequestByAddress(connection: SolanaConnection, address: PublicKey): Promise<WithdrawRequest>;
120
+ export declare function fetchDelayedDepositRequest(connection: SolanaConnection, stv: PublicKey, user: PublicKey, epochId: number, programId?: PublicKey): Promise<DelayedDepositRequest>;
121
+ export declare function fetchDelayedDepositRequestByAddress(connection: SolanaConnection, address: PublicKey): Promise<DelayedDepositRequest>;
88
122
  export declare function fetchAllStvs(connection: SolanaConnection, programId?: PublicKey): Promise<[PublicKey, Stv][]>;
89
123
  export declare function fetchPendingWithdrawRequests(connection: SolanaConnection, stv: PublicKey, epochId: number, programId?: PublicKey): Promise<[PublicKey, WithdrawRequest][]>;
124
+ export declare function fetchPendingDelayedDepositRequests(connection: SolanaConnection, stv: PublicKey, epochId: number, programId?: PublicKey): Promise<[PublicKey, DelayedDepositRequest][]>;
90
125
  export declare function fetchManagerRole(connection: SolanaConnection, stv: PublicKey, manager: PublicKey, programId?: PublicKey): Promise<ManagerRole | null>;
91
126
  export declare function fetchManagersForStv(connection: SolanaConnection, stv: PublicKey, programId?: PublicKey): Promise<[PublicKey, ManagerRole][]>;
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeGlobalConfig = deserializeGlobalConfig;
4
4
  exports.deserializeStv = deserializeStv;
5
5
  exports.deserializeWithdrawRequest = deserializeWithdrawRequest;
6
+ exports.withdrawRequestKind = withdrawRequestKind;
7
+ exports.deserializeDelayedDepositRequest = deserializeDelayedDepositRequest;
6
8
  exports.deserializeManagerRole = deserializeManagerRole;
7
9
  exports.fetchGlobalConfig = fetchGlobalConfig;
8
10
  exports.fetchStv = fetchStv;
9
11
  exports.fetchStvByAddress = fetchStvByAddress;
10
12
  exports.fetchWithdrawRequest = fetchWithdrawRequest;
11
13
  exports.fetchWithdrawRequestByAddress = fetchWithdrawRequestByAddress;
14
+ exports.fetchDelayedDepositRequest = fetchDelayedDepositRequest;
15
+ exports.fetchDelayedDepositRequestByAddress = fetchDelayedDepositRequestByAddress;
12
16
  exports.fetchAllStvs = fetchAllStvs;
13
17
  exports.fetchPendingWithdrawRequests = fetchPendingWithdrawRequests;
18
+ exports.fetchPendingDelayedDepositRequests = fetchPendingDelayedDepositRequests;
14
19
  exports.fetchManagerRole = fetchManagerRole;
15
20
  exports.fetchManagersForStv = fetchManagersForStv;
16
21
  const buffer_1 = require("../common/buffer");
@@ -88,7 +93,14 @@ function deserializeGlobalConfig(data) {
88
93
  * [357..358] version u8
89
94
  * [358..359] bump u8
90
95
  * [359..360] _padding [u8; 1]
91
- * [360..664] _reserved [u8; 304]
96
+ * [360..362] depositFeeBps u16
97
+ * [362..364] withdrawalFeeBps u16
98
+ * [364..368] pendingDepositCount u32
99
+ * [368..376] pendingDepositBase u64 (delayed deposit principal not yet active)
100
+ * [376..408] feeReceiverEvAta Pubkey (pinned canonical fee receiver evX ATA)
101
+ * [408..416] lockedSeedShares u64 (C-1 supply floor)
102
+ * [416..417] withdrawalMode u8 (0=instant, 1=X, 2=X+1)
103
+ * [417..664] _reserved [u8; 247]
92
104
  */
93
105
  function deserializeStv(data) {
94
106
  if (data.length < constants_1.STV_SIZE) {
@@ -107,6 +119,7 @@ function deserializeStv(data) {
107
119
  evMint: (0, buffer_1.readPubkey)(data, 40),
108
120
  strategy: (0, buffer_1.readPubkey)(data, 72),
109
121
  feeReceiver: (0, buffer_1.readPubkey)(data, 104),
122
+ feeReceiverEvAta: (0, buffer_1.readPubkey)(data, 376),
110
123
  lendProgram: (0, buffer_1.readPubkey)(data, 136),
111
124
  vaultAta: (0, buffer_1.readPubkey)(data, 168),
112
125
  childVaults,
@@ -132,6 +145,12 @@ function deserializeStv(data) {
132
145
  childVaultCount: (0, buffer_1.readU8)(data, 356),
133
146
  version: (0, buffer_1.readU8)(data, 357),
134
147
  bump: (0, buffer_1.readU8)(data, 358),
148
+ depositFeeBps: (0, buffer_1.readU16)(data, 360),
149
+ withdrawalFeeBps: (0, buffer_1.readU16)(data, 362),
150
+ pendingDepositCount: (0, buffer_1.readU32)(data, 364),
151
+ pendingDepositBase: (0, buffer_1.readU64)(data, 368),
152
+ lockedSeedShares: (0, buffer_1.readU64)(data, 408),
153
+ withdrawalMode: (0, buffer_1.readU8)(data, 416),
135
154
  };
136
155
  }
137
156
  /**
@@ -146,7 +165,12 @@ function deserializeStv(data) {
146
165
  * [ 88.. 92] epochId u32
147
166
  * [ 92.. 96] claimAvailableAfter u32 (unix seconds)
148
167
  * [ 96.. 97] bump u8
149
- * [ 97..168] _reserved [u8; 71]
168
+ * [ 97.. 98] version u8
169
+ * [ 98.. 99] requestFlags u8 (bit0 WR_FLAG_MIGRATE: 0=withdraw, 1=migrate)
170
+ * [ 99..104] _padding [u8; 5]
171
+ * [104..112] destVaultId u64 (migrate: dest STV vault_id; withdraw: 0)
172
+ * [112..120] minDestShares u64 (migrate: slippage floor; withdraw: 0)
173
+ * [120..168] _reserved0 [u8; 48]
150
174
  */
151
175
  function deserializeWithdrawRequest(data) {
152
176
  if (data.length < constants_1.WITHDRAW_REQUEST_SIZE) {
@@ -164,6 +188,47 @@ function deserializeWithdrawRequest(data) {
164
188
  epochId: (0, buffer_1.readU32)(data, 88),
165
189
  claimAvailableAfter: (0, buffer_1.readU32)(data, 92),
166
190
  bump: (0, buffer_1.readU8)(data, 96),
191
+ requestFlags: (0, buffer_1.readU8)(data, 98),
192
+ destVaultId: (0, buffer_1.readU64)(data, 104),
193
+ minDestShares: (0, buffer_1.readU64)(data, 112),
194
+ };
195
+ }
196
+ /**
197
+ * WithdrawRequest kind from `requestFlags` bit 0.
198
+ * Returns `"migrate"` when WR_FLAG_MIGRATE (0x01) is set, else `"withdraw"`.
199
+ */
200
+ function withdrawRequestKind(wr) {
201
+ return (wr.requestFlags & 0x01) !== 0 ? "migrate" : "withdraw";
202
+ }
203
+ /**
204
+ * DelayedDepositRequest — per-(STV, user, epoch) pending deposit. Total 152 bytes.
205
+ *
206
+ * Layout (offsets include the 8-byte discriminator):
207
+ * [ 0.. 8] discriminator (sha256("account:DelayedDepositRequest")[..8])
208
+ * [ 8.. 40] stv Pubkey
209
+ * [ 40.. 72] user Pubkey
210
+ * [ 72.. 80] amount u64
211
+ * [ 80.. 84] epochId u32 (offset_of == 80, asserted on-chain)
212
+ * [ 84.. 85] bump u8
213
+ * [ 85.. 86] version u8
214
+ * [ 86.. 88] _padding [u8; 2]
215
+ * [ 88..152] _reserved [u8; 64]
216
+ */
217
+ function deserializeDelayedDepositRequest(data) {
218
+ if (data.length < constants_1.DELAYED_DEPOSIT_REQUEST_SIZE) {
219
+ throw new Error(`DelayedDepositRequest data too short: ${data.length} < ${constants_1.DELAYED_DEPOSIT_REQUEST_SIZE}`);
220
+ }
221
+ const disc = data.subarray(0, 8);
222
+ if (!disc.equals(constants_1.DISC_DELAYED_DEPOSIT_REQUEST)) {
223
+ throw new Error(`Invalid DelayedDepositRequest discriminator`);
224
+ }
225
+ return {
226
+ stv: (0, buffer_1.readPubkey)(data, 8),
227
+ user: (0, buffer_1.readPubkey)(data, 40),
228
+ amount: (0, buffer_1.readU64)(data, 72),
229
+ epochId: (0, buffer_1.readU32)(data, 80),
230
+ bump: (0, buffer_1.readU8)(data, 84),
231
+ version: (0, buffer_1.readU8)(data, 85),
167
232
  };
168
233
  }
169
234
  /**
@@ -227,6 +292,19 @@ async function fetchWithdrawRequestByAddress(connection, address) {
227
292
  throw new Error(`WithdrawRequest not found at ${address.toBase58()}`);
228
293
  return deserializeWithdrawRequest(info.data);
229
294
  }
295
+ async function fetchDelayedDepositRequest(connection, stv, user, epochId, programId = constants_1.PROGRAM_ID) {
296
+ const [pda] = (0, pda_1.findDelayedDepositRequestPda)(stv, user, epochId, programId);
297
+ const info = await connection.getAccountInfo(pda);
298
+ if (!info)
299
+ throw new Error("DelayedDepositRequest account not found");
300
+ return deserializeDelayedDepositRequest(info.data);
301
+ }
302
+ async function fetchDelayedDepositRequestByAddress(connection, address) {
303
+ const info = await connection.getAccountInfo(address);
304
+ if (!info)
305
+ throw new Error(`DelayedDepositRequest not found at ${address.toBase58()}`);
306
+ return deserializeDelayedDepositRequest(info.data);
307
+ }
230
308
  // ---------------------------------------------------------------------------
231
309
  // GPA Helpers
232
310
  // ---------------------------------------------------------------------------
@@ -252,6 +330,19 @@ async function fetchPendingWithdrawRequests(connection, stv, epochId, programId
252
330
  });
253
331
  return accounts.map((a) => [a.pubkey, deserializeWithdrawRequest(a.account.data)]);
254
332
  }
333
+ async function fetchPendingDelayedDepositRequests(connection, stv, epochId, programId = constants_1.PROGRAM_ID) {
334
+ const epochBuf = Buffer.alloc(4);
335
+ epochBuf.writeUInt32LE(epochId, 0);
336
+ const accounts = await connection.getProgramAccounts(programId, {
337
+ filters: [
338
+ { dataSize: constants_1.DELAYED_DEPOSIT_REQUEST_SIZE },
339
+ { memcmp: { offset: 0, bytes: constants_1.DISC_DELAYED_DEPOSIT_REQUEST.toString("base64"), encoding: "base64" } },
340
+ { memcmp: { offset: 8, bytes: stv.toBuffer().toString("base64"), encoding: "base64" } },
341
+ { memcmp: { offset: 80, bytes: epochBuf.toString("base64"), encoding: "base64" } },
342
+ ],
343
+ });
344
+ return accounts.map((a) => [a.pubkey, deserializeDelayedDepositRequest(a.account.data)]);
345
+ }
255
346
  async function fetchManagerRole(connection, stv, manager, programId = constants_1.PROGRAM_ID) {
256
347
  const [pda] = (0, pda_1.findStvManagerRolePda)(stv, manager, programId);
257
348
  const info = await connection.getAccountInfo(pda);
@@ -4,10 +4,13 @@ export declare const CONFIG_SEED: Buffer<ArrayBuffer>;
4
4
  export declare const STV_SEED: Buffer<ArrayBuffer>;
5
5
  export declare const EV_MINT_SEED: Buffer<ArrayBuffer>;
6
6
  export declare const WITHDRAW_REQUEST_SEED: Buffer<ArrayBuffer>;
7
+ export declare const MIGRATE_REQUEST_SEED: Buffer<ArrayBuffer>;
8
+ export declare const DELAYED_DEPOSIT_SEED: Buffer<ArrayBuffer>;
7
9
  export declare const MANAGER_SEED: Buffer<ArrayBuffer>;
8
10
  export declare const DISC_GLOBAL_CONFIG: Buffer<ArrayBuffer>;
9
11
  export declare const DISC_STV: Buffer<ArrayBuffer>;
10
12
  export declare const DISC_WITHDRAW_REQUEST: Buffer<ArrayBuffer>;
13
+ export declare const DISC_DELAYED_DEPOSIT_REQUEST: Buffer<ArrayBuffer>;
11
14
  export { DISC_MANAGER_ROLE } from "../common/constants";
12
15
  export declare const IX_INIT_OR_UPDATE_CONFIG = 0;
13
16
  export declare const IX_INIT_OR_UPDATE_STV = 1;
@@ -22,6 +25,12 @@ export declare const IX_ADD_MANAGER = 9;
22
25
  export declare const IX_REMOVE_MANAGER = 10;
23
26
  export declare const IX_OVERRIDE_CLAIM_WITHDRAW = 11;
24
27
  export declare const IX_MIGRATE_LEND = 12;
28
+ export declare const IX_MIGRATE_REQUEST = 13;
29
+ export declare const IX_MIGRATE_EXECUTE = 14;
30
+ export declare const IX_PROCESS_DELAYED_DEPOSIT = 15;
31
+ export declare const IX_MIGRATE_CANCEL = 16;
32
+ export declare const IX_INSTANT_WITHDRAW = 17;
33
+ export declare const IX_SEED_STV = 18;
25
34
  export declare const EVT_CONFIG_INITIALIZED = 0;
26
35
  export declare const EVT_CONFIG_UPDATED = 1;
27
36
  export declare const EVT_STV_CREATED = 2;
@@ -40,13 +49,34 @@ export declare const EVT_MANAGER_ADDED = 14;
40
49
  export declare const EVT_MANAGER_REMOVED = 15;
41
50
  export declare const EVT_WITHDRAW_OVERRIDE_CLAIMED = 16;
42
51
  export declare const EVT_LEND_MIGRATED = 17;
43
- export declare const EVT_VAULT_ATA_BACKFILLED = 18;
52
+ export declare const EVT_MIGRATE_REQUESTED = 18;
53
+ export declare const EVT_MIGRATE_EXECUTED = 19;
54
+ export declare const EVT_DELAYED_DEPOSIT_PROCESSED = 20;
55
+ export declare const EVT_INSTANT_WITHDRAWN = 21;
56
+ export declare const EVT_STV_SEEDED = 22;
44
57
  export declare const FLAG_PAUSED = 1;
45
58
  export declare const FLAG_DEPOSITS_DISABLED = 2;
46
59
  export declare const FLAG_WITHDRAWALS_DISABLED = 4;
47
60
  export declare const FLAG_REBALANCE_DISABLED = 8;
48
- export declare const FLAG_TEST_MODE = 16;
49
61
  export declare const FLAG_ALLOCATOR = 32;
62
+ /** Skip the per-epoch withdraw rate-limit on this STV (claim_withdraw + migrate_execute). */
63
+ export declare const FLAG_BYPASS_WITHDRAW_LIMIT = 64;
64
+ /** Source STV: apply withdrawal_fee_bps when migrating OUT via migrate_request/migrate_execute. */
65
+ export declare const FLAG_WITHDRAWAL_FEE_ON_MIGRATE = 128;
66
+ /** Dest STV: apply deposit_fee_bps when migrating IN via migrate_execute. */
67
+ export declare const FLAG_DEPOSIT_FEE_ON_MIGRATE = 256;
68
+ /** Delay user deposits by at least one epoch before evX is minted. */
69
+ export declare const FLAG_DELAYED_DEPOSIT = 512;
70
+ /** Migrate exit (source) skips the +1 epoch cooldown — in-protocol move, no drain risk. */
71
+ export declare const FLAG_BYPASS_MIGRATE_SRC_WAITOUT = 1024;
72
+ /** Migrate entry (dest) skips its waitout. */
73
+ export declare const FLAG_BYPASS_MIGRATE_DST_WAITOUT = 2048;
74
+ /**
75
+ * C-1 seed gate. Program-owned (set by seed_stv, never via
76
+ * init_or_update_stv). When unset, every public path reverts VaultNotSeeded.
77
+ * When set with locked_seed_shares > 0, the vault may run instant_withdraw.
78
+ */
79
+ export declare const FLAG_SEEDED = 4096;
50
80
  /**
51
81
  * Protocol-wide emergency pause. When set on `GlobalConfig.flags`, blocks
52
82
  * every value-movement instruction across every STV (deposit, request/claim
@@ -60,7 +90,12 @@ export { PPS_DECIMALS, BPS_DENOMINATOR, STALENESS_THRESHOLD } from "../common/co
60
90
  export declare const MAX_CHILD_VAULTS = 6;
61
91
  export declare const MAX_STRATEGIES = 6;
62
92
  export declare const FEE_CAP_BPS = 9900;
93
+ /** Max deposit_fee_bps / withdrawal_fee_bps (enforced at init_or_update_stv). */
94
+ export declare const MAX_FEE_BPS = 1000;
95
+ /** WithdrawRequest.request_flags bit 0: 0 = withdraw, 1 = migrate. */
96
+ export declare const WR_FLAG_MIGRATE = 1;
63
97
  export declare const GLOBAL_CONFIG_SIZE = 56;
64
98
  export declare const STV_SIZE = 664;
65
99
  export declare const WITHDRAW_REQUEST_SIZE = 168;
100
+ export declare const DELAYED_DEPOSIT_REQUEST_SIZE = 152;
66
101
  export declare const MANAGER_ROLE_SIZE = 80;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PPS_DECIMALS = exports.CFG_FLAG_GLOBAL_PAUSED = exports.FLAG_ALLOCATOR = exports.FLAG_TEST_MODE = exports.FLAG_REBALANCE_DISABLED = exports.FLAG_WITHDRAWALS_DISABLED = exports.FLAG_DEPOSITS_DISABLED = exports.FLAG_PAUSED = exports.EVT_VAULT_ATA_BACKFILLED = exports.EVT_LEND_MIGRATED = exports.EVT_WITHDRAW_OVERRIDE_CLAIMED = exports.EVT_MANAGER_REMOVED = exports.EVT_MANAGER_ADDED = exports.EVT_STV_CLOSED = exports.EVT_FEES_SETTLED = exports.EVT_EPOCH_ADVANCED = exports.EVT_EPOCH_PROCESSED = exports.EVT_WITHDRAWN_FROM_STRATEGY = exports.EVT_DEPOSITED_TO_STRATEGY = exports.EVT_WITHDRAW_CLAIMED = exports.EVT_WITHDRAW_REQUEST_INCREASED = exports.EVT_WITHDRAW_REQUESTED = exports.EVT_DEPOSITED = exports.EVT_STV_UPDATED = exports.EVT_STV_CREATED = exports.EVT_CONFIG_UPDATED = exports.EVT_CONFIG_INITIALIZED = exports.IX_MIGRATE_LEND = exports.IX_OVERRIDE_CLAIM_WITHDRAW = exports.IX_REMOVE_MANAGER = exports.IX_ADD_MANAGER = exports.IX_CLOSE_STV = exports.IX_WITHDRAW_FROM_STRATEGY = exports.IX_DEPOSIT_TO_STRATEGY = exports.IX_PROCESS_EPOCH = exports.IX_CLAIM_WITHDRAW = exports.IX_REQUEST_WITHDRAW = exports.IX_DEPOSIT = exports.IX_INIT_OR_UPDATE_STV = exports.IX_INIT_OR_UPDATE_CONFIG = exports.DISC_MANAGER_ROLE = exports.DISC_WITHDRAW_REQUEST = exports.DISC_STV = exports.DISC_GLOBAL_CONFIG = exports.MANAGER_SEED = exports.WITHDRAW_REQUEST_SEED = exports.EV_MINT_SEED = exports.STV_SEED = exports.CONFIG_SEED = exports.PROGRAM_ID = void 0;
4
- exports.MANAGER_ROLE_SIZE = exports.WITHDRAW_REQUEST_SIZE = exports.STV_SIZE = exports.GLOBAL_CONFIG_SIZE = exports.FEE_CAP_BPS = exports.MAX_STRATEGIES = exports.MAX_CHILD_VAULTS = exports.STALENESS_THRESHOLD = exports.BPS_DENOMINATOR = void 0;
3
+ exports.EVT_LEND_MIGRATED = exports.EVT_WITHDRAW_OVERRIDE_CLAIMED = exports.EVT_MANAGER_REMOVED = exports.EVT_MANAGER_ADDED = exports.EVT_STV_CLOSED = exports.EVT_FEES_SETTLED = exports.EVT_EPOCH_ADVANCED = exports.EVT_EPOCH_PROCESSED = exports.EVT_WITHDRAWN_FROM_STRATEGY = exports.EVT_DEPOSITED_TO_STRATEGY = exports.EVT_WITHDRAW_CLAIMED = exports.EVT_WITHDRAW_REQUEST_INCREASED = exports.EVT_WITHDRAW_REQUESTED = exports.EVT_DEPOSITED = exports.EVT_STV_UPDATED = exports.EVT_STV_CREATED = exports.EVT_CONFIG_UPDATED = exports.EVT_CONFIG_INITIALIZED = exports.IX_SEED_STV = exports.IX_INSTANT_WITHDRAW = exports.IX_MIGRATE_CANCEL = exports.IX_PROCESS_DELAYED_DEPOSIT = exports.IX_MIGRATE_EXECUTE = exports.IX_MIGRATE_REQUEST = exports.IX_MIGRATE_LEND = exports.IX_OVERRIDE_CLAIM_WITHDRAW = exports.IX_REMOVE_MANAGER = exports.IX_ADD_MANAGER = exports.IX_CLOSE_STV = exports.IX_WITHDRAW_FROM_STRATEGY = exports.IX_DEPOSIT_TO_STRATEGY = exports.IX_PROCESS_EPOCH = exports.IX_CLAIM_WITHDRAW = exports.IX_REQUEST_WITHDRAW = exports.IX_DEPOSIT = exports.IX_INIT_OR_UPDATE_STV = exports.IX_INIT_OR_UPDATE_CONFIG = exports.DISC_MANAGER_ROLE = exports.DISC_DELAYED_DEPOSIT_REQUEST = exports.DISC_WITHDRAW_REQUEST = exports.DISC_STV = exports.DISC_GLOBAL_CONFIG = exports.MANAGER_SEED = exports.DELAYED_DEPOSIT_SEED = exports.MIGRATE_REQUEST_SEED = exports.WITHDRAW_REQUEST_SEED = exports.EV_MINT_SEED = exports.STV_SEED = exports.CONFIG_SEED = exports.PROGRAM_ID = void 0;
4
+ exports.MANAGER_ROLE_SIZE = exports.DELAYED_DEPOSIT_REQUEST_SIZE = exports.WITHDRAW_REQUEST_SIZE = exports.STV_SIZE = exports.GLOBAL_CONFIG_SIZE = exports.WR_FLAG_MIGRATE = exports.MAX_FEE_BPS = exports.FEE_CAP_BPS = exports.MAX_STRATEGIES = exports.MAX_CHILD_VAULTS = exports.STALENESS_THRESHOLD = exports.BPS_DENOMINATOR = exports.PPS_DECIMALS = exports.CFG_FLAG_GLOBAL_PAUSED = exports.FLAG_SEEDED = exports.FLAG_BYPASS_MIGRATE_DST_WAITOUT = exports.FLAG_BYPASS_MIGRATE_SRC_WAITOUT = exports.FLAG_DELAYED_DEPOSIT = exports.FLAG_DEPOSIT_FEE_ON_MIGRATE = exports.FLAG_WITHDRAWAL_FEE_ON_MIGRATE = exports.FLAG_BYPASS_WITHDRAW_LIMIT = exports.FLAG_ALLOCATOR = exports.FLAG_REBALANCE_DISABLED = exports.FLAG_WITHDRAWALS_DISABLED = exports.FLAG_DEPOSITS_DISABLED = exports.FLAG_PAUSED = exports.EVT_STV_SEEDED = exports.EVT_INSTANT_WITHDRAWN = exports.EVT_DELAYED_DEPOSIT_PROCESSED = exports.EVT_MIGRATE_EXECUTED = exports.EVT_MIGRATE_REQUESTED = void 0;
5
5
  const web3_js_1 = require("@solana/web3.js");
6
6
  // ---------------------------------------------------------------------------
7
7
  // Program ID
@@ -14,6 +14,8 @@ exports.CONFIG_SEED = Buffer.from("config");
14
14
  exports.STV_SEED = Buffer.from("stv");
15
15
  exports.EV_MINT_SEED = Buffer.from("ev_mint");
16
16
  exports.WITHDRAW_REQUEST_SEED = Buffer.from("withdraw_request");
17
+ exports.MIGRATE_REQUEST_SEED = Buffer.from("migrate_request");
18
+ exports.DELAYED_DEPOSIT_SEED = Buffer.from("delayed_deposit");
17
19
  exports.MANAGER_SEED = Buffer.from("manager");
18
20
  // ---------------------------------------------------------------------------
19
21
  // Account Discriminators (8-byte Anchor-compatible)
@@ -27,6 +29,9 @@ exports.DISC_STV = Buffer.from([
27
29
  exports.DISC_WITHDRAW_REQUEST = Buffer.from([
28
30
  0xba, 0xef, 0xae, 0xbf, 0xbd, 0x0d, 0x2f, 0xc4,
29
31
  ]);
32
+ exports.DISC_DELAYED_DEPOSIT_REQUEST = Buffer.from([
33
+ 0x33, 0x09, 0xc3, 0xd1, 0xbd, 0xee, 0x7b, 0xe1,
34
+ ]);
30
35
  // Shared with elemental-lend and jlpd-strategy — defined once in common/
31
36
  var constants_1 = require("../common/constants");
32
37
  Object.defineProperty(exports, "DISC_MANAGER_ROLE", { enumerable: true, get: function () { return constants_1.DISC_MANAGER_ROLE; } });
@@ -46,6 +51,12 @@ exports.IX_ADD_MANAGER = 9;
46
51
  exports.IX_REMOVE_MANAGER = 10;
47
52
  exports.IX_OVERRIDE_CLAIM_WITHDRAW = 11;
48
53
  exports.IX_MIGRATE_LEND = 12;
54
+ exports.IX_MIGRATE_REQUEST = 13;
55
+ exports.IX_MIGRATE_EXECUTE = 14;
56
+ exports.IX_PROCESS_DELAYED_DEPOSIT = 15;
57
+ exports.IX_MIGRATE_CANCEL = 16;
58
+ exports.IX_INSTANT_WITHDRAW = 17;
59
+ exports.IX_SEED_STV = 18;
49
60
  // ---------------------------------------------------------------------------
50
61
  // Event Discriminators (1-byte)
51
62
  // ---------------------------------------------------------------------------
@@ -67,7 +78,11 @@ exports.EVT_MANAGER_ADDED = 14;
67
78
  exports.EVT_MANAGER_REMOVED = 15;
68
79
  exports.EVT_WITHDRAW_OVERRIDE_CLAIMED = 16;
69
80
  exports.EVT_LEND_MIGRATED = 17;
70
- exports.EVT_VAULT_ATA_BACKFILLED = 18;
81
+ exports.EVT_MIGRATE_REQUESTED = 18;
82
+ exports.EVT_MIGRATE_EXECUTED = 19;
83
+ exports.EVT_DELAYED_DEPOSIT_PROCESSED = 20;
84
+ exports.EVT_INSTANT_WITHDRAWN = 21;
85
+ exports.EVT_STV_SEEDED = 22;
71
86
  // ---------------------------------------------------------------------------
72
87
  // Vault Flags
73
88
  // ---------------------------------------------------------------------------
@@ -76,8 +91,25 @@ exports.FLAG_PAUSED = 0x0001;
76
91
  exports.FLAG_DEPOSITS_DISABLED = 0x0002;
77
92
  exports.FLAG_WITHDRAWALS_DISABLED = 0x0004;
78
93
  exports.FLAG_REBALANCE_DISABLED = 0x0008;
79
- exports.FLAG_TEST_MODE = 0x0010;
80
94
  exports.FLAG_ALLOCATOR = 0x0020;
95
+ /** Skip the per-epoch withdraw rate-limit on this STV (claim_withdraw + migrate_execute). */
96
+ exports.FLAG_BYPASS_WITHDRAW_LIMIT = 0x0040;
97
+ /** Source STV: apply withdrawal_fee_bps when migrating OUT via migrate_request/migrate_execute. */
98
+ exports.FLAG_WITHDRAWAL_FEE_ON_MIGRATE = 0x0080;
99
+ /** Dest STV: apply deposit_fee_bps when migrating IN via migrate_execute. */
100
+ exports.FLAG_DEPOSIT_FEE_ON_MIGRATE = 0x0100;
101
+ /** Delay user deposits by at least one epoch before evX is minted. */
102
+ exports.FLAG_DELAYED_DEPOSIT = 0x0200;
103
+ /** Migrate exit (source) skips the +1 epoch cooldown — in-protocol move, no drain risk. */
104
+ exports.FLAG_BYPASS_MIGRATE_SRC_WAITOUT = 0x0400;
105
+ /** Migrate entry (dest) skips its waitout. */
106
+ exports.FLAG_BYPASS_MIGRATE_DST_WAITOUT = 0x0800;
107
+ /**
108
+ * C-1 seed gate. Program-owned (set by seed_stv, never via
109
+ * init_or_update_stv). When unset, every public path reverts VaultNotSeeded.
110
+ * When set with locked_seed_shares > 0, the vault may run instant_withdraw.
111
+ */
112
+ exports.FLAG_SEEDED = 0x1000;
81
113
  // GlobalConfig flags
82
114
  /**
83
115
  * Protocol-wide emergency pause. When set on `GlobalConfig.flags`, blocks
@@ -98,10 +130,15 @@ Object.defineProperty(exports, "STALENESS_THRESHOLD", { enumerable: true, get: f
98
130
  exports.MAX_CHILD_VAULTS = 6;
99
131
  exports.MAX_STRATEGIES = exports.MAX_CHILD_VAULTS; // backward compat
100
132
  exports.FEE_CAP_BPS = 9900;
133
+ /** Max deposit_fee_bps / withdrawal_fee_bps (enforced at init_or_update_stv). */
134
+ exports.MAX_FEE_BPS = 1000;
135
+ /** WithdrawRequest.request_flags bit 0: 0 = withdraw, 1 = migrate. */
136
+ exports.WR_FLAG_MIGRATE = 0x01;
101
137
  // ---------------------------------------------------------------------------
102
138
  // Account Sizes
103
139
  // ---------------------------------------------------------------------------
104
140
  exports.GLOBAL_CONFIG_SIZE = 56;
105
141
  exports.STV_SIZE = 664;
106
142
  exports.WITHDRAW_REQUEST_SIZE = 168;
143
+ exports.DELAYED_DEPOSIT_REQUEST_SIZE = 152;
107
144
  exports.MANAGER_ROLE_SIZE = 80;