@ensuro/core 2.0.0-beta1 → 2.0.0-beta11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +36 -14
  2. package/build/contracts/AccessManager.sol/AccessManager.json +564 -0
  3. package/build/contracts/ERC4626AssetManager.sol/ERC4626AssetManager.json +238 -0
  4. package/build/contracts/EToken.sol/EToken.json +147 -46
  5. package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +23 -4
  6. package/build/contracts/LiquidityThresholdAssetManager.sol/LiquidityThresholdAssetManager.json +222 -0
  7. package/build/contracts/Policy.sol/Policy.json +2 -2
  8. package/build/contracts/PolicyPool.sol/PolicyPool.json +437 -61
  9. package/build/contracts/PolicyPoolComponent.sol/PolicyPoolComponent.json +21 -2
  10. package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +142 -16
  11. package/build/contracts/Reserve.sol/Reserve.json +85 -8
  12. package/build/contracts/RiskModule.sol/RiskModule.json +21 -2
  13. package/build/contracts/SignedQuoteRiskModule.sol/SignedQuoteRiskModule.json +979 -0
  14. package/build/contracts/TimeScaled.sol/TimeScaled.json +3 -17
  15. package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +24 -5
  16. package/build/contracts/{WadRayMath.sol → dependencies/WadRayMath.sol}/WadRayMath.json +3 -3
  17. package/build/contracts/interfaces/{IPolicyPoolConfig.sol/IPolicyPoolConfig.json → IAccessManager.sol/IAccessManager.json} +77 -59
  18. package/build/contracts/interfaces/IAssetManager.sol/IAssetManager.json +128 -0
  19. package/build/contracts/interfaces/IEToken.sol/IEToken.json +13 -0
  20. package/build/contracts/interfaces/IPolicyPool.sol/IPolicyPool.json +40 -16
  21. package/build/contracts/interfaces/IPolicyPoolComponent.sol/IPolicyPoolComponent.json +19 -0
  22. package/build/contracts/interfaces/IPremiumsAccount.sol/IPremiumsAccount.json +13 -0
  23. package/build/contracts/mocks/FixedRateVault.sol/FixedRateVault.json +736 -0
  24. package/build/contracts/mocks/ForwardProxy.sol/ForwardProxy.json +2 -2
  25. package/build/contracts/mocks/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +180 -0
  26. package/build/contracts/mocks/PolicyHolderMock.sol/PolicyHolderMock.json +28 -2
  27. package/build/contracts/mocks/PolicyPoolComponentMock.sol/PolicyPoolComponentMock.json +21 -2
  28. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMock.json +118 -19
  29. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMockForward.json +6 -6
  30. package/build/contracts/mocks/RiskModuleMock.sol/RiskModuleMock.json +783 -0
  31. package/build/contracts/mocks/TestCurrency.sol/TestCurrency.json +2 -2
  32. package/build/contracts/mocks/TestNFT.sol/TestNFT.json +2 -2
  33. package/contracts/AccessManager.sol +132 -0
  34. package/contracts/ERC4626AssetManager.sol +55 -0
  35. package/contracts/EToken.sol +208 -102
  36. package/contracts/LPManualWhitelist.sol +19 -3
  37. package/contracts/LiquidityThresholdAssetManager.sol +175 -0
  38. package/contracts/Policy.sol +5 -3
  39. package/contracts/PolicyPool.sol +381 -116
  40. package/contracts/PolicyPoolComponent.sol +61 -44
  41. package/contracts/PremiumsAccount.sol +324 -86
  42. package/contracts/Reserve.sol +199 -4
  43. package/contracts/RiskModule.sol +62 -31
  44. package/contracts/SignedQuoteRiskModule.sol +248 -0
  45. package/contracts/TimeScaled.sol +19 -15
  46. package/contracts/TrustfulRiskModule.sol +69 -2
  47. package/contracts/dependencies/WadRayMath.sol +126 -0
  48. package/contracts/interfaces/IAccessManager.sol +148 -0
  49. package/contracts/interfaces/IAssetManager.sol +89 -0
  50. package/contracts/interfaces/IEToken.sol +25 -2
  51. package/contracts/interfaces/ILPWhitelist.sol +17 -0
  52. package/contracts/interfaces/IPolicyPool.sol +21 -14
  53. package/contracts/interfaces/IPolicyPoolComponent.sol +5 -1
  54. package/contracts/interfaces/IPremiumsAccount.sol +5 -0
  55. package/contracts/interfaces/IRiskModule.sol +67 -4
  56. package/contracts/mocks/FixedRateVault.sol +85 -0
  57. package/contracts/mocks/InterfaceIdCalculator.sol +32 -0
  58. package/contracts/mocks/PolicyHolderMock.sol +21 -0
  59. package/contracts/mocks/PolicyPoolComponentMock.sol +10 -0
  60. package/contracts/mocks/PolicyPoolMock.sol +41 -15
  61. package/contracts/mocks/RiskModuleMock.sol +75 -0
  62. package/js/deploy.js +704 -0
  63. package/js/test-utils.js +339 -159
  64. package/package.json +1 -1
  65. package/build/contracts/FlightDelayRiskModule.sol/FlightDelayRiskModule.json +0 -890
  66. package/build/contracts/PolicyNFT.sol/PolicyNFT.json +0 -583
  67. package/build/contracts/PolicyPoolConfig.sol/PolicyPoolConfig.json +0 -691
  68. package/build/contracts/dependencies/ChainlinkClientUpgradeable.sol/ChainlinkClientUpgradeable.json +0 -63
  69. package/build/contracts/interfaces/IPolicyNFT.sol/IPolicyNFT.json +0 -321
  70. package/build/contracts/mocks/LinkTokenMock.sol/LinkTokenMock.json +0 -370
  71. package/build/contracts/mocks/TestCurrencyUUPS.sol/TestCurrencyUUPS.json +0 -353
  72. package/build/contracts/upgraded/IPolicyNFTv1.sol/IPolicyNFTv1.json +0 -322
  73. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1.json +0 -584
  74. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1_Upgrade.json +0 -615
  75. package/contracts/FlightDelayRiskModule.sol +0 -217
  76. package/contracts/PolicyNFT.sol +0 -96
  77. package/contracts/PolicyPoolConfig.sol +0 -204
  78. package/contracts/WadRayMath.sol +0 -135
  79. package/contracts/dependencies/ChainlinkClientUpgradeable.sol +0 -371
  80. package/contracts/interfaces/IPolicyNFT.sol +0 -15
  81. package/contracts/interfaces/IPolicyPoolConfig.sol +0 -96
  82. package/contracts/mocks/LinkTokenMock.sol +0 -30
  83. package/contracts/upgraded/IPolicyNFTv1.sol +0 -15
  84. package/contracts/upgraded/PolicyNFTv1.sol +0 -126
