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.
- package/dist/index.cjs +32968 -40246
- package/dist/index.cjs.map +122 -200
- package/dist/index.js +40234 -39832
- package/dist/index.js.map +82 -96
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/lagoonV1/delay.proxy.admin.d.ts +208 -0
- package/dist/integrations/lagoonV1/delay.proxy.admin.d.ts.map +1 -0
- package/dist/integrations/lagoonV1/index.d.ts +1 -0
- package/dist/integrations/lagoonV1/index.d.ts.map +1 -1
- package/dist/integrations/lagoonV1/lagoon.v1.d.ts +17 -0
- package/dist/integrations/lagoonV1/lagoon.v1.d.ts.map +1 -1
- package/dist/integrations/lagoonV2/addresses.d.ts +19 -0
- package/dist/integrations/lagoonV2/addresses.d.ts.map +1 -0
- package/dist/integrations/lagoonV2/factory.abi.d.ts +183 -0
- package/dist/integrations/lagoonV2/factory.abi.d.ts.map +1 -0
- package/dist/integrations/lagoonV2/index.d.ts +7 -0
- package/dist/integrations/lagoonV2/index.d.ts.map +1 -0
- package/dist/integrations/lagoonV2/lagoon.v2.d.ts +132 -0
- package/dist/integrations/lagoonV2/lagoon.v2.d.ts.map +1 -0
- package/dist/integrations/lagoonV2/lagoon.v2.permissions.d.ts +268 -0
- package/dist/integrations/lagoonV2/lagoon.v2.permissions.d.ts.map +1 -0
- package/dist/integrations/lagoonV2/lagoon.v2.setters.d.ts +293 -0
- package/dist/integrations/lagoonV2/lagoon.v2.setters.d.ts.map +1 -0
- package/dist/integrations/lagoonV2/vault.abi.d.ts +349 -0
- package/dist/integrations/lagoonV2/vault.abi.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/integrations/index.ts +1 -0
- package/src/integrations/lagoonV1/delay.proxy.admin.ts +358 -0
- package/src/integrations/lagoonV1/index.ts +1 -0
- package/src/integrations/lagoonV1/lagoon.v1.ts +109 -36
- package/src/integrations/lagoonV2/addresses.ts +35 -0
- package/src/integrations/lagoonV2/factory.abi.ts +110 -0
- package/src/integrations/lagoonV2/index.ts +6 -0
- package/src/integrations/lagoonV2/lagoon.v2.permissions.ts +578 -0
- package/src/integrations/lagoonV2/lagoon.v2.setters.ts +521 -0
- package/src/integrations/lagoonV2/lagoon.v2.ts +345 -0
- package/src/integrations/lagoonV2/vault.abi.ts +479 -0
- package/src/lib/contractsRegistry.json +4 -2
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lagoon v0.6 vault setter/admin calldata builders — SDK-C.
|
|
3
|
+
*
|
|
4
|
+
* This module extends the v0.6 permission surface beyond what SDK-B covered.
|
|
5
|
+
* SDK-B (`lagoon.v2.permissions.ts`) handles the 16 role-gated operational
|
|
6
|
+
* functions (settleDeposit, settleRedeem, updateNewTotalAssets, expireTotalAssets,
|
|
7
|
+
* pause, unpause, whitelist/blacklist ops, updateRates, role-address setters).
|
|
8
|
+
*
|
|
9
|
+
* This module adds the remaining 13 setter/admin/utility functions:
|
|
10
|
+
* - MaxCap: updateMaxCap
|
|
11
|
+
* - Sync: setSyncMode, updateTotalAssetsLifespan
|
|
12
|
+
* - Guardrails: updateGuardrails, updateActivated, securityCouncilUpdateTotalAssets
|
|
13
|
+
* - Sanctions: setExternalSanctionsList
|
|
14
|
+
* - Kill-switch: lockUpdateSafe, lockSuperOperator
|
|
15
|
+
* - Batch claim: claimSharesOnBehalf, claimAssetsOnBehalf
|
|
16
|
+
* - Metadata: updateName, updateSymbol
|
|
17
|
+
*
|
|
18
|
+
* All function signatures have been verified against the deployed v0.6 implementations:
|
|
19
|
+
* Arbitrum: 0x3f5A9e1D82c595d14bA93c97eB8a77928cFdee70
|
|
20
|
+
* Ethereum: 0x6C77c47FB8168E22976C3B0338CB1769c952249f
|
|
21
|
+
*
|
|
22
|
+
* Selector verification (2026-06-08):
|
|
23
|
+
* updateMaxCap(uint256) 0xe81ba080
|
|
24
|
+
* setSyncMode(uint8) 0x363d8de8
|
|
25
|
+
* updateTotalAssetsLifespan(uint128) 0xae16ea8c
|
|
26
|
+
* updateGuardrails((uint256,int256)) 0xced9a8de
|
|
27
|
+
* updateActivated(bool) 0xdc324cb2
|
|
28
|
+
* securityCouncilUpdateTotalAssets(uint256) 0xdeb337a5
|
|
29
|
+
* setExternalSanctionsList(address) 0x7de5c4f4
|
|
30
|
+
* lockUpdateSafe() 0x8c9881a9
|
|
31
|
+
* lockSuperOperator() 0x32c06a4e
|
|
32
|
+
* claimSharesOnBehalf(address[]) 0xf15be6f9
|
|
33
|
+
* claimAssetsOnBehalf(address[]) 0x26d6c82f
|
|
34
|
+
* updateName(string) 0x84da92a7
|
|
35
|
+
* updateSymbol(string) 0x537f5312
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { encodeFunctionData } from "viem";
|
|
39
|
+
import type { Address } from "viem";
|
|
40
|
+
import { createCall, type Call, type HexString, type Unwrapable } from "../..";
|
|
41
|
+
import lagoonV2VaultAbi from "./vault.abi.ts";
|
|
42
|
+
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Types
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Guardrails struct for Lagoon v0.6.
|
|
49
|
+
*
|
|
50
|
+
* When activated, `updateNewTotalAssets` is gated:
|
|
51
|
+
* - newTotalAssets must not increase by more than `upperRate` (expressed as a
|
|
52
|
+
* percentage delta in WAD — e.g. 1e17 = 10% max increase per interval).
|
|
53
|
+
* - newTotalAssets must not decrease by more than `|lowerRate|` (negative int256
|
|
54
|
+
* expressed in WAD — e.g. -1e17 = 10% max decrease).
|
|
55
|
+
*
|
|
56
|
+
* The Security Council can bypass these bounds via `securityCouncilUpdateTotalAssets`.
|
|
57
|
+
*/
|
|
58
|
+
export type LagoonV2Guardrails = Readonly<{
|
|
59
|
+
upperRate: bigint; // uint256, WAD (e.g. 1e17 = 10% max increase)
|
|
60
|
+
lowerRate: bigint; // int256 (negative), WAD (e.g. -1e17 = 10% max decrease)
|
|
61
|
+
}>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* SyncMode enum for Lagoon v0.6.
|
|
65
|
+
*
|
|
66
|
+
* Async = 0 (default): standard epoch-based settlement flow.
|
|
67
|
+
* Sync = 1: synchronous instant settlement — deposit/redeem are settled immediately.
|
|
68
|
+
*/
|
|
69
|
+
export const LagoonV2SyncMode = {
|
|
70
|
+
Async: 0,
|
|
71
|
+
Sync: 1,
|
|
72
|
+
} as const;
|
|
73
|
+
export type LagoonV2SyncModeValue = (typeof LagoonV2SyncMode)[keyof typeof LagoonV2SyncMode];
|
|
74
|
+
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// MaxCap — Admin
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Encodes an `updateMaxCap(uint256 maxCap)` call.
|
|
81
|
+
* Selector: 0xe81ba080
|
|
82
|
+
* Role: Owner (Admin)
|
|
83
|
+
*
|
|
84
|
+
* Sets the maximum total assets the vault is allowed to hold. Deposits that
|
|
85
|
+
* would push totalAssets above this cap are rejected. Set to `type(uint256).max`
|
|
86
|
+
* to disable the cap.
|
|
87
|
+
*
|
|
88
|
+
* Required by the DeFi-Kit mandatory-cap deploy step (DeFi-Kit#200).
|
|
89
|
+
*/
|
|
90
|
+
export const LagoonV2UpdateMaxCapCalldata = ({ maxCap }: { maxCap: bigint }): HexString => {
|
|
91
|
+
return encodeFunctionData({
|
|
92
|
+
abi: lagoonV2VaultAbi,
|
|
93
|
+
functionName: "updateMaxCap",
|
|
94
|
+
args: [maxCap],
|
|
95
|
+
}) as HexString;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const lagoonV2UpdateMaxCapTrx = ({ vault, maxCap }: { vault: Address; maxCap: bigint }): Unwrapable<Call> => {
|
|
99
|
+
return createCall({
|
|
100
|
+
operation: 0,
|
|
101
|
+
to: vault,
|
|
102
|
+
value: 0n,
|
|
103
|
+
data: LagoonV2UpdateMaxCapCalldata({ maxCap }),
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// Sync configuration — Admin
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Encodes a `setSyncMode(uint8 syncMode)` call.
|
|
113
|
+
* Selector: 0x363d8de8
|
|
114
|
+
* Role: Owner (Admin)
|
|
115
|
+
*
|
|
116
|
+
* Switches between Async (epoch settlement) and Sync (instant settlement) modes.
|
|
117
|
+
* Use `LagoonV2SyncMode.Async` or `LagoonV2SyncMode.Sync`.
|
|
118
|
+
*
|
|
119
|
+
* WARNING: switching modes mid-epoch may leave open requests in an inconsistent
|
|
120
|
+
* state. Only switch when no pending deposit/redeem requests are outstanding.
|
|
121
|
+
*/
|
|
122
|
+
export const LagoonV2SetSyncModeCalldata = ({ syncMode }: { syncMode: LagoonV2SyncModeValue }): HexString => {
|
|
123
|
+
return encodeFunctionData({
|
|
124
|
+
abi: lagoonV2VaultAbi,
|
|
125
|
+
functionName: "setSyncMode",
|
|
126
|
+
args: [syncMode],
|
|
127
|
+
}) as HexString;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const lagoonV2SetSyncModeTrx = ({
|
|
131
|
+
vault,
|
|
132
|
+
syncMode,
|
|
133
|
+
}: {
|
|
134
|
+
vault: Address;
|
|
135
|
+
syncMode: LagoonV2SyncModeValue;
|
|
136
|
+
}): Unwrapable<Call> => {
|
|
137
|
+
return createCall({
|
|
138
|
+
operation: 0,
|
|
139
|
+
to: vault,
|
|
140
|
+
value: 0n,
|
|
141
|
+
data: LagoonV2SetSyncModeCalldata({ syncMode }),
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Encodes an `updateTotalAssetsLifespan(uint128 lifespan)` call.
|
|
147
|
+
* Selector: 0xae16ea8c
|
|
148
|
+
* Role: Owner (Admin)
|
|
149
|
+
*
|
|
150
|
+
* Sets the duration (in seconds) for which a published NAV remains valid.
|
|
151
|
+
* After `lifespan` seconds, `isTotalAssetsValid()` returns false and the valuation
|
|
152
|
+
* manager must call `updateNewTotalAssets` to publish a fresh NAV before the next
|
|
153
|
+
* settlement can proceed.
|
|
154
|
+
*
|
|
155
|
+
* The Valuation Manager calls `expireTotalAssets()` to invalidate early.
|
|
156
|
+
* The Admin calls this to adjust the lifespan window.
|
|
157
|
+
*/
|
|
158
|
+
export const LagoonV2UpdateTotalAssetsLifespanCalldata = ({ lifespan }: { lifespan: bigint }): HexString => {
|
|
159
|
+
return encodeFunctionData({
|
|
160
|
+
abi: lagoonV2VaultAbi,
|
|
161
|
+
functionName: "updateTotalAssetsLifespan",
|
|
162
|
+
args: [lifespan],
|
|
163
|
+
}) as HexString;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const lagoonV2UpdateTotalAssetsLifespanTrx = ({
|
|
167
|
+
vault,
|
|
168
|
+
lifespan,
|
|
169
|
+
}: {
|
|
170
|
+
vault: Address;
|
|
171
|
+
lifespan: bigint;
|
|
172
|
+
}): Unwrapable<Call> => {
|
|
173
|
+
return createCall({
|
|
174
|
+
operation: 0,
|
|
175
|
+
to: vault,
|
|
176
|
+
value: 0n,
|
|
177
|
+
data: LagoonV2UpdateTotalAssetsLifespanCalldata({ lifespan }),
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// ---------------------------------------------------------------------------
|
|
182
|
+
// Guardrails — Admin
|
|
183
|
+
// ---------------------------------------------------------------------------
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Encodes an `updateGuardrails((uint256,int256) guardrails)` call.
|
|
187
|
+
* Selector: 0xced9a8de
|
|
188
|
+
* Role: Owner (Admin)
|
|
189
|
+
*
|
|
190
|
+
* Sets the guardrail bounds for `updateNewTotalAssets`. When guardrails are
|
|
191
|
+
* activated (via `updateActivated(true)`), any NAV update that would move
|
|
192
|
+
* totalAssets outside [currentTotalAssets * (1 + lowerRate/1e18),
|
|
193
|
+
* currentTotalAssets * (1 + upperRate/1e18)] will revert.
|
|
194
|
+
*
|
|
195
|
+
* The Security Council can bypass guardrails via `securityCouncilUpdateTotalAssets`.
|
|
196
|
+
*
|
|
197
|
+
* @param guardrails.upperRate - Max allowed NAV increase as a WAD multiplier
|
|
198
|
+
* (e.g. 1e17 = 10% max increase). uint256.
|
|
199
|
+
* @param guardrails.lowerRate - Max allowed NAV decrease as a signed WAD multiplier
|
|
200
|
+
* (e.g. -1e17 = 10% max decrease). int256, must be <= 0 for a decrease bound.
|
|
201
|
+
*/
|
|
202
|
+
export const LagoonV2UpdateGuardrailsCalldata = ({ guardrails }: { guardrails: LagoonV2Guardrails }): HexString => {
|
|
203
|
+
return encodeFunctionData({
|
|
204
|
+
abi: lagoonV2VaultAbi,
|
|
205
|
+
functionName: "updateGuardrails",
|
|
206
|
+
args: [{ upperRate: guardrails.upperRate, lowerRate: guardrails.lowerRate }],
|
|
207
|
+
}) as HexString;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const lagoonV2UpdateGuardrailsTrx = ({
|
|
211
|
+
vault,
|
|
212
|
+
guardrails,
|
|
213
|
+
}: {
|
|
214
|
+
vault: Address;
|
|
215
|
+
guardrails: LagoonV2Guardrails;
|
|
216
|
+
}): Unwrapable<Call> => {
|
|
217
|
+
return createCall({
|
|
218
|
+
operation: 0,
|
|
219
|
+
to: vault,
|
|
220
|
+
value: 0n,
|
|
221
|
+
data: LagoonV2UpdateGuardrailsCalldata({ guardrails }),
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Encodes an `updateActivated(bool activated)` call.
|
|
227
|
+
* Selector: 0xdc324cb2
|
|
228
|
+
* Role: Owner (Admin)
|
|
229
|
+
*
|
|
230
|
+
* Enables or disables the guardrails for NAV updates.
|
|
231
|
+
* When `activated = true`, `updateNewTotalAssets` enforces the bounds set by
|
|
232
|
+
* `updateGuardrails`. When `false`, guardrails are bypassed.
|
|
233
|
+
*/
|
|
234
|
+
export const LagoonV2UpdateActivatedCalldata = ({ activated }: { activated: boolean }): HexString => {
|
|
235
|
+
return encodeFunctionData({
|
|
236
|
+
abi: lagoonV2VaultAbi,
|
|
237
|
+
functionName: "updateActivated",
|
|
238
|
+
args: [activated],
|
|
239
|
+
}) as HexString;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const lagoonV2UpdateActivatedTrx = ({
|
|
243
|
+
vault,
|
|
244
|
+
activated,
|
|
245
|
+
}: {
|
|
246
|
+
vault: Address;
|
|
247
|
+
activated: boolean;
|
|
248
|
+
}): Unwrapable<Call> => {
|
|
249
|
+
return createCall({
|
|
250
|
+
operation: 0,
|
|
251
|
+
to: vault,
|
|
252
|
+
value: 0n,
|
|
253
|
+
data: LagoonV2UpdateActivatedCalldata({ activated }),
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// ---------------------------------------------------------------------------
|
|
258
|
+
// Security Council — guardrail bypass NAV update
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Encodes a `securityCouncilUpdateTotalAssets(uint256 newTotalAssets)` call.
|
|
263
|
+
* Selector: 0xdeb337a5
|
|
264
|
+
* Role: Security Council
|
|
265
|
+
*
|
|
266
|
+
* Publishes a new NAV, bypassing all guardrail bounds. Only callable by the
|
|
267
|
+
* address set as `securityCouncil`. Use in emergencies where the normal
|
|
268
|
+
* `updateNewTotalAssets` path would revert due to guardrail violations (e.g.
|
|
269
|
+
* after a significant NAV drawdown that exceeds the `lowerRate` bound).
|
|
270
|
+
*
|
|
271
|
+
* This directly sets the vault's total assets — verify the value before calling.
|
|
272
|
+
*/
|
|
273
|
+
export const LagoonV2SecurityCouncilUpdateTotalAssetsCalldata = ({
|
|
274
|
+
newTotalAssets,
|
|
275
|
+
}: {
|
|
276
|
+
newTotalAssets: bigint;
|
|
277
|
+
}): HexString => {
|
|
278
|
+
return encodeFunctionData({
|
|
279
|
+
abi: lagoonV2VaultAbi,
|
|
280
|
+
functionName: "securityCouncilUpdateTotalAssets",
|
|
281
|
+
args: [newTotalAssets],
|
|
282
|
+
}) as HexString;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const lagoonV2SecurityCouncilUpdateTotalAssetsTrx = ({
|
|
286
|
+
vault,
|
|
287
|
+
newTotalAssets,
|
|
288
|
+
}: {
|
|
289
|
+
vault: Address;
|
|
290
|
+
newTotalAssets: bigint;
|
|
291
|
+
}): Unwrapable<Call> => {
|
|
292
|
+
return createCall({
|
|
293
|
+
operation: 0,
|
|
294
|
+
to: vault,
|
|
295
|
+
value: 0n,
|
|
296
|
+
data: LagoonV2SecurityCouncilUpdateTotalAssetsCalldata({ newTotalAssets }),
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// ---------------------------------------------------------------------------
|
|
301
|
+
// Sanctions — Admin
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Encodes a `setExternalSanctionsList(address sanctionsList)` call.
|
|
306
|
+
* Selector: 0x7de5c4f4
|
|
307
|
+
* Role: Owner (Admin)
|
|
308
|
+
*
|
|
309
|
+
* Sets the external sanctions oracle address (e.g. Chainalysis OFAC sanctions
|
|
310
|
+
* list at 0x40C57923924B5c5c5455c48D93317139ADDaC8fb). When set to a non-zero
|
|
311
|
+
* address, the vault will reject transfers from/to addresses that appear on the
|
|
312
|
+
* sanctions list. Set to `address(0)` to disable external sanctions checking.
|
|
313
|
+
*/
|
|
314
|
+
export const LagoonV2SetExternalSanctionsListCalldata = ({ sanctionsList }: { sanctionsList: Address }): HexString => {
|
|
315
|
+
return encodeFunctionData({
|
|
316
|
+
abi: lagoonV2VaultAbi,
|
|
317
|
+
functionName: "setExternalSanctionsList",
|
|
318
|
+
args: [sanctionsList],
|
|
319
|
+
}) as HexString;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export const lagoonV2SetExternalSanctionsListTrx = ({
|
|
323
|
+
vault,
|
|
324
|
+
sanctionsList,
|
|
325
|
+
}: {
|
|
326
|
+
vault: Address;
|
|
327
|
+
sanctionsList: Address;
|
|
328
|
+
}): Unwrapable<Call> => {
|
|
329
|
+
return createCall({
|
|
330
|
+
operation: 0,
|
|
331
|
+
to: vault,
|
|
332
|
+
value: 0n,
|
|
333
|
+
data: LagoonV2SetExternalSanctionsListCalldata({ sanctionsList }),
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// ---------------------------------------------------------------------------
|
|
338
|
+
// Kill-switches — Admin (ONE-WAY, IRREVERSIBLE)
|
|
339
|
+
// ---------------------------------------------------------------------------
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Encodes a `lockUpdateSafe()` call.
|
|
343
|
+
* Selector: 0x8c9881a9
|
|
344
|
+
* Role: Owner (Admin)
|
|
345
|
+
*
|
|
346
|
+
* WARNING: IRREVERSIBLE. Permanently locks the ability to update the Safe address
|
|
347
|
+
* that controls settlement. Once called, the vault's Safe cannot be changed, ever.
|
|
348
|
+
* Only call after confirming the Safe address is correct and the Safe is operational.
|
|
349
|
+
*/
|
|
350
|
+
export const LagoonV2LockUpdateSafeCalldata = (): HexString => {
|
|
351
|
+
return encodeFunctionData({
|
|
352
|
+
abi: lagoonV2VaultAbi,
|
|
353
|
+
functionName: "lockUpdateSafe",
|
|
354
|
+
args: [],
|
|
355
|
+
}) as HexString;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
export const lagoonV2LockUpdateSafeTrx = ({ vault }: { vault: Address }): Unwrapable<Call> => {
|
|
359
|
+
return createCall({
|
|
360
|
+
operation: 0,
|
|
361
|
+
to: vault,
|
|
362
|
+
value: 0n,
|
|
363
|
+
data: LagoonV2LockUpdateSafeCalldata(),
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Encodes a `lockSuperOperator()` call.
|
|
369
|
+
* Selector: 0x32c06a4e
|
|
370
|
+
* Role: Owner (Admin)
|
|
371
|
+
*
|
|
372
|
+
* WARNING: IRREVERSIBLE. Permanently disables the Super Operator role. Once
|
|
373
|
+
* called, `updateSuperOperator` will always revert and no address can ever be
|
|
374
|
+
* granted Super Operator privileges on this vault again.
|
|
375
|
+
* Only call if you intend to permanently disable super-operator batch claim functionality.
|
|
376
|
+
*/
|
|
377
|
+
export const LagoonV2LockSuperOperatorCalldata = (): HexString => {
|
|
378
|
+
return encodeFunctionData({
|
|
379
|
+
abi: lagoonV2VaultAbi,
|
|
380
|
+
functionName: "lockSuperOperator",
|
|
381
|
+
args: [],
|
|
382
|
+
}) as HexString;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export const lagoonV2LockSuperOperatorTrx = ({ vault }: { vault: Address }): Unwrapable<Call> => {
|
|
386
|
+
return createCall({
|
|
387
|
+
operation: 0,
|
|
388
|
+
to: vault,
|
|
389
|
+
value: 0n,
|
|
390
|
+
data: LagoonV2LockSuperOperatorCalldata(),
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// ---------------------------------------------------------------------------
|
|
395
|
+
// Batch claim — Super Operator
|
|
396
|
+
// ---------------------------------------------------------------------------
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Encodes a `claimSharesOnBehalf(address[] receivers)` call.
|
|
400
|
+
* Selector: 0xf15be6f9
|
|
401
|
+
* Role: Super Operator
|
|
402
|
+
*
|
|
403
|
+
* Batch-claims settled shares on behalf of depositors who have not yet called
|
|
404
|
+
* `claimShares` themselves. Each address in `receivers` must have a pending
|
|
405
|
+
* settled deposit for the current or a past epoch.
|
|
406
|
+
*
|
|
407
|
+
* Useful for onboarding flows where the operator wants to distribute shares to
|
|
408
|
+
* newly admitted depositors without requiring each depositor to submit a separate
|
|
409
|
+
* claim transaction.
|
|
410
|
+
*/
|
|
411
|
+
export const LagoonV2ClaimSharesOnBehalfCalldata = ({ receivers }: { receivers: Address[] }): HexString => {
|
|
412
|
+
return encodeFunctionData({
|
|
413
|
+
abi: lagoonV2VaultAbi,
|
|
414
|
+
functionName: "claimSharesOnBehalf",
|
|
415
|
+
args: [receivers],
|
|
416
|
+
}) as HexString;
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
export const lagoonV2ClaimSharesOnBehalfTrx = ({
|
|
420
|
+
vault,
|
|
421
|
+
receivers,
|
|
422
|
+
}: {
|
|
423
|
+
vault: Address;
|
|
424
|
+
receivers: Address[];
|
|
425
|
+
}): Unwrapable<Call> => {
|
|
426
|
+
return createCall({
|
|
427
|
+
operation: 0,
|
|
428
|
+
to: vault,
|
|
429
|
+
value: 0n,
|
|
430
|
+
data: LagoonV2ClaimSharesOnBehalfCalldata({ receivers }),
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Encodes a `claimAssetsOnBehalf(address[] receivers)` call.
|
|
436
|
+
* Selector: 0x26d6c82f
|
|
437
|
+
* Role: Super Operator
|
|
438
|
+
*
|
|
439
|
+
* Batch-claims settled underlying assets on behalf of redeemers who have not yet
|
|
440
|
+
* called `claimAssets` themselves. Each address in `receivers` must have a pending
|
|
441
|
+
* settled redemption for the current or a past epoch.
|
|
442
|
+
*
|
|
443
|
+
* Symmetric to `claimSharesOnBehalf` but for the redeem path.
|
|
444
|
+
*/
|
|
445
|
+
export const LagoonV2ClaimAssetsOnBehalfCalldata = ({ receivers }: { receivers: Address[] }): HexString => {
|
|
446
|
+
return encodeFunctionData({
|
|
447
|
+
abi: lagoonV2VaultAbi,
|
|
448
|
+
functionName: "claimAssetsOnBehalf",
|
|
449
|
+
args: [receivers],
|
|
450
|
+
}) as HexString;
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
export const lagoonV2ClaimAssetsOnBehalfTrx = ({
|
|
454
|
+
vault,
|
|
455
|
+
receivers,
|
|
456
|
+
}: {
|
|
457
|
+
vault: Address;
|
|
458
|
+
receivers: Address[];
|
|
459
|
+
}): Unwrapable<Call> => {
|
|
460
|
+
return createCall({
|
|
461
|
+
operation: 0,
|
|
462
|
+
to: vault,
|
|
463
|
+
value: 0n,
|
|
464
|
+
data: LagoonV2ClaimAssetsOnBehalfCalldata({ receivers }),
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
// ---------------------------------------------------------------------------
|
|
469
|
+
// Metadata — Admin
|
|
470
|
+
// ---------------------------------------------------------------------------
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Encodes an `updateName(string name)` call.
|
|
474
|
+
* Selector: 0x84da92a7
|
|
475
|
+
* Role: Owner (Admin)
|
|
476
|
+
*
|
|
477
|
+
* Updates the ERC20 `name()` of the vault token. Note that this only updates
|
|
478
|
+
* the on-chain storage value; any off-chain caches (block explorers, dApps) will
|
|
479
|
+
* need to refresh.
|
|
480
|
+
*/
|
|
481
|
+
export const LagoonV2UpdateNameCalldata = ({ name }: { name: string }): HexString => {
|
|
482
|
+
return encodeFunctionData({
|
|
483
|
+
abi: lagoonV2VaultAbi,
|
|
484
|
+
functionName: "updateName",
|
|
485
|
+
args: [name],
|
|
486
|
+
}) as HexString;
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
export const lagoonV2UpdateNameTrx = ({ vault, name }: { vault: Address; name: string }): Unwrapable<Call> => {
|
|
490
|
+
return createCall({
|
|
491
|
+
operation: 0,
|
|
492
|
+
to: vault,
|
|
493
|
+
value: 0n,
|
|
494
|
+
data: LagoonV2UpdateNameCalldata({ name }),
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Encodes an `updateSymbol(string symbol)` call.
|
|
500
|
+
* Selector: 0x537f5312
|
|
501
|
+
* Role: Owner (Admin)
|
|
502
|
+
*
|
|
503
|
+
* Updates the ERC20 `symbol()` of the vault token. Same caveats as `updateName`
|
|
504
|
+
* regarding off-chain cache invalidation.
|
|
505
|
+
*/
|
|
506
|
+
export const LagoonV2UpdateSymbolCalldata = ({ symbol }: { symbol: string }): HexString => {
|
|
507
|
+
return encodeFunctionData({
|
|
508
|
+
abi: lagoonV2VaultAbi,
|
|
509
|
+
functionName: "updateSymbol",
|
|
510
|
+
args: [symbol],
|
|
511
|
+
}) as HexString;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
export const lagoonV2UpdateSymbolTrx = ({ vault, symbol }: { vault: Address; symbol: string }): Unwrapable<Call> => {
|
|
515
|
+
return createCall({
|
|
516
|
+
operation: 0,
|
|
517
|
+
to: vault,
|
|
518
|
+
value: 0n,
|
|
519
|
+
data: LagoonV2UpdateSymbolCalldata({ symbol }),
|
|
520
|
+
});
|
|
521
|
+
};
|