@ensuro/core 1.2.5 → 2.0.0-beta1

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 (92) hide show
  1. package/README.md +44 -17
  2. package/build/contracts/EToken.sol/EToken.json +141 -177
  3. package/build/contracts/FlightDelayRiskModule.sol/FlightDelayRiskModule.json +112 -315
  4. package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +34 -2
  5. package/build/contracts/Policy.sol/Policy.json +2 -2
  6. package/build/contracts/PolicyNFT.sol/PolicyNFT.json +16 -3
  7. package/build/contracts/PolicyPool.sol/PolicyPool.json +105 -351
  8. package/build/contracts/PolicyPoolComponent.sol/PolicyPoolComponent.json +32 -0
  9. package/build/contracts/PolicyPoolConfig.sol/PolicyPoolConfig.json +77 -72
  10. package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +761 -0
  11. package/build/contracts/{BaseAssetManager.sol/BaseAssetManager.json → Reserve.sol/Reserve.json} +23 -191
  12. package/build/contracts/RiskModule.sol/RiskModule.json +94 -302
  13. package/build/contracts/TimeScaled.sol/TimeScaled.json +24 -0
  14. package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +142 -325
  15. package/build/contracts/dependencies/ChainlinkClientUpgradeable.sol/ChainlinkClientUpgradeable.json +15 -2
  16. package/build/contracts/dependencies/ERC1967Proxy.sol/ERC1967Proxy.json +64 -0
  17. package/build/{interfaces/IExchange.sol/IExchange.json → contracts/dependencies/IERC20Metadata.sol/IERC20Metadata.json} +83 -79
  18. package/build/{interfaces → contracts/interfaces}/IEToken.sol/IEToken.json +32 -97
  19. package/build/{interfaces → contracts/interfaces}/ILPWhitelist.sol/ILPWhitelist.json +1 -1
  20. package/build/{interfaces → contracts/interfaces}/IPolicyHolder.sol/IPolicyHolder.json +1 -1
  21. package/build/{interfaces → contracts/interfaces}/IPolicyNFT.sol/IPolicyNFT.json +1 -1
  22. package/build/{interfaces → contracts/interfaces}/IPolicyPool.sol/IPolicyPool.json +121 -108
  23. package/build/{interfaces → contracts/interfaces}/IPolicyPoolComponent.sol/IPolicyPoolComponent.json +1 -1
  24. package/build/{interfaces → contracts/interfaces}/IPolicyPoolConfig.sol/IPolicyPoolConfig.json +20 -36
  25. package/build/contracts/interfaces/IPremiumsAccount.sol/IPremiumsAccount.json +302 -0
  26. package/build/{interfaces → contracts/interfaces}/IRiskModule.sol/IRiskModule.json +58 -34
  27. package/build/contracts/mocks/ForwardProxy.sol/ForwardProxy.json +43 -0
  28. package/build/{interfaces/IInsolvencyHook.sol/IInsolvencyHook.json → contracts/mocks/IMintableERC20.sol/IMintableERC20.json} +13 -8
  29. package/build/contracts/mocks/LinkTokenMock.sol/LinkTokenMock.json +370 -0
  30. package/build/contracts/mocks/PolicyHolderMock.sol/PolicyHolderMock.json +202 -0
  31. package/build/contracts/mocks/PolicyPoolComponentMock.sol/PolicyPoolComponentMock.json +35 -0
  32. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMock.json +603 -0
  33. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMockForward.json +92 -0
  34. package/build/contracts/mocks/TestCurrency.sol/TestCurrency.json +343 -0
  35. package/build/contracts/mocks/TestCurrencyUUPS.sol/TestCurrencyUUPS.json +353 -0
  36. package/build/contracts/mocks/TestNFT.sol/TestNFT.json +388 -0
  37. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1.json +16 -3
  38. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1_Upgrade.json +16 -3
  39. package/contracts/EToken.sol +188 -273
  40. package/contracts/FlightDelayRiskModule.sol +30 -21
  41. package/contracts/LPManualWhitelist.sol +3 -3
  42. package/contracts/Policy.sol +48 -44
  43. package/contracts/PolicyNFT.sol +2 -2
  44. package/contracts/PolicyPool.sol +114 -467
  45. package/contracts/PolicyPoolComponent.sol +14 -3
  46. package/contracts/PolicyPoolConfig.sol +30 -73
  47. package/contracts/PremiumsAccount.sol +274 -0
  48. package/contracts/Reserve.sol +34 -0
  49. package/contracts/RiskModule.sol +216 -164
  50. package/contracts/TimeScaled.sol +134 -0
  51. package/contracts/TrustfulRiskModule.sol +23 -21
  52. package/contracts/dependencies/ERC1967Proxy.sol +19 -0
  53. package/contracts/dependencies/IERC20Metadata.sol +19 -0
  54. package/contracts/interfaces/IEToken.sol +172 -0
  55. package/{interfaces → contracts/interfaces}/ILPWhitelist.sol +0 -0
  56. package/{interfaces → contracts/interfaces}/IPolicyHolder.sol +0 -0
  57. package/{interfaces → contracts/interfaces}/IPolicyNFT.sol +0 -0
  58. package/contracts/interfaces/IPolicyPool.sol +138 -0
  59. package/{interfaces → contracts/interfaces}/IPolicyPoolComponent.sol +0 -0
  60. package/{interfaces → contracts/interfaces}/IPolicyPoolConfig.sol +31 -20
  61. package/contracts/interfaces/IPremiumsAccount.sol +71 -0
  62. package/contracts/interfaces/IRiskModule.sol +60 -0
  63. package/contracts/mocks/ForwardProxy.sol +66 -0
  64. package/contracts/mocks/IMintableERC20.sol +13 -0
  65. package/contracts/mocks/LinkTokenMock.sol +30 -0
  66. package/contracts/mocks/PolicyHolderMock.sol +68 -0
  67. package/contracts/mocks/PolicyPoolComponentMock.sol +17 -0
  68. package/contracts/mocks/PolicyPoolMock.sol +122 -0
  69. package/contracts/mocks/TestCurrency.sol +35 -0
  70. package/contracts/mocks/TestNFT.sol +23 -0
  71. package/contracts/upgraded/PolicyNFTv1.sol +1 -1
  72. package/js/test-utils.js +278 -0
  73. package/package.json +2 -2
  74. package/build/contracts/AaveAssetManager.sol/AaveAssetManager.json +0 -723
  75. package/build/contracts/DataTypes.sol/DataTypes.json +0 -10
  76. package/build/contracts/Exchange.sol/Exchange.json +0 -546
  77. package/build/contracts/extras/IPriceRiskModule.sol/IPriceRiskModule.json +0 -253
  78. package/build/contracts/extras/PriceRiskModule.sol/PriceRiskModule.json +0 -1036
  79. package/build/interfaces/IAssetManager.sol/IAssetManager.json +0 -31
  80. package/build/interfaces/IExchange.sol/IPriceOracle.json +0 -30
  81. package/contracts/AaveAssetManager.sol +0 -298
  82. package/contracts/BaseAssetManager.sol +0 -301
  83. package/contracts/DataTypes.sol +0 -287
  84. package/contracts/Exchange.sol +0 -173
  85. package/contracts/extras/IPriceRiskModule.sol +0 -41
  86. package/contracts/extras/PriceRiskModule.sol +0 -243
  87. package/interfaces/IAssetManager.sol +0 -23
  88. package/interfaces/IEToken.sol +0 -48
  89. package/interfaces/IExchange.sol +0 -59
  90. package/interfaces/IInsolvencyHook.sol +0 -27
  91. package/interfaces/IPolicyPool.sol +0 -44
  92. package/interfaces/IRiskModule.sol +0 -29
