@elemental-stv-core/sdk 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/p-stv-core/accounts.d.ts +44 -39
- package/dist/p-stv-core/accounts.js +85 -69
- package/dist/p-stv-core/constants.d.ts +12 -2
- package/dist/p-stv-core/constants.js +13 -3
- package/dist/p-stv-core/events.js +15 -0
- package/dist/p-stv-core/instructions.d.ts +57 -1
- package/dist/p-stv-core/instructions.js +52 -3
- package/dist/p-stv-core/types.d.ts +33 -3
- package/package.json +1 -1
|
@@ -18,46 +18,51 @@ export declare function deserializeGlobalConfig(data: Buffer): GlobalConfig;
|
|
|
18
18
|
/**
|
|
19
19
|
* STV — per-vault state. Total 664 bytes (v2 layout).
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* v2 layout (offsets include the 8-byte Anchor-compatible discriminator).
|
|
22
|
+
* All compile-time asserts in p-stv-core/programs/p-stv-core/src/state/stv.rs
|
|
23
|
+
* are the canonical source of truth; offsets here are copied from those asserts.
|
|
24
|
+
*
|
|
22
25
|
* [ 0.. 8] discriminator (sha256("account:Stv")[..8])
|
|
23
|
-
* [ 8.. 40] baseMint Pubkey
|
|
24
|
-
* [ 40.. 72] evMint Pubkey
|
|
25
|
-
* [ 72..104] strategy Pubkey (
|
|
26
|
-
* [104..136] feeReceiver Pubkey
|
|
27
|
-
* [136..168] lendProgram Pubkey (
|
|
28
|
-
* [168..200] vaultAta Pubkey (canonical ATA
|
|
29
|
-
* [200..
|
|
30
|
-
* [
|
|
31
|
-
* [
|
|
32
|
-
* [
|
|
33
|
-
* [
|
|
34
|
-
* [
|
|
35
|
-
* [
|
|
36
|
-
* [
|
|
37
|
-
* [
|
|
38
|
-
* [
|
|
39
|
-
* [
|
|
40
|
-
* [
|
|
41
|
-
* [
|
|
42
|
-
* [
|
|
43
|
-
* [
|
|
44
|
-
* [
|
|
45
|
-
* [
|
|
46
|
-
* [
|
|
47
|
-
* [
|
|
48
|
-
* [
|
|
49
|
-
* [
|
|
50
|
-
* [
|
|
51
|
-
* [
|
|
52
|
-
* [
|
|
53
|
-
* [
|
|
54
|
-
* [
|
|
55
|
-
* [
|
|
56
|
-
* [
|
|
57
|
-
* [
|
|
58
|
-
* [
|
|
59
|
-
* [
|
|
60
|
-
* [
|
|
26
|
+
* [ 8.. 40] baseMint Pubkey (_OFFSET_BASE_MINT == 8)
|
|
27
|
+
* [ 40.. 72] evMint Pubkey (_OFFSET_EV_MINT == 40)
|
|
28
|
+
* [ 72..104] strategy Pubkey (_OFFSET_STRATEGY == 72; immutable)
|
|
29
|
+
* [104..136] feeReceiver Pubkey (_OFFSET_FEE_RECEIVER == 104)
|
|
30
|
+
* [136..168] lendProgram Pubkey (_OFFSET_LEND_PROGRAM == 136; zero = inactive)
|
|
31
|
+
* [168..200] vaultAta Pubkey (_OFFSET_VAULT_ATA == 168; canonical ATA)
|
|
32
|
+
* [200..232] admin Pubkey (_OFFSET_ADMIN == 200; per-vault admin, never zero on v2)
|
|
33
|
+
* [232..264] pendingAdmin Pubkey (_OFFSET_PENDING_ADMIN == 232; zero = no rotation in progress)
|
|
34
|
+
* [264..296] childVaults[4] [u64; 4] (_OFFSET_CHILD_VAULTS == 264; MAX_CHILD_VAULTS = 4)
|
|
35
|
+
* [296..304] vaultId u64 (_OFFSET_VAULT_ID == 296)
|
|
36
|
+
* [304..312] reservedBase u64
|
|
37
|
+
* [312..320] requestedShares u64 (shares pending in escrow)
|
|
38
|
+
* [320..328] vaultCapacity u64 (0 = uncapped)
|
|
39
|
+
* [328..336] minDeposit u64
|
|
40
|
+
* [336..344] hwm u64 (high-water mark for perf fees)
|
|
41
|
+
* [344..352] lastFeeTs u64
|
|
42
|
+
* [352..360] epochPps u64 (locked PPS for current epoch claims)
|
|
43
|
+
* [360..368] lastNav u64 (snapshot for rate-limit window)
|
|
44
|
+
* [368..376] dailyWithdrawnBase u64 (rate-limit accumulator)
|
|
45
|
+
* [376..380] nextEpochTs u32
|
|
46
|
+
* [380..384] epochSec u32
|
|
47
|
+
* [384..388] currentEpochId u32
|
|
48
|
+
* [388..392] pendingWithdrawals u32
|
|
49
|
+
* [392..396] withdrawWindowStart u32
|
|
50
|
+
* [396..398] mgmtFeeBps u16
|
|
51
|
+
* [398..400] perfFeeBps u16
|
|
52
|
+
* [400..402] flags u16
|
|
53
|
+
* [402..404] dailyWithdrawLimitBps u16
|
|
54
|
+
* [404..405] childVaultCount u8
|
|
55
|
+
* [405..406] version u8 (== 2 for v2 accounts)
|
|
56
|
+
* [406..407] bump u8
|
|
57
|
+
* [407..408] _padding [u8; 1]
|
|
58
|
+
* [408..410] depositFeeBps u16 (_OFFSET_DEPOSIT_FEE_BPS == 408)
|
|
59
|
+
* [410..412] withdrawalFeeBps u16 (_OFFSET_WITHDRAWAL_FEE_BPS == 410)
|
|
60
|
+
* [412..416] pendingDepositCount u32 (_OFFSET_PENDING_DEPOSIT_COUNT == 412)
|
|
61
|
+
* [416..424] pendingDepositBase u64 (_OFFSET_PENDING_DEPOSIT_BASE == 416)
|
|
62
|
+
* [424..456] feeReceiverEvAta Pubkey (_OFFSET_FEE_RECEIVER_EV_ATA == 424)
|
|
63
|
+
* [456..464] lockedSeedShares u64 (_OFFSET_LOCKED_SEED_SHARES == 456)
|
|
64
|
+
* [464..465] withdrawalMode u8 (_OFFSET_WITHDRAWAL_MODE == 464; 0=instant, 1=X, 2=X+1)
|
|
65
|
+
* [465..664] _reserved [u8; 199] (_OFFSET_RESERVED == 465)
|
|
61
66
|
*/
|
|
62
67
|
export declare function deserializeStv(data: Buffer): Stv;
|
|
63
68
|
/**
|
|
@@ -61,46 +61,51 @@ function deserializeGlobalConfig(data) {
|
|
|
61
61
|
/**
|
|
62
62
|
* STV — per-vault state. Total 664 bytes (v2 layout).
|
|
63
63
|
*
|
|
64
|
-
*
|
|
64
|
+
* v2 layout (offsets include the 8-byte Anchor-compatible discriminator).
|
|
65
|
+
* All compile-time asserts in p-stv-core/programs/p-stv-core/src/state/stv.rs
|
|
66
|
+
* are the canonical source of truth; offsets here are copied from those asserts.
|
|
67
|
+
*
|
|
65
68
|
* [ 0.. 8] discriminator (sha256("account:Stv")[..8])
|
|
66
|
-
* [ 8.. 40] baseMint Pubkey
|
|
67
|
-
* [ 40.. 72] evMint Pubkey
|
|
68
|
-
* [ 72..104] strategy Pubkey (
|
|
69
|
-
* [104..136] feeReceiver Pubkey
|
|
70
|
-
* [136..168] lendProgram Pubkey (
|
|
71
|
-
* [168..200] vaultAta Pubkey (canonical ATA
|
|
72
|
-
* [200..
|
|
73
|
-
* [
|
|
74
|
-
* [
|
|
75
|
-
* [
|
|
76
|
-
* [
|
|
77
|
-
* [
|
|
78
|
-
* [
|
|
79
|
-
* [
|
|
80
|
-
* [
|
|
81
|
-
* [
|
|
82
|
-
* [
|
|
83
|
-
* [
|
|
84
|
-
* [
|
|
85
|
-
* [
|
|
86
|
-
* [
|
|
87
|
-
* [
|
|
88
|
-
* [
|
|
89
|
-
* [
|
|
90
|
-
* [
|
|
91
|
-
* [
|
|
92
|
-
* [
|
|
93
|
-
* [
|
|
94
|
-
* [
|
|
95
|
-
* [
|
|
96
|
-
* [
|
|
97
|
-
* [
|
|
98
|
-
* [
|
|
99
|
-
* [
|
|
100
|
-
* [
|
|
101
|
-
* [
|
|
102
|
-
* [
|
|
103
|
-
* [
|
|
69
|
+
* [ 8.. 40] baseMint Pubkey (_OFFSET_BASE_MINT == 8)
|
|
70
|
+
* [ 40.. 72] evMint Pubkey (_OFFSET_EV_MINT == 40)
|
|
71
|
+
* [ 72..104] strategy Pubkey (_OFFSET_STRATEGY == 72; immutable)
|
|
72
|
+
* [104..136] feeReceiver Pubkey (_OFFSET_FEE_RECEIVER == 104)
|
|
73
|
+
* [136..168] lendProgram Pubkey (_OFFSET_LEND_PROGRAM == 136; zero = inactive)
|
|
74
|
+
* [168..200] vaultAta Pubkey (_OFFSET_VAULT_ATA == 168; canonical ATA)
|
|
75
|
+
* [200..232] admin Pubkey (_OFFSET_ADMIN == 200; per-vault admin, never zero on v2)
|
|
76
|
+
* [232..264] pendingAdmin Pubkey (_OFFSET_PENDING_ADMIN == 232; zero = no rotation in progress)
|
|
77
|
+
* [264..296] childVaults[4] [u64; 4] (_OFFSET_CHILD_VAULTS == 264; MAX_CHILD_VAULTS = 4)
|
|
78
|
+
* [296..304] vaultId u64 (_OFFSET_VAULT_ID == 296)
|
|
79
|
+
* [304..312] reservedBase u64
|
|
80
|
+
* [312..320] requestedShares u64 (shares pending in escrow)
|
|
81
|
+
* [320..328] vaultCapacity u64 (0 = uncapped)
|
|
82
|
+
* [328..336] minDeposit u64
|
|
83
|
+
* [336..344] hwm u64 (high-water mark for perf fees)
|
|
84
|
+
* [344..352] lastFeeTs u64
|
|
85
|
+
* [352..360] epochPps u64 (locked PPS for current epoch claims)
|
|
86
|
+
* [360..368] lastNav u64 (snapshot for rate-limit window)
|
|
87
|
+
* [368..376] dailyWithdrawnBase u64 (rate-limit accumulator)
|
|
88
|
+
* [376..380] nextEpochTs u32
|
|
89
|
+
* [380..384] epochSec u32
|
|
90
|
+
* [384..388] currentEpochId u32
|
|
91
|
+
* [388..392] pendingWithdrawals u32
|
|
92
|
+
* [392..396] withdrawWindowStart u32
|
|
93
|
+
* [396..398] mgmtFeeBps u16
|
|
94
|
+
* [398..400] perfFeeBps u16
|
|
95
|
+
* [400..402] flags u16
|
|
96
|
+
* [402..404] dailyWithdrawLimitBps u16
|
|
97
|
+
* [404..405] childVaultCount u8
|
|
98
|
+
* [405..406] version u8 (== 2 for v2 accounts)
|
|
99
|
+
* [406..407] bump u8
|
|
100
|
+
* [407..408] _padding [u8; 1]
|
|
101
|
+
* [408..410] depositFeeBps u16 (_OFFSET_DEPOSIT_FEE_BPS == 408)
|
|
102
|
+
* [410..412] withdrawalFeeBps u16 (_OFFSET_WITHDRAWAL_FEE_BPS == 410)
|
|
103
|
+
* [412..416] pendingDepositCount u32 (_OFFSET_PENDING_DEPOSIT_COUNT == 412)
|
|
104
|
+
* [416..424] pendingDepositBase u64 (_OFFSET_PENDING_DEPOSIT_BASE == 416)
|
|
105
|
+
* [424..456] feeReceiverEvAta Pubkey (_OFFSET_FEE_RECEIVER_EV_ATA == 424)
|
|
106
|
+
* [456..464] lockedSeedShares u64 (_OFFSET_LOCKED_SEED_SHARES == 456)
|
|
107
|
+
* [464..465] withdrawalMode u8 (_OFFSET_WITHDRAWAL_MODE == 464; 0=instant, 1=X, 2=X+1)
|
|
108
|
+
* [465..664] _reserved [u8; 199] (_OFFSET_RESERVED == 465)
|
|
104
109
|
*/
|
|
105
110
|
function deserializeStv(data) {
|
|
106
111
|
if (data.length < constants_1.STV_SIZE) {
|
|
@@ -110,47 +115,58 @@ function deserializeStv(data) {
|
|
|
110
115
|
if (!disc.equals(constants_1.DISC_STV)) {
|
|
111
116
|
throw new Error(`Invalid Stv discriminator`);
|
|
112
117
|
}
|
|
118
|
+
// v2 freeze gate: version must be 2 AND admin must be nonzero.
|
|
119
|
+
// (mirrors the combined gate in Stv::from_account in stv.rs)
|
|
120
|
+
const version = (0, buffer_1.readU8)(data, 405);
|
|
121
|
+
const adminBytes = data.subarray(200, 232);
|
|
122
|
+
const adminIsZero = adminBytes.every((b) => b === 0);
|
|
123
|
+
if (version !== 2 || adminIsZero) {
|
|
124
|
+
throw new Error(`Stv account is not v2-migrated: version=${version}, admin=${adminIsZero ? "zero" : "nonzero"}`);
|
|
125
|
+
}
|
|
126
|
+
// childVaults: [u64; 4] at offset 264, MAX_CHILD_VAULTS = 4
|
|
113
127
|
const childVaults = [];
|
|
114
128
|
for (let i = 0; i < constants_1.MAX_STRATEGIES; i++) {
|
|
115
|
-
childVaults.push((0, buffer_1.readU64)(data,
|
|
129
|
+
childVaults.push((0, buffer_1.readU64)(data, 264 + i * 8));
|
|
116
130
|
}
|
|
117
131
|
return {
|
|
118
132
|
baseMint: (0, buffer_1.readPubkey)(data, 8),
|
|
119
133
|
evMint: (0, buffer_1.readPubkey)(data, 40),
|
|
120
134
|
strategy: (0, buffer_1.readPubkey)(data, 72),
|
|
121
135
|
feeReceiver: (0, buffer_1.readPubkey)(data, 104),
|
|
122
|
-
feeReceiverEvAta: (0, buffer_1.readPubkey)(data, 376),
|
|
123
136
|
lendProgram: (0, buffer_1.readPubkey)(data, 136),
|
|
124
137
|
vaultAta: (0, buffer_1.readPubkey)(data, 168),
|
|
138
|
+
admin: (0, buffer_1.readPubkey)(data, 200),
|
|
139
|
+
pendingAdmin: (0, buffer_1.readPubkey)(data, 232),
|
|
125
140
|
childVaults,
|
|
126
|
-
vaultId: (0, buffer_1.readU64)(data,
|
|
127
|
-
reservedBase: (0, buffer_1.readU64)(data,
|
|
128
|
-
requestedShares: (0, buffer_1.readU64)(data,
|
|
129
|
-
vaultCapacity: (0, buffer_1.readU64)(data,
|
|
130
|
-
minDeposit: (0, buffer_1.readU64)(data,
|
|
131
|
-
hwm: (0, buffer_1.readU64)(data,
|
|
132
|
-
lastFeeTs: (0, buffer_1.readU64)(data,
|
|
133
|
-
epochPps: (0, buffer_1.readU64)(data,
|
|
134
|
-
lastNav: (0, buffer_1.readU64)(data,
|
|
135
|
-
dailyWithdrawnBase: (0, buffer_1.readU64)(data,
|
|
136
|
-
nextEpochTs: (0, buffer_1.readU32)(data,
|
|
137
|
-
epochSec: (0, buffer_1.readU32)(data,
|
|
138
|
-
currentEpochId: (0, buffer_1.readU32)(data,
|
|
139
|
-
pendingWithdrawals: (0, buffer_1.readU32)(data,
|
|
140
|
-
withdrawWindowStart: (0, buffer_1.readU32)(data,
|
|
141
|
-
mgmtFeeBps: (0, buffer_1.readU16)(data,
|
|
142
|
-
perfFeeBps: (0, buffer_1.readU16)(data,
|
|
143
|
-
flags: (0, buffer_1.readU16)(data,
|
|
144
|
-
dailyWithdrawLimitBps: (0, buffer_1.readU16)(data,
|
|
145
|
-
childVaultCount: (0, buffer_1.readU8)(data,
|
|
146
|
-
version
|
|
147
|
-
bump: (0, buffer_1.readU8)(data,
|
|
148
|
-
depositFeeBps: (0, buffer_1.readU16)(data,
|
|
149
|
-
withdrawalFeeBps: (0, buffer_1.readU16)(data,
|
|
150
|
-
pendingDepositCount: (0, buffer_1.readU32)(data,
|
|
151
|
-
pendingDepositBase: (0, buffer_1.readU64)(data,
|
|
152
|
-
|
|
153
|
-
|
|
141
|
+
vaultId: (0, buffer_1.readU64)(data, 296),
|
|
142
|
+
reservedBase: (0, buffer_1.readU64)(data, 304),
|
|
143
|
+
requestedShares: (0, buffer_1.readU64)(data, 312),
|
|
144
|
+
vaultCapacity: (0, buffer_1.readU64)(data, 320),
|
|
145
|
+
minDeposit: (0, buffer_1.readU64)(data, 328),
|
|
146
|
+
hwm: (0, buffer_1.readU64)(data, 336),
|
|
147
|
+
lastFeeTs: (0, buffer_1.readU64)(data, 344),
|
|
148
|
+
epochPps: (0, buffer_1.readU64)(data, 352),
|
|
149
|
+
lastNav: (0, buffer_1.readU64)(data, 360),
|
|
150
|
+
dailyWithdrawnBase: (0, buffer_1.readU64)(data, 368),
|
|
151
|
+
nextEpochTs: (0, buffer_1.readU32)(data, 376),
|
|
152
|
+
epochSec: (0, buffer_1.readU32)(data, 380),
|
|
153
|
+
currentEpochId: (0, buffer_1.readU32)(data, 384),
|
|
154
|
+
pendingWithdrawals: (0, buffer_1.readU32)(data, 388),
|
|
155
|
+
withdrawWindowStart: (0, buffer_1.readU32)(data, 392),
|
|
156
|
+
mgmtFeeBps: (0, buffer_1.readU16)(data, 396),
|
|
157
|
+
perfFeeBps: (0, buffer_1.readU16)(data, 398),
|
|
158
|
+
flags: (0, buffer_1.readU16)(data, 400),
|
|
159
|
+
dailyWithdrawLimitBps: (0, buffer_1.readU16)(data, 402),
|
|
160
|
+
childVaultCount: (0, buffer_1.readU8)(data, 404),
|
|
161
|
+
version,
|
|
162
|
+
bump: (0, buffer_1.readU8)(data, 406),
|
|
163
|
+
depositFeeBps: (0, buffer_1.readU16)(data, 408),
|
|
164
|
+
withdrawalFeeBps: (0, buffer_1.readU16)(data, 410),
|
|
165
|
+
pendingDepositCount: (0, buffer_1.readU32)(data, 412),
|
|
166
|
+
pendingDepositBase: (0, buffer_1.readU64)(data, 416),
|
|
167
|
+
feeReceiverEvAta: (0, buffer_1.readPubkey)(data, 424),
|
|
168
|
+
lockedSeedShares: (0, buffer_1.readU64)(data, 456),
|
|
169
|
+
withdrawalMode: (0, buffer_1.readU8)(data, 464),
|
|
154
170
|
};
|
|
155
171
|
}
|
|
156
172
|
/**
|
|
@@ -31,6 +31,10 @@ export declare const IX_PROCESS_DELAYED_DEPOSIT = 15;
|
|
|
31
31
|
export declare const IX_MIGRATE_CANCEL = 16;
|
|
32
32
|
export declare const IX_INSTANT_WITHDRAW = 17;
|
|
33
33
|
export declare const IX_SEED_STV = 18;
|
|
34
|
+
/** migrate_stv_layout (disc 0x13 = 19) — one-shot global-admin v1→v2 layout migration. */
|
|
35
|
+
export declare const IX_MIGRATE_STV_LAYOUT = 19;
|
|
36
|
+
/** accept_vault_admin (disc 0x14 = 20) — complete a two-step vault-admin rotation. */
|
|
37
|
+
export declare const IX_ACCEPT_VAULT_ADMIN = 20;
|
|
34
38
|
export declare const EVT_CONFIG_INITIALIZED = 0;
|
|
35
39
|
export declare const EVT_CONFIG_UPDATED = 1;
|
|
36
40
|
export declare const EVT_STV_CREATED = 2;
|
|
@@ -54,6 +58,12 @@ export declare const EVT_MIGRATE_EXECUTED = 19;
|
|
|
54
58
|
export declare const EVT_DELAYED_DEPOSIT_PROCESSED = 20;
|
|
55
59
|
export declare const EVT_INSTANT_WITHDRAWN = 21;
|
|
56
60
|
export declare const EVT_STV_SEEDED = 22;
|
|
61
|
+
/** StvAdminSet — emitted by migrate_stv_layout. Fields: vault_id(8), admin(32). */
|
|
62
|
+
export declare const EVT_STV_ADMIN_SET = 23;
|
|
63
|
+
/** AdminRotationStarted — emitted when update sets pending_admin to nonzero. Fields: vault_id(8), newPendingAdmin(32). */
|
|
64
|
+
export declare const EVT_ADMIN_ROTATION_STARTED = 24;
|
|
65
|
+
/** AdminRotationAccepted — emitted by accept_vault_admin. Fields: vault_id(8), newAdmin(32). */
|
|
66
|
+
export declare const EVT_ADMIN_ROTATION_ACCEPTED = 25;
|
|
57
67
|
export declare const FLAG_PAUSED = 1;
|
|
58
68
|
export declare const FLAG_DEPOSITS_DISABLED = 2;
|
|
59
69
|
export declare const FLAG_WITHDRAWALS_DISABLED = 4;
|
|
@@ -87,8 +97,8 @@ export declare const FLAG_SEEDED = 4096;
|
|
|
87
97
|
*/
|
|
88
98
|
export declare const CFG_FLAG_GLOBAL_PAUSED = 1;
|
|
89
99
|
export { PPS_DECIMALS, BPS_DENOMINATOR, STALENESS_THRESHOLD } from "../common/constants";
|
|
90
|
-
export declare const MAX_CHILD_VAULTS =
|
|
91
|
-
export declare const MAX_STRATEGIES =
|
|
100
|
+
export declare const MAX_CHILD_VAULTS = 4;
|
|
101
|
+
export declare const MAX_STRATEGIES = 4;
|
|
92
102
|
export declare const FEE_CAP_BPS = 9900;
|
|
93
103
|
/** Max deposit_fee_bps / withdrawal_fee_bps (enforced at init_or_update_stv). */
|
|
94
104
|
export declare const MAX_FEE_BPS = 1000;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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;
|
|
3
|
+
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_ACCEPT_VAULT_ADMIN = exports.IX_MIGRATE_STV_LAYOUT = 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_ADMIN_ROTATION_ACCEPTED = exports.EVT_ADMIN_ROTATION_STARTED = exports.EVT_STV_ADMIN_SET = exports.EVT_STV_SEEDED = exports.EVT_INSTANT_WITHDRAWN = exports.EVT_DELAYED_DEPOSIT_PROCESSED = exports.EVT_MIGRATE_EXECUTED = exports.EVT_MIGRATE_REQUESTED = exports.EVT_LEND_MIGRATED = exports.EVT_WITHDRAW_OVERRIDE_CLAIMED = void 0;
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
// Program ID
|
|
@@ -57,6 +57,10 @@ exports.IX_PROCESS_DELAYED_DEPOSIT = 15;
|
|
|
57
57
|
exports.IX_MIGRATE_CANCEL = 16;
|
|
58
58
|
exports.IX_INSTANT_WITHDRAW = 17;
|
|
59
59
|
exports.IX_SEED_STV = 18;
|
|
60
|
+
/** migrate_stv_layout (disc 0x13 = 19) — one-shot global-admin v1→v2 layout migration. */
|
|
61
|
+
exports.IX_MIGRATE_STV_LAYOUT = 19;
|
|
62
|
+
/** accept_vault_admin (disc 0x14 = 20) — complete a two-step vault-admin rotation. */
|
|
63
|
+
exports.IX_ACCEPT_VAULT_ADMIN = 20;
|
|
60
64
|
// ---------------------------------------------------------------------------
|
|
61
65
|
// Event Discriminators (1-byte)
|
|
62
66
|
// ---------------------------------------------------------------------------
|
|
@@ -83,6 +87,12 @@ exports.EVT_MIGRATE_EXECUTED = 19;
|
|
|
83
87
|
exports.EVT_DELAYED_DEPOSIT_PROCESSED = 20;
|
|
84
88
|
exports.EVT_INSTANT_WITHDRAWN = 21;
|
|
85
89
|
exports.EVT_STV_SEEDED = 22;
|
|
90
|
+
/** StvAdminSet — emitted by migrate_stv_layout. Fields: vault_id(8), admin(32). */
|
|
91
|
+
exports.EVT_STV_ADMIN_SET = 23;
|
|
92
|
+
/** AdminRotationStarted — emitted when update sets pending_admin to nonzero. Fields: vault_id(8), newPendingAdmin(32). */
|
|
93
|
+
exports.EVT_ADMIN_ROTATION_STARTED = 24;
|
|
94
|
+
/** AdminRotationAccepted — emitted by accept_vault_admin. Fields: vault_id(8), newAdmin(32). */
|
|
95
|
+
exports.EVT_ADMIN_ROTATION_ACCEPTED = 25;
|
|
86
96
|
// ---------------------------------------------------------------------------
|
|
87
97
|
// Vault Flags
|
|
88
98
|
// ---------------------------------------------------------------------------
|
|
@@ -127,7 +137,7 @@ var constants_2 = require("../common/constants");
|
|
|
127
137
|
Object.defineProperty(exports, "PPS_DECIMALS", { enumerable: true, get: function () { return constants_2.PPS_DECIMALS; } });
|
|
128
138
|
Object.defineProperty(exports, "BPS_DENOMINATOR", { enumerable: true, get: function () { return constants_2.BPS_DENOMINATOR; } });
|
|
129
139
|
Object.defineProperty(exports, "STALENESS_THRESHOLD", { enumerable: true, get: function () { return constants_2.STALENESS_THRESHOLD; } });
|
|
130
|
-
exports.MAX_CHILD_VAULTS =
|
|
140
|
+
exports.MAX_CHILD_VAULTS = 4;
|
|
131
141
|
exports.MAX_STRATEGIES = exports.MAX_CHILD_VAULTS; // backward compat
|
|
132
142
|
exports.FEE_CAP_BPS = 9900;
|
|
133
143
|
/** Max deposit_fee_bps / withdrawal_fee_bps (enforced at init_or_update_stv). */
|
|
@@ -213,6 +213,21 @@ function parseEventBuffer(data) {
|
|
|
213
213
|
return data.length >= 17 ? {
|
|
214
214
|
name: "StvSeeded", vaultId: (0, buffer_1.readU64)(data, 1), amount: (0, buffer_1.readU64)(data, 9),
|
|
215
215
|
} : null;
|
|
216
|
+
case constants_1.EVT_STV_ADMIN_SET:
|
|
217
|
+
// Fields: vault_id(8), admin(32) → total payload 41 bytes (with 1-byte disc = 41)
|
|
218
|
+
return data.length >= 41 ? {
|
|
219
|
+
name: "StvAdminSet", vaultId: (0, buffer_1.readU64)(data, 1), admin: (0, buffer_1.readPubkey)(data, 9),
|
|
220
|
+
} : null;
|
|
221
|
+
case constants_1.EVT_ADMIN_ROTATION_STARTED:
|
|
222
|
+
// Fields: vault_id(8), new_pending_admin(32) → total payload 41 bytes
|
|
223
|
+
return data.length >= 41 ? {
|
|
224
|
+
name: "AdminRotationStarted", vaultId: (0, buffer_1.readU64)(data, 1), newPendingAdmin: (0, buffer_1.readPubkey)(data, 9),
|
|
225
|
+
} : null;
|
|
226
|
+
case constants_1.EVT_ADMIN_ROTATION_ACCEPTED:
|
|
227
|
+
// Fields: vault_id(8), new_admin(32) → total payload 41 bytes
|
|
228
|
+
return data.length >= 41 ? {
|
|
229
|
+
name: "AdminRotationAccepted", vaultId: (0, buffer_1.readU64)(data, 1), newAdmin: (0, buffer_1.readPubkey)(data, 9),
|
|
230
|
+
} : null;
|
|
216
231
|
default:
|
|
217
232
|
return null;
|
|
218
233
|
}
|
|
@@ -49,6 +49,26 @@ export interface InitOrUpdateStvArgs {
|
|
|
49
49
|
* requires a C-1 seed floor and a non-allocator vault.
|
|
50
50
|
*/
|
|
51
51
|
withdrawalMode?: number;
|
|
52
|
+
/**
|
|
53
|
+
* CREATE path (STV does not yet exist): REQUIRED. Per-vault admin pubkey. Must be
|
|
54
|
+
* nonzero — the handler rejects zero / None. The global admin is the signer here;
|
|
55
|
+
* vaultAdmin can be a different key (e.g. a Squads multi-sig vault PDA).
|
|
56
|
+
*
|
|
57
|
+
* Wire encoding: `0x01 + 32 bytes` (Some(nonzero)). The handler will reject
|
|
58
|
+
* `None` (0x00) and `Some([0;32])` with `InvalidParameter`.
|
|
59
|
+
*/
|
|
60
|
+
vaultAdmin?: PublicKey;
|
|
61
|
+
/**
|
|
62
|
+
* UPDATE path (STV already exists): three-value encoding matching the handler:
|
|
63
|
+
* undefined / not provided → None → no change to pending rotation
|
|
64
|
+
* PublicKey.default ([0u8;32]) → Some([0;32]) → cancel pending rotation
|
|
65
|
+
* any nonzero PublicKey → Some(nonzero) → start/replace rotation; emits AdminRotationStarted
|
|
66
|
+
*
|
|
67
|
+
* Wire encoding: `0x00` (None) or `0x01 + 32 bytes` (Some).
|
|
68
|
+
* ONLY `accept_vault_admin` may change `stv.admin` post-create/migration.
|
|
69
|
+
* A pending admin has ZERO authority before accept.
|
|
70
|
+
*/
|
|
71
|
+
pendingAdmin?: PublicKey;
|
|
52
72
|
remainingAccounts?: AccountMeta[];
|
|
53
73
|
}
|
|
54
74
|
export declare function createInitOrUpdateStvIx(args: InitOrUpdateStvArgs, programId?: PublicKey): TransactionInstruction;
|
|
@@ -244,9 +264,11 @@ export interface AddManagerArgs {
|
|
|
244
264
|
}
|
|
245
265
|
export declare function createAddManagerIx(args: AddManagerArgs, programId?: PublicKey): TransactionInstruction;
|
|
246
266
|
export interface RemoveManagerArgs {
|
|
267
|
+
/** Must be the per-vault admin (stv.admin). NOT the global config admin. */
|
|
247
268
|
admin: PublicKey;
|
|
248
269
|
payer: PublicKey;
|
|
249
|
-
|
|
270
|
+
/** STV PDA — required for vault-admin auth check (stv.admin == admin). */
|
|
271
|
+
stv: PublicKey;
|
|
250
272
|
managerRole: PublicKey;
|
|
251
273
|
}
|
|
252
274
|
export declare function createRemoveManagerIx(args: RemoveManagerArgs, programId?: PublicKey): TransactionInstruction;
|
|
@@ -475,3 +497,37 @@ export interface SeedStvArgs {
|
|
|
475
497
|
amount: BN | number;
|
|
476
498
|
}
|
|
477
499
|
export declare function createSeedStvIx(args: SeedStvArgs, programId?: PublicKey): TransactionInstruction;
|
|
500
|
+
export interface MigrateStvLayoutArgs {
|
|
501
|
+
/** Must match GlobalConfig.admin. */
|
|
502
|
+
admin: PublicKey;
|
|
503
|
+
/** GlobalConfig PDA. */
|
|
504
|
+
config: PublicKey;
|
|
505
|
+
/** The v1-shaped STV account to migrate (writable). */
|
|
506
|
+
stv: PublicKey;
|
|
507
|
+
/**
|
|
508
|
+
* Expected vault_id from the v1 account (guards against passing the wrong STV
|
|
509
|
+
* for a given arg set — the handler hard-reverts on mismatch).
|
|
510
|
+
*/
|
|
511
|
+
expectedVaultId: BN | number;
|
|
512
|
+
/**
|
|
513
|
+
* Expected withdrawal_mode byte at the v1 offset (416). The handler validates
|
|
514
|
+
* this before the shuffle. Guards against stale ops scripts.
|
|
515
|
+
*/
|
|
516
|
+
expectedOldWithdrawalMode: number;
|
|
517
|
+
/**
|
|
518
|
+
* Optional withdrawal_mode backfill. When provided, the handler applies
|
|
519
|
+
* queue-empty guards and instant-mode restrictions before writing the new mode
|
|
520
|
+
* at the v2 offset (464). When undefined/omitted, the shuffled v1 byte is preserved.
|
|
521
|
+
*
|
|
522
|
+
* Values: 0=instant, 1=X, 2=X+1.
|
|
523
|
+
*/
|
|
524
|
+
newWithdrawalMode?: number;
|
|
525
|
+
}
|
|
526
|
+
export declare function createMigrateStvLayoutIx(args: MigrateStvLayoutArgs, programId?: PublicKey): TransactionInstruction;
|
|
527
|
+
export interface AcceptVaultAdminArgs {
|
|
528
|
+
/** Must equal stv.pending_admin on-chain. Signer proves the new key is live. */
|
|
529
|
+
pendingAdmin: PublicKey;
|
|
530
|
+
/** STV account (writable). */
|
|
531
|
+
stv: PublicKey;
|
|
532
|
+
}
|
|
533
|
+
export declare function createAcceptVaultAdminIx(args: AcceptVaultAdminArgs, programId?: PublicKey): TransactionInstruction;
|
|
@@ -21,6 +21,8 @@ exports.buildMigrateRemainingAccounts = buildMigrateRemainingAccounts;
|
|
|
21
21
|
exports.buildStrategyRemainingAccounts = buildStrategyRemainingAccounts;
|
|
22
22
|
exports.createInstantWithdrawIx = createInstantWithdrawIx;
|
|
23
23
|
exports.createSeedStvIx = createSeedStvIx;
|
|
24
|
+
exports.createMigrateStvLayoutIx = createMigrateStvLayoutIx;
|
|
25
|
+
exports.createAcceptVaultAdminIx = createAcceptVaultAdminIx;
|
|
24
26
|
const web3_js_1 = require("@solana/web3.js");
|
|
25
27
|
const spl_token_1 = require("@solana/spl-token");
|
|
26
28
|
const buffer_1 = require("../common/buffer");
|
|
@@ -42,7 +44,7 @@ function createInitOrUpdateConfigIx(args, programId = constants_1.PROGRAM_ID) {
|
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
function createInitOrUpdateStvIx(args, programId = constants_1.PROGRAM_ID) {
|
|
45
|
-
const { admin, payer, config, stv, evMint, baseMint, vaultAta, feeReceiverEvAta, tokenProgram, ataProgram = spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, systemProgram = web3_js_1.SystemProgram.programId, vaultId, stvBump, evMintBump, feeReceiver, strategy, epochSec, mgmtFeeBps, perfFeeBps, vaultCapacity, minDeposit, flags, addStrategy, removeStrategy, lendProgram, dailyWithdrawLimitBps, depositFeeBps, withdrawalFeeBps, withdrawalMode, remainingAccounts = [], } = args;
|
|
47
|
+
const { admin, payer, config, stv, evMint, baseMint, vaultAta, feeReceiverEvAta, tokenProgram, ataProgram = spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, systemProgram = web3_js_1.SystemProgram.programId, vaultId, stvBump, evMintBump, feeReceiver, strategy, epochSec, mgmtFeeBps, perfFeeBps, vaultCapacity, minDeposit, flags, addStrategy, removeStrategy, lendProgram, dailyWithdrawLimitBps, depositFeeBps, withdrawalFeeBps, withdrawalMode, vaultAdmin, pendingAdmin, remainingAccounts = [], } = args;
|
|
46
48
|
const data = [constants_1.IX_INIT_OR_UPDATE_STV];
|
|
47
49
|
(0, buffer_1.writeU64)(data, vaultId);
|
|
48
50
|
data.push(stvBump & 0xff);
|
|
@@ -65,6 +67,13 @@ function createInitOrUpdateStvIx(args, programId = constants_1.PROGRAM_ID) {
|
|
|
65
67
|
throw new Error(`withdrawalMode must be 0 (instant), 1 (X) or 2 (X+1); got ${withdrawalMode}`);
|
|
66
68
|
}
|
|
67
69
|
(0, buffer_1.writeOptionalU8)(data, withdrawalMode);
|
|
70
|
+
// NEW (v2): vault_admin_or_pending — the last optional-pubkey field.
|
|
71
|
+
// CREATE path: pass vaultAdmin (required nonzero). Handler rejects None/zero.
|
|
72
|
+
// UPDATE path: pass pendingAdmin (optional; None = no change, zero pubkey = cancel).
|
|
73
|
+
// Both share the same wire position; interpretation is per create/update branch.
|
|
74
|
+
// Wire: 0x00 = None, 0x01 + 32 bytes = Some(pubkey).
|
|
75
|
+
const vaultAdminOrPending = vaultAdmin ?? pendingAdmin;
|
|
76
|
+
(0, buffer_1.writeOptionalPubkey)(data, vaultAdminOrPending);
|
|
68
77
|
return new web3_js_1.TransactionInstruction({
|
|
69
78
|
keys: [
|
|
70
79
|
{ pubkey: admin, isSigner: true, isWritable: false },
|
|
@@ -316,12 +325,12 @@ function createAddManagerIx(args, programId = constants_1.PROGRAM_ID) {
|
|
|
316
325
|
});
|
|
317
326
|
}
|
|
318
327
|
function createRemoveManagerIx(args, programId = constants_1.PROGRAM_ID) {
|
|
319
|
-
const { admin, payer,
|
|
328
|
+
const { admin, payer, stv, managerRole } = args;
|
|
320
329
|
return new web3_js_1.TransactionInstruction({
|
|
321
330
|
keys: [
|
|
322
331
|
{ pubkey: admin, isSigner: true, isWritable: false },
|
|
323
332
|
{ pubkey: payer, isSigner: false, isWritable: true },
|
|
324
|
-
{ pubkey:
|
|
333
|
+
{ pubkey: stv, isSigner: false, isWritable: false },
|
|
325
334
|
{ pubkey: managerRole, isSigner: false, isWritable: true },
|
|
326
335
|
],
|
|
327
336
|
programId,
|
|
@@ -533,3 +542,43 @@ function createSeedStvIx(args, programId = constants_1.PROGRAM_ID) {
|
|
|
533
542
|
data: Buffer.from(data),
|
|
534
543
|
});
|
|
535
544
|
}
|
|
545
|
+
function createMigrateStvLayoutIx(args, programId = constants_1.PROGRAM_ID) {
|
|
546
|
+
const { admin, config, stv, expectedVaultId, expectedOldWithdrawalMode, newWithdrawalMode } = args;
|
|
547
|
+
// Data: expected_vault_id(8) + expected_old_withdrawal_mode(1)
|
|
548
|
+
// + new_withdrawal_mode (0x00 or 0x01 + byte).
|
|
549
|
+
const data = [constants_1.IX_MIGRATE_STV_LAYOUT];
|
|
550
|
+
(0, buffer_1.writeU64)(data, expectedVaultId);
|
|
551
|
+
data.push(expectedOldWithdrawalMode & 0xff);
|
|
552
|
+
if (newWithdrawalMode !== undefined && newWithdrawalMode !== null) {
|
|
553
|
+
if (newWithdrawalMode < 0 || newWithdrawalMode > 2) {
|
|
554
|
+
throw new Error(`newWithdrawalMode must be 0 (instant), 1 (X) or 2 (X+1); got ${newWithdrawalMode}`);
|
|
555
|
+
}
|
|
556
|
+
// Some(m): 0x01 tag + mode byte
|
|
557
|
+
data.push(0x01);
|
|
558
|
+
data.push(newWithdrawalMode & 0xff);
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
// None: 0x00 tag
|
|
562
|
+
data.push(0x00);
|
|
563
|
+
}
|
|
564
|
+
return new web3_js_1.TransactionInstruction({
|
|
565
|
+
keys: [
|
|
566
|
+
{ pubkey: admin, isSigner: true, isWritable: false },
|
|
567
|
+
{ pubkey: config, isSigner: false, isWritable: false },
|
|
568
|
+
{ pubkey: stv, isSigner: false, isWritable: true },
|
|
569
|
+
],
|
|
570
|
+
programId,
|
|
571
|
+
data: Buffer.from(data),
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
function createAcceptVaultAdminIx(args, programId = constants_1.PROGRAM_ID) {
|
|
575
|
+
const { pendingAdmin, stv } = args;
|
|
576
|
+
return new web3_js_1.TransactionInstruction({
|
|
577
|
+
keys: [
|
|
578
|
+
{ pubkey: pendingAdmin, isSigner: true, isWritable: false },
|
|
579
|
+
{ pubkey: stv, isSigner: false, isWritable: true },
|
|
580
|
+
],
|
|
581
|
+
programId,
|
|
582
|
+
data: Buffer.from([constants_1.IX_ACCEPT_VAULT_ADMIN]),
|
|
583
|
+
});
|
|
584
|
+
}
|
|
@@ -12,11 +12,21 @@ export interface Stv {
|
|
|
12
12
|
evMint: PublicKey;
|
|
13
13
|
strategy: PublicKey;
|
|
14
14
|
feeReceiver: PublicKey;
|
|
15
|
-
/** Pinned canonical ATA for feeReceiver + evMint. */
|
|
16
|
-
feeReceiverEvAta: PublicKey;
|
|
17
15
|
lendProgram: PublicKey;
|
|
18
16
|
/** Canonical ATA for (stv_pda, base_mint, token_program). Set at init. */
|
|
19
17
|
vaultAta: PublicKey;
|
|
18
|
+
/**
|
|
19
|
+
* Per-vault admin pubkey (v2 layout, offset 200). Set at create or migration.
|
|
20
|
+
* Never zero on a v2-loadable STV (enforced by the v2 freeze gate). Only
|
|
21
|
+
* `accept_vault_admin` may change this post-create/migration.
|
|
22
|
+
*/
|
|
23
|
+
admin: PublicKey;
|
|
24
|
+
/**
|
|
25
|
+
* Pending admin for two-step rotation (v2 layout, offset 232). Non-zero means a
|
|
26
|
+
* rotation is in progress; `accept_vault_admin` completes it. Zero = no pending
|
|
27
|
+
* rotation. A pending admin has ZERO authority before accept.
|
|
28
|
+
*/
|
|
29
|
+
pendingAdmin: PublicKey;
|
|
20
30
|
childVaults: BN[];
|
|
21
31
|
vaultId: BN;
|
|
22
32
|
reservedBase: BN;
|
|
@@ -50,6 +60,8 @@ export interface Stv {
|
|
|
50
60
|
pendingDepositBase: BN;
|
|
51
61
|
/** Number of open DelayedDepositRequest accounts. */
|
|
52
62
|
pendingDepositCount: number;
|
|
63
|
+
/** Pinned canonical ATA for feeReceiver + evMint (offset 424 in v2). */
|
|
64
|
+
feeReceiverEvAta: PublicKey;
|
|
53
65
|
/** C-1 supply floor (seed shares) — set by seed_stv, redeemed only via close_stv. */
|
|
54
66
|
lockedSeedShares: BN;
|
|
55
67
|
/** Withdrawal mode: 0=instant, 1=X, 2=X+1. Create-only/immutable. */
|
|
@@ -263,4 +275,22 @@ export interface StvSeededEvent {
|
|
|
263
275
|
vaultId: BN;
|
|
264
276
|
amount: BN;
|
|
265
277
|
}
|
|
266
|
-
|
|
278
|
+
/** Emitted by migrate_stv_layout after setting the initial per-vault admin. */
|
|
279
|
+
export interface StvAdminSetEvent {
|
|
280
|
+
name: "StvAdminSet";
|
|
281
|
+
vaultId: BN;
|
|
282
|
+
admin: PublicKey;
|
|
283
|
+
}
|
|
284
|
+
/** Emitted by init_or_update_stv (update path) when pending_admin is set to a nonzero value. */
|
|
285
|
+
export interface AdminRotationStartedEvent {
|
|
286
|
+
name: "AdminRotationStarted";
|
|
287
|
+
vaultId: BN;
|
|
288
|
+
newPendingAdmin: PublicKey;
|
|
289
|
+
}
|
|
290
|
+
/** Emitted by accept_vault_admin after the new admin accepts the rotation. */
|
|
291
|
+
export interface AdminRotationAcceptedEvent {
|
|
292
|
+
name: "AdminRotationAccepted";
|
|
293
|
+
vaultId: BN;
|
|
294
|
+
newAdmin: PublicKey;
|
|
295
|
+
}
|
|
296
|
+
export type StvEvent = ConfigInitializedEvent | ConfigUpdatedEvent | StvCreatedEvent | StvUpdatedEvent | DepositedEvent | WithdrawRequestedEvent | WithdrawRequestIncreasedEvent | WithdrawClaimedEvent | DepositedToStrategyEvent | WithdrawnFromStrategyEvent | EpochProcessedEvent | EpochAdvancedEvent | FeesSettledEvent | StvClosedEvent | ManagerAddedEvent | ManagerRemovedEvent | WithdrawOverrideClaimedEvent | LendMigratedEvent | MigrateRequestedEvent | MigrateExecutedEvent | DelayedDepositProcessedEvent | InstantWithdrawnEvent | StvSeededEvent | StvAdminSetEvent | AdminRotationStartedEvent | AdminRotationAcceptedEvent;
|