damm-sdk 1.4.36 → 1.4.37

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 (39) hide show
  1. package/dist/index.cjs +32968 -40246
  2. package/dist/index.cjs.map +122 -200
  3. package/dist/index.js +40234 -39832
  4. package/dist/index.js.map +82 -96
  5. package/dist/integrations/index.d.ts +1 -0
  6. package/dist/integrations/index.d.ts.map +1 -1
  7. package/dist/integrations/lagoonV1/delay.proxy.admin.d.ts +208 -0
  8. package/dist/integrations/lagoonV1/delay.proxy.admin.d.ts.map +1 -0
  9. package/dist/integrations/lagoonV1/index.d.ts +1 -0
  10. package/dist/integrations/lagoonV1/index.d.ts.map +1 -1
  11. package/dist/integrations/lagoonV1/lagoon.v1.d.ts +17 -0
  12. package/dist/integrations/lagoonV1/lagoon.v1.d.ts.map +1 -1
  13. package/dist/integrations/lagoonV2/addresses.d.ts +19 -0
  14. package/dist/integrations/lagoonV2/addresses.d.ts.map +1 -0
  15. package/dist/integrations/lagoonV2/factory.abi.d.ts +183 -0
  16. package/dist/integrations/lagoonV2/factory.abi.d.ts.map +1 -0
  17. package/dist/integrations/lagoonV2/index.d.ts +7 -0
  18. package/dist/integrations/lagoonV2/index.d.ts.map +1 -0
  19. package/dist/integrations/lagoonV2/lagoon.v2.d.ts +132 -0
  20. package/dist/integrations/lagoonV2/lagoon.v2.d.ts.map +1 -0
  21. package/dist/integrations/lagoonV2/lagoon.v2.permissions.d.ts +268 -0
  22. package/dist/integrations/lagoonV2/lagoon.v2.permissions.d.ts.map +1 -0
  23. package/dist/integrations/lagoonV2/lagoon.v2.setters.d.ts +293 -0
  24. package/dist/integrations/lagoonV2/lagoon.v2.setters.d.ts.map +1 -0
  25. package/dist/integrations/lagoonV2/vault.abi.d.ts +349 -0
  26. package/dist/integrations/lagoonV2/vault.abi.d.ts.map +1 -0
  27. package/package.json +1 -1
  28. package/src/integrations/index.ts +1 -0
  29. package/src/integrations/lagoonV1/delay.proxy.admin.ts +358 -0
  30. package/src/integrations/lagoonV1/index.ts +1 -0
  31. package/src/integrations/lagoonV1/lagoon.v1.ts +109 -36
  32. package/src/integrations/lagoonV2/addresses.ts +35 -0
  33. package/src/integrations/lagoonV2/factory.abi.ts +110 -0
  34. package/src/integrations/lagoonV2/index.ts +6 -0
  35. package/src/integrations/lagoonV2/lagoon.v2.permissions.ts +578 -0
  36. package/src/integrations/lagoonV2/lagoon.v2.setters.ts +521 -0
  37. package/src/integrations/lagoonV2/lagoon.v2.ts +345 -0
  38. package/src/integrations/lagoonV2/vault.abi.ts +479 -0
  39. package/src/lib/contractsRegistry.json +4 -2