@@ -1,26 +1,8 @@
1
1
  {
2
2
  "_format": "hh-sol-artifact-1",
3
3
  "contractName": "IPolicyPool",
4
- "sourceName": "interfaces/IPolicyPool.sol",
4
+ "sourceName": "contracts/interfaces/IPolicyPool.sol",
5
5
  "abi": [
6
- {
7
- "inputs": [
8
- {
9
- "internalType": "uint256",
10
- "name": "amount",
11
- "type": "uint256"
12
- },
13
- {
14
- "internalType": "bool",
15
- "name": "positive",
16
- "type": "bool"
17
- }
18
- ],
19
- "name": "assetEarnings",
20
- "outputs": [],
21
- "stateMutability": "nonpayable",
22
- "type": "function"
23
- },
24
6
  {
25
7
  "inputs": [],
26
8
  "name": "config",
@@ -68,46 +50,86 @@
68
50
  {
69
51
  "inputs": [
70
52
  {
71
- "internalType": "uint256",
72
- "name": "index",
73
- "type": "uint256"
74
- }
75
- ],
76
- "name": "getETokenAt",
77
- "outputs": [
78
- {
79
- "internalType": "contract IEToken",
80
- "name": "",
81
- "type": "address"
82
- }
83
- ],
84
- "stateMutability": "view",
85
- "type": "function"
86
- },
87
- {
88
- "inputs": [],
89
- "name": "getETokenCount",
90
- "outputs": [
91
- {
92
- "internalType": "uint256",
93
- "name": "",
94
- "type": "uint256"
95
- }
96
- ],
97
- "stateMutability": "view",
98
- "type": "function"
99
- },
100
- {
101
- "inputs": [],
102
- "name": "getInvestable",
103
- "outputs": [
104
- {
105
- "internalType": "uint256",
106
- "name": "",
107
- "type": "uint256"
53
+ "components": [
54
+ {
55
+ "internalType": "uint256",
56
+ "name": "id",
57
+ "type": "uint256"
58
+ },
59
+ {
60
+ "internalType": "uint256",
61
+ "name": "payout",
62
+ "type": "uint256"
63
+ },
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "premium",
67
+ "type": "uint256"
68
+ },
69
+ {
70
+ "internalType": "uint256",
71
+ "name": "jrScr",
72
+ "type": "uint256"
73
+ },
74
+ {
75
+ "internalType": "uint256",
76
+ "name": "srScr",
77
+ "type": "uint256"
78
+ },
79
+ {
80
+ "internalType": "uint256",
81
+ "name": "lossProb",
82
+ "type": "uint256"
83
+ },
84
+ {
85
+ "internalType": "uint256",
86
+ "name": "purePremium",
87
+ "type": "uint256"
88
+ },
89
+ {
90
+ "internalType": "uint256",
91
+ "name": "ensuroCommission",
92
+ "type": "uint256"
93
+ },
94
+ {
95
+ "internalType": "uint256",
96
+ "name": "partnerCommission",
97
+ "type": "uint256"
98
+ },
99
+ {
100
+ "internalType": "uint256",
101
+ "name": "jrCoc",
102
+ "type": "uint256"
103
+ },
104
+ {
105
+ "internalType": "uint256",
106
+ "name": "srCoc",
107
+ "type": "uint256"
108
+ },
109
+ {
110
+ "internalType": "contract IRiskModule",
111
+ "name": "riskModule",
112
+ "type": "address"
113
+ },
114
+ {
115
+ "internalType": "uint40",
116
+ "name": "start",
117
+ "type": "uint40"
118
+ },
119
+ {
120
+ "internalType": "uint40",
121
+ "name": "expiration",
122
+ "type": "uint40"
123
+ }
124
+ ],
125
+ "internalType": "struct Policy.PolicyData",
126
+ "name": "policy",
127
+ "type": "tuple"
108
128
  }
109
129
  ],
110
- "stateMutability": "view",
130
+ "name": "expirePolicy",
131
+ "outputs": [],
132
+ "stateMutability": "nonpayable",
111
133
  "type": "function"
112
134
  },
113
135
  {
@@ -131,7 +153,12 @@
131
153
  },
132
154
  {
133
155
  "internalType": "uint256",
134
- "name": "scr",
156
+ "name": "jrScr",
157
+ "type": "uint256"
158
+ },
159
+ {
160
+ "internalType": "uint256",
161
+ "name": "srScr",
135
162
  "type": "uint256"
136
163
  },
137
164
  {
@@ -146,17 +173,22 @@
146
173
  },
147
174
  {
148
175
  "internalType": "uint256",
149
- "name": "premiumForEnsuro",
176
+ "name": "ensuroCommission",
177
+ "type": "uint256"
178
+ },
179
+ {
180
+ "internalType": "uint256",
181
+ "name": "partnerCommission",
150
182
  "type": "uint256"
151
183
  },
152
184
  {
153
185
  "internalType": "uint256",
154
- "name": "premiumForRm",
186
+ "name": "jrCoc",
155
187
  "type": "uint256"
156
188
  },
157
189
  {
158
190
  "internalType": "uint256",
159
- "name": "premiumForLps",
191
+ "name": "srCoc",
160
192
  "type": "uint256"
161
193
  },
162
194
  {
@@ -214,19 +246,6 @@
214
246
  "stateMutability": "view",
215
247
  "type": "function"
216
248
  },
217
- {
218
- "inputs": [
219
- {
220
- "internalType": "uint256",
221
- "name": "amount",
222
- "type": "uint256"
223
- }
224
- ],
225
- "name": "receiveGrant",
226
- "outputs": [],
227
- "stateMutability": "nonpayable",
228
- "type": "function"
229
- },
230
249
  {
231
250
  "inputs": [
232
251
  {
@@ -248,7 +267,12 @@
248
267
  },
249
268
  {
250
269
  "internalType": "uint256",
251
- "name": "scr",
270
+ "name": "jrScr",
271
+ "type": "uint256"
272
+ },
273
+ {
274
+ "internalType": "uint256",
275
+ "name": "srScr",
252
276
  "type": "uint256"
253
277
  },
254
278
  {
@@ -263,17 +287,22 @@
263
287
  },
264
288
  {
265
289
  "internalType": "uint256",
266
- "name": "premiumForEnsuro",
290
+ "name": "ensuroCommission",
291
+ "type": "uint256"
292
+ },
293
+ {
294
+ "internalType": "uint256",
295
+ "name": "partnerCommission",
267
296
  "type": "uint256"
268
297
  },
269
298
  {
270
299
  "internalType": "uint256",
271
- "name": "premiumForRm",
300
+ "name": "jrCoc",
272
301
  "type": "uint256"
273
302
  },
274
303
  {
275
304
  "internalType": "uint256",
276
- "name": "premiumForLps",
305
+ "name": "srCoc",
277
306
  "type": "uint256"
278
307
  },
279
308
  {
@@ -328,7 +357,12 @@
328
357
  },
329
358
  {
330
359
  "internalType": "uint256",
331
- "name": "scr",
360
+ "name": "jrScr",
361
+ "type": "uint256"
362
+ },
363
+ {
364
+ "internalType": "uint256",
365
+ "name": "srScr",
332
366
  "type": "uint256"
333
367
  },
334
368
  {
@@ -343,17 +377,22 @@
343
377
  },
344
378
  {
345
379
  "internalType": "uint256",
346
- "name": "premiumForEnsuro",
380
+ "name": "ensuroCommission",
381
+ "type": "uint256"
382
+ },
383
+ {
384
+ "internalType": "uint256",
385
+ "name": "partnerCommission",
347
386
  "type": "uint256"
348
387
  },
349
388
  {
350
389
  "internalType": "uint256",
351
- "name": "premiumForRm",
390
+ "name": "jrCoc",
352
391
  "type": "uint256"
353
392
  },
354
393
  {
355
394
  "internalType": "uint256",
356
- "name": "premiumForLps",
395
+ "name": "srCoc",
357
396
  "type": "uint256"
358
397
  },
359
398
  {
@@ -387,32 +426,6 @@
387
426
  "stateMutability": "nonpayable",
388
427
  "type": "function"
389
428
  },
390
- {
391
- "inputs": [
392
- {
393
- "internalType": "contract IAssetManager",
394
- "name": "newAssetManager",
395
- "type": "address"
396
- }
397
- ],
398
- "name": "setAssetManager",
399
- "outputs": [],
400
- "stateMutability": "nonpayable",
401
- "type": "function"
402
- },
403
- {
404
- "inputs": [],
405
- "name": "totalETokenSupply",
406
- "outputs": [
407
- {
408
- "internalType": "uint256",
409
- "name": "",
410
- "type": "uint256"
411
- }
412
- ],
413
- "stateMutability": "view",
414
- "type": "function"
415
- },
416
429
  {
417
430
  "inputs": [
418
431
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_format": "hh-sol-artifact-1",
3
3
  "contractName": "IPolicyPoolComponent",
4
- "sourceName": "interfaces/IPolicyPoolComponent.sol",
4
+ "sourceName": "contracts/interfaces/IPolicyPoolComponent.sol",
5
5
  "abi": [
6
6
  {
7
7
  "inputs": [],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_format": "hh-sol-artifact-1",
3
3
  "contractName": "IPolicyPoolConfig",
4
- "sourceName": "interfaces/IPolicyPoolConfig.sol",
4
+ "sourceName": "contracts/interfaces/IPolicyPoolConfig.sol",
5
5
  "abi": [
6
6
  {
7
7
  "anonymous": false,
@@ -98,15 +98,15 @@
98
98
  "type": "event"
99
99
  },
100
100
  {
101
- "inputs": [],
102
- "name": "assetManager",
103
- "outputs": [
101
+ "inputs": [
104
102
  {
105
- "internalType": "contract IAssetManager",
106
- "name": "",
103
+ "internalType": "contract IRiskModule",
104
+ "name": "riskModule",
107
105
  "type": "address"
108
106
  }
109
107
  ],
108
+ "name": "checkAcceptsNewPolicy",
109
+ "outputs": [],
110
110
  "stateMutability": "view",
111
111
  "type": "function"
112
112
  },
@@ -118,7 +118,7 @@
118
118
  "type": "address"
119
119
  }
120
120
  ],
121
- "name": "checkAcceptsNewPolicy",
121
+ "name": "checkAcceptsResolvePolicy",
122
122
  "outputs": [],
123
123
  "stateMutability": "view",
124
124
  "type": "function"
@@ -126,12 +126,22 @@
126
126
  {
127
127
  "inputs": [
128
128
  {
129
- "internalType": "contract IRiskModule",
130
- "name": "riskModule",
129
+ "internalType": "address",
130
+ "name": "component",
131
+ "type": "address"
132
+ },
133
+ {
134
+ "internalType": "bytes32",
135
+ "name": "role",
136
+ "type": "bytes32"
137
+ },
138
+ {
139
+ "internalType": "address",
140
+ "name": "account",
131
141
  "type": "address"
132
142
  }
133
143
  ],
134
- "name": "checkAcceptsResolvePolicy",
144
+ "name": "checkComponentRole",
135
145
  "outputs": [],
136
146
  "stateMutability": "view",
137
147
  "type": "function"
@@ -184,19 +194,6 @@
184
194
  "stateMutability": "nonpayable",
185
195
  "type": "function"
186
196
  },
187
- {
188
- "inputs": [],
189
- "name": "exchange",
190
- "outputs": [
191
- {
192
- "internalType": "contract IExchange",
193
- "name": "",
194
- "type": "address"
195
- }
196
- ],
197
- "stateMutability": "view",
198
- "type": "function"
199
- },
200
197
  {
201
198
  "inputs": [
202
199
  {
@@ -258,19 +255,6 @@
258
255
  "stateMutability": "view",
259
256
  "type": "function"
260
257
  },
261
- {
262
- "inputs": [],
263
- "name": "insolvencyHook",
264
- "outputs": [
265
- {
266
- "internalType": "contract IInsolvencyHook",
267
- "name": "",
268
- "type": "address"
269
- }
270
- ],
271
- "stateMutability": "view",
272
- "type": "function"
273
- },
274
258
  {
275
259
  "inputs": [],
276
260
  "name": "lpWhitelist",