@gitmyabi/cover 1.0.0 → 1.0.1
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 +7 -7
- package/contracts/Cover.d.ts +1978 -0
- package/contracts/Cover.js +2142 -0
- package/contracts/Cover.ts +2585 -0
- package/contracts/OwnedUpgradeabilityProxy.d.ts +266 -0
- package/contracts/OwnedUpgradeabilityProxy.js +294 -0
- package/contracts/OwnedUpgradeabilityProxy.ts +370 -0
- package/contracts/index.d.ts +4 -2
- package/contracts/index.js +7 -4
- package/contracts/index.ts +4 -2
- package/package.json +4 -4
- package/contracts/COVER_json.d.ts +0 -858
- package/contracts/COVER_json.js +0 -862
- package/contracts/COVER_json.ts +0 -1129
|
@@ -0,0 +1,2142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Cover = exports.CoverAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* Cover ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.CoverAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "_registry",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "_stakingPoolImplementation",
|
|
21
|
+
"type": "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "address",
|
|
25
|
+
"name": "_verifyingAddress",
|
|
26
|
+
"type": "address"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "nonpayable",
|
|
30
|
+
"type": "constructor"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"internalType": "uint256",
|
|
36
|
+
"name": "coverId",
|
|
37
|
+
"type": "uint256"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"name": "AlreadyMigratedCoverData",
|
|
41
|
+
"type": "error"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"inputs": [],
|
|
45
|
+
"name": "CommissionRateTooHigh",
|
|
46
|
+
"type": "error"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"inputs": [],
|
|
50
|
+
"name": "CoverAmountIsZero",
|
|
51
|
+
"type": "error"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"inputs": [],
|
|
55
|
+
"name": "CoverAssetMismatch",
|
|
56
|
+
"type": "error"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"inputs": [],
|
|
60
|
+
"name": "CoverAssetNotSupported",
|
|
61
|
+
"type": "error"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"inputs": [
|
|
65
|
+
{
|
|
66
|
+
"internalType": "uint256",
|
|
67
|
+
"name": "coverId",
|
|
68
|
+
"type": "uint256"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"name": "CoverNotYetExpired",
|
|
72
|
+
"type": "error"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"inputs": [],
|
|
76
|
+
"name": "CoverPeriodTooLong",
|
|
77
|
+
"type": "error"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"inputs": [],
|
|
81
|
+
"name": "CoverPeriodTooShort",
|
|
82
|
+
"type": "error"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"inputs": [
|
|
86
|
+
{
|
|
87
|
+
"internalType": "address",
|
|
88
|
+
"name": "to",
|
|
89
|
+
"type": "address"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"internalType": "uint256",
|
|
93
|
+
"name": "amount",
|
|
94
|
+
"type": "uint256"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"name": "ETHTransferFailed",
|
|
98
|
+
"type": "error"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [],
|
|
102
|
+
"name": "EditNotSupported",
|
|
103
|
+
"type": "error"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"inputs": [],
|
|
107
|
+
"name": "ExpiredCoversCannotBeEdited",
|
|
108
|
+
"type": "error"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"inputs": [],
|
|
112
|
+
"name": "InsufficientCoverAmountAllocated",
|
|
113
|
+
"type": "error"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"inputs": [],
|
|
117
|
+
"name": "InsufficientEthSent",
|
|
118
|
+
"type": "error"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [],
|
|
122
|
+
"name": "InvalidPaymentAsset",
|
|
123
|
+
"type": "error"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"inputs": [],
|
|
127
|
+
"name": "InvalidRiConfig",
|
|
128
|
+
"type": "error"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"inputs": [],
|
|
132
|
+
"name": "InvalidSignature",
|
|
133
|
+
"type": "error"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"inputs": [],
|
|
137
|
+
"name": "IpfsMetadataAlreadySet",
|
|
138
|
+
"type": "error"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"inputs": [
|
|
142
|
+
{
|
|
143
|
+
"internalType": "uint256",
|
|
144
|
+
"name": "originalCoverId",
|
|
145
|
+
"type": "uint256"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"name": "MustBeOriginalCoverId",
|
|
149
|
+
"type": "error"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"inputs": [],
|
|
153
|
+
"name": "OnlyAdvisoryBoard",
|
|
154
|
+
"type": "error"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"inputs": [],
|
|
158
|
+
"name": "OnlyMember",
|
|
159
|
+
"type": "error"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"inputs": [],
|
|
163
|
+
"name": "OnlyOwnerOrApproved",
|
|
164
|
+
"type": "error"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"inputs": [
|
|
168
|
+
{
|
|
169
|
+
"internalType": "uint256",
|
|
170
|
+
"name": "currentState",
|
|
171
|
+
"type": "uint256"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"internalType": "uint256",
|
|
175
|
+
"name": "checks",
|
|
176
|
+
"type": "uint256"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"name": "Paused",
|
|
180
|
+
"type": "error"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"inputs": [],
|
|
184
|
+
"name": "PriceExceedsMaxPremiumInAsset",
|
|
185
|
+
"type": "error"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"inputs": [],
|
|
189
|
+
"name": "ProductDeprecated",
|
|
190
|
+
"type": "error"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"inputs": [],
|
|
194
|
+
"name": "ProductNotFound",
|
|
195
|
+
"type": "error"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [],
|
|
199
|
+
"name": "ReentrantCall",
|
|
200
|
+
"type": "error"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"inputs": [
|
|
204
|
+
{
|
|
205
|
+
"internalType": "uint256",
|
|
206
|
+
"name": "index",
|
|
207
|
+
"type": "uint256"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"name": "RevertedWithoutReason",
|
|
211
|
+
"type": "error"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"inputs": [],
|
|
215
|
+
"name": "RiAmountIsZero",
|
|
216
|
+
"type": "error"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"inputs": [],
|
|
220
|
+
"name": "SignatureExpired",
|
|
221
|
+
"type": "error"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"inputs": [
|
|
225
|
+
{
|
|
226
|
+
"internalType": "address",
|
|
227
|
+
"name": "caller",
|
|
228
|
+
"type": "address"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"internalType": "uint256",
|
|
232
|
+
"name": "callerIndex",
|
|
233
|
+
"type": "uint256"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"internalType": "uint256",
|
|
237
|
+
"name": "authorizedBitmap",
|
|
238
|
+
"type": "uint256"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"name": "Unauthorized",
|
|
242
|
+
"type": "error"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"inputs": [],
|
|
246
|
+
"name": "UnexpectedEthSent",
|
|
247
|
+
"type": "error"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"inputs": [],
|
|
251
|
+
"name": "UnexpectedRiPremium",
|
|
252
|
+
"type": "error"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"inputs": [],
|
|
256
|
+
"name": "WrongCoverEditEntrypoint",
|
|
257
|
+
"type": "error"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"anonymous": false,
|
|
261
|
+
"inputs": [
|
|
262
|
+
{
|
|
263
|
+
"indexed": true,
|
|
264
|
+
"internalType": "uint256",
|
|
265
|
+
"name": "coverId",
|
|
266
|
+
"type": "uint256"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"indexed": true,
|
|
270
|
+
"internalType": "uint256",
|
|
271
|
+
"name": "originalCoverId",
|
|
272
|
+
"type": "uint256"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"indexed": true,
|
|
276
|
+
"internalType": "uint256",
|
|
277
|
+
"name": "buyerMemberId",
|
|
278
|
+
"type": "uint256"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"indexed": false,
|
|
282
|
+
"internalType": "uint256",
|
|
283
|
+
"name": "productId",
|
|
284
|
+
"type": "uint256"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"name": "CoverBought",
|
|
288
|
+
"type": "event"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"anonymous": false,
|
|
292
|
+
"inputs": [
|
|
293
|
+
{
|
|
294
|
+
"indexed": true,
|
|
295
|
+
"internalType": "uint256",
|
|
296
|
+
"name": "coverId",
|
|
297
|
+
"type": "uint256"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"indexed": false,
|
|
301
|
+
"internalType": "uint256",
|
|
302
|
+
"name": "premium",
|
|
303
|
+
"type": "uint256"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"indexed": false,
|
|
307
|
+
"internalType": "uint256",
|
|
308
|
+
"name": "paymentAsset",
|
|
309
|
+
"type": "uint256"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"indexed": false,
|
|
313
|
+
"internalType": "bytes",
|
|
314
|
+
"name": "data",
|
|
315
|
+
"type": "bytes"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"indexed": false,
|
|
319
|
+
"internalType": "uint8",
|
|
320
|
+
"name": "dataFormatVersion",
|
|
321
|
+
"type": "uint8"
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
"name": "CoverRiAllocated",
|
|
325
|
+
"type": "event"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"inputs": [],
|
|
329
|
+
"name": "DEFAULT_MIN_PRICE_RATIO",
|
|
330
|
+
"outputs": [
|
|
331
|
+
{
|
|
332
|
+
"internalType": "uint256",
|
|
333
|
+
"name": "",
|
|
334
|
+
"type": "uint256"
|
|
335
|
+
}
|
|
336
|
+
],
|
|
337
|
+
"stateMutability": "view",
|
|
338
|
+
"type": "function"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"inputs": [],
|
|
342
|
+
"name": "DOMAIN_SEPARATOR",
|
|
343
|
+
"outputs": [
|
|
344
|
+
{
|
|
345
|
+
"internalType": "bytes32",
|
|
346
|
+
"name": "",
|
|
347
|
+
"type": "bytes32"
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
"stateMutability": "view",
|
|
351
|
+
"type": "function"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"inputs": [],
|
|
355
|
+
"name": "MAX_COMMISSION_RATIO",
|
|
356
|
+
"outputs": [
|
|
357
|
+
{
|
|
358
|
+
"internalType": "uint256",
|
|
359
|
+
"name": "",
|
|
360
|
+
"type": "uint256"
|
|
361
|
+
}
|
|
362
|
+
],
|
|
363
|
+
"stateMutability": "view",
|
|
364
|
+
"type": "function"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"inputs": [],
|
|
368
|
+
"name": "NXM_PER_ALLOCATION_UNIT",
|
|
369
|
+
"outputs": [
|
|
370
|
+
{
|
|
371
|
+
"internalType": "uint256",
|
|
372
|
+
"name": "",
|
|
373
|
+
"type": "uint256"
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"stateMutability": "view",
|
|
377
|
+
"type": "function"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"inputs": [
|
|
381
|
+
{
|
|
382
|
+
"internalType": "uint256",
|
|
383
|
+
"name": "assetId",
|
|
384
|
+
"type": "uint256"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"name": "activeCover",
|
|
388
|
+
"outputs": [
|
|
389
|
+
{
|
|
390
|
+
"internalType": "uint192",
|
|
391
|
+
"name": "totalActiveCoverInAsset",
|
|
392
|
+
"type": "uint192"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"internalType": "uint64",
|
|
396
|
+
"name": "lastBucketUpdateId",
|
|
397
|
+
"type": "uint64"
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
"stateMutability": "view",
|
|
401
|
+
"type": "function"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"inputs": [
|
|
405
|
+
{
|
|
406
|
+
"internalType": "uint256",
|
|
407
|
+
"name": "coverId",
|
|
408
|
+
"type": "uint256"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"internalType": "uint256",
|
|
412
|
+
"name": "payoutAmountInAsset",
|
|
413
|
+
"type": "uint256"
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
"name": "burnStake",
|
|
417
|
+
"outputs": [],
|
|
418
|
+
"stateMutability": "nonpayable",
|
|
419
|
+
"type": "function"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"inputs": [
|
|
423
|
+
{
|
|
424
|
+
"components": [
|
|
425
|
+
{
|
|
426
|
+
"internalType": "uint256",
|
|
427
|
+
"name": "coverId",
|
|
428
|
+
"type": "uint256"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"internalType": "address",
|
|
432
|
+
"name": "owner",
|
|
433
|
+
"type": "address"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"internalType": "uint24",
|
|
437
|
+
"name": "productId",
|
|
438
|
+
"type": "uint24"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"internalType": "uint8",
|
|
442
|
+
"name": "coverAsset",
|
|
443
|
+
"type": "uint8"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"internalType": "uint96",
|
|
447
|
+
"name": "amount",
|
|
448
|
+
"type": "uint96"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"internalType": "uint32",
|
|
452
|
+
"name": "period",
|
|
453
|
+
"type": "uint32"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"internalType": "uint256",
|
|
457
|
+
"name": "maxPremiumInAsset",
|
|
458
|
+
"type": "uint256"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"internalType": "uint8",
|
|
462
|
+
"name": "paymentAsset",
|
|
463
|
+
"type": "uint8"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"internalType": "uint16",
|
|
467
|
+
"name": "commissionRatio",
|
|
468
|
+
"type": "uint16"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"internalType": "address",
|
|
472
|
+
"name": "commissionDestination",
|
|
473
|
+
"type": "address"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"internalType": "string",
|
|
477
|
+
"name": "ipfsData",
|
|
478
|
+
"type": "string"
|
|
479
|
+
}
|
|
480
|
+
],
|
|
481
|
+
"internalType": "struct BuyCoverParams",
|
|
482
|
+
"name": "params",
|
|
483
|
+
"type": "tuple"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"components": [
|
|
487
|
+
{
|
|
488
|
+
"internalType": "uint256",
|
|
489
|
+
"name": "poolId",
|
|
490
|
+
"type": "uint256"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"internalType": "uint256",
|
|
494
|
+
"name": "coverAmountInAsset",
|
|
495
|
+
"type": "uint256"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"internalType": "struct PoolAllocationRequest[]",
|
|
499
|
+
"name": "poolAllocationRequests",
|
|
500
|
+
"type": "tuple[]"
|
|
501
|
+
}
|
|
502
|
+
],
|
|
503
|
+
"name": "buyCover",
|
|
504
|
+
"outputs": [
|
|
505
|
+
{
|
|
506
|
+
"internalType": "uint256",
|
|
507
|
+
"name": "coverId",
|
|
508
|
+
"type": "uint256"
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
"stateMutability": "payable",
|
|
512
|
+
"type": "function"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"inputs": [
|
|
516
|
+
{
|
|
517
|
+
"components": [
|
|
518
|
+
{
|
|
519
|
+
"internalType": "uint256",
|
|
520
|
+
"name": "coverId",
|
|
521
|
+
"type": "uint256"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"internalType": "address",
|
|
525
|
+
"name": "owner",
|
|
526
|
+
"type": "address"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"internalType": "uint24",
|
|
530
|
+
"name": "productId",
|
|
531
|
+
"type": "uint24"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"internalType": "uint8",
|
|
535
|
+
"name": "coverAsset",
|
|
536
|
+
"type": "uint8"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"internalType": "uint96",
|
|
540
|
+
"name": "amount",
|
|
541
|
+
"type": "uint96"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"internalType": "uint32",
|
|
545
|
+
"name": "period",
|
|
546
|
+
"type": "uint32"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"internalType": "uint256",
|
|
550
|
+
"name": "maxPremiumInAsset",
|
|
551
|
+
"type": "uint256"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"internalType": "uint8",
|
|
555
|
+
"name": "paymentAsset",
|
|
556
|
+
"type": "uint8"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"internalType": "uint16",
|
|
560
|
+
"name": "commissionRatio",
|
|
561
|
+
"type": "uint16"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"internalType": "address",
|
|
565
|
+
"name": "commissionDestination",
|
|
566
|
+
"type": "address"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"internalType": "string",
|
|
570
|
+
"name": "ipfsData",
|
|
571
|
+
"type": "string"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
"internalType": "struct BuyCoverParams",
|
|
575
|
+
"name": "params",
|
|
576
|
+
"type": "tuple"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"components": [
|
|
580
|
+
{
|
|
581
|
+
"internalType": "uint256",
|
|
582
|
+
"name": "poolId",
|
|
583
|
+
"type": "uint256"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"internalType": "uint256",
|
|
587
|
+
"name": "coverAmountInAsset",
|
|
588
|
+
"type": "uint256"
|
|
589
|
+
}
|
|
590
|
+
],
|
|
591
|
+
"internalType": "struct PoolAllocationRequest[]",
|
|
592
|
+
"name": "poolAllocationRequests",
|
|
593
|
+
"type": "tuple[]"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"components": [
|
|
597
|
+
{
|
|
598
|
+
"internalType": "uint256",
|
|
599
|
+
"name": "providerId",
|
|
600
|
+
"type": "uint256"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"internalType": "uint256",
|
|
604
|
+
"name": "amount",
|
|
605
|
+
"type": "uint256"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"internalType": "uint256",
|
|
609
|
+
"name": "premium",
|
|
610
|
+
"type": "uint256"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"internalType": "bytes",
|
|
614
|
+
"name": "signature",
|
|
615
|
+
"type": "bytes"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"internalType": "bytes",
|
|
619
|
+
"name": "data",
|
|
620
|
+
"type": "bytes"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"internalType": "uint8",
|
|
624
|
+
"name": "dataFormat",
|
|
625
|
+
"type": "uint8"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"internalType": "uint32",
|
|
629
|
+
"name": "deadline",
|
|
630
|
+
"type": "uint32"
|
|
631
|
+
}
|
|
632
|
+
],
|
|
633
|
+
"internalType": "struct RiRequest",
|
|
634
|
+
"name": "riRequest",
|
|
635
|
+
"type": "tuple"
|
|
636
|
+
}
|
|
637
|
+
],
|
|
638
|
+
"name": "buyCoverWithRi",
|
|
639
|
+
"outputs": [
|
|
640
|
+
{
|
|
641
|
+
"internalType": "uint256",
|
|
642
|
+
"name": "coverId",
|
|
643
|
+
"type": "uint256"
|
|
644
|
+
}
|
|
645
|
+
],
|
|
646
|
+
"stateMutability": "payable",
|
|
647
|
+
"type": "function"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"inputs": [
|
|
651
|
+
{
|
|
652
|
+
"internalType": "address",
|
|
653
|
+
"name": "_coverNFTDescriptor",
|
|
654
|
+
"type": "address"
|
|
655
|
+
}
|
|
656
|
+
],
|
|
657
|
+
"name": "changeCoverNFTDescriptor",
|
|
658
|
+
"outputs": [],
|
|
659
|
+
"stateMutability": "nonpayable",
|
|
660
|
+
"type": "function"
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"inputs": [
|
|
664
|
+
{
|
|
665
|
+
"internalType": "address",
|
|
666
|
+
"name": "_stakingNFTDescriptor",
|
|
667
|
+
"type": "address"
|
|
668
|
+
}
|
|
669
|
+
],
|
|
670
|
+
"name": "changeStakingNFTDescriptor",
|
|
671
|
+
"outputs": [],
|
|
672
|
+
"stateMutability": "nonpayable",
|
|
673
|
+
"type": "function"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"inputs": [],
|
|
677
|
+
"name": "claims",
|
|
678
|
+
"outputs": [
|
|
679
|
+
{
|
|
680
|
+
"internalType": "address",
|
|
681
|
+
"name": "",
|
|
682
|
+
"type": "address"
|
|
683
|
+
}
|
|
684
|
+
],
|
|
685
|
+
"stateMutability": "view",
|
|
686
|
+
"type": "function"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"inputs": [],
|
|
690
|
+
"name": "coverNFT",
|
|
691
|
+
"outputs": [
|
|
692
|
+
{
|
|
693
|
+
"internalType": "contract ICoverNFT",
|
|
694
|
+
"name": "",
|
|
695
|
+
"type": "address"
|
|
696
|
+
}
|
|
697
|
+
],
|
|
698
|
+
"stateMutability": "view",
|
|
699
|
+
"type": "function"
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
"inputs": [],
|
|
703
|
+
"name": "coverProducts",
|
|
704
|
+
"outputs": [
|
|
705
|
+
{
|
|
706
|
+
"internalType": "contract ICoverProducts",
|
|
707
|
+
"name": "",
|
|
708
|
+
"type": "address"
|
|
709
|
+
}
|
|
710
|
+
],
|
|
711
|
+
"stateMutability": "view",
|
|
712
|
+
"type": "function"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"inputs": [
|
|
716
|
+
{
|
|
717
|
+
"components": [
|
|
718
|
+
{
|
|
719
|
+
"internalType": "uint256",
|
|
720
|
+
"name": "coverId",
|
|
721
|
+
"type": "uint256"
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
"internalType": "address",
|
|
725
|
+
"name": "owner",
|
|
726
|
+
"type": "address"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"internalType": "uint24",
|
|
730
|
+
"name": "productId",
|
|
731
|
+
"type": "uint24"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"internalType": "uint8",
|
|
735
|
+
"name": "coverAsset",
|
|
736
|
+
"type": "uint8"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
"internalType": "uint96",
|
|
740
|
+
"name": "amount",
|
|
741
|
+
"type": "uint96"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
"internalType": "uint32",
|
|
745
|
+
"name": "period",
|
|
746
|
+
"type": "uint32"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"internalType": "uint256",
|
|
750
|
+
"name": "maxPremiumInAsset",
|
|
751
|
+
"type": "uint256"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"internalType": "uint8",
|
|
755
|
+
"name": "paymentAsset",
|
|
756
|
+
"type": "uint8"
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"internalType": "uint16",
|
|
760
|
+
"name": "commissionRatio",
|
|
761
|
+
"type": "uint16"
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"internalType": "address",
|
|
765
|
+
"name": "commissionDestination",
|
|
766
|
+
"type": "address"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"internalType": "string",
|
|
770
|
+
"name": "ipfsData",
|
|
771
|
+
"type": "string"
|
|
772
|
+
}
|
|
773
|
+
],
|
|
774
|
+
"internalType": "struct BuyCoverParams",
|
|
775
|
+
"name": "params",
|
|
776
|
+
"type": "tuple"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"components": [
|
|
780
|
+
{
|
|
781
|
+
"internalType": "uint256",
|
|
782
|
+
"name": "poolId",
|
|
783
|
+
"type": "uint256"
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"internalType": "uint256",
|
|
787
|
+
"name": "coverAmountInAsset",
|
|
788
|
+
"type": "uint256"
|
|
789
|
+
}
|
|
790
|
+
],
|
|
791
|
+
"internalType": "struct PoolAllocationRequest[]",
|
|
792
|
+
"name": "poolAllocationRequests",
|
|
793
|
+
"type": "tuple[]"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"internalType": "address",
|
|
797
|
+
"name": "buyer",
|
|
798
|
+
"type": "address"
|
|
799
|
+
}
|
|
800
|
+
],
|
|
801
|
+
"name": "executeCoverBuy",
|
|
802
|
+
"outputs": [
|
|
803
|
+
{
|
|
804
|
+
"internalType": "uint256",
|
|
805
|
+
"name": "coverId",
|
|
806
|
+
"type": "uint256"
|
|
807
|
+
}
|
|
808
|
+
],
|
|
809
|
+
"stateMutability": "payable",
|
|
810
|
+
"type": "function"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"inputs": [
|
|
814
|
+
{
|
|
815
|
+
"internalType": "uint256",
|
|
816
|
+
"name": "coverId",
|
|
817
|
+
"type": "uint256"
|
|
818
|
+
}
|
|
819
|
+
],
|
|
820
|
+
"name": "expireCover",
|
|
821
|
+
"outputs": [],
|
|
822
|
+
"stateMutability": "nonpayable",
|
|
823
|
+
"type": "function"
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
"inputs": [
|
|
827
|
+
{
|
|
828
|
+
"internalType": "uint256",
|
|
829
|
+
"name": "coverId",
|
|
830
|
+
"type": "uint256"
|
|
831
|
+
}
|
|
832
|
+
],
|
|
833
|
+
"name": "getCoverData",
|
|
834
|
+
"outputs": [
|
|
835
|
+
{
|
|
836
|
+
"components": [
|
|
837
|
+
{
|
|
838
|
+
"internalType": "uint24",
|
|
839
|
+
"name": "productId",
|
|
840
|
+
"type": "uint24"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
"internalType": "uint8",
|
|
844
|
+
"name": "coverAsset",
|
|
845
|
+
"type": "uint8"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"internalType": "uint96",
|
|
849
|
+
"name": "amount",
|
|
850
|
+
"type": "uint96"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
"internalType": "uint32",
|
|
854
|
+
"name": "start",
|
|
855
|
+
"type": "uint32"
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"internalType": "uint32",
|
|
859
|
+
"name": "period",
|
|
860
|
+
"type": "uint32"
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"internalType": "uint32",
|
|
864
|
+
"name": "gracePeriod",
|
|
865
|
+
"type": "uint32"
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"internalType": "uint16",
|
|
869
|
+
"name": "rewardsRatio",
|
|
870
|
+
"type": "uint16"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"internalType": "uint16",
|
|
874
|
+
"name": "capacityRatio",
|
|
875
|
+
"type": "uint16"
|
|
876
|
+
}
|
|
877
|
+
],
|
|
878
|
+
"internalType": "struct CoverData",
|
|
879
|
+
"name": "",
|
|
880
|
+
"type": "tuple"
|
|
881
|
+
}
|
|
882
|
+
],
|
|
883
|
+
"stateMutability": "view",
|
|
884
|
+
"type": "function"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"inputs": [],
|
|
888
|
+
"name": "getCoverDataCount",
|
|
889
|
+
"outputs": [
|
|
890
|
+
{
|
|
891
|
+
"internalType": "uint256",
|
|
892
|
+
"name": "",
|
|
893
|
+
"type": "uint256"
|
|
894
|
+
}
|
|
895
|
+
],
|
|
896
|
+
"stateMutability": "view",
|
|
897
|
+
"type": "function"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
"inputs": [
|
|
901
|
+
{
|
|
902
|
+
"internalType": "uint256",
|
|
903
|
+
"name": "coverId",
|
|
904
|
+
"type": "uint256"
|
|
905
|
+
}
|
|
906
|
+
],
|
|
907
|
+
"name": "getCoverDataWithReference",
|
|
908
|
+
"outputs": [
|
|
909
|
+
{
|
|
910
|
+
"components": [
|
|
911
|
+
{
|
|
912
|
+
"internalType": "uint24",
|
|
913
|
+
"name": "productId",
|
|
914
|
+
"type": "uint24"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
"internalType": "uint8",
|
|
918
|
+
"name": "coverAsset",
|
|
919
|
+
"type": "uint8"
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
"internalType": "uint96",
|
|
923
|
+
"name": "amount",
|
|
924
|
+
"type": "uint96"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
"internalType": "uint32",
|
|
928
|
+
"name": "start",
|
|
929
|
+
"type": "uint32"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"internalType": "uint32",
|
|
933
|
+
"name": "period",
|
|
934
|
+
"type": "uint32"
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
"internalType": "uint32",
|
|
938
|
+
"name": "gracePeriod",
|
|
939
|
+
"type": "uint32"
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
"internalType": "uint16",
|
|
943
|
+
"name": "rewardsRatio",
|
|
944
|
+
"type": "uint16"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
"internalType": "uint16",
|
|
948
|
+
"name": "capacityRatio",
|
|
949
|
+
"type": "uint16"
|
|
950
|
+
}
|
|
951
|
+
],
|
|
952
|
+
"internalType": "struct CoverData",
|
|
953
|
+
"name": "",
|
|
954
|
+
"type": "tuple"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
"components": [
|
|
958
|
+
{
|
|
959
|
+
"internalType": "uint32",
|
|
960
|
+
"name": "originalCoverId",
|
|
961
|
+
"type": "uint32"
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
"internalType": "uint32",
|
|
965
|
+
"name": "latestCoverId",
|
|
966
|
+
"type": "uint32"
|
|
967
|
+
}
|
|
968
|
+
],
|
|
969
|
+
"internalType": "struct CoverReference",
|
|
970
|
+
"name": "",
|
|
971
|
+
"type": "tuple"
|
|
972
|
+
}
|
|
973
|
+
],
|
|
974
|
+
"stateMutability": "view",
|
|
975
|
+
"type": "function"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
"inputs": [
|
|
979
|
+
{
|
|
980
|
+
"internalType": "uint256",
|
|
981
|
+
"name": "coverId",
|
|
982
|
+
"type": "uint256"
|
|
983
|
+
}
|
|
984
|
+
],
|
|
985
|
+
"name": "getCoverDataWithRi",
|
|
986
|
+
"outputs": [
|
|
987
|
+
{
|
|
988
|
+
"components": [
|
|
989
|
+
{
|
|
990
|
+
"internalType": "uint24",
|
|
991
|
+
"name": "productId",
|
|
992
|
+
"type": "uint24"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"internalType": "uint8",
|
|
996
|
+
"name": "coverAsset",
|
|
997
|
+
"type": "uint8"
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
"internalType": "uint96",
|
|
1001
|
+
"name": "amount",
|
|
1002
|
+
"type": "uint96"
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
"internalType": "uint32",
|
|
1006
|
+
"name": "start",
|
|
1007
|
+
"type": "uint32"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
"internalType": "uint32",
|
|
1011
|
+
"name": "period",
|
|
1012
|
+
"type": "uint32"
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
"internalType": "uint32",
|
|
1016
|
+
"name": "gracePeriod",
|
|
1017
|
+
"type": "uint32"
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
"internalType": "uint16",
|
|
1021
|
+
"name": "rewardsRatio",
|
|
1022
|
+
"type": "uint16"
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
"internalType": "uint16",
|
|
1026
|
+
"name": "capacityRatio",
|
|
1027
|
+
"type": "uint16"
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
1030
|
+
"internalType": "struct CoverData",
|
|
1031
|
+
"name": "",
|
|
1032
|
+
"type": "tuple"
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
"components": [
|
|
1036
|
+
{
|
|
1037
|
+
"internalType": "uint24",
|
|
1038
|
+
"name": "providerId",
|
|
1039
|
+
"type": "uint24"
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
"internalType": "uint96",
|
|
1043
|
+
"name": "amount",
|
|
1044
|
+
"type": "uint96"
|
|
1045
|
+
}
|
|
1046
|
+
],
|
|
1047
|
+
"internalType": "struct Ri",
|
|
1048
|
+
"name": "",
|
|
1049
|
+
"type": "tuple"
|
|
1050
|
+
}
|
|
1051
|
+
],
|
|
1052
|
+
"stateMutability": "view",
|
|
1053
|
+
"type": "function"
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
"inputs": [
|
|
1057
|
+
{
|
|
1058
|
+
"internalType": "uint256",
|
|
1059
|
+
"name": "coverId",
|
|
1060
|
+
"type": "uint256"
|
|
1061
|
+
}
|
|
1062
|
+
],
|
|
1063
|
+
"name": "getCoverMetadata",
|
|
1064
|
+
"outputs": [
|
|
1065
|
+
{
|
|
1066
|
+
"internalType": "string",
|
|
1067
|
+
"name": "",
|
|
1068
|
+
"type": "string"
|
|
1069
|
+
}
|
|
1070
|
+
],
|
|
1071
|
+
"stateMutability": "view",
|
|
1072
|
+
"type": "function"
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
"inputs": [
|
|
1076
|
+
{
|
|
1077
|
+
"internalType": "uint256",
|
|
1078
|
+
"name": "coverId",
|
|
1079
|
+
"type": "uint256"
|
|
1080
|
+
}
|
|
1081
|
+
],
|
|
1082
|
+
"name": "getCoverReference",
|
|
1083
|
+
"outputs": [
|
|
1084
|
+
{
|
|
1085
|
+
"components": [
|
|
1086
|
+
{
|
|
1087
|
+
"internalType": "uint32",
|
|
1088
|
+
"name": "originalCoverId",
|
|
1089
|
+
"type": "uint32"
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
"internalType": "uint32",
|
|
1093
|
+
"name": "latestCoverId",
|
|
1094
|
+
"type": "uint32"
|
|
1095
|
+
}
|
|
1096
|
+
],
|
|
1097
|
+
"internalType": "struct CoverReference",
|
|
1098
|
+
"name": "coverReference",
|
|
1099
|
+
"type": "tuple"
|
|
1100
|
+
}
|
|
1101
|
+
],
|
|
1102
|
+
"stateMutability": "view",
|
|
1103
|
+
"type": "function"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
"inputs": [
|
|
1107
|
+
{
|
|
1108
|
+
"internalType": "uint256",
|
|
1109
|
+
"name": "coverId",
|
|
1110
|
+
"type": "uint256"
|
|
1111
|
+
}
|
|
1112
|
+
],
|
|
1113
|
+
"name": "getCoverRi",
|
|
1114
|
+
"outputs": [
|
|
1115
|
+
{
|
|
1116
|
+
"components": [
|
|
1117
|
+
{
|
|
1118
|
+
"internalType": "uint24",
|
|
1119
|
+
"name": "providerId",
|
|
1120
|
+
"type": "uint24"
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
"internalType": "uint96",
|
|
1124
|
+
"name": "amount",
|
|
1125
|
+
"type": "uint96"
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
"internalType": "struct Ri",
|
|
1129
|
+
"name": "",
|
|
1130
|
+
"type": "tuple"
|
|
1131
|
+
}
|
|
1132
|
+
],
|
|
1133
|
+
"stateMutability": "view",
|
|
1134
|
+
"type": "function"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"inputs": [],
|
|
1138
|
+
"name": "getDefaultMinPriceRatio",
|
|
1139
|
+
"outputs": [
|
|
1140
|
+
{
|
|
1141
|
+
"internalType": "uint256",
|
|
1142
|
+
"name": "",
|
|
1143
|
+
"type": "uint256"
|
|
1144
|
+
}
|
|
1145
|
+
],
|
|
1146
|
+
"stateMutability": "pure",
|
|
1147
|
+
"type": "function"
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
"inputs": [],
|
|
1151
|
+
"name": "getGlobalCapacityAndPriceRatios",
|
|
1152
|
+
"outputs": [
|
|
1153
|
+
{
|
|
1154
|
+
"internalType": "uint256",
|
|
1155
|
+
"name": "_globalCapacityRatio",
|
|
1156
|
+
"type": "uint256"
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
"internalType": "uint256",
|
|
1160
|
+
"name": "_defaultMinPriceRatio",
|
|
1161
|
+
"type": "uint256"
|
|
1162
|
+
}
|
|
1163
|
+
],
|
|
1164
|
+
"stateMutability": "pure",
|
|
1165
|
+
"type": "function"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
"inputs": [],
|
|
1169
|
+
"name": "getGlobalCapacityRatio",
|
|
1170
|
+
"outputs": [
|
|
1171
|
+
{
|
|
1172
|
+
"internalType": "uint256",
|
|
1173
|
+
"name": "",
|
|
1174
|
+
"type": "uint256"
|
|
1175
|
+
}
|
|
1176
|
+
],
|
|
1177
|
+
"stateMutability": "pure",
|
|
1178
|
+
"type": "function"
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
"inputs": [],
|
|
1182
|
+
"name": "getGlobalRewardsRatio",
|
|
1183
|
+
"outputs": [
|
|
1184
|
+
{
|
|
1185
|
+
"internalType": "uint256",
|
|
1186
|
+
"name": "",
|
|
1187
|
+
"type": "uint256"
|
|
1188
|
+
}
|
|
1189
|
+
],
|
|
1190
|
+
"stateMutability": "pure",
|
|
1191
|
+
"type": "function"
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
"inputs": [
|
|
1195
|
+
{
|
|
1196
|
+
"internalType": "uint256",
|
|
1197
|
+
"name": "coverId",
|
|
1198
|
+
"type": "uint256"
|
|
1199
|
+
}
|
|
1200
|
+
],
|
|
1201
|
+
"name": "getLatestEditCoverData",
|
|
1202
|
+
"outputs": [
|
|
1203
|
+
{
|
|
1204
|
+
"components": [
|
|
1205
|
+
{
|
|
1206
|
+
"internalType": "uint24",
|
|
1207
|
+
"name": "productId",
|
|
1208
|
+
"type": "uint24"
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
"internalType": "uint8",
|
|
1212
|
+
"name": "coverAsset",
|
|
1213
|
+
"type": "uint8"
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
"internalType": "uint96",
|
|
1217
|
+
"name": "amount",
|
|
1218
|
+
"type": "uint96"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
"internalType": "uint32",
|
|
1222
|
+
"name": "start",
|
|
1223
|
+
"type": "uint32"
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
"internalType": "uint32",
|
|
1227
|
+
"name": "period",
|
|
1228
|
+
"type": "uint32"
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
"internalType": "uint32",
|
|
1232
|
+
"name": "gracePeriod",
|
|
1233
|
+
"type": "uint32"
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
"internalType": "uint16",
|
|
1237
|
+
"name": "rewardsRatio",
|
|
1238
|
+
"type": "uint16"
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
"internalType": "uint16",
|
|
1242
|
+
"name": "capacityRatio",
|
|
1243
|
+
"type": "uint16"
|
|
1244
|
+
}
|
|
1245
|
+
],
|
|
1246
|
+
"internalType": "struct CoverData",
|
|
1247
|
+
"name": "",
|
|
1248
|
+
"type": "tuple"
|
|
1249
|
+
}
|
|
1250
|
+
],
|
|
1251
|
+
"stateMutability": "view",
|
|
1252
|
+
"type": "function"
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
"inputs": [
|
|
1256
|
+
{
|
|
1257
|
+
"internalType": "uint256",
|
|
1258
|
+
"name": "coverId",
|
|
1259
|
+
"type": "uint256"
|
|
1260
|
+
}
|
|
1261
|
+
],
|
|
1262
|
+
"name": "getPoolAllocations",
|
|
1263
|
+
"outputs": [
|
|
1264
|
+
{
|
|
1265
|
+
"components": [
|
|
1266
|
+
{
|
|
1267
|
+
"internalType": "uint40",
|
|
1268
|
+
"name": "poolId",
|
|
1269
|
+
"type": "uint40"
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
"internalType": "uint96",
|
|
1273
|
+
"name": "coverAmountInNXM",
|
|
1274
|
+
"type": "uint96"
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
"internalType": "uint96",
|
|
1278
|
+
"name": "premiumInNXM",
|
|
1279
|
+
"type": "uint96"
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
"internalType": "uint24",
|
|
1283
|
+
"name": "allocationId",
|
|
1284
|
+
"type": "uint24"
|
|
1285
|
+
}
|
|
1286
|
+
],
|
|
1287
|
+
"internalType": "struct PoolAllocation[]",
|
|
1288
|
+
"name": "",
|
|
1289
|
+
"type": "tuple[]"
|
|
1290
|
+
}
|
|
1291
|
+
],
|
|
1292
|
+
"stateMutability": "view",
|
|
1293
|
+
"type": "function"
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
"inputs": [
|
|
1297
|
+
{
|
|
1298
|
+
"internalType": "uint256",
|
|
1299
|
+
"name": "providerId",
|
|
1300
|
+
"type": "uint256"
|
|
1301
|
+
}
|
|
1302
|
+
],
|
|
1303
|
+
"name": "getRiProviderConfig",
|
|
1304
|
+
"outputs": [
|
|
1305
|
+
{
|
|
1306
|
+
"components": [
|
|
1307
|
+
{
|
|
1308
|
+
"internalType": "uint24",
|
|
1309
|
+
"name": "nextNonce",
|
|
1310
|
+
"type": "uint24"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
"internalType": "address",
|
|
1314
|
+
"name": "premiumDestination",
|
|
1315
|
+
"type": "address"
|
|
1316
|
+
}
|
|
1317
|
+
],
|
|
1318
|
+
"internalType": "struct RiConfig",
|
|
1319
|
+
"name": "",
|
|
1320
|
+
"type": "tuple"
|
|
1321
|
+
}
|
|
1322
|
+
],
|
|
1323
|
+
"stateMutability": "view",
|
|
1324
|
+
"type": "function"
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
"inputs": [
|
|
1328
|
+
{
|
|
1329
|
+
"internalType": "bytes[]",
|
|
1330
|
+
"name": "data",
|
|
1331
|
+
"type": "bytes[]"
|
|
1332
|
+
}
|
|
1333
|
+
],
|
|
1334
|
+
"name": "multicall",
|
|
1335
|
+
"outputs": [
|
|
1336
|
+
{
|
|
1337
|
+
"internalType": "bytes[]",
|
|
1338
|
+
"name": "results",
|
|
1339
|
+
"type": "bytes[]"
|
|
1340
|
+
}
|
|
1341
|
+
],
|
|
1342
|
+
"stateMutability": "nonpayable",
|
|
1343
|
+
"type": "function"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
"inputs": [],
|
|
1347
|
+
"name": "pool",
|
|
1348
|
+
"outputs": [
|
|
1349
|
+
{
|
|
1350
|
+
"internalType": "contract IPool",
|
|
1351
|
+
"name": "",
|
|
1352
|
+
"type": "address"
|
|
1353
|
+
}
|
|
1354
|
+
],
|
|
1355
|
+
"stateMutability": "view",
|
|
1356
|
+
"type": "function"
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
"inputs": [
|
|
1360
|
+
{
|
|
1361
|
+
"internalType": "uint256[]",
|
|
1362
|
+
"name": "coverIds",
|
|
1363
|
+
"type": "uint256[]"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
"internalType": "string[]",
|
|
1367
|
+
"name": "ipfsMetadata",
|
|
1368
|
+
"type": "string[]"
|
|
1369
|
+
}
|
|
1370
|
+
],
|
|
1371
|
+
"name": "populateIpfsMetadata",
|
|
1372
|
+
"outputs": [],
|
|
1373
|
+
"stateMutability": "nonpayable",
|
|
1374
|
+
"type": "function"
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
"inputs": [
|
|
1378
|
+
{
|
|
1379
|
+
"internalType": "uint256",
|
|
1380
|
+
"name": "coverAsset",
|
|
1381
|
+
"type": "uint256"
|
|
1382
|
+
}
|
|
1383
|
+
],
|
|
1384
|
+
"name": "recalculateActiveCoverInAsset",
|
|
1385
|
+
"outputs": [],
|
|
1386
|
+
"stateMutability": "nonpayable",
|
|
1387
|
+
"type": "function"
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
"inputs": [],
|
|
1391
|
+
"name": "registry",
|
|
1392
|
+
"outputs": [
|
|
1393
|
+
{
|
|
1394
|
+
"internalType": "contract IRegistry",
|
|
1395
|
+
"name": "",
|
|
1396
|
+
"type": "address"
|
|
1397
|
+
}
|
|
1398
|
+
],
|
|
1399
|
+
"stateMutability": "view",
|
|
1400
|
+
"type": "function"
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
"inputs": [],
|
|
1404
|
+
"name": "riSigner",
|
|
1405
|
+
"outputs": [
|
|
1406
|
+
{
|
|
1407
|
+
"internalType": "address",
|
|
1408
|
+
"name": "",
|
|
1409
|
+
"type": "address"
|
|
1410
|
+
}
|
|
1411
|
+
],
|
|
1412
|
+
"stateMutability": "view",
|
|
1413
|
+
"type": "function"
|
|
1414
|
+
},
|
|
1415
|
+
{
|
|
1416
|
+
"inputs": [
|
|
1417
|
+
{
|
|
1418
|
+
"internalType": "uint256",
|
|
1419
|
+
"name": "providerId",
|
|
1420
|
+
"type": "uint256"
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
"internalType": "address",
|
|
1424
|
+
"name": "premiumDestination",
|
|
1425
|
+
"type": "address"
|
|
1426
|
+
}
|
|
1427
|
+
],
|
|
1428
|
+
"name": "setRiConfig",
|
|
1429
|
+
"outputs": [],
|
|
1430
|
+
"stateMutability": "nonpayable",
|
|
1431
|
+
"type": "function"
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"inputs": [
|
|
1435
|
+
{
|
|
1436
|
+
"internalType": "address",
|
|
1437
|
+
"name": "_riSigner",
|
|
1438
|
+
"type": "address"
|
|
1439
|
+
}
|
|
1440
|
+
],
|
|
1441
|
+
"name": "setRiSigner",
|
|
1442
|
+
"outputs": [],
|
|
1443
|
+
"stateMutability": "nonpayable",
|
|
1444
|
+
"type": "function"
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
"inputs": [],
|
|
1448
|
+
"name": "stakingNFT",
|
|
1449
|
+
"outputs": [
|
|
1450
|
+
{
|
|
1451
|
+
"internalType": "contract IStakingNFT",
|
|
1452
|
+
"name": "",
|
|
1453
|
+
"type": "address"
|
|
1454
|
+
}
|
|
1455
|
+
],
|
|
1456
|
+
"stateMutability": "view",
|
|
1457
|
+
"type": "function"
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
"inputs": [
|
|
1461
|
+
{
|
|
1462
|
+
"internalType": "uint256",
|
|
1463
|
+
"name": "poolId",
|
|
1464
|
+
"type": "uint256"
|
|
1465
|
+
}
|
|
1466
|
+
],
|
|
1467
|
+
"name": "stakingPool",
|
|
1468
|
+
"outputs": [
|
|
1469
|
+
{
|
|
1470
|
+
"internalType": "contract IStakingPool",
|
|
1471
|
+
"name": "",
|
|
1472
|
+
"type": "address"
|
|
1473
|
+
}
|
|
1474
|
+
],
|
|
1475
|
+
"stateMutability": "view",
|
|
1476
|
+
"type": "function"
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
"inputs": [],
|
|
1480
|
+
"name": "stakingPoolFactory",
|
|
1481
|
+
"outputs": [
|
|
1482
|
+
{
|
|
1483
|
+
"internalType": "address",
|
|
1484
|
+
"name": "",
|
|
1485
|
+
"type": "address"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
"stateMutability": "view",
|
|
1489
|
+
"type": "function"
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
"inputs": [],
|
|
1493
|
+
"name": "stakingPoolImplementation",
|
|
1494
|
+
"outputs": [
|
|
1495
|
+
{
|
|
1496
|
+
"internalType": "address",
|
|
1497
|
+
"name": "",
|
|
1498
|
+
"type": "address"
|
|
1499
|
+
}
|
|
1500
|
+
],
|
|
1501
|
+
"stateMutability": "view",
|
|
1502
|
+
"type": "function"
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
"inputs": [],
|
|
1506
|
+
"name": "tokenController",
|
|
1507
|
+
"outputs": [
|
|
1508
|
+
{
|
|
1509
|
+
"internalType": "contract ITokenController",
|
|
1510
|
+
"name": "",
|
|
1511
|
+
"type": "address"
|
|
1512
|
+
}
|
|
1513
|
+
],
|
|
1514
|
+
"stateMutability": "view",
|
|
1515
|
+
"type": "function"
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
"inputs": [
|
|
1519
|
+
{
|
|
1520
|
+
"internalType": "uint256",
|
|
1521
|
+
"name": "assetId",
|
|
1522
|
+
"type": "uint256"
|
|
1523
|
+
}
|
|
1524
|
+
],
|
|
1525
|
+
"name": "totalActiveCoverInAsset",
|
|
1526
|
+
"outputs": [
|
|
1527
|
+
{
|
|
1528
|
+
"internalType": "uint256",
|
|
1529
|
+
"name": "",
|
|
1530
|
+
"type": "uint256"
|
|
1531
|
+
}
|
|
1532
|
+
],
|
|
1533
|
+
"stateMutability": "view",
|
|
1534
|
+
"type": "function"
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
"inputs": [
|
|
1538
|
+
{
|
|
1539
|
+
"internalType": "uint256",
|
|
1540
|
+
"name": "coverAsset",
|
|
1541
|
+
"type": "uint256"
|
|
1542
|
+
}
|
|
1543
|
+
],
|
|
1544
|
+
"name": "updateTotalActiveCoverAmount",
|
|
1545
|
+
"outputs": [],
|
|
1546
|
+
"stateMutability": "nonpayable",
|
|
1547
|
+
"type": "function"
|
|
1548
|
+
}
|
|
1549
|
+
];
|
|
1550
|
+
/**
|
|
1551
|
+
* Cover Contract Class
|
|
1552
|
+
*
|
|
1553
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
1554
|
+
*
|
|
1555
|
+
* @example
|
|
1556
|
+
* ```typescript
|
|
1557
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
1558
|
+
* import { mainnet } from 'viem/chains';
|
|
1559
|
+
* import { Cover } from 'Cover';
|
|
1560
|
+
*
|
|
1561
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
1562
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
1563
|
+
*
|
|
1564
|
+
* const contract = new Cover('0x...', { publicClient, walletClient });
|
|
1565
|
+
*
|
|
1566
|
+
* // Read functions
|
|
1567
|
+
* const result = await contract.balanceOf('0x...');
|
|
1568
|
+
*
|
|
1569
|
+
* // Write functions
|
|
1570
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
1571
|
+
*
|
|
1572
|
+
* // Simulate transactions (dry-run)
|
|
1573
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
1574
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
1575
|
+
*
|
|
1576
|
+
* // Watch events
|
|
1577
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1578
|
+
* console.log('Transfer event:', event);
|
|
1579
|
+
* });
|
|
1580
|
+
* ```
|
|
1581
|
+
*/
|
|
1582
|
+
class Cover {
|
|
1583
|
+
constructor(address, clients) {
|
|
1584
|
+
this.contractAddress = address;
|
|
1585
|
+
this.publicClient = clients.publicClient;
|
|
1586
|
+
this.contract = (0, viem_1.getContract)({
|
|
1587
|
+
address,
|
|
1588
|
+
abi: exports.CoverAbi,
|
|
1589
|
+
client: {
|
|
1590
|
+
public: clients.publicClient,
|
|
1591
|
+
wallet: clients.walletClient,
|
|
1592
|
+
},
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Get the contract address
|
|
1597
|
+
*/
|
|
1598
|
+
get address() {
|
|
1599
|
+
return this.contractAddress;
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Get the underlying viem contract instance.
|
|
1603
|
+
*/
|
|
1604
|
+
getContract() {
|
|
1605
|
+
return this.contract;
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* DEFAULT_MIN_PRICE_RATIO
|
|
1609
|
+
* view
|
|
1610
|
+
*/
|
|
1611
|
+
async DEFAULT_MIN_PRICE_RATIO() {
|
|
1612
|
+
return this.contract.read.DEFAULT_MIN_PRICE_RATIO();
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* DOMAIN_SEPARATOR
|
|
1616
|
+
* view
|
|
1617
|
+
*/
|
|
1618
|
+
async DOMAIN_SEPARATOR() {
|
|
1619
|
+
return this.contract.read.DOMAIN_SEPARATOR();
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* MAX_COMMISSION_RATIO
|
|
1623
|
+
* view
|
|
1624
|
+
*/
|
|
1625
|
+
async MAX_COMMISSION_RATIO() {
|
|
1626
|
+
return this.contract.read.MAX_COMMISSION_RATIO();
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* NXM_PER_ALLOCATION_UNIT
|
|
1630
|
+
* view
|
|
1631
|
+
*/
|
|
1632
|
+
async NXM_PER_ALLOCATION_UNIT() {
|
|
1633
|
+
return this.contract.read.NXM_PER_ALLOCATION_UNIT();
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* activeCover
|
|
1637
|
+
* view
|
|
1638
|
+
*/
|
|
1639
|
+
async activeCover(assetId) {
|
|
1640
|
+
return this.contract.read.activeCover([assetId]);
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* claims
|
|
1644
|
+
* view
|
|
1645
|
+
*/
|
|
1646
|
+
async claims() {
|
|
1647
|
+
return this.contract.read.claims();
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* coverNFT
|
|
1651
|
+
* view
|
|
1652
|
+
*/
|
|
1653
|
+
async coverNFT() {
|
|
1654
|
+
return this.contract.read.coverNFT();
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* coverProducts
|
|
1658
|
+
* view
|
|
1659
|
+
*/
|
|
1660
|
+
async coverProducts() {
|
|
1661
|
+
return this.contract.read.coverProducts();
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* getCoverData
|
|
1665
|
+
* view
|
|
1666
|
+
*/
|
|
1667
|
+
async getCoverData(coverId) {
|
|
1668
|
+
return this.contract.read.getCoverData([coverId]);
|
|
1669
|
+
}
|
|
1670
|
+
/**
|
|
1671
|
+
* getCoverDataCount
|
|
1672
|
+
* view
|
|
1673
|
+
*/
|
|
1674
|
+
async getCoverDataCount() {
|
|
1675
|
+
return this.contract.read.getCoverDataCount();
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* getCoverDataWithReference
|
|
1679
|
+
* view
|
|
1680
|
+
*/
|
|
1681
|
+
async getCoverDataWithReference(coverId) {
|
|
1682
|
+
return this.contract.read.getCoverDataWithReference([coverId]);
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* getCoverDataWithRi
|
|
1686
|
+
* view
|
|
1687
|
+
*/
|
|
1688
|
+
async getCoverDataWithRi(coverId) {
|
|
1689
|
+
return this.contract.read.getCoverDataWithRi([coverId]);
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* getCoverMetadata
|
|
1693
|
+
* view
|
|
1694
|
+
*/
|
|
1695
|
+
async getCoverMetadata(coverId) {
|
|
1696
|
+
return this.contract.read.getCoverMetadata([coverId]);
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* getCoverReference
|
|
1700
|
+
* view
|
|
1701
|
+
*/
|
|
1702
|
+
async getCoverReference(coverId) {
|
|
1703
|
+
return this.contract.read.getCoverReference([coverId]);
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* getCoverRi
|
|
1707
|
+
* view
|
|
1708
|
+
*/
|
|
1709
|
+
async getCoverRi(coverId) {
|
|
1710
|
+
return this.contract.read.getCoverRi([coverId]);
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* getDefaultMinPriceRatio
|
|
1714
|
+
* pure
|
|
1715
|
+
*/
|
|
1716
|
+
async getDefaultMinPriceRatio() {
|
|
1717
|
+
return this.contract.read.getDefaultMinPriceRatio();
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* getGlobalCapacityAndPriceRatios
|
|
1721
|
+
* pure
|
|
1722
|
+
*/
|
|
1723
|
+
async getGlobalCapacityAndPriceRatios() {
|
|
1724
|
+
return this.contract.read.getGlobalCapacityAndPriceRatios();
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* getGlobalCapacityRatio
|
|
1728
|
+
* pure
|
|
1729
|
+
*/
|
|
1730
|
+
async getGlobalCapacityRatio() {
|
|
1731
|
+
return this.contract.read.getGlobalCapacityRatio();
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* getGlobalRewardsRatio
|
|
1735
|
+
* pure
|
|
1736
|
+
*/
|
|
1737
|
+
async getGlobalRewardsRatio() {
|
|
1738
|
+
return this.contract.read.getGlobalRewardsRatio();
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* getLatestEditCoverData
|
|
1742
|
+
* view
|
|
1743
|
+
*/
|
|
1744
|
+
async getLatestEditCoverData(coverId) {
|
|
1745
|
+
return this.contract.read.getLatestEditCoverData([coverId]);
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* getPoolAllocations
|
|
1749
|
+
* view
|
|
1750
|
+
*/
|
|
1751
|
+
async getPoolAllocations(coverId) {
|
|
1752
|
+
return this.contract.read.getPoolAllocations([coverId]);
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* getRiProviderConfig
|
|
1756
|
+
* view
|
|
1757
|
+
*/
|
|
1758
|
+
async getRiProviderConfig(providerId) {
|
|
1759
|
+
return this.contract.read.getRiProviderConfig([providerId]);
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* pool
|
|
1763
|
+
* view
|
|
1764
|
+
*/
|
|
1765
|
+
async pool() {
|
|
1766
|
+
return this.contract.read.pool();
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* registry
|
|
1770
|
+
* view
|
|
1771
|
+
*/
|
|
1772
|
+
async registry() {
|
|
1773
|
+
return this.contract.read.registry();
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* riSigner
|
|
1777
|
+
* view
|
|
1778
|
+
*/
|
|
1779
|
+
async riSigner() {
|
|
1780
|
+
return this.contract.read.riSigner();
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* stakingNFT
|
|
1784
|
+
* view
|
|
1785
|
+
*/
|
|
1786
|
+
async stakingNFT() {
|
|
1787
|
+
return this.contract.read.stakingNFT();
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* stakingPool
|
|
1791
|
+
* view
|
|
1792
|
+
*/
|
|
1793
|
+
async stakingPool(poolId) {
|
|
1794
|
+
return this.contract.read.stakingPool([poolId]);
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* stakingPoolFactory
|
|
1798
|
+
* view
|
|
1799
|
+
*/
|
|
1800
|
+
async stakingPoolFactory() {
|
|
1801
|
+
return this.contract.read.stakingPoolFactory();
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* stakingPoolImplementation
|
|
1805
|
+
* view
|
|
1806
|
+
*/
|
|
1807
|
+
async stakingPoolImplementation() {
|
|
1808
|
+
return this.contract.read.stakingPoolImplementation();
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* tokenController
|
|
1812
|
+
* view
|
|
1813
|
+
*/
|
|
1814
|
+
async tokenController() {
|
|
1815
|
+
return this.contract.read.tokenController();
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* totalActiveCoverInAsset
|
|
1819
|
+
* view
|
|
1820
|
+
*/
|
|
1821
|
+
async totalActiveCoverInAsset(assetId) {
|
|
1822
|
+
return this.contract.read.totalActiveCoverInAsset([assetId]);
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* burnStake
|
|
1826
|
+
* nonpayable
|
|
1827
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1828
|
+
*/
|
|
1829
|
+
async burnStake(coverId, payoutAmountInAsset, options) {
|
|
1830
|
+
if (!this.contract.write) {
|
|
1831
|
+
throw new Error('Wallet client is required for write operations');
|
|
1832
|
+
}
|
|
1833
|
+
return this.contract.write.burnStake([coverId, payoutAmountInAsset], options);
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* buyCover
|
|
1837
|
+
* payable
|
|
1838
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1839
|
+
*/
|
|
1840
|
+
async buyCover(params, poolAllocationRequests, options) {
|
|
1841
|
+
if (!this.contract.write) {
|
|
1842
|
+
throw new Error('Wallet client is required for write operations');
|
|
1843
|
+
}
|
|
1844
|
+
return this.contract.write.buyCover([params, poolAllocationRequests], options);
|
|
1845
|
+
}
|
|
1846
|
+
/**
|
|
1847
|
+
* buyCoverWithRi
|
|
1848
|
+
* payable
|
|
1849
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1850
|
+
*/
|
|
1851
|
+
async buyCoverWithRi(params, poolAllocationRequests, riRequest, options) {
|
|
1852
|
+
if (!this.contract.write) {
|
|
1853
|
+
throw new Error('Wallet client is required for write operations');
|
|
1854
|
+
}
|
|
1855
|
+
return this.contract.write.buyCoverWithRi([params, poolAllocationRequests, riRequest], options);
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* changeCoverNFTDescriptor
|
|
1859
|
+
* nonpayable
|
|
1860
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1861
|
+
*/
|
|
1862
|
+
async changeCoverNFTDescriptor(_coverNFTDescriptor, options) {
|
|
1863
|
+
if (!this.contract.write) {
|
|
1864
|
+
throw new Error('Wallet client is required for write operations');
|
|
1865
|
+
}
|
|
1866
|
+
return this.contract.write.changeCoverNFTDescriptor([_coverNFTDescriptor], options);
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* changeStakingNFTDescriptor
|
|
1870
|
+
* nonpayable
|
|
1871
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1872
|
+
*/
|
|
1873
|
+
async changeStakingNFTDescriptor(_stakingNFTDescriptor, options) {
|
|
1874
|
+
if (!this.contract.write) {
|
|
1875
|
+
throw new Error('Wallet client is required for write operations');
|
|
1876
|
+
}
|
|
1877
|
+
return this.contract.write.changeStakingNFTDescriptor([_stakingNFTDescriptor], options);
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* executeCoverBuy
|
|
1881
|
+
* payable
|
|
1882
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1883
|
+
*/
|
|
1884
|
+
async executeCoverBuy(params, poolAllocationRequests, buyer, options) {
|
|
1885
|
+
if (!this.contract.write) {
|
|
1886
|
+
throw new Error('Wallet client is required for write operations');
|
|
1887
|
+
}
|
|
1888
|
+
return this.contract.write.executeCoverBuy([params, poolAllocationRequests, buyer], options);
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* expireCover
|
|
1892
|
+
* nonpayable
|
|
1893
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1894
|
+
*/
|
|
1895
|
+
async expireCover(coverId, options) {
|
|
1896
|
+
if (!this.contract.write) {
|
|
1897
|
+
throw new Error('Wallet client is required for write operations');
|
|
1898
|
+
}
|
|
1899
|
+
return this.contract.write.expireCover([coverId], options);
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* multicall
|
|
1903
|
+
* nonpayable
|
|
1904
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1905
|
+
*/
|
|
1906
|
+
async multicall(data, options) {
|
|
1907
|
+
if (!this.contract.write) {
|
|
1908
|
+
throw new Error('Wallet client is required for write operations');
|
|
1909
|
+
}
|
|
1910
|
+
return this.contract.write.multicall([data], options);
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* populateIpfsMetadata
|
|
1914
|
+
* nonpayable
|
|
1915
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1916
|
+
*/
|
|
1917
|
+
async populateIpfsMetadata(coverIds, ipfsMetadata, options) {
|
|
1918
|
+
if (!this.contract.write) {
|
|
1919
|
+
throw new Error('Wallet client is required for write operations');
|
|
1920
|
+
}
|
|
1921
|
+
return this.contract.write.populateIpfsMetadata([coverIds, ipfsMetadata], options);
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* recalculateActiveCoverInAsset
|
|
1925
|
+
* nonpayable
|
|
1926
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1927
|
+
*/
|
|
1928
|
+
async recalculateActiveCoverInAsset(coverAsset, options) {
|
|
1929
|
+
if (!this.contract.write) {
|
|
1930
|
+
throw new Error('Wallet client is required for write operations');
|
|
1931
|
+
}
|
|
1932
|
+
return this.contract.write.recalculateActiveCoverInAsset([coverAsset], options);
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* setRiConfig
|
|
1936
|
+
* nonpayable
|
|
1937
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1938
|
+
*/
|
|
1939
|
+
async setRiConfig(providerId, premiumDestination, options) {
|
|
1940
|
+
if (!this.contract.write) {
|
|
1941
|
+
throw new Error('Wallet client is required for write operations');
|
|
1942
|
+
}
|
|
1943
|
+
return this.contract.write.setRiConfig([providerId, premiumDestination], options);
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* setRiSigner
|
|
1947
|
+
* nonpayable
|
|
1948
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1949
|
+
*/
|
|
1950
|
+
async setRiSigner(_riSigner, options) {
|
|
1951
|
+
if (!this.contract.write) {
|
|
1952
|
+
throw new Error('Wallet client is required for write operations');
|
|
1953
|
+
}
|
|
1954
|
+
return this.contract.write.setRiSigner([_riSigner], options);
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* updateTotalActiveCoverAmount
|
|
1958
|
+
* nonpayable
|
|
1959
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1960
|
+
*/
|
|
1961
|
+
async updateTotalActiveCoverAmount(coverAsset, options) {
|
|
1962
|
+
if (!this.contract.write) {
|
|
1963
|
+
throw new Error('Wallet client is required for write operations');
|
|
1964
|
+
}
|
|
1965
|
+
return this.contract.write.updateTotalActiveCoverAmount([coverAsset], options);
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1969
|
+
*
|
|
1970
|
+
* @example
|
|
1971
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1972
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1973
|
+
* console.log('Would succeed:', result.result);
|
|
1974
|
+
*/
|
|
1975
|
+
get simulate() {
|
|
1976
|
+
const contract = this.contract;
|
|
1977
|
+
if (!contract.simulate) {
|
|
1978
|
+
throw new Error('Public client is required for simulation');
|
|
1979
|
+
}
|
|
1980
|
+
return {
|
|
1981
|
+
/**
|
|
1982
|
+
* Simulate burnStake
|
|
1983
|
+
* Returns gas estimate and result without sending transaction
|
|
1984
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1985
|
+
*/
|
|
1986
|
+
async burnStake(coverId, payoutAmountInAsset, options) {
|
|
1987
|
+
return contract.simulate.burnStake([coverId, payoutAmountInAsset], options);
|
|
1988
|
+
},
|
|
1989
|
+
/**
|
|
1990
|
+
* Simulate buyCover
|
|
1991
|
+
* Returns gas estimate and result without sending transaction
|
|
1992
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1993
|
+
*/
|
|
1994
|
+
async buyCover(params, poolAllocationRequests, options) {
|
|
1995
|
+
return contract.simulate.buyCover([params, poolAllocationRequests], options);
|
|
1996
|
+
},
|
|
1997
|
+
/**
|
|
1998
|
+
* Simulate buyCoverWithRi
|
|
1999
|
+
* Returns gas estimate and result without sending transaction
|
|
2000
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2001
|
+
*/
|
|
2002
|
+
async buyCoverWithRi(params, poolAllocationRequests, riRequest, options) {
|
|
2003
|
+
return contract.simulate.buyCoverWithRi([params, poolAllocationRequests, riRequest], options);
|
|
2004
|
+
},
|
|
2005
|
+
/**
|
|
2006
|
+
* Simulate changeCoverNFTDescriptor
|
|
2007
|
+
* Returns gas estimate and result without sending transaction
|
|
2008
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2009
|
+
*/
|
|
2010
|
+
async changeCoverNFTDescriptor(_coverNFTDescriptor, options) {
|
|
2011
|
+
return contract.simulate.changeCoverNFTDescriptor([_coverNFTDescriptor], options);
|
|
2012
|
+
},
|
|
2013
|
+
/**
|
|
2014
|
+
* Simulate changeStakingNFTDescriptor
|
|
2015
|
+
* Returns gas estimate and result without sending transaction
|
|
2016
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2017
|
+
*/
|
|
2018
|
+
async changeStakingNFTDescriptor(_stakingNFTDescriptor, options) {
|
|
2019
|
+
return contract.simulate.changeStakingNFTDescriptor([_stakingNFTDescriptor], options);
|
|
2020
|
+
},
|
|
2021
|
+
/**
|
|
2022
|
+
* Simulate executeCoverBuy
|
|
2023
|
+
* Returns gas estimate and result without sending transaction
|
|
2024
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2025
|
+
*/
|
|
2026
|
+
async executeCoverBuy(params, poolAllocationRequests, buyer, options) {
|
|
2027
|
+
return contract.simulate.executeCoverBuy([params, poolAllocationRequests, buyer], options);
|
|
2028
|
+
},
|
|
2029
|
+
/**
|
|
2030
|
+
* Simulate expireCover
|
|
2031
|
+
* Returns gas estimate and result without sending transaction
|
|
2032
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2033
|
+
*/
|
|
2034
|
+
async expireCover(coverId, options) {
|
|
2035
|
+
return contract.simulate.expireCover([coverId], options);
|
|
2036
|
+
},
|
|
2037
|
+
/**
|
|
2038
|
+
* Simulate multicall
|
|
2039
|
+
* Returns gas estimate and result without sending transaction
|
|
2040
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2041
|
+
*/
|
|
2042
|
+
async multicall(data, options) {
|
|
2043
|
+
return contract.simulate.multicall([data], options);
|
|
2044
|
+
},
|
|
2045
|
+
/**
|
|
2046
|
+
* Simulate populateIpfsMetadata
|
|
2047
|
+
* Returns gas estimate and result without sending transaction
|
|
2048
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2049
|
+
*/
|
|
2050
|
+
async populateIpfsMetadata(coverIds, ipfsMetadata, options) {
|
|
2051
|
+
return contract.simulate.populateIpfsMetadata([coverIds, ipfsMetadata], options);
|
|
2052
|
+
},
|
|
2053
|
+
/**
|
|
2054
|
+
* Simulate recalculateActiveCoverInAsset
|
|
2055
|
+
* Returns gas estimate and result without sending transaction
|
|
2056
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2057
|
+
*/
|
|
2058
|
+
async recalculateActiveCoverInAsset(coverAsset, options) {
|
|
2059
|
+
return contract.simulate.recalculateActiveCoverInAsset([coverAsset], options);
|
|
2060
|
+
},
|
|
2061
|
+
/**
|
|
2062
|
+
* Simulate setRiConfig
|
|
2063
|
+
* Returns gas estimate and result without sending transaction
|
|
2064
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2065
|
+
*/
|
|
2066
|
+
async setRiConfig(providerId, premiumDestination, options) {
|
|
2067
|
+
return contract.simulate.setRiConfig([providerId, premiumDestination], options);
|
|
2068
|
+
},
|
|
2069
|
+
/**
|
|
2070
|
+
* Simulate setRiSigner
|
|
2071
|
+
* Returns gas estimate and result without sending transaction
|
|
2072
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2073
|
+
*/
|
|
2074
|
+
async setRiSigner(_riSigner, options) {
|
|
2075
|
+
return contract.simulate.setRiSigner([_riSigner], options);
|
|
2076
|
+
},
|
|
2077
|
+
/**
|
|
2078
|
+
* Simulate updateTotalActiveCoverAmount
|
|
2079
|
+
* Returns gas estimate and result without sending transaction
|
|
2080
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
2081
|
+
*/
|
|
2082
|
+
async updateTotalActiveCoverAmount(coverAsset, options) {
|
|
2083
|
+
return contract.simulate.updateTotalActiveCoverAmount([coverAsset], options);
|
|
2084
|
+
}
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Watch contract events
|
|
2089
|
+
*
|
|
2090
|
+
* @example
|
|
2091
|
+
* // Watch all Transfer events
|
|
2092
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
2093
|
+
* console.log('Transfer:', event);
|
|
2094
|
+
* });
|
|
2095
|
+
*
|
|
2096
|
+
* // Stop watching
|
|
2097
|
+
* unwatch();
|
|
2098
|
+
*/
|
|
2099
|
+
get watch() {
|
|
2100
|
+
return {
|
|
2101
|
+
/**
|
|
2102
|
+
* Watch CoverBought events
|
|
2103
|
+
* @param callback Function to call when event is emitted
|
|
2104
|
+
* @param filter Optional filter for indexed parameters
|
|
2105
|
+
* @returns Unwatch function to stop listening
|
|
2106
|
+
*/
|
|
2107
|
+
CoverBought: (callback, filter) => {
|
|
2108
|
+
return this.publicClient.watchContractEvent({
|
|
2109
|
+
address: this.contractAddress,
|
|
2110
|
+
abi: exports.CoverAbi,
|
|
2111
|
+
eventName: 'CoverBought',
|
|
2112
|
+
args: filter,
|
|
2113
|
+
onLogs: (logs) => {
|
|
2114
|
+
logs.forEach((log) => {
|
|
2115
|
+
callback(log.args);
|
|
2116
|
+
});
|
|
2117
|
+
},
|
|
2118
|
+
});
|
|
2119
|
+
},
|
|
2120
|
+
/**
|
|
2121
|
+
* Watch CoverRiAllocated events
|
|
2122
|
+
* @param callback Function to call when event is emitted
|
|
2123
|
+
* @param filter Optional filter for indexed parameters
|
|
2124
|
+
* @returns Unwatch function to stop listening
|
|
2125
|
+
*/
|
|
2126
|
+
CoverRiAllocated: (callback, filter) => {
|
|
2127
|
+
return this.publicClient.watchContractEvent({
|
|
2128
|
+
address: this.contractAddress,
|
|
2129
|
+
abi: exports.CoverAbi,
|
|
2130
|
+
eventName: 'CoverRiAllocated',
|
|
2131
|
+
args: filter,
|
|
2132
|
+
onLogs: (logs) => {
|
|
2133
|
+
logs.forEach((log) => {
|
|
2134
|
+
callback(log.args);
|
|
2135
|
+
});
|
|
2136
|
+
},
|
|
2137
|
+
});
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
exports.Cover = Cover;
|