@@ -0,0 +1,110 @@
1
+ // Lagoon v0.6 factory ABI — v3 factory, bytes overload only.
2
+ // The typed overload (0xff592eb5) embeds the v0.5.1 12-field InitStruct and reverts on the
3
+ // 19-field v0.6 struct decode. Always use the bytes overload (0x9dfe49f2) for v0.6 deployments.
4
+ export default [
5
+ {
6
+ inputs: [{ internalType: "bool", name: "disable", type: "bool" }],
7
+ stateMutability: "nonpayable",
8
+ type: "constructor",
9
+ },
10
+ { inputs: [], name: "InvalidInitialization", type: "error" },
11
+ { inputs: [], name: "NotInitializing", type: "error" },
12
+ {
13
+ inputs: [{ internalType: "address", name: "owner", type: "address" }],
14
+ name: "OwnableInvalidOwner",
15
+ type: "error",
16
+ },
17
+ {
18
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
19
+ name: "OwnableUnauthorizedAccount",
20
+ type: "error",
21
+ },
22
+ {
23
+ anonymous: false,
24
+ inputs: [{ indexed: false, internalType: "uint64", name: "version", type: "uint64" }],
25
+ name: "Initialized",
26
+ type: "event",
27
+ },
28
+ {
29
+ anonymous: false,
30
+ inputs: [
31
+ { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
32
+ { indexed: true, internalType: "address", name: "newOwner", type: "address" },
33
+ ],
34
+ name: "OwnershipTransferred",
35
+ type: "event",
36
+ },
37
+ {
38
+ anonymous: false,
39
+ inputs: [
40
+ { indexed: false, internalType: "address", name: "proxy", type: "address" },
41
+ { indexed: false, internalType: "address", name: "deployer", type: "address" },
42
+ ],
43
+ name: "ProxyDeployed",
44
+ type: "event",
45
+ },
46
+ // Bytes overload: selector 0x9dfe49f2
47
+ // call_data must be pre-encoded as: initialize(bytes,address,address) with abi.encode(<19-field InitStruct tuple>)
48
+ // Use this overload exclusively for v0.6 — the typed overload (0xff592eb5) contains the
49
+ // v0.5.1 12-field struct and reverts on any v0.6 decode attempt.
50
+ {
51
+ inputs: [
52
+ { internalType: "address", name: "_logic", type: "address" },
53
+ { internalType: "address", name: "_initialOwner", type: "address" },
54
+ { internalType: "uint256", name: "_initialDelay", type: "uint256" },
55
+ { internalType: "bytes", name: "call_data", type: "bytes" },
56
+ { internalType: "bytes32", name: "salt", type: "bytes32" },
57
+ ],
58
+ name: "createVaultProxy",
59
+ outputs: [{ internalType: "address", name: "", type: "address" }],
60
+ stateMutability: "nonpayable",
61
+ type: "function",
62
+ },
63
+ {
64
+ inputs: [
65
+ { internalType: "address", name: "_registry", type: "address" },
66
+ { internalType: "address", name: "_wrappedNativeToken", type: "address" },
67
+ { internalType: "address", name: "owner", type: "address" },
68
+ ],
69
+ name: "initialize",
70
+ outputs: [],
71
+ stateMutability: "nonpayable",
72
+ type: "function",
73
+ },
74
+ {
75
+ inputs: [{ internalType: "address", name: "vault", type: "address" }],
76
+ name: "isInstance",
77
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
78
+ stateMutability: "view",
79
+ type: "function",
80
+ },
81
+ {
82
+ inputs: [],
83
+ name: "owner",
84
+ outputs: [{ internalType: "address", name: "", type: "address" }],
85
+ stateMutability: "view",
86
+ type: "function",
87
+ },
88
+ {
89
+ inputs: [],
90
+ name: "registry",
91
+ outputs: [{ internalType: "address", name: "", type: "address" }],
92
+ stateMutability: "view",
93
+ type: "function",
94
+ },
95
+ { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" },
96
+ {
97
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
98
+ name: "transferOwnership",
99
+ outputs: [],
100
+ stateMutability: "nonpayable",
101
+ type: "function",
102
+ },
103
+ {
104
+ inputs: [],
105
+ name: "wrappedNativeToken",
106
+ outputs: [{ internalType: "address", name: "", type: "address" }],
107
+ stateMutability: "view",
108
+ type: "function",
109
+ },
110
+ ] as const;
@@ -0,0 +1,6 @@
1
+ export { default as lagoonV2FactoryAbi } from "./factory.abi";
2
+ export { default as lagoonV2VaultAbi } from "./vault.abi";
3
+ export * from "./addresses";
4
+ export * from "./lagoon.v2";
5
+ export * from "./lagoon.v2.permissions";
6
+ export * from "./lagoon.v2.setters";
@@ -0,0 +1,578 @@
1
+ /**
2
+ * Lagoon v0.6 vault permission builders.
3
+ *
4
+ * These functions encode calldata for the role-gated functions on a deployed v0.6
5
+ * LagoonVault proxy. They are the v0.6 counterparts of the v0.5 helpers in
6
+ * `src/integrations/lagoonV1/lagoon.v1.ts` and mirror that module's shape exactly.
7
+ *
8
+ * Naming: all exports are prefixed `LagoonV2` / `lagoonV2` to avoid name conflicts
9
+ * with the v0.5 lagoonV1 exports (e.g. PauseVaultCalldata, pauseVaultTrx) that are
10
+ * already on the top-level SDK namespace.
11
+ *
12
+ * All function signatures have been verified against the deployed v0.6 implementations:
13
+ * Arbitrum: 0x3f5A9e1D82c595d14bA93c97eB8a77928cFdee70
14
+ * Ethereum: 0x6C77c47FB8168E22976C3B0338CB1769c952249f
15
+ *
16
+ * v0.6 differences from v0.5 that affect this module:
17
+ * - updateRates takes a 5-field Rates struct (managementRate, performanceRate,
18
+ * entryRate, exitRate, haircutRate) — selector 0x0190b902. v0.5 had 2 fields.
19
+ * - addToBlacklist / revokeFromBlacklist are NEW (Accessable / Blacklist mode).
20
+ * - updateSecurityCouncil and updateSuperOperator are NEW role setters.
21
+ * - addToWhitelist / revokeFromWhitelist remain for Whitelist mode.
22
+ */
23
+
24
+ import { encodeFunctionData } from "viem";
25
+ import type { Address } from "viem";
26
+ import { createCall, type Call, type HexString, type Unwrapable } from "../..";
27
+ import lagoonV2VaultAbi from "./vault.abi.ts";
28
+
29
+ // ---------------------------------------------------------------------------
30
+ // Types
31
+ // ---------------------------------------------------------------------------
32
+
33
+ /**
34
+ * 5-field fee rates struct for Lagoon v0.6.
35
+ *
36
+ * Caps (from FeeLib.sol):
37
+ * managementRate max 1000 bps (10%)
38
+ * performanceRate max 5000 bps (50%)
39
+ * entryRate max 200 bps (2%)
40
+ * exitRate max 200 bps (2%)
41
+ * haircutRate max 2000 bps (20%)
42
+ *
43
+ * Entry and exit rates can only DECREASE after first initialization
44
+ * (RateCanOnlyDecrease). Management, performance, and haircut have no
45
+ * monotonic rule — they can be raised up to their caps at any time.
46
+ */
47
+ export type LagoonV2Rates = Readonly<{
48
+ managementRate: number; // uint16, max 1000
49
+ performanceRate: number; // uint16, max 5000
50
+ entryRate: number; // uint16, max 200
51
+ exitRate: number; // uint16, max 200
52
+ haircutRate: number; // uint16, max 2000
53
+ }>;
54
+
55
+ // ---------------------------------------------------------------------------
56
+ // Validation
57
+ // ---------------------------------------------------------------------------
58
+
59
+ function validateLagoonV2Rates(rates: LagoonV2Rates): void {
60
+ if (rates.managementRate > 1_000) {
61
+ throw new Error(`managementRate ${rates.managementRate} exceeds max 1000 bps (10%)`);
62
+ }
63
+ if (rates.performanceRate > 5_000) {
64
+ throw new Error(`performanceRate ${rates.performanceRate} exceeds max 5000 bps (50%)`);
65
+ }
66
+ if (rates.entryRate > 200) {
67
+ throw new Error(`entryRate ${rates.entryRate} exceeds max 200 bps (2%)`);
68
+ }
69
+ if (rates.exitRate > 200) {
70
+ throw new Error(`exitRate ${rates.exitRate} exceeds max 200 bps (2%)`);
71
+ }
72
+ if (rates.haircutRate > 2_000) {
73
+ throw new Error(`haircutRate ${rates.haircutRate} exceeds max 2000 bps (20%)`);
74
+ }
75
+ }
76
+
77
+ // ---------------------------------------------------------------------------
78
+ // Settler (Safe) — settleDeposit, settleRedeem, updateNewTotalAssets, expireTotalAssets
79
+ // ---------------------------------------------------------------------------
80
+
81
+ /**
82
+ * Encodes a `settleDeposit(uint256 epoch)` call.
83
+ * Selector: 0xd24ca58a
84
+ * Role: Safe (Settler)
85
+ */
86
+ export const LagoonV2SettleDepositCalldata = ({ epoch }: { epoch: bigint }): HexString => {
87
+ return encodeFunctionData({
88
+ abi: lagoonV2VaultAbi,
89
+ functionName: "settleDeposit",
90
+ args: [epoch],
91
+ }) as HexString;
92
+ };
93
+
94
+ export const lagoonV2SettleDepositTrx = ({ vault, epoch }: { vault: Address; epoch: bigint }): Unwrapable<Call> => {
95
+ return createCall({
96
+ operation: 0,
97
+ to: vault,
98
+ value: 0n,
99
+ data: LagoonV2SettleDepositCalldata({ epoch }),
100
+ });
101
+ };
102
+
103
+ /**
104
+ * Encodes a `settleRedeem(uint256 epoch)` call.
105
+ * Selector: 0xa627df66
106
+ * Role: Safe (Settler)
107
+ */
108
+ export const LagoonV2SettleRedeemCalldata = ({ epoch }: { epoch: bigint }): HexString => {
109
+ return encodeFunctionData({
110
+ abi: lagoonV2VaultAbi,
111
+ functionName: "settleRedeem",
112
+ args: [epoch],
113
+ }) as HexString;
114
+ };
115
+
116
+ export const lagoonV2SettleRedeemTrx = ({ vault, epoch }: { vault: Address; epoch: bigint }): Unwrapable<Call> => {
117
+ return createCall({
118
+ operation: 0,
119
+ to: vault,
120
+ value: 0n,
121
+ data: LagoonV2SettleRedeemCalldata({ epoch }),
122
+ });
123
+ };
124
+
125
+ /**
126
+ * Encodes an `updateNewTotalAssets(uint256 newTotalAssets)` call.
127
+ * Selector: 0xbcd1bf34
128
+ * Role: Valuation Manager
129
+ *
130
+ * Subject to guardrails when activated. Reverts ValuationUpdateNotAllowed()
131
+ * if a NAV is currently valid (isTotalAssetsValid()). The Safe must call
132
+ * lagoonV2ExpireTotalAssetsTrx first in that case.
133
+ */
134
+ export const LagoonV2UpdateNewTotalAssetsCalldata = ({ newTotalAssets }: { newTotalAssets: bigint }): HexString => {
135
+ return encodeFunctionData({
136
+ abi: lagoonV2VaultAbi,
137
+ functionName: "updateNewTotalAssets",
138
+ args: [newTotalAssets],
139
+ }) as HexString;
140
+ };
141
+
142
+ export const lagoonV2UpdateNewTotalAssetsTrx = ({
143
+ vault,
144
+ newTotalAssets,
145
+ }: {
146
+ vault: Address;
147
+ newTotalAssets: bigint;
148
+ }): Unwrapable<Call> => {
149
+ return createCall({
150
+ operation: 0,
151
+ to: vault,
152
+ value: 0n,
153
+ data: LagoonV2UpdateNewTotalAssetsCalldata({ newTotalAssets }),
154
+ });
155
+ };
156
+
157
+ /**
158
+ * Encodes an `expireTotalAssets()` call.
159
+ * Selector: 0x927b15df
160
+ * Role: Safe
161
+ *
162
+ * Immediately invalidates the current NAV. Required before pushing a new NAV
163
+ * when isTotalAssetsValid() is true.
164
+ */
165
+ export const LagoonV2ExpireTotalAssetsCalldata = (): HexString => {
166
+ return encodeFunctionData({
167
+ abi: lagoonV2VaultAbi,
168
+ functionName: "expireTotalAssets",
169
+ args: [],
170
+ }) as HexString;
171
+ };
172
+
173
+ export const lagoonV2ExpireTotalAssetsTrx = ({ vault }: { vault: Address }): Unwrapable<Call> => {
174
+ return createCall({
175
+ operation: 0,
176
+ to: vault,
177
+ value: 0n,
178
+ data: LagoonV2ExpireTotalAssetsCalldata(),
179
+ });
180
+ };
181
+
182
+ // ---------------------------------------------------------------------------
183
+ // Guardian — pause / unpause
184
+ // ---------------------------------------------------------------------------
185
+
186
+ /**
187
+ * Encodes a `pause()` call.
188
+ * Selector: 0x8456cb59
189
+ * Role: Owner (Guardian in practice — Owner delegates pause authority)
190
+ *
191
+ * Halts all deposit and redeem operations. Emergency use only.
192
+ */
193
+ export const LagoonV2PauseVaultCalldata = (): HexString => {
194
+ return encodeFunctionData({
195
+ abi: lagoonV2VaultAbi,
196
+ functionName: "pause",
197
+ args: [],
198
+ }) as HexString;
199
+ };
200
+
201
+ export const lagoonV2PauseVaultTrx = ({ vault }: { vault: Address }): Unwrapable<Call> => {
202
+ return createCall({
203
+ operation: 0,
204
+ to: vault,
205
+ value: 0n,
206
+ data: LagoonV2PauseVaultCalldata(),
207
+ });
208
+ };
209
+
210
+ /**
211
+ * Encodes an `unpause()` call.
212
+ * Selector: 0x3f4ba83a
213
+ * Role: Owner (Admin)
214
+ *
215
+ * Resumes normal vault operations after a pause.
216
+ */
217
+ export const LagoonV2UnpauseVaultCalldata = (): HexString => {
218
+ return encodeFunctionData({
219
+ abi: lagoonV2VaultAbi,
220
+ functionName: "unpause",
221
+ args: [],
222
+ }) as HexString;
223
+ };
224
+
225
+ export const lagoonV2UnpauseVaultTrx = ({ vault }: { vault: Address }): Unwrapable<Call> => {
226
+ return createCall({
227
+ operation: 0,
228
+ to: vault,
229
+ value: 0n,
230
+ data: LagoonV2UnpauseVaultCalldata(),
231
+ });
232
+ };
233
+
234
+ // ---------------------------------------------------------------------------
235
+ // Whitelist Manager — whitelist operations (Whitelist access mode)
236
+ // ---------------------------------------------------------------------------
237
+
238
+ /**
239
+ * Encodes an `addToWhitelist(address[] accounts)` call.
240
+ * Selector: 0x7f649783
241
+ * Role: Whitelist (Access) Manager
242
+ *
243
+ * Grants vault access when the vault is in Whitelist mode (AccessMode.Whitelist).
244
+ * In Blacklist mode this is still callable but has no gate effect.
245
+ */
246
+ export const LagoonV2AddToWhitelistCalldata = ({ accounts }: { accounts: Address[] }): HexString => {
247
+ return encodeFunctionData({
248
+ abi: lagoonV2VaultAbi,
249
+ functionName: "addToWhitelist",
250
+ args: [accounts],
251
+ }) as HexString;
252
+ };
253
+
254
+ export const lagoonV2AddToWhitelistTrx = ({
255
+ vault,
256
+ accounts,
257
+ }: {
258
+ vault: Address;
259
+ accounts: Address[];
260
+ }): Unwrapable<Call> => {
261
+ return createCall({
262
+ operation: 0,
263
+ to: vault,
264
+ value: 0n,
265
+ data: LagoonV2AddToWhitelistCalldata({ accounts }),
266
+ });
267
+ };
268
+
269
+ /**
270
+ * Encodes a `revokeFromWhitelist(address[] accounts)` call.
271
+ * Selector: 0x86af6e68
272
+ * Role: Whitelist (Access) Manager
273
+ *
274
+ * Revokes vault access for addresses in Whitelist mode.
275
+ */
276
+ export const LagoonV2RevokeFromWhitelistCalldata = ({ accounts }: { accounts: Address[] }): HexString => {
277
+ return encodeFunctionData({
278
+ abi: lagoonV2VaultAbi,
279
+ functionName: "revokeFromWhitelist",
280
+ args: [accounts],
281
+ }) as HexString;
282
+ };
283
+
284
+ export const lagoonV2RevokeFromWhitelistTrx = ({
285
+ vault,
286
+ accounts,
287
+ }: {
288
+ vault: Address;
289
+ accounts: Address[];
290
+ }): Unwrapable<Call> => {
291
+ return createCall({
292
+ operation: 0,
293
+ to: vault,
294
+ value: 0n,
295
+ data: LagoonV2RevokeFromWhitelistCalldata({ accounts }),
296
+ });
297
+ };
298
+
299
+ // ---------------------------------------------------------------------------
300
+ // Whitelist Manager — blacklist operations (Blacklist access mode — NEW in v0.6)
301
+ // ---------------------------------------------------------------------------
302
+
303
+ /**
304
+ * Encodes an `addToBlacklist(address[] accounts)` call.
305
+ * Selector: 0x935eb35f
306
+ * Role: Whitelist (Access) Manager
307
+ *
308
+ * Blocks vault access and transfers for addresses in Blacklist mode.
309
+ * NEW in v0.6 — does not exist in v0.5.
310
+ */
311
+ export const LagoonV2AddToBlacklistCalldata = ({ accounts }: { accounts: Address[] }): HexString => {
312
+ return encodeFunctionData({
313
+ abi: lagoonV2VaultAbi,
314
+ functionName: "addToBlacklist",
315
+ args: [accounts],
316
+ }) as HexString;
317
+ };
318
+
319
+ export const lagoonV2AddToBlacklistTrx = ({
320
+ vault,
321
+ accounts,
322
+ }: {
323
+ vault: Address;
324
+ accounts: Address[];
325
+ }): Unwrapable<Call> => {
326
+ return createCall({
327
+ operation: 0,
328
+ to: vault,
329
+ value: 0n,
330
+ data: LagoonV2AddToBlacklistCalldata({ accounts }),
331
+ });
332
+ };
333
+
334
+ /**
335
+ * Encodes a `revokeFromBlacklist(address[] accounts)` call.
336
+ * Selector: 0x4cc724c2
337
+ * Role: Whitelist (Access) Manager
338
+ *
339
+ * Removes addresses from the blacklist.
340
+ * NEW in v0.6 — does not exist in v0.5.
341
+ */
342
+ export const LagoonV2RevokeFromBlacklistCalldata = ({ accounts }: { accounts: Address[] }): HexString => {
343
+ return encodeFunctionData({
344
+ abi: lagoonV2VaultAbi,
345
+ functionName: "revokeFromBlacklist",
346
+ args: [accounts],
347
+ }) as HexString;
348
+ };
349
+
350
+ export const lagoonV2RevokeFromBlacklistTrx = ({
351
+ vault,
352
+ accounts,
353
+ }: {
354
+ vault: Address;
355
+ accounts: Address[];
356
+ }): Unwrapable<Call> => {
357
+ return createCall({
358
+ operation: 0,
359
+ to: vault,
360
+ value: 0n,
361
+ data: LagoonV2RevokeFromBlacklistCalldata({ accounts }),
362
+ });
363
+ };
364
+
365
+ // ---------------------------------------------------------------------------
366
+ // Admin — updateRates (5-field Rates struct — NEW ABI in v0.6)
367
+ // ---------------------------------------------------------------------------
368
+
369
+ /**
370
+ * Encodes an `updateRates((uint16,uint16,uint16,uint16,uint16) rates)` call.
371
+ * Selector: 0x0190b902
372
+ * Role: Owner (Admin)
373
+ *
374
+ * v0.6 CHANGE: v0.5 had `updateRates(uint16 managementRate, uint16 performanceRate)`
375
+ * (2 positional args). v0.6 uses a single Rates struct with 5 fields. The selector
376
+ * is therefore different and not backward-compatible with v0.5 callers.
377
+ *
378
+ * Rate-change rules:
379
+ * - entryRate and exitRate can only DECREASE after first initialization.
380
+ * - managementRate, performanceRate, and haircutRate can be raised or lowered
381
+ * freely up to their respective caps.
382
+ * - No cooldown mechanism (removed in v0.6).
383
+ */
384
+ export const LagoonV2UpdateRatesCalldata = ({ rates }: { rates: LagoonV2Rates }): HexString => {
385
+ validateLagoonV2Rates(rates);
386
+
387
+ return encodeFunctionData({
388
+ abi: lagoonV2VaultAbi,
389
+ functionName: "updateRates",
390
+ args: [
391
+ {
392
+ managementRate: rates.managementRate,
393
+ performanceRate: rates.performanceRate,
394
+ entryRate: rates.entryRate,
395
+ exitRate: rates.exitRate,
396
+ haircutRate: rates.haircutRate,
397
+ },
398
+ ],
399
+ }) as HexString;
400
+ };
401
+
402
+ export const lagoonV2UpdateRatesTrx = ({
403
+ vault,
404
+ rates,
405
+ }: {
406
+ vault: Address;
407
+ rates: LagoonV2Rates;
408
+ }): Unwrapable<Call> => {
409
+ return createCall({
410
+ operation: 0,
411
+ to: vault,
412
+ value: 0n,
413
+ data: LagoonV2UpdateRatesCalldata({ rates }),
414
+ });
415
+ };
416
+
417
+ // ---------------------------------------------------------------------------
418
+ // Admin — role setters
419
+ // ---------------------------------------------------------------------------
420
+
421
+ /**
422
+ * Encodes an `updateWhitelistManager(address)` call.
423
+ * Selector: 0xf1a76fcc
424
+ * Role: Owner (Admin)
425
+ */
426
+ export const LagoonV2UpdateWhitelistManagerCalldata = ({
427
+ newWhitelistManager,
428
+ }: {
429
+ newWhitelistManager: Address;
430
+ }): HexString => {
431
+ return encodeFunctionData({
432
+ abi: lagoonV2VaultAbi,
433
+ functionName: "updateWhitelistManager",
434
+ args: [newWhitelistManager],
435
+ }) as HexString;
436
+ };
437
+
438
+ export const lagoonV2UpdateWhitelistManagerTrx = ({
439
+ vault,
440
+ newWhitelistManager,
441
+ }: {
442
+ vault: Address;
443
+ newWhitelistManager: Address;
444
+ }): Unwrapable<Call> => {
445
+ return createCall({
446
+ operation: 0,
447
+ to: vault,
448
+ value: 0n,
449
+ data: LagoonV2UpdateWhitelistManagerCalldata({ newWhitelistManager }),
450
+ });
451
+ };
452
+
453
+ /**
454
+ * Encodes an `updateValuationManager(address)` call.
455
+ * Selector: 0x65ccfcef
456
+ * Role: Owner (Admin)
457
+ */
458
+ export const LagoonV2UpdateValuationManagerCalldata = ({
459
+ newValuationManager,
460
+ }: {
461
+ newValuationManager: Address;
462
+ }): HexString => {
463
+ return encodeFunctionData({
464
+ abi: lagoonV2VaultAbi,
465
+ functionName: "updateValuationManager",
466
+ args: [newValuationManager],
467
+ }) as HexString;
468
+ };
469
+
470
+ export const lagoonV2UpdateValuationManagerTrx = ({
471
+ vault,
472
+ newValuationManager,
473
+ }: {
474
+ vault: Address;
475
+ newValuationManager: Address;
476
+ }): Unwrapable<Call> => {
477
+ return createCall({
478
+ operation: 0,
479
+ to: vault,
480
+ value: 0n,
481
+ data: LagoonV2UpdateValuationManagerCalldata({ newValuationManager }),
482
+ });
483
+ };
484
+
485
+ /**
486
+ * Encodes an `updateFeeReceiver(address)` call.
487
+ * Selector: 0xc69bebe4
488
+ * Role: Owner (Admin)
489
+ */
490
+ export const LagoonV2UpdateFeeReceiverCalldata = ({ newFeeReceiver }: { newFeeReceiver: Address }): HexString => {
491
+ return encodeFunctionData({
492
+ abi: lagoonV2VaultAbi,
493
+ functionName: "updateFeeReceiver",
494
+ args: [newFeeReceiver],
495
+ }) as HexString;
496
+ };
497
+
498
+ export const lagoonV2UpdateFeeReceiverTrx = ({
499
+ vault,
500
+ newFeeReceiver,
501
+ }: {
502
+ vault: Address;
503
+ newFeeReceiver: Address;
504
+ }): Unwrapable<Call> => {
505
+ return createCall({
506
+ operation: 0,
507
+ to: vault,
508
+ value: 0n,
509
+ data: LagoonV2UpdateFeeReceiverCalldata({ newFeeReceiver }),
510
+ });
511
+ };
512
+
513
+ /**
514
+ * Encodes an `updateSecurityCouncil(address)` call.
515
+ * Selector: 0xdbfe3e96
516
+ * Role: Owner (Admin)
517
+ *
518
+ * NEW in v0.6. The Security Council can bypass guardrails via
519
+ * securityCouncilUpdateTotalAssets() — treat this address as high-trust.
520
+ */
521
+ export const LagoonV2UpdateSecurityCouncilCalldata = ({
522
+ newSecurityCouncil,
523
+ }: {
524
+ newSecurityCouncil: Address;
525
+ }): HexString => {
526
+ return encodeFunctionData({
527
+ abi: lagoonV2VaultAbi,
528
+ functionName: "updateSecurityCouncil",
529
+ args: [newSecurityCouncil],
530
+ }) as HexString;
531
+ };
532
+
533
+ export const lagoonV2UpdateSecurityCouncilTrx = ({
534
+ vault,
535
+ newSecurityCouncil,
536
+ }: {
537
+ vault: Address;
538
+ newSecurityCouncil: Address;
539
+ }): Unwrapable<Call> => {
540
+ return createCall({
541
+ operation: 0,
542
+ to: vault,
543
+ value: 0n,
544
+ data: LagoonV2UpdateSecurityCouncilCalldata({ newSecurityCouncil }),
545
+ });
546
+ };
547
+
548
+ /**
549
+ * Encodes an `updateSuperOperator(address)` call.
550
+ * Selector: 0x3a891d3b
551
+ * Role: Owner (Admin)
552
+ *
553
+ * NEW in v0.6. The Super Operator can act on behalf of any user without
554
+ * per-user approval (except for protocolFeeReceiver). Can be locked
555
+ * permanently via lockSuperOperator().
556
+ */
557
+ export const LagoonV2UpdateSuperOperatorCalldata = ({ newSuperOperator }: { newSuperOperator: Address }): HexString => {
558
+ return encodeFunctionData({
559
+ abi: lagoonV2VaultAbi,
560
+ functionName: "updateSuperOperator",
561
+ args: [newSuperOperator],
562
+ }) as HexString;
563
+ };
564
+
565
+ export const lagoonV2UpdateSuperOperatorTrx = ({
566
+ vault,
567
+ newSuperOperator,
568
+ }: {
569
+ vault: Address;
570
+ newSuperOperator: Address;
571
+ }): Unwrapable<Call> => {
572
+ return createCall({
573
+ operation: 0,
574
+ to: vault,
575
+ value: 0n,
576
+ data: LagoonV2UpdateSuperOperatorCalldata({ newSuperOperator }),
577
+ });
578
+ };