@@ -1,27 +1,8 @@
1
1
  {
2
2
  "_format": "hh-sol-artifact-1",
3
- "contractName": "IPolicyPoolConfig",
4
- "sourceName": "contracts/interfaces/IPolicyPoolConfig.sol",
3
+ "contractName": "IAccessManager",
4
+ "sourceName": "contracts/interfaces/IAccessManager.sol",
5
5
  "abi": [
6
- {
7
- "anonymous": false,
8
- "inputs": [
9
- {
10
- "indexed": true,
11
- "internalType": "contract IRiskModule",
12
- "name": "riskModule",
13
- "type": "address"
14
- },
15
- {
16
- "indexed": false,
17
- "internalType": "enum IPolicyPoolConfig.RiskModuleStatus",
18
- "name": "newStatus",
19
- "type": "uint8"
20
- }
21
- ],
22
- "name": "RiskModuleStatusChanged",
23
- "type": "event"
24
- },
25
6
  {
26
7
  "anonymous": false,
27
8
  "inputs": [
@@ -100,25 +81,27 @@
100
81
  {
101
82
  "inputs": [
102
83
  {
103
- "internalType": "contract IRiskModule",
104
- "name": "riskModule",
84
+ "internalType": "address",
85
+ "name": "component",
105
86
  "type": "address"
106
- }
107
- ],
108
- "name": "checkAcceptsNewPolicy",
109
- "outputs": [],
110
- "stateMutability": "view",
111
- "type": "function"
112
- },
113
- {
114
- "inputs": [
87
+ },
115
88
  {
116
- "internalType": "contract IRiskModule",
117
- "name": "riskModule",
89
+ "internalType": "bytes32",
90
+ "name": "role",
91
+ "type": "bytes32"
92
+ },
93
+ {
94
+ "internalType": "address",
95
+ "name": "account",
118
96
  "type": "address"
97
+ },
98
+ {
99
+ "internalType": "bool",
100
+ "name": "alsoGlobal",
101
+ "type": "bool"
119
102
  }
120
103
  ],
121
- "name": "checkAcceptsResolvePolicy",
104
+ "name": "checkComponentRole",
122
105
  "outputs": [],
123
106
  "stateMutability": "view",
124
107
  "type": "function"
@@ -132,16 +115,26 @@
132
115
  },
133
116
  {
134
117
  "internalType": "bytes32",
135
- "name": "role",
118
+ "name": "role1",
119
+ "type": "bytes32"
120
+ },
121
+ {
122
+ "internalType": "bytes32",
123
+ "name": "role2",
136
124
  "type": "bytes32"
137
125
  },
138
126
  {
139
127
  "internalType": "address",
140
128
  "name": "account",
141
129
  "type": "address"
130
+ },
131
+ {
132
+ "internalType": "bool",
133
+ "name": "alsoGlobal",
134
+ "type": "bool"
142
135
  }
143
136
  ],
144
- "name": "checkComponentRole",
137
+ "name": "checkComponentRole2",
145
138
  "outputs": [],
146
139
  "stateMutability": "view",
147
140
  "type": "function"
@@ -188,10 +181,27 @@
188
181
  "type": "function"
189
182
  },
190
183
  {
191
- "inputs": [],
192
- "name": "connect",
193
- "outputs": [],
194
- "stateMutability": "nonpayable",
184
+ "inputs": [
185
+ {
186
+ "internalType": "address",
187
+ "name": "component",
188
+ "type": "address"
189
+ },
190
+ {
191
+ "internalType": "bytes32",
192
+ "name": "role",
193
+ "type": "bytes32"
194
+ }
195
+ ],
196
+ "name": "getComponentRole",
197
+ "outputs": [
198
+ {
199
+ "internalType": "bytes32",
200
+ "name": "",
201
+ "type": "bytes32"
202
+ }
203
+ ],
204
+ "stateMutability": "view",
195
205
  "type": "function"
196
206
  },
197
207
  {
@@ -233,6 +243,11 @@
233
243
  },
234
244
  {
235
245
  "inputs": [
246
+ {
247
+ "internalType": "address",
248
+ "name": "component",
249
+ "type": "address"
250
+ },
236
251
  {
237
252
  "internalType": "bytes32",
238
253
  "name": "role",
@@ -242,9 +257,14 @@
242
257
  "internalType": "address",
243
258
  "name": "account",
244
259
  "type": "address"
260
+ },
261
+ {
262
+ "internalType": "bool",
263
+ "name": "alsoGlobal",
264
+ "type": "bool"
245
265
  }
246
266
  ],
247
- "name": "hasRole",
267
+ "name": "hasComponentRole",
248
268
  "outputs": [
249
269
  {
250
270
  "internalType": "bool",
@@ -256,13 +276,24 @@
256
276
  "type": "function"
257
277
  },
258
278
  {
259
- "inputs": [],
260
- "name": "lpWhitelist",
279
+ "inputs": [
280
+ {
281
+ "internalType": "bytes32",
282
+ "name": "role",
283
+ "type": "bytes32"
284
+ },
285
+ {
286
+ "internalType": "address",
287
+ "name": "account",
288
+ "type": "address"
289
+ }
290
+ ],
291
+ "name": "hasRole",
261
292
  "outputs": [
262
293
  {
263
- "internalType": "contract ILPWhitelist",
294
+ "internalType": "bool",
264
295
  "name": "",
265
- "type": "address"
296
+ "type": "bool"
266
297
  }
267
298
  ],
268
299
  "stateMutability": "view",
@@ -303,19 +334,6 @@
303
334
  "outputs": [],
304
335
  "stateMutability": "nonpayable",
305
336
  "type": "function"
306
- },
307
- {
308
- "inputs": [],
309
- "name": "treasury",
310
- "outputs": [
311
- {
312
- "internalType": "address",
313
- "name": "",
314
- "type": "address"
315
- }
316
- ],
317
- "stateMutability": "view",
318
- "type": "function"
319
337
  }
320
338
  ],
321
339
  "bytecode": "0x",
@@ -0,0 +1,128 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "IAssetManager",
4
+ "sourceName": "contracts/interfaces/IAssetManager.sol",
5
+ "abi": [
6
+ {
7
+ "anonymous": false,
8
+ "inputs": [
9
+ {
10
+ "indexed": false,
11
+ "internalType": "int256",
12
+ "name": "earnings",
13
+ "type": "int256"
14
+ }
15
+ ],
16
+ "name": "EarningsRecorded",
17
+ "type": "event"
18
+ },
19
+ {
20
+ "anonymous": false,
21
+ "inputs": [
22
+ {
23
+ "indexed": false,
24
+ "internalType": "uint256",
25
+ "name": "amount",
26
+ "type": "uint256"
27
+ }
28
+ ],
29
+ "name": "MoneyDeinvested",
30
+ "type": "event"
31
+ },
32
+ {
33
+ "anonymous": false,
34
+ "inputs": [
35
+ {
36
+ "indexed": false,
37
+ "internalType": "uint256",
38
+ "name": "amount",
39
+ "type": "uint256"
40
+ }
41
+ ],
42
+ "name": "MoneyInvested",
43
+ "type": "event"
44
+ },
45
+ {
46
+ "inputs": [],
47
+ "name": "connect",
48
+ "outputs": [],
49
+ "stateMutability": "nonpayable",
50
+ "type": "function"
51
+ },
52
+ {
53
+ "inputs": [],
54
+ "name": "deinvestAll",
55
+ "outputs": [
56
+ {
57
+ "internalType": "int256",
58
+ "name": "",
59
+ "type": "int256"
60
+ }
61
+ ],
62
+ "stateMutability": "nonpayable",
63
+ "type": "function"
64
+ },
65
+ {
66
+ "inputs": [],
67
+ "name": "rebalance",
68
+ "outputs": [],
69
+ "stateMutability": "nonpayable",
70
+ "type": "function"
71
+ },
72
+ {
73
+ "inputs": [],
74
+ "name": "recordEarnings",
75
+ "outputs": [
76
+ {
77
+ "internalType": "int256",
78
+ "name": "",
79
+ "type": "int256"
80
+ }
81
+ ],
82
+ "stateMutability": "nonpayable",
83
+ "type": "function"
84
+ },
85
+ {
86
+ "inputs": [
87
+ {
88
+ "internalType": "uint256",
89
+ "name": "paymentAmount",
90
+ "type": "uint256"
91
+ }
92
+ ],
93
+ "name": "refillWallet",
94
+ "outputs": [
95
+ {
96
+ "internalType": "uint256",
97
+ "name": "",
98
+ "type": "uint256"
99
+ }
100
+ ],
101
+ "stateMutability": "nonpayable",
102
+ "type": "function"
103
+ },
104
+ {
105
+ "inputs": [
106
+ {
107
+ "internalType": "bytes4",
108
+ "name": "interfaceId",
109
+ "type": "bytes4"
110
+ }
111
+ ],
112
+ "name": "supportsInterface",
113
+ "outputs": [
114
+ {
115
+ "internalType": "bool",
116
+ "name": "",
117
+ "type": "bool"
118
+ }
119
+ ],
120
+ "stateMutability": "view",
121
+ "type": "function"
122
+ }
123
+ ],
124
+ "bytecode": "0x",
125
+ "deployedBytecode": "0x",
126
+ "linkReferences": {},
127
+ "deployedLinkReferences": {}
128
+ }
@@ -261,6 +261,19 @@
261
261
  "stateMutability": "nonpayable",
262
262
  "type": "function"
263
263
  },
