@gitmyabi/moostakedao-ousd-usde 0.0.0-stage → 1.0.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/README.md +107 -2
- package/contracts/BeefyVaultV7.d.ts +1188 -0
- package/contracts/BeefyVaultV7.js +1149 -0
- package/contracts/BeefyVaultV7.ts +1560 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +40 -3
|
@@ -0,0 +1,1560 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BeefyVaultV7 ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const BeefyVaultV7Abi = [
|
|
10
|
+
{
|
|
11
|
+
"anonymous": false,
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"indexed": true,
|
|
15
|
+
"internalType": "address",
|
|
16
|
+
"name": "owner",
|
|
17
|
+
"type": "address"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"indexed": true,
|
|
21
|
+
"internalType": "address",
|
|
22
|
+
"name": "spender",
|
|
23
|
+
"type": "address"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"indexed": false,
|
|
27
|
+
"internalType": "uint256",
|
|
28
|
+
"name": "value",
|
|
29
|
+
"type": "uint256"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"name": "Approval",
|
|
33
|
+
"type": "event"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"anonymous": false,
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "address",
|
|
41
|
+
"name": "implementation",
|
|
42
|
+
"type": "address"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "NewStratCandidate",
|
|
46
|
+
"type": "event"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"anonymous": false,
|
|
50
|
+
"inputs": [
|
|
51
|
+
{
|
|
52
|
+
"indexed": true,
|
|
53
|
+
"internalType": "address",
|
|
54
|
+
"name": "previousOwner",
|
|
55
|
+
"type": "address"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"indexed": true,
|
|
59
|
+
"internalType": "address",
|
|
60
|
+
"name": "newOwner",
|
|
61
|
+
"type": "address"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"name": "OwnershipTransferred",
|
|
65
|
+
"type": "event"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"anonymous": false,
|
|
69
|
+
"inputs": [
|
|
70
|
+
{
|
|
71
|
+
"indexed": true,
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "from",
|
|
74
|
+
"type": "address"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"indexed": true,
|
|
78
|
+
"internalType": "address",
|
|
79
|
+
"name": "to",
|
|
80
|
+
"type": "address"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"indexed": false,
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "value",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"name": "Transfer",
|
|
90
|
+
"type": "event"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"anonymous": false,
|
|
94
|
+
"inputs": [
|
|
95
|
+
{
|
|
96
|
+
"indexed": false,
|
|
97
|
+
"internalType": "address",
|
|
98
|
+
"name": "implementation",
|
|
99
|
+
"type": "address"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"name": "UpgradeStrat",
|
|
103
|
+
"type": "event"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"inputs": [
|
|
107
|
+
{
|
|
108
|
+
"internalType": "address",
|
|
109
|
+
"name": "owner",
|
|
110
|
+
"type": "address"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"internalType": "address",
|
|
114
|
+
"name": "spender",
|
|
115
|
+
"type": "address"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"name": "allowance",
|
|
119
|
+
"outputs": [
|
|
120
|
+
{
|
|
121
|
+
"internalType": "uint256",
|
|
122
|
+
"name": "",
|
|
123
|
+
"type": "uint256"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"stateMutability": "view",
|
|
127
|
+
"type": "function"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"inputs": [],
|
|
131
|
+
"name": "approvalDelay",
|
|
132
|
+
"outputs": [
|
|
133
|
+
{
|
|
134
|
+
"internalType": "uint256",
|
|
135
|
+
"name": "",
|
|
136
|
+
"type": "uint256"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"stateMutability": "view",
|
|
140
|
+
"type": "function"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"inputs": [
|
|
144
|
+
{
|
|
145
|
+
"internalType": "address",
|
|
146
|
+
"name": "spender",
|
|
147
|
+
"type": "address"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"internalType": "uint256",
|
|
151
|
+
"name": "amount",
|
|
152
|
+
"type": "uint256"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"name": "approve",
|
|
156
|
+
"outputs": [
|
|
157
|
+
{
|
|
158
|
+
"internalType": "bool",
|
|
159
|
+
"name": "",
|
|
160
|
+
"type": "bool"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"stateMutability": "nonpayable",
|
|
164
|
+
"type": "function"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"inputs": [],
|
|
168
|
+
"name": "available",
|
|
169
|
+
"outputs": [
|
|
170
|
+
{
|
|
171
|
+
"internalType": "uint256",
|
|
172
|
+
"name": "",
|
|
173
|
+
"type": "uint256"
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"stateMutability": "view",
|
|
177
|
+
"type": "function"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"inputs": [],
|
|
181
|
+
"name": "balance",
|
|
182
|
+
"outputs": [
|
|
183
|
+
{
|
|
184
|
+
"internalType": "uint256",
|
|
185
|
+
"name": "",
|
|
186
|
+
"type": "uint256"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"stateMutability": "view",
|
|
190
|
+
"type": "function"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"inputs": [
|
|
194
|
+
{
|
|
195
|
+
"internalType": "address",
|
|
196
|
+
"name": "account",
|
|
197
|
+
"type": "address"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"name": "balanceOf",
|
|
201
|
+
"outputs": [
|
|
202
|
+
{
|
|
203
|
+
"internalType": "uint256",
|
|
204
|
+
"name": "",
|
|
205
|
+
"type": "uint256"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"stateMutability": "view",
|
|
209
|
+
"type": "function"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"inputs": [],
|
|
213
|
+
"name": "decimals",
|
|
214
|
+
"outputs": [
|
|
215
|
+
{
|
|
216
|
+
"internalType": "uint8",
|
|
217
|
+
"name": "",
|
|
218
|
+
"type": "uint8"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"stateMutability": "view",
|
|
222
|
+
"type": "function"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"inputs": [
|
|
226
|
+
{
|
|
227
|
+
"internalType": "address",
|
|
228
|
+
"name": "spender",
|
|
229
|
+
"type": "address"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"internalType": "uint256",
|
|
233
|
+
"name": "subtractedValue",
|
|
234
|
+
"type": "uint256"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"name": "decreaseAllowance",
|
|
238
|
+
"outputs": [
|
|
239
|
+
{
|
|
240
|
+
"internalType": "bool",
|
|
241
|
+
"name": "",
|
|
242
|
+
"type": "bool"
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
"stateMutability": "nonpayable",
|
|
246
|
+
"type": "function"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"inputs": [
|
|
250
|
+
{
|
|
251
|
+
"internalType": "uint256",
|
|
252
|
+
"name": "_amount",
|
|
253
|
+
"type": "uint256"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"name": "deposit",
|
|
257
|
+
"outputs": [],
|
|
258
|
+
"stateMutability": "nonpayable",
|
|
259
|
+
"type": "function"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"inputs": [],
|
|
263
|
+
"name": "depositAll",
|
|
264
|
+
"outputs": [],
|
|
265
|
+
"stateMutability": "nonpayable",
|
|
266
|
+
"type": "function"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"inputs": [],
|
|
270
|
+
"name": "earn",
|
|
271
|
+
"outputs": [],
|
|
272
|
+
"stateMutability": "nonpayable",
|
|
273
|
+
"type": "function"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"inputs": [],
|
|
277
|
+
"name": "getPricePerFullShare",
|
|
278
|
+
"outputs": [
|
|
279
|
+
{
|
|
280
|
+
"internalType": "uint256",
|
|
281
|
+
"name": "",
|
|
282
|
+
"type": "uint256"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
"stateMutability": "view",
|
|
286
|
+
"type": "function"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"inputs": [
|
|
290
|
+
{
|
|
291
|
+
"internalType": "address",
|
|
292
|
+
"name": "_token",
|
|
293
|
+
"type": "address"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"name": "inCaseTokensGetStuck",
|
|
297
|
+
"outputs": [],
|
|
298
|
+
"stateMutability": "nonpayable",
|
|
299
|
+
"type": "function"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"inputs": [
|
|
303
|
+
{
|
|
304
|
+
"internalType": "address",
|
|
305
|
+
"name": "spender",
|
|
306
|
+
"type": "address"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"internalType": "uint256",
|
|
310
|
+
"name": "addedValue",
|
|
311
|
+
"type": "uint256"
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"name": "increaseAllowance",
|
|
315
|
+
"outputs": [
|
|
316
|
+
{
|
|
317
|
+
"internalType": "bool",
|
|
318
|
+
"name": "",
|
|
319
|
+
"type": "bool"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"stateMutability": "nonpayable",
|
|
323
|
+
"type": "function"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"inputs": [
|
|
327
|
+
{
|
|
328
|
+
"internalType": "contract IStrategyV7",
|
|
329
|
+
"name": "_strategy",
|
|
330
|
+
"type": "address"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"internalType": "string",
|
|
334
|
+
"name": "_name",
|
|
335
|
+
"type": "string"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"internalType": "string",
|
|
339
|
+
"name": "_symbol",
|
|
340
|
+
"type": "string"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"internalType": "uint256",
|
|
344
|
+
"name": "_approvalDelay",
|
|
345
|
+
"type": "uint256"
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
"name": "initialize",
|
|
349
|
+
"outputs": [],
|
|
350
|
+
"stateMutability": "nonpayable",
|
|
351
|
+
"type": "function"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"inputs": [],
|
|
355
|
+
"name": "name",
|
|
356
|
+
"outputs": [
|
|
357
|
+
{
|
|
358
|
+
"internalType": "string",
|
|
359
|
+
"name": "",
|
|
360
|
+
"type": "string"
|
|
361
|
+
}
|
|
362
|
+
],
|
|
363
|
+
"stateMutability": "view",
|
|
364
|
+
"type": "function"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"inputs": [],
|
|
368
|
+
"name": "owner",
|
|
369
|
+
"outputs": [
|
|
370
|
+
{
|
|
371
|
+
"internalType": "address",
|
|
372
|
+
"name": "",
|
|
373
|
+
"type": "address"
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"stateMutability": "view",
|
|
377
|
+
"type": "function"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"inputs": [
|
|
381
|
+
{
|
|
382
|
+
"internalType": "address",
|
|
383
|
+
"name": "_implementation",
|
|
384
|
+
"type": "address"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"name": "proposeStrat",
|
|
388
|
+
"outputs": [],
|
|
389
|
+
"stateMutability": "nonpayable",
|
|
390
|
+
"type": "function"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"inputs": [],
|
|
394
|
+
"name": "renounceOwnership",
|
|
395
|
+
"outputs": [],
|
|
396
|
+
"stateMutability": "nonpayable",
|
|
397
|
+
"type": "function"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"inputs": [],
|
|
401
|
+
"name": "stratCandidate",
|
|
402
|
+
"outputs": [
|
|
403
|
+
{
|
|
404
|
+
"internalType": "address",
|
|
405
|
+
"name": "implementation",
|
|
406
|
+
"type": "address"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"internalType": "uint256",
|
|
410
|
+
"name": "proposedTime",
|
|
411
|
+
"type": "uint256"
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"stateMutability": "view",
|
|
415
|
+
"type": "function"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"inputs": [],
|
|
419
|
+
"name": "strategy",
|
|
420
|
+
"outputs": [
|
|
421
|
+
{
|
|
422
|
+
"internalType": "contract IStrategyV7",
|
|
423
|
+
"name": "",
|
|
424
|
+
"type": "address"
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
"stateMutability": "view",
|
|
428
|
+
"type": "function"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"inputs": [],
|
|
432
|
+
"name": "symbol",
|
|
433
|
+
"outputs": [
|
|
434
|
+
{
|
|
435
|
+
"internalType": "string",
|
|
436
|
+
"name": "",
|
|
437
|
+
"type": "string"
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
"stateMutability": "view",
|
|
441
|
+
"type": "function"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"inputs": [],
|
|
445
|
+
"name": "totalSupply",
|
|
446
|
+
"outputs": [
|
|
447
|
+
{
|
|
448
|
+
"internalType": "uint256",
|
|
449
|
+
"name": "",
|
|
450
|
+
"type": "uint256"
|
|
451
|
+
}
|
|
452
|
+
],
|
|
453
|
+
"stateMutability": "view",
|
|
454
|
+
"type": "function"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"inputs": [
|
|
458
|
+
{
|
|
459
|
+
"internalType": "address",
|
|
460
|
+
"name": "recipient",
|
|
461
|
+
"type": "address"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"internalType": "uint256",
|
|
465
|
+
"name": "amount",
|
|
466
|
+
"type": "uint256"
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"name": "transfer",
|
|
470
|
+
"outputs": [
|
|
471
|
+
{
|
|
472
|
+
"internalType": "bool",
|
|
473
|
+
"name": "",
|
|
474
|
+
"type": "bool"
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
"stateMutability": "nonpayable",
|
|
478
|
+
"type": "function"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"inputs": [
|
|
482
|
+
{
|
|
483
|
+
"internalType": "address",
|
|
484
|
+
"name": "sender",
|
|
485
|
+
"type": "address"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"internalType": "address",
|
|
489
|
+
"name": "recipient",
|
|
490
|
+
"type": "address"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"internalType": "uint256",
|
|
494
|
+
"name": "amount",
|
|
495
|
+
"type": "uint256"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"name": "transferFrom",
|
|
499
|
+
"outputs": [
|
|
500
|
+
{
|
|
501
|
+
"internalType": "bool",
|
|
502
|
+
"name": "",
|
|
503
|
+
"type": "bool"
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
"stateMutability": "nonpayable",
|
|
507
|
+
"type": "function"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"inputs": [
|
|
511
|
+
{
|
|
512
|
+
"internalType": "address",
|
|
513
|
+
"name": "newOwner",
|
|
514
|
+
"type": "address"
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
"name": "transferOwnership",
|
|
518
|
+
"outputs": [],
|
|
519
|
+
"stateMutability": "nonpayable",
|
|
520
|
+
"type": "function"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"inputs": [],
|
|
524
|
+
"name": "upgradeStrat",
|
|
525
|
+
"outputs": [],
|
|
526
|
+
"stateMutability": "nonpayable",
|
|
527
|
+
"type": "function"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"inputs": [],
|
|
531
|
+
"name": "want",
|
|
532
|
+
"outputs": [
|
|
533
|
+
{
|
|
534
|
+
"internalType": "contract IERC20Upgradeable",
|
|
535
|
+
"name": "",
|
|
536
|
+
"type": "address"
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
"stateMutability": "view",
|
|
540
|
+
"type": "function"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"inputs": [
|
|
544
|
+
{
|
|
545
|
+
"internalType": "uint256",
|
|
546
|
+
"name": "_shares",
|
|
547
|
+
"type": "uint256"
|
|
548
|
+
}
|
|
549
|
+
],
|
|
550
|
+
"name": "withdraw",
|
|
551
|
+
"outputs": [],
|
|
552
|
+
"stateMutability": "nonpayable",
|
|
553
|
+
"type": "function"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"inputs": [],
|
|
557
|
+
"name": "withdrawAll",
|
|
558
|
+
"outputs": [],
|
|
559
|
+
"stateMutability": "nonpayable",
|
|
560
|
+
"type": "function"
|
|
561
|
+
}
|
|
562
|
+
] as const satisfies Abi;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Type-safe ABI for BeefyVaultV7
|
|
566
|
+
*/
|
|
567
|
+
export type BeefyVaultV7Abi = typeof BeefyVaultV7Abi;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Contract instance type for BeefyVaultV7
|
|
571
|
+
*/
|
|
572
|
+
// Use any for contract type to avoid complex viem type issues
|
|
573
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
574
|
+
export type BeefyVaultV7Contract = any;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* BeefyVaultV7 Contract Class
|
|
578
|
+
*
|
|
579
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
580
|
+
*
|
|
581
|
+
* @example
|
|
582
|
+
* ```typescript
|
|
583
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
584
|
+
* import { mainnet } from 'viem/chains';
|
|
585
|
+
* import { BeefyVaultV7 } from 'BeefyVaultV7';
|
|
586
|
+
*
|
|
587
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
588
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
589
|
+
*
|
|
590
|
+
* const contract = new BeefyVaultV7('0x...', { publicClient, walletClient });
|
|
591
|
+
*
|
|
592
|
+
* // Read functions
|
|
593
|
+
* const result = await contract.balanceOf('0x...');
|
|
594
|
+
*
|
|
595
|
+
* // Write functions
|
|
596
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
597
|
+
*
|
|
598
|
+
* // Simulate transactions (dry-run)
|
|
599
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
600
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
601
|
+
*
|
|
602
|
+
* // Watch events
|
|
603
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
604
|
+
* console.log('Transfer event:', event);
|
|
605
|
+
* });
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
export class BeefyVaultV7 {
|
|
609
|
+
private contract: BeefyVaultV7Contract;
|
|
610
|
+
private contractAddress: Address;
|
|
611
|
+
private publicClient: PublicClient;
|
|
612
|
+
|
|
613
|
+
constructor(
|
|
614
|
+
address: Address,
|
|
615
|
+
clients: {
|
|
616
|
+
publicClient: PublicClient;
|
|
617
|
+
walletClient?: WalletClient;
|
|
618
|
+
}
|
|
619
|
+
) {
|
|
620
|
+
this.contractAddress = address;
|
|
621
|
+
this.publicClient = clients.publicClient;
|
|
622
|
+
this.contract = getContract({
|
|
623
|
+
address,
|
|
624
|
+
abi: BeefyVaultV7Abi,
|
|
625
|
+
client: {
|
|
626
|
+
public: clients.publicClient,
|
|
627
|
+
wallet: clients.walletClient,
|
|
628
|
+
},
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Get the contract address
|
|
634
|
+
*/
|
|
635
|
+
get address(): Address {
|
|
636
|
+
return this.contractAddress;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Get the underlying viem contract instance.
|
|
641
|
+
*/
|
|
642
|
+
getContract(): BeefyVaultV7Contract {
|
|
643
|
+
return this.contract;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* allowance
|
|
648
|
+
* view
|
|
649
|
+
*/
|
|
650
|
+
async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
651
|
+
return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* approvalDelay
|
|
656
|
+
* view
|
|
657
|
+
*/
|
|
658
|
+
async approvalDelay(): Promise<bigint> {
|
|
659
|
+
return this.contract.read.approvalDelay() as Promise<bigint>;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* available
|
|
664
|
+
* view
|
|
665
|
+
*/
|
|
666
|
+
async available(): Promise<bigint> {
|
|
667
|
+
return this.contract.read.available() as Promise<bigint>;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* balance
|
|
672
|
+
* view
|
|
673
|
+
*/
|
|
674
|
+
async balance(): Promise<bigint> {
|
|
675
|
+
return this.contract.read.balance() as Promise<bigint>;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* balanceOf
|
|
680
|
+
* view
|
|
681
|
+
*/
|
|
682
|
+
async balanceOf(account: `0x${string}`): Promise<bigint> {
|
|
683
|
+
return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* decimals
|
|
688
|
+
* view
|
|
689
|
+
*/
|
|
690
|
+
async decimals(): Promise<bigint> {
|
|
691
|
+
return this.contract.read.decimals() as Promise<bigint>;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* getPricePerFullShare
|
|
696
|
+
* view
|
|
697
|
+
*/
|
|
698
|
+
async getPricePerFullShare(): Promise<bigint> {
|
|
699
|
+
return this.contract.read.getPricePerFullShare() as Promise<bigint>;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* name
|
|
704
|
+
* view
|
|
705
|
+
*/
|
|
706
|
+
async name(): Promise<string> {
|
|
707
|
+
return this.contract.read.name() as Promise<string>;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* owner
|
|
712
|
+
* view
|
|
713
|
+
*/
|
|
714
|
+
async owner(): Promise<`0x${string}`> {
|
|
715
|
+
return this.contract.read.owner() as Promise<`0x${string}`>;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* stratCandidate
|
|
720
|
+
* view
|
|
721
|
+
*/
|
|
722
|
+
async stratCandidate(): Promise<[`0x${string}`, bigint]> {
|
|
723
|
+
return this.contract.read.stratCandidate() as Promise<[`0x${string}`, bigint]>;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* strategy
|
|
728
|
+
* view
|
|
729
|
+
*/
|
|
730
|
+
async strategy(): Promise<`0x${string}`> {
|
|
731
|
+
return this.contract.read.strategy() as Promise<`0x${string}`>;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* symbol
|
|
736
|
+
* view
|
|
737
|
+
*/
|
|
738
|
+
async symbol(): Promise<string> {
|
|
739
|
+
return this.contract.read.symbol() as Promise<string>;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* totalSupply
|
|
744
|
+
* view
|
|
745
|
+
*/
|
|
746
|
+
async totalSupply(): Promise<bigint> {
|
|
747
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* want
|
|
752
|
+
* view
|
|
753
|
+
*/
|
|
754
|
+
async want(): Promise<`0x${string}`> {
|
|
755
|
+
return this.contract.read.want() as Promise<`0x${string}`>;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* approve
|
|
760
|
+
* nonpayable
|
|
761
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
762
|
+
*/
|
|
763
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
764
|
+
accessList?: import('viem').AccessList;
|
|
765
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
766
|
+
chain?: import('viem').Chain | null;
|
|
767
|
+
dataSuffix?: `0x${string}`;
|
|
768
|
+
gas?: bigint;
|
|
769
|
+
gasPrice?: bigint;
|
|
770
|
+
maxFeePerGas?: bigint;
|
|
771
|
+
maxPriorityFeePerGas?: bigint;
|
|
772
|
+
nonce?: number;
|
|
773
|
+
value?: bigint;
|
|
774
|
+
}): Promise<`0x${string}`> {
|
|
775
|
+
if (!this.contract.write) {
|
|
776
|
+
throw new Error('Wallet client is required for write operations');
|
|
777
|
+
}
|
|
778
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* decreaseAllowance
|
|
783
|
+
* nonpayable
|
|
784
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
785
|
+
*/
|
|
786
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
787
|
+
accessList?: import('viem').AccessList;
|
|
788
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
789
|
+
chain?: import('viem').Chain | null;
|
|
790
|
+
dataSuffix?: `0x${string}`;
|
|
791
|
+
gas?: bigint;
|
|
792
|
+
gasPrice?: bigint;
|
|
793
|
+
maxFeePerGas?: bigint;
|
|
794
|
+
maxPriorityFeePerGas?: bigint;
|
|
795
|
+
nonce?: number;
|
|
796
|
+
value?: bigint;
|
|
797
|
+
}): Promise<`0x${string}`> {
|
|
798
|
+
if (!this.contract.write) {
|
|
799
|
+
throw new Error('Wallet client is required for write operations');
|
|
800
|
+
}
|
|
801
|
+
return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* deposit
|
|
806
|
+
* nonpayable
|
|
807
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
808
|
+
*/
|
|
809
|
+
async deposit(_amount: bigint, options?: {
|
|
810
|
+
accessList?: import('viem').AccessList;
|
|
811
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
812
|
+
chain?: import('viem').Chain | null;
|
|
813
|
+
dataSuffix?: `0x${string}`;
|
|
814
|
+
gas?: bigint;
|
|
815
|
+
gasPrice?: bigint;
|
|
816
|
+
maxFeePerGas?: bigint;
|
|
817
|
+
maxPriorityFeePerGas?: bigint;
|
|
818
|
+
nonce?: number;
|
|
819
|
+
value?: bigint;
|
|
820
|
+
}): Promise<`0x${string}`> {
|
|
821
|
+
if (!this.contract.write) {
|
|
822
|
+
throw new Error('Wallet client is required for write operations');
|
|
823
|
+
}
|
|
824
|
+
return this.contract.write.deposit([_amount] as const, options) as Promise<`0x${string}`>;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* depositAll
|
|
829
|
+
* nonpayable
|
|
830
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
831
|
+
*/
|
|
832
|
+
async depositAll(options?: {
|
|
833
|
+
accessList?: import('viem').AccessList;
|
|
834
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
835
|
+
chain?: import('viem').Chain | null;
|
|
836
|
+
dataSuffix?: `0x${string}`;
|
|
837
|
+
gas?: bigint;
|
|
838
|
+
gasPrice?: bigint;
|
|
839
|
+
maxFeePerGas?: bigint;
|
|
840
|
+
maxPriorityFeePerGas?: bigint;
|
|
841
|
+
nonce?: number;
|
|
842
|
+
value?: bigint;
|
|
843
|
+
}): Promise<`0x${string}`> {
|
|
844
|
+
if (!this.contract.write) {
|
|
845
|
+
throw new Error('Wallet client is required for write operations');
|
|
846
|
+
}
|
|
847
|
+
return this.contract.write.depositAll(options) as Promise<`0x${string}`>;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* earn
|
|
852
|
+
* nonpayable
|
|
853
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
854
|
+
*/
|
|
855
|
+
async earn(options?: {
|
|
856
|
+
accessList?: import('viem').AccessList;
|
|
857
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
858
|
+
chain?: import('viem').Chain | null;
|
|
859
|
+
dataSuffix?: `0x${string}`;
|
|
860
|
+
gas?: bigint;
|
|
861
|
+
gasPrice?: bigint;
|
|
862
|
+
maxFeePerGas?: bigint;
|
|
863
|
+
maxPriorityFeePerGas?: bigint;
|
|
864
|
+
nonce?: number;
|
|
865
|
+
value?: bigint;
|
|
866
|
+
}): Promise<`0x${string}`> {
|
|
867
|
+
if (!this.contract.write) {
|
|
868
|
+
throw new Error('Wallet client is required for write operations');
|
|
869
|
+
}
|
|
870
|
+
return this.contract.write.earn(options) as Promise<`0x${string}`>;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* inCaseTokensGetStuck
|
|
875
|
+
* nonpayable
|
|
876
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
877
|
+
*/
|
|
878
|
+
async inCaseTokensGetStuck(_token: `0x${string}`, options?: {
|
|
879
|
+
accessList?: import('viem').AccessList;
|
|
880
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
881
|
+
chain?: import('viem').Chain | null;
|
|
882
|
+
dataSuffix?: `0x${string}`;
|
|
883
|
+
gas?: bigint;
|
|
884
|
+
gasPrice?: bigint;
|
|
885
|
+
maxFeePerGas?: bigint;
|
|
886
|
+
maxPriorityFeePerGas?: bigint;
|
|
887
|
+
nonce?: number;
|
|
888
|
+
value?: bigint;
|
|
889
|
+
}): Promise<`0x${string}`> {
|
|
890
|
+
if (!this.contract.write) {
|
|
891
|
+
throw new Error('Wallet client is required for write operations');
|
|
892
|
+
}
|
|
893
|
+
return this.contract.write.inCaseTokensGetStuck([_token] as const, options) as Promise<`0x${string}`>;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* increaseAllowance
|
|
898
|
+
* nonpayable
|
|
899
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
900
|
+
*/
|
|
901
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
902
|
+
accessList?: import('viem').AccessList;
|
|
903
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
904
|
+
chain?: import('viem').Chain | null;
|
|
905
|
+
dataSuffix?: `0x${string}`;
|
|
906
|
+
gas?: bigint;
|
|
907
|
+
gasPrice?: bigint;
|
|
908
|
+
maxFeePerGas?: bigint;
|
|
909
|
+
maxPriorityFeePerGas?: bigint;
|
|
910
|
+
nonce?: number;
|
|
911
|
+
value?: bigint;
|
|
912
|
+
}): Promise<`0x${string}`> {
|
|
913
|
+
if (!this.contract.write) {
|
|
914
|
+
throw new Error('Wallet client is required for write operations');
|
|
915
|
+
}
|
|
916
|
+
return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* initialize
|
|
921
|
+
* nonpayable
|
|
922
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
923
|
+
*/
|
|
924
|
+
async initialize(_strategy: `0x${string}`, _name: string, _symbol: string, _approvalDelay: bigint, options?: {
|
|
925
|
+
accessList?: import('viem').AccessList;
|
|
926
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
927
|
+
chain?: import('viem').Chain | null;
|
|
928
|
+
dataSuffix?: `0x${string}`;
|
|
929
|
+
gas?: bigint;
|
|
930
|
+
gasPrice?: bigint;
|
|
931
|
+
maxFeePerGas?: bigint;
|
|
932
|
+
maxPriorityFeePerGas?: bigint;
|
|
933
|
+
nonce?: number;
|
|
934
|
+
value?: bigint;
|
|
935
|
+
}): Promise<`0x${string}`> {
|
|
936
|
+
if (!this.contract.write) {
|
|
937
|
+
throw new Error('Wallet client is required for write operations');
|
|
938
|
+
}
|
|
939
|
+
return this.contract.write.initialize([_strategy, _name, _symbol, _approvalDelay] as const, options) as Promise<`0x${string}`>;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* proposeStrat
|
|
944
|
+
* nonpayable
|
|
945
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
946
|
+
*/
|
|
947
|
+
async proposeStrat(_implementation: `0x${string}`, options?: {
|
|
948
|
+
accessList?: import('viem').AccessList;
|
|
949
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
950
|
+
chain?: import('viem').Chain | null;
|
|
951
|
+
dataSuffix?: `0x${string}`;
|
|
952
|
+
gas?: bigint;
|
|
953
|
+
gasPrice?: bigint;
|
|
954
|
+
maxFeePerGas?: bigint;
|
|
955
|
+
maxPriorityFeePerGas?: bigint;
|
|
956
|
+
nonce?: number;
|
|
957
|
+
value?: bigint;
|
|
958
|
+
}): Promise<`0x${string}`> {
|
|
959
|
+
if (!this.contract.write) {
|
|
960
|
+
throw new Error('Wallet client is required for write operations');
|
|
961
|
+
}
|
|
962
|
+
return this.contract.write.proposeStrat([_implementation] as const, options) as Promise<`0x${string}`>;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* renounceOwnership
|
|
967
|
+
* nonpayable
|
|
968
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
969
|
+
*/
|
|
970
|
+
async renounceOwnership(options?: {
|
|
971
|
+
accessList?: import('viem').AccessList;
|
|
972
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
973
|
+
chain?: import('viem').Chain | null;
|
|
974
|
+
dataSuffix?: `0x${string}`;
|
|
975
|
+
gas?: bigint;
|
|
976
|
+
gasPrice?: bigint;
|
|
977
|
+
maxFeePerGas?: bigint;
|
|
978
|
+
maxPriorityFeePerGas?: bigint;
|
|
979
|
+
nonce?: number;
|
|
980
|
+
value?: bigint;
|
|
981
|
+
}): Promise<`0x${string}`> {
|
|
982
|
+
if (!this.contract.write) {
|
|
983
|
+
throw new Error('Wallet client is required for write operations');
|
|
984
|
+
}
|
|
985
|
+
return this.contract.write.renounceOwnership(options) as Promise<`0x${string}`>;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* transfer
|
|
990
|
+
* nonpayable
|
|
991
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
992
|
+
*/
|
|
993
|
+
async transfer(recipient: `0x${string}`, amount: bigint, options?: {
|
|
994
|
+
accessList?: import('viem').AccessList;
|
|
995
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
996
|
+
chain?: import('viem').Chain | null;
|
|
997
|
+
dataSuffix?: `0x${string}`;
|
|
998
|
+
gas?: bigint;
|
|
999
|
+
gasPrice?: bigint;
|
|
1000
|
+
maxFeePerGas?: bigint;
|
|
1001
|
+
maxPriorityFeePerGas?: bigint;
|
|
1002
|
+
nonce?: number;
|
|
1003
|
+
value?: bigint;
|
|
1004
|
+
}): Promise<`0x${string}`> {
|
|
1005
|
+
if (!this.contract.write) {
|
|
1006
|
+
throw new Error('Wallet client is required for write operations');
|
|
1007
|
+
}
|
|
1008
|
+
return this.contract.write.transfer([recipient, amount] as const, options) as Promise<`0x${string}`>;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* transferFrom
|
|
1013
|
+
* nonpayable
|
|
1014
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1015
|
+
*/
|
|
1016
|
+
async transferFrom(sender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
|
|
1017
|
+
accessList?: import('viem').AccessList;
|
|
1018
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1019
|
+
chain?: import('viem').Chain | null;
|
|
1020
|
+
dataSuffix?: `0x${string}`;
|
|
1021
|
+
gas?: bigint;
|
|
1022
|
+
gasPrice?: bigint;
|
|
1023
|
+
maxFeePerGas?: bigint;
|
|
1024
|
+
maxPriorityFeePerGas?: bigint;
|
|
1025
|
+
nonce?: number;
|
|
1026
|
+
value?: bigint;
|
|
1027
|
+
}): Promise<`0x${string}`> {
|
|
1028
|
+
if (!this.contract.write) {
|
|
1029
|
+
throw new Error('Wallet client is required for write operations');
|
|
1030
|
+
}
|
|
1031
|
+
return this.contract.write.transferFrom([sender, recipient, amount] as const, options) as Promise<`0x${string}`>;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* transferOwnership
|
|
1036
|
+
* nonpayable
|
|
1037
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1038
|
+
*/
|
|
1039
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1040
|
+
accessList?: import('viem').AccessList;
|
|
1041
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1042
|
+
chain?: import('viem').Chain | null;
|
|
1043
|
+
dataSuffix?: `0x${string}`;
|
|
1044
|
+
gas?: bigint;
|
|
1045
|
+
gasPrice?: bigint;
|
|
1046
|
+
maxFeePerGas?: bigint;
|
|
1047
|
+
maxPriorityFeePerGas?: bigint;
|
|
1048
|
+
nonce?: number;
|
|
1049
|
+
value?: bigint;
|
|
1050
|
+
}): Promise<`0x${string}`> {
|
|
1051
|
+
if (!this.contract.write) {
|
|
1052
|
+
throw new Error('Wallet client is required for write operations');
|
|
1053
|
+
}
|
|
1054
|
+
return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* upgradeStrat
|
|
1059
|
+
* nonpayable
|
|
1060
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1061
|
+
*/
|
|
1062
|
+
async upgradeStrat(options?: {
|
|
1063
|
+
accessList?: import('viem').AccessList;
|
|
1064
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1065
|
+
chain?: import('viem').Chain | null;
|
|
1066
|
+
dataSuffix?: `0x${string}`;
|
|
1067
|
+
gas?: bigint;
|
|
1068
|
+
gasPrice?: bigint;
|
|
1069
|
+
maxFeePerGas?: bigint;
|
|
1070
|
+
maxPriorityFeePerGas?: bigint;
|
|
1071
|
+
nonce?: number;
|
|
1072
|
+
value?: bigint;
|
|
1073
|
+
}): Promise<`0x${string}`> {
|
|
1074
|
+
if (!this.contract.write) {
|
|
1075
|
+
throw new Error('Wallet client is required for write operations');
|
|
1076
|
+
}
|
|
1077
|
+
return this.contract.write.upgradeStrat(options) as Promise<`0x${string}`>;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* withdraw
|
|
1082
|
+
* nonpayable
|
|
1083
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1084
|
+
*/
|
|
1085
|
+
async withdraw(_shares: bigint, options?: {
|
|
1086
|
+
accessList?: import('viem').AccessList;
|
|
1087
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1088
|
+
chain?: import('viem').Chain | null;
|
|
1089
|
+
dataSuffix?: `0x${string}`;
|
|
1090
|
+
gas?: bigint;
|
|
1091
|
+
gasPrice?: bigint;
|
|
1092
|
+
maxFeePerGas?: bigint;
|
|
1093
|
+
maxPriorityFeePerGas?: bigint;
|
|
1094
|
+
nonce?: number;
|
|
1095
|
+
value?: bigint;
|
|
1096
|
+
}): Promise<`0x${string}`> {
|
|
1097
|
+
if (!this.contract.write) {
|
|
1098
|
+
throw new Error('Wallet client is required for write operations');
|
|
1099
|
+
}
|
|
1100
|
+
return this.contract.write.withdraw([_shares] as const, options) as Promise<`0x${string}`>;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* withdrawAll
|
|
1105
|
+
* nonpayable
|
|
1106
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1107
|
+
*/
|
|
1108
|
+
async withdrawAll(options?: {
|
|
1109
|
+
accessList?: import('viem').AccessList;
|
|
1110
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1111
|
+
chain?: import('viem').Chain | null;
|
|
1112
|
+
dataSuffix?: `0x${string}`;
|
|
1113
|
+
gas?: bigint;
|
|
1114
|
+
gasPrice?: bigint;
|
|
1115
|
+
maxFeePerGas?: bigint;
|
|
1116
|
+
maxPriorityFeePerGas?: bigint;
|
|
1117
|
+
nonce?: number;
|
|
1118
|
+
value?: bigint;
|
|
1119
|
+
}): Promise<`0x${string}`> {
|
|
1120
|
+
if (!this.contract.write) {
|
|
1121
|
+
throw new Error('Wallet client is required for write operations');
|
|
1122
|
+
}
|
|
1123
|
+
return this.contract.write.withdrawAll(options) as Promise<`0x${string}`>;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1130
|
+
*
|
|
1131
|
+
* @example
|
|
1132
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1133
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1134
|
+
* console.log('Would succeed:', result.result);
|
|
1135
|
+
*/
|
|
1136
|
+
get simulate() {
|
|
1137
|
+
const contract = this.contract;
|
|
1138
|
+
if (!contract.simulate) {
|
|
1139
|
+
throw new Error('Public client is required for simulation');
|
|
1140
|
+
}
|
|
1141
|
+
return {
|
|
1142
|
+
/**
|
|
1143
|
+
* Simulate approve
|
|
1144
|
+
* Returns gas estimate and result without sending transaction
|
|
1145
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1146
|
+
*/
|
|
1147
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
1148
|
+
accessList?: import('viem').AccessList;
|
|
1149
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1150
|
+
chain?: import('viem').Chain | null;
|
|
1151
|
+
dataSuffix?: `0x${string}`;
|
|
1152
|
+
gas?: bigint;
|
|
1153
|
+
gasPrice?: bigint;
|
|
1154
|
+
maxFeePerGas?: bigint;
|
|
1155
|
+
maxPriorityFeePerGas?: bigint;
|
|
1156
|
+
nonce?: number;
|
|
1157
|
+
value?: bigint;
|
|
1158
|
+
}): Promise<boolean> {
|
|
1159
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
1160
|
+
},
|
|
1161
|
+
/**
|
|
1162
|
+
* Simulate decreaseAllowance
|
|
1163
|
+
* Returns gas estimate and result without sending transaction
|
|
1164
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1165
|
+
*/
|
|
1166
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
1167
|
+
accessList?: import('viem').AccessList;
|
|
1168
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1169
|
+
chain?: import('viem').Chain | null;
|
|
1170
|
+
dataSuffix?: `0x${string}`;
|
|
1171
|
+
gas?: bigint;
|
|
1172
|
+
gasPrice?: bigint;
|
|
1173
|
+
maxFeePerGas?: bigint;
|
|
1174
|
+
maxPriorityFeePerGas?: bigint;
|
|
1175
|
+
nonce?: number;
|
|
1176
|
+
value?: bigint;
|
|
1177
|
+
}): Promise<boolean> {
|
|
1178
|
+
return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
|
|
1179
|
+
},
|
|
1180
|
+
/**
|
|
1181
|
+
* Simulate deposit
|
|
1182
|
+
* Returns gas estimate and result without sending transaction
|
|
1183
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1184
|
+
*/
|
|
1185
|
+
async deposit(_amount: bigint, options?: {
|
|
1186
|
+
accessList?: import('viem').AccessList;
|
|
1187
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1188
|
+
chain?: import('viem').Chain | null;
|
|
1189
|
+
dataSuffix?: `0x${string}`;
|
|
1190
|
+
gas?: bigint;
|
|
1191
|
+
gasPrice?: bigint;
|
|
1192
|
+
maxFeePerGas?: bigint;
|
|
1193
|
+
maxPriorityFeePerGas?: bigint;
|
|
1194
|
+
nonce?: number;
|
|
1195
|
+
value?: bigint;
|
|
1196
|
+
}): Promise<void> {
|
|
1197
|
+
return contract.simulate.deposit([_amount] as const, options) as Promise<void>;
|
|
1198
|
+
},
|
|
1199
|
+
/**
|
|
1200
|
+
* Simulate depositAll
|
|
1201
|
+
* Returns gas estimate and result without sending transaction
|
|
1202
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1203
|
+
*/
|
|
1204
|
+
async depositAll(options?: {
|
|
1205
|
+
accessList?: import('viem').AccessList;
|
|
1206
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1207
|
+
chain?: import('viem').Chain | null;
|
|
1208
|
+
dataSuffix?: `0x${string}`;
|
|
1209
|
+
gas?: bigint;
|
|
1210
|
+
gasPrice?: bigint;
|
|
1211
|
+
maxFeePerGas?: bigint;
|
|
1212
|
+
maxPriorityFeePerGas?: bigint;
|
|
1213
|
+
nonce?: number;
|
|
1214
|
+
value?: bigint;
|
|
1215
|
+
}): Promise<void> {
|
|
1216
|
+
return contract.simulate.depositAll(options) as Promise<void>;
|
|
1217
|
+
},
|
|
1218
|
+
/**
|
|
1219
|
+
* Simulate earn
|
|
1220
|
+
* Returns gas estimate and result without sending transaction
|
|
1221
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1222
|
+
*/
|
|
1223
|
+
async earn(options?: {
|
|
1224
|
+
accessList?: import('viem').AccessList;
|
|
1225
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1226
|
+
chain?: import('viem').Chain | null;
|
|
1227
|
+
dataSuffix?: `0x${string}`;
|
|
1228
|
+
gas?: bigint;
|
|
1229
|
+
gasPrice?: bigint;
|
|
1230
|
+
maxFeePerGas?: bigint;
|
|
1231
|
+
maxPriorityFeePerGas?: bigint;
|
|
1232
|
+
nonce?: number;
|
|
1233
|
+
value?: bigint;
|
|
1234
|
+
}): Promise<void> {
|
|
1235
|
+
return contract.simulate.earn(options) as Promise<void>;
|
|
1236
|
+
},
|
|
1237
|
+
/**
|
|
1238
|
+
* Simulate inCaseTokensGetStuck
|
|
1239
|
+
* Returns gas estimate and result without sending transaction
|
|
1240
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1241
|
+
*/
|
|
1242
|
+
async inCaseTokensGetStuck(_token: `0x${string}`, options?: {
|
|
1243
|
+
accessList?: import('viem').AccessList;
|
|
1244
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1245
|
+
chain?: import('viem').Chain | null;
|
|
1246
|
+
dataSuffix?: `0x${string}`;
|
|
1247
|
+
gas?: bigint;
|
|
1248
|
+
gasPrice?: bigint;
|
|
1249
|
+
maxFeePerGas?: bigint;
|
|
1250
|
+
maxPriorityFeePerGas?: bigint;
|
|
1251
|
+
nonce?: number;
|
|
1252
|
+
value?: bigint;
|
|
1253
|
+
}): Promise<void> {
|
|
1254
|
+
return contract.simulate.inCaseTokensGetStuck([_token] as const, options) as Promise<void>;
|
|
1255
|
+
},
|
|
1256
|
+
/**
|
|
1257
|
+
* Simulate increaseAllowance
|
|
1258
|
+
* Returns gas estimate and result without sending transaction
|
|
1259
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1260
|
+
*/
|
|
1261
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
1262
|
+
accessList?: import('viem').AccessList;
|
|
1263
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1264
|
+
chain?: import('viem').Chain | null;
|
|
1265
|
+
dataSuffix?: `0x${string}`;
|
|
1266
|
+
gas?: bigint;
|
|
1267
|
+
gasPrice?: bigint;
|
|
1268
|
+
maxFeePerGas?: bigint;
|
|
1269
|
+
maxPriorityFeePerGas?: bigint;
|
|
1270
|
+
nonce?: number;
|
|
1271
|
+
value?: bigint;
|
|
1272
|
+
}): Promise<boolean> {
|
|
1273
|
+
return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
|
|
1274
|
+
},
|
|
1275
|
+
/**
|
|
1276
|
+
* Simulate initialize
|
|
1277
|
+
* Returns gas estimate and result without sending transaction
|
|
1278
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1279
|
+
*/
|
|
1280
|
+
async initialize(_strategy: `0x${string}`, _name: string, _symbol: string, _approvalDelay: bigint, options?: {
|
|
1281
|
+
accessList?: import('viem').AccessList;
|
|
1282
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1283
|
+
chain?: import('viem').Chain | null;
|
|
1284
|
+
dataSuffix?: `0x${string}`;
|
|
1285
|
+
gas?: bigint;
|
|
1286
|
+
gasPrice?: bigint;
|
|
1287
|
+
maxFeePerGas?: bigint;
|
|
1288
|
+
maxPriorityFeePerGas?: bigint;
|
|
1289
|
+
nonce?: number;
|
|
1290
|
+
value?: bigint;
|
|
1291
|
+
}): Promise<void> {
|
|
1292
|
+
return contract.simulate.initialize([_strategy, _name, _symbol, _approvalDelay] as const, options) as Promise<void>;
|
|
1293
|
+
},
|
|
1294
|
+
/**
|
|
1295
|
+
* Simulate proposeStrat
|
|
1296
|
+
* Returns gas estimate and result without sending transaction
|
|
1297
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1298
|
+
*/
|
|
1299
|
+
async proposeStrat(_implementation: `0x${string}`, options?: {
|
|
1300
|
+
accessList?: import('viem').AccessList;
|
|
1301
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1302
|
+
chain?: import('viem').Chain | null;
|
|
1303
|
+
dataSuffix?: `0x${string}`;
|
|
1304
|
+
gas?: bigint;
|
|
1305
|
+
gasPrice?: bigint;
|
|
1306
|
+
maxFeePerGas?: bigint;
|
|
1307
|
+
maxPriorityFeePerGas?: bigint;
|
|
1308
|
+
nonce?: number;
|
|
1309
|
+
value?: bigint;
|
|
1310
|
+
}): Promise<void> {
|
|
1311
|
+
return contract.simulate.proposeStrat([_implementation] as const, options) as Promise<void>;
|
|
1312
|
+
},
|
|
1313
|
+
/**
|
|
1314
|
+
* Simulate renounceOwnership
|
|
1315
|
+
* Returns gas estimate and result without sending transaction
|
|
1316
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1317
|
+
*/
|
|
1318
|
+
async renounceOwnership(options?: {
|
|
1319
|
+
accessList?: import('viem').AccessList;
|
|
1320
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1321
|
+
chain?: import('viem').Chain | null;
|
|
1322
|
+
dataSuffix?: `0x${string}`;
|
|
1323
|
+
gas?: bigint;
|
|
1324
|
+
gasPrice?: bigint;
|
|
1325
|
+
maxFeePerGas?: bigint;
|
|
1326
|
+
maxPriorityFeePerGas?: bigint;
|
|
1327
|
+
nonce?: number;
|
|
1328
|
+
value?: bigint;
|
|
1329
|
+
}): Promise<void> {
|
|
1330
|
+
return contract.simulate.renounceOwnership(options) as Promise<void>;
|
|
1331
|
+
},
|
|
1332
|
+
/**
|
|
1333
|
+
* Simulate transfer
|
|
1334
|
+
* Returns gas estimate and result without sending transaction
|
|
1335
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1336
|
+
*/
|
|
1337
|
+
async transfer(recipient: `0x${string}`, amount: bigint, options?: {
|
|
1338
|
+
accessList?: import('viem').AccessList;
|
|
1339
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1340
|
+
chain?: import('viem').Chain | null;
|
|
1341
|
+
dataSuffix?: `0x${string}`;
|
|
1342
|
+
gas?: bigint;
|
|
1343
|
+
gasPrice?: bigint;
|
|
1344
|
+
maxFeePerGas?: bigint;
|
|
1345
|
+
maxPriorityFeePerGas?: bigint;
|
|
1346
|
+
nonce?: number;
|
|
1347
|
+
value?: bigint;
|
|
1348
|
+
}): Promise<boolean> {
|
|
1349
|
+
return contract.simulate.transfer([recipient, amount] as const, options) as Promise<boolean>;
|
|
1350
|
+
},
|
|
1351
|
+
/**
|
|
1352
|
+
* Simulate transferFrom
|
|
1353
|
+
* Returns gas estimate and result without sending transaction
|
|
1354
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1355
|
+
*/
|
|
1356
|
+
async transferFrom(sender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
|
|
1357
|
+
accessList?: import('viem').AccessList;
|
|
1358
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1359
|
+
chain?: import('viem').Chain | null;
|
|
1360
|
+
dataSuffix?: `0x${string}`;
|
|
1361
|
+
gas?: bigint;
|
|
1362
|
+
gasPrice?: bigint;
|
|
1363
|
+
maxFeePerGas?: bigint;
|
|
1364
|
+
maxPriorityFeePerGas?: bigint;
|
|
1365
|
+
nonce?: number;
|
|
1366
|
+
value?: bigint;
|
|
1367
|
+
}): Promise<boolean> {
|
|
1368
|
+
return contract.simulate.transferFrom([sender, recipient, amount] as const, options) as Promise<boolean>;
|
|
1369
|
+
},
|
|
1370
|
+
/**
|
|
1371
|
+
* Simulate transferOwnership
|
|
1372
|
+
* Returns gas estimate and result without sending transaction
|
|
1373
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1374
|
+
*/
|
|
1375
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1376
|
+
accessList?: import('viem').AccessList;
|
|
1377
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1378
|
+
chain?: import('viem').Chain | null;
|
|
1379
|
+
dataSuffix?: `0x${string}`;
|
|
1380
|
+
gas?: bigint;
|
|
1381
|
+
gasPrice?: bigint;
|
|
1382
|
+
maxFeePerGas?: bigint;
|
|
1383
|
+
maxPriorityFeePerGas?: bigint;
|
|
1384
|
+
nonce?: number;
|
|
1385
|
+
value?: bigint;
|
|
1386
|
+
}): Promise<void> {
|
|
1387
|
+
return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
|
|
1388
|
+
},
|
|
1389
|
+
/**
|
|
1390
|
+
* Simulate upgradeStrat
|
|
1391
|
+
* Returns gas estimate and result without sending transaction
|
|
1392
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1393
|
+
*/
|
|
1394
|
+
async upgradeStrat(options?: {
|
|
1395
|
+
accessList?: import('viem').AccessList;
|
|
1396
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1397
|
+
chain?: import('viem').Chain | null;
|
|
1398
|
+
dataSuffix?: `0x${string}`;
|
|
1399
|
+
gas?: bigint;
|
|
1400
|
+
gasPrice?: bigint;
|
|
1401
|
+
maxFeePerGas?: bigint;
|
|
1402
|
+
maxPriorityFeePerGas?: bigint;
|
|
1403
|
+
nonce?: number;
|
|
1404
|
+
value?: bigint;
|
|
1405
|
+
}): Promise<void> {
|
|
1406
|
+
return contract.simulate.upgradeStrat(options) as Promise<void>;
|
|
1407
|
+
},
|
|
1408
|
+
/**
|
|
1409
|
+
* Simulate withdraw
|
|
1410
|
+
* Returns gas estimate and result without sending transaction
|
|
1411
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1412
|
+
*/
|
|
1413
|
+
async withdraw(_shares: bigint, options?: {
|
|
1414
|
+
accessList?: import('viem').AccessList;
|
|
1415
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1416
|
+
chain?: import('viem').Chain | null;
|
|
1417
|
+
dataSuffix?: `0x${string}`;
|
|
1418
|
+
gas?: bigint;
|
|
1419
|
+
gasPrice?: bigint;
|
|
1420
|
+
maxFeePerGas?: bigint;
|
|
1421
|
+
maxPriorityFeePerGas?: bigint;
|
|
1422
|
+
nonce?: number;
|
|
1423
|
+
value?: bigint;
|
|
1424
|
+
}): Promise<void> {
|
|
1425
|
+
return contract.simulate.withdraw([_shares] as const, options) as Promise<void>;
|
|
1426
|
+
},
|
|
1427
|
+
/**
|
|
1428
|
+
* Simulate withdrawAll
|
|
1429
|
+
* Returns gas estimate and result without sending transaction
|
|
1430
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1431
|
+
*/
|
|
1432
|
+
async withdrawAll(options?: {
|
|
1433
|
+
accessList?: import('viem').AccessList;
|
|
1434
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1435
|
+
chain?: import('viem').Chain | null;
|
|
1436
|
+
dataSuffix?: `0x${string}`;
|
|
1437
|
+
gas?: bigint;
|
|
1438
|
+
gasPrice?: bigint;
|
|
1439
|
+
maxFeePerGas?: bigint;
|
|
1440
|
+
maxPriorityFeePerGas?: bigint;
|
|
1441
|
+
nonce?: number;
|
|
1442
|
+
value?: bigint;
|
|
1443
|
+
}): Promise<void> {
|
|
1444
|
+
return contract.simulate.withdrawAll(options) as Promise<void>;
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* Watch contract events
|
|
1451
|
+
*
|
|
1452
|
+
* @example
|
|
1453
|
+
* // Watch all Transfer events
|
|
1454
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1455
|
+
* console.log('Transfer:', event);
|
|
1456
|
+
* });
|
|
1457
|
+
*
|
|
1458
|
+
* // Stop watching
|
|
1459
|
+
* unwatch();
|
|
1460
|
+
*/
|
|
1461
|
+
get watch() {
|
|
1462
|
+
return {
|
|
1463
|
+
/**
|
|
1464
|
+
* Watch Approval events
|
|
1465
|
+
* @param callback Function to call when event is emitted
|
|
1466
|
+
* @param filter Optional filter for indexed parameters
|
|
1467
|
+
* @returns Unwatch function to stop listening
|
|
1468
|
+
*/
|
|
1469
|
+
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; spender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1470
|
+
return this.publicClient.watchContractEvent({
|
|
1471
|
+
address: this.contractAddress,
|
|
1472
|
+
abi: BeefyVaultV7Abi,
|
|
1473
|
+
eventName: 'Approval',
|
|
1474
|
+
args: filter as any,
|
|
1475
|
+
onLogs: (logs: any[]) => {
|
|
1476
|
+
logs.forEach((log: any) => {
|
|
1477
|
+
callback(log.args as any);
|
|
1478
|
+
});
|
|
1479
|
+
},
|
|
1480
|
+
}) as () => void;
|
|
1481
|
+
},
|
|
1482
|
+
/**
|
|
1483
|
+
* Watch NewStratCandidate events
|
|
1484
|
+
* @param callback Function to call when event is emitted
|
|
1485
|
+
* @param filter Optional filter for indexed parameters
|
|
1486
|
+
* @returns Unwatch function to stop listening
|
|
1487
|
+
*/
|
|
1488
|
+
NewStratCandidate: (callback: (event: { implementation: `0x${string}` }) => void) => {
|
|
1489
|
+
return this.publicClient.watchContractEvent({
|
|
1490
|
+
address: this.contractAddress,
|
|
1491
|
+
abi: BeefyVaultV7Abi,
|
|
1492
|
+
eventName: 'NewStratCandidate',
|
|
1493
|
+
|
|
1494
|
+
onLogs: (logs: any[]) => {
|
|
1495
|
+
logs.forEach((log: any) => {
|
|
1496
|
+
callback(log.args as any);
|
|
1497
|
+
});
|
|
1498
|
+
},
|
|
1499
|
+
}) as () => void;
|
|
1500
|
+
},
|
|
1501
|
+
/**
|
|
1502
|
+
* Watch OwnershipTransferred events
|
|
1503
|
+
* @param callback Function to call when event is emitted
|
|
1504
|
+
* @param filter Optional filter for indexed parameters
|
|
1505
|
+
* @returns Unwatch function to stop listening
|
|
1506
|
+
*/
|
|
1507
|
+
OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner?: `0x${string}` | `0x${string}`[] | null; newOwner?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1508
|
+
return this.publicClient.watchContractEvent({
|
|
1509
|
+
address: this.contractAddress,
|
|
1510
|
+
abi: BeefyVaultV7Abi,
|
|
1511
|
+
eventName: 'OwnershipTransferred',
|
|
1512
|
+
args: filter as any,
|
|
1513
|
+
onLogs: (logs: any[]) => {
|
|
1514
|
+
logs.forEach((log: any) => {
|
|
1515
|
+
callback(log.args as any);
|
|
1516
|
+
});
|
|
1517
|
+
},
|
|
1518
|
+
}) as () => void;
|
|
1519
|
+
},
|
|
1520
|
+
/**
|
|
1521
|
+
* Watch Transfer events
|
|
1522
|
+
* @param callback Function to call when event is emitted
|
|
1523
|
+
* @param filter Optional filter for indexed parameters
|
|
1524
|
+
* @returns Unwatch function to stop listening
|
|
1525
|
+
*/
|
|
1526
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from?: `0x${string}` | `0x${string}`[] | null; to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1527
|
+
return this.publicClient.watchContractEvent({
|
|
1528
|
+
address: this.contractAddress,
|
|
1529
|
+
abi: BeefyVaultV7Abi,
|
|
1530
|
+
eventName: 'Transfer',
|
|
1531
|
+
args: filter as any,
|
|
1532
|
+
onLogs: (logs: any[]) => {
|
|
1533
|
+
logs.forEach((log: any) => {
|
|
1534
|
+
callback(log.args as any);
|
|
1535
|
+
});
|
|
1536
|
+
},
|
|
1537
|
+
}) as () => void;
|
|
1538
|
+
},
|
|
1539
|
+
/**
|
|
1540
|
+
* Watch UpgradeStrat events
|
|
1541
|
+
* @param callback Function to call when event is emitted
|
|
1542
|
+
* @param filter Optional filter for indexed parameters
|
|
1543
|
+
* @returns Unwatch function to stop listening
|
|
1544
|
+
*/
|
|
1545
|
+
UpgradeStrat: (callback: (event: { implementation: `0x${string}` }) => void) => {
|
|
1546
|
+
return this.publicClient.watchContractEvent({
|
|
1547
|
+
address: this.contractAddress,
|
|
1548
|
+
abi: BeefyVaultV7Abi,
|
|
1549
|
+
eventName: 'UpgradeStrat',
|
|
1550
|
+
|
|
1551
|
+
onLogs: (logs: any[]) => {
|
|
1552
|
+
logs.forEach((log: any) => {
|
|
1553
|
+
callback(log.args as any);
|
|
1554
|
+
});
|
|
1555
|
+
},
|
|
1556
|
+
}) as () => void;
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
}
|