264
+ {
265
+ "inputs": [
266
+ {
267
+ "internalType": "address",
268
+ "name": "borrower",
269
+ "type": "address"
270
+ }
271
+ ],
272
+ "name": "removeBorrower",
273
+ "outputs": [],
274
+ "stateMutability": "nonpayable",
275
+ "type": "function"
276
+ },
264
277
  {
265
278
  "inputs": [
266
279
  {
@@ -5,10 +5,10 @@
5
5
  "abi": [
6
6
  {
7
7
  "inputs": [],
8
- "name": "config",
8
+ "name": "access",
9
9
  "outputs": [
10
10
  {
11
- "internalType": "contract IPolicyPoolConfig",
11
+ "internalType": "contract IAccessManager",
12
12
  "name": "",
13
13
  "type": "address"
14
14
  }
@@ -132,6 +132,25 @@
132
132
  "stateMutability": "nonpayable",
133
133
  "type": "function"
134
134
  },
135
+ {
136
+ "inputs": [
137
+ {
138
+ "internalType": "uint256",
139
+ "name": "policyId",
140
+ "type": "uint256"
141
+ }
142
+ ],
143
+ "name": "isActive",
144
+ "outputs": [
145
+ {
146
+ "internalType": "bool",
147
+ "name": "",
148
+ "type": "bool"
149
+ }
150
+ ],
151
+ "stateMutability": "view",
152
+ "type": "function"
153
+ },
135
154
  {
136
155
  "inputs": [
137
156
  {
@@ -213,7 +232,12 @@
213
232
  },
214
233
  {
215
234
  "internalType": "address",
216
- "name": "customer",
235
+ "name": "caller",
236
+ "type": "address"
237
+ },
238
+ {
239
+ "internalType": "address",
240
+ "name": "policyHolder",
217
241
  "type": "address"
218
242
  },
219
243
  {
@@ -233,19 +257,6 @@
233
257
  "stateMutability": "nonpayable",
234
258
  "type": "function"
235
259
  },
236
- {
237
- "inputs": [],
238
- "name": "policyNFT",
239
- "outputs": [
240
- {
241
- "internalType": "address",
242
- "name": "",
243
- "type": "address"
244
- }
245
- ],
246
- "stateMutability": "view",
247
- "type": "function"
248
- },
249
260
  {
250
261
  "inputs": [
251
262
  {
@@ -426,6 +437,19 @@
426
437
  "stateMutability": "nonpayable",
427
438
  "type": "function"
428
439
  },
440
+ {
441
+ "inputs": [],
442
+ "name": "treasury",
443
+ "outputs": [
444
+ {
445
+ "internalType": "address",
446
+ "name": "",
447
+ "type": "address"
448
+ }
449
+ ],
450
+ "stateMutability": "view",
451
+ "type": "function"
452
+ },
429
453
  {
430
454
  "inputs": [
431
455
  {
@@ -15,6 +15,25 @@
15
15
  ],
16
16
  "stateMutability": "view",
17
17
  "type": "function"
18
+ },
19
+ {
20
+ "inputs": [
21
+ {
22
+ "internalType": "bytes4",
23
+ "name": "interfaceId",
24
+ "type": "bytes4"
25
+ }
26
+ ],
27
+ "name": "supportsInterface",
28
+ "outputs": [
29
+ {
30
+ "internalType": "bool",
31
+ "name": "",
32
+ "type": "bool"
33
+ }
34
+ ],
35
+ "stateMutability": "view",
36
+ "type": "function"
18
37
  }
19
38
  ],
20
39
  "bytecode": "0x",
@@ -281,6 +281,19 @@
281
281
  "stateMutability": "nonpayable",
282
282
  "type": "function"
283
283
  },
284
+ {
285
+ "inputs": [],
286
+ "name": "purePremiums",
287
+ "outputs": [
288
+ {
289
+ "internalType": "uint256",
290
+ "name": "",
291
+ "type": "uint256"
292
+ }
293
+ ],
294
+ "stateMutability": "view",
295
+ "type": "function"
296
+ },
284
297
  {
285
298
  "inputs": [],
286
299
  "name": "seniorEtk",