@ensuro/core 1.2.6 → 2.0.0-beta2

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 (91) hide show
  1. package/README.md +49 -17
  2. package/build/contracts/EToken.sol/EToken.json +163 -173
  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 -98
  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 -49
  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/TestNFT.sol/TestNFT.json +388 -0
  36. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1.json +16 -3
  37. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1_Upgrade.json +16 -3
  38. package/contracts/EToken.sol +210 -267
  39. package/contracts/FlightDelayRiskModule.sol +30 -21
  40. package/contracts/LPManualWhitelist.sol +4 -4
  41. package/contracts/Policy.sol +48 -44
  42. package/contracts/PolicyNFT.sol +2 -2
  43. package/contracts/PolicyPool.sol +114 -467
  44. package/contracts/PolicyPoolComponent.sol +14 -3
  45. package/contracts/PolicyPoolConfig.sol +29 -91
  46. package/contracts/PremiumsAccount.sol +274 -0
  47. package/contracts/Reserve.sol +34 -0
  48. package/contracts/RiskModule.sol +216 -164
  49. package/contracts/TimeScaled.sol +134 -0
  50. package/contracts/TrustfulRiskModule.sol +23 -21
  51. package/contracts/dependencies/ERC1967Proxy.sol +19 -0
  52. package/contracts/dependencies/IERC20Metadata.sol +19 -0
  53. package/contracts/interfaces/IEToken.sol +172 -0
  54. package/{interfaces → contracts/interfaces}/ILPWhitelist.sol +0 -0
  55. package/{interfaces → contracts/interfaces}/IPolicyHolder.sol +0 -0
  56. package/{interfaces → contracts/interfaces}/IPolicyNFT.sol +0 -0
  57. package/contracts/interfaces/IPolicyPool.sol +138 -0
  58. package/{interfaces → contracts/interfaces}/IPolicyPoolComponent.sol +0 -0
  59. package/{interfaces → contracts/interfaces}/IPolicyPoolConfig.sol +31 -22
  60. package/contracts/interfaces/IPremiumsAccount.sol +71 -0
  61. package/contracts/interfaces/IRiskModule.sol +60 -0
  62. package/contracts/mocks/ForwardProxy.sol +66 -0
  63. package/contracts/mocks/IMintableERC20.sol +13 -0
  64. package/contracts/mocks/LinkTokenMock.sol +30 -0
  65. package/contracts/mocks/PolicyHolderMock.sol +68 -0
  66. package/contracts/mocks/PolicyPoolComponentMock.sol +17 -0
  67. package/contracts/mocks/PolicyPoolMock.sol +122 -0
  68. package/contracts/mocks/TestCurrency.sol +35 -0
  69. package/contracts/mocks/TestNFT.sol +23 -0
  70. package/contracts/upgraded/PolicyNFTv1.sol +1 -1
  71. package/js/test-utils.js +278 -0
  72. package/package.json +2 -2
  73. package/build/contracts/AaveAssetManager.sol/AaveAssetManager.json +0 -723
  74. package/build/contracts/DataTypes.sol/DataTypes.json +0 -10
  75. package/build/contracts/Exchange.sol/Exchange.json +0 -546
  76. package/build/contracts/extras/IPriceRiskModule.sol/IPriceRiskModule.json +0 -253
  77. package/build/contracts/extras/PriceRiskModule.sol/PriceRiskModule.json +0 -1036
  78. package/build/interfaces/IAssetManager.sol/IAssetManager.json +0 -31
  79. package/build/interfaces/IExchange.sol/IPriceOracle.json +0 -30
  80. package/contracts/AaveAssetManager.sol +0 -298
  81. package/contracts/BaseAssetManager.sol +0 -301
  82. package/contracts/DataTypes.sol +0 -287
  83. package/contracts/Exchange.sol +0 -173
  84. package/contracts/extras/IPriceRiskModule.sol +0 -41
  85. package/contracts/extras/PriceRiskModule.sol +0 -243
  86. package/interfaces/IAssetManager.sol +0 -23
  87. package/interfaces/IEToken.sol +0 -48
  88. package/interfaces/IExchange.sol +0 -59
  89. package/interfaces/IInsolvencyHook.sol +0 -27
  90. package/interfaces/IPolicyPool.sol +0 -44
  91. package/interfaces/IRiskModule.sol +0 -29
@@ -1,243 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5
- import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
6
- import {IPolicyPool} from "../../interfaces/IPolicyPool.sol";
7
- import {IPolicyPoolConfig} from "../../interfaces/IPolicyPoolConfig.sol";
8
- import {RiskModule} from "../RiskModule.sol";
9
- import {Policy} from "../Policy.sol";
10
- import {WadRayMath} from "../WadRayMath.sol";
11
- import {IPriceRiskModule} from "./IPriceRiskModule.sol";
12
-
13
- /**
14
- * @title PriceRiskModule
15
- * @dev Risk Module that triggers the payout if the price of an asset is lower or higher than trigger price
16
- * @custom:security-contact security@ensuro.co
17
- * @author Ensuro
18
- */
19
- contract PriceRiskModule is RiskModule, IPriceRiskModule {
20
- using SafeERC20 for IERC20Metadata;
21
- using WadRayMath for uint256;
22
-
23
- bytes32 public constant CUSTOMER_ROLE = keccak256("CUSTOMER_ROLE");
24
- bytes32 public constant PRICER_ROLE = keccak256("PRICER_ROLE");
25
-
26
- uint8 public constant PRICE_SLOTS = 30;
27
-
28
- /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
29
- IERC20Metadata internal immutable _asset;
30
- /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
31
- IERC20Metadata internal immutable _referenceCurrency;
32
- /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
33
- uint256 internal immutable _slotSize;
34
-
35
- struct PolicyData {
36
- Policy.PolicyData ensuroPolicy;
37
- uint256 triggerPrice;
38
- bool lower; // If true -> triggers if the price is lower, If false -> triggers if the price is higher
39
- }
40
-
41
- mapping(uint256 => PolicyData) internal _policies;
42
-
43
- // Duration (in hours) of the protection * (1 if lower else -1) => cummulative density function
44
- // [0] = prob of ([0, infinite%)
45
- // [1] = prob of ([1, infinite%)
46
- // ...
47
- // [PRICE_SLOTS - 1] = prob of ([PRICE_SLOTS - 1, -infinite%)
48
- mapping(int40 => uint256[PRICE_SLOTS]) internal _cdf;
49
-
50
- uint96 internal _internalId;
51
-
52
- event NewPricePolicy(
53
- address indexed customer,
54
- uint256 policyId,
55
- uint256 triggerPrice,
56
- bool lower
57
- );
58
-
59
- /**
60
- * @dev Constructs the LiquidationProtectionRiskModule
61
- * @param policyPool_ The policyPool
62
- * @param asset_ Address of the asset which price want to protect
63
- * @param referenceCurrency_ Address of the comparison asset (price will be price(asset)/price(currency))
64
- * @param slotSize_ Size of each percentage slot in the pdf function (in wad)
65
- */
66
- /// @custom:oz-upgrades-unsafe-allow constructor
67
- constructor(
68
- IPolicyPool policyPool_,
69
- IERC20Metadata asset_,
70
- IERC20Metadata referenceCurrency_,
71
- uint256 slotSize_
72
- ) RiskModule(policyPool_) {
73
- _asset = asset_;
74
- _referenceCurrency = referenceCurrency_;
75
- _slotSize = slotSize_;
76
- }
77
-
78
- /**
79
- * @dev Initializes the RiskModule
80
- * @param name_ Name of the Risk Module
81
- * @param scrPercentage_ Solvency Capital Requirement percentage, to calculate
82
- * capital requirement as % of (payout - premium) (in ray)
83
- * @param ensuroFee_ % of premium that will go for Ensuro treasury (in ray)
84
- * @param scrInterestRate_ cost of capital (in ray)
85
- * @param maxScrPerPolicy_ Max SCR to be allocated to this module (in wad)
86
- * @param scrLimit_ Max SCR to be allocated to this module (in wad)
87
- * @param wallet_ Address of the RiskModule provider
88
- */
89
- function initialize(
90
- string memory name_,
91
- uint256 scrPercentage_,
92
- uint256 ensuroFee_,
93
- uint256 scrInterestRate_,
94
- uint256 maxScrPerPolicy_,
95
- uint256 scrLimit_,
96
- address wallet_
97
- ) public initializer {
98
- __RiskModule_init(
99
- name_,
100
- scrPercentage_,
101
- ensuroFee_,
102
- scrInterestRate_,
103
- maxScrPerPolicy_,
104
- scrLimit_,
105
- wallet_
106
- );
107
- _internalId = 1;
108
- }
109
-
110
- function _getCurrentPrice() internal view returns (uint256) {
111
- uint256 ret = policyPool().config().exchange().convert(
112
- address(_asset),
113
- address(_referenceCurrency),
114
- 10**_asset.decimals()
115
- );
116
- require(ret != 0, "Price not available");
117
- return ret;
118
- }
119
-
120
- /**
121
- * @dev Returns the premium and lossProb of the policy
122
- * @param triggerPrice Price of the asset_ that will trigger the policy (expressed in _referenceCurrency)
123
- * @param lower If true -> triggers if the price is lower, If false -> triggers if the price is higher
124
- * @param payout Expressed in policyPool.currency()
125
- * @param expiration Expiration of the policy
126
- * @return premium Premium that needs to be paid
127
- * @return lossProb Probability of paying the maximum payout
128
- */
129
- function pricePolicy(
130
- uint256 triggerPrice,
131
- bool lower,
132
- uint256 payout,
133
- uint40 expiration
134
- ) public view override returns (uint256 premium, uint256 lossProb) {
135
- uint256 currentPrice = _getCurrentPrice();
136
- require(
137
- (lower && currentPrice > triggerPrice) || (!lower && currentPrice < triggerPrice),
138
- "Price already at trigger value"
139
- );
140
- lossProb = _computeLossProb(currentPrice, triggerPrice, expiration - uint40(block.timestamp));
141
- if (lossProb == 0) return (0, 0);
142
- premium = getMinimumPremium(payout, lossProb, expiration); // TODO: extra fee for RiskModule?
143
- return (premium, lossProb);
144
- }
145
-
146
- function _computeLossProb(
147
- uint256 currentPrice,
148
- uint256 triggerPrice,
149
- uint40 duration
150
- ) internal view returns (uint256) {
151
- uint256[PRICE_SLOTS] storage pdf = _cdf[
152
- int40((duration + 1800) / 3600) * (currentPrice > triggerPrice ? int40(1) : int40(-1))
153
- ];
154
- uint256 priceJump;
155
- uint256 decimalConv = 10**(18 - _referenceCurrency.decimals());
156
- // Calculate the jump percentage as integer with simetric rounding
157
- if (currentPrice > triggerPrice) {
158
- priceJump =
159
- WadRayMath.wad() -
160
- (triggerPrice * decimalConv).wadDiv(currentPrice * decimalConv);
161
- } else {
162
- priceJump =
163
- (triggerPrice * decimalConv).wadDiv(currentPrice * decimalConv) -
164
- WadRayMath.wad();
165
- }
166
-
167
- uint8 downPerc = uint8((priceJump + _slotSize / 2) / _slotSize);
168
-
169
- if (downPerc >= PRICE_SLOTS) {
170
- return pdf[PRICE_SLOTS - 1];
171
- } else {
172
- return pdf[downPerc];
173
- }
174
- }
175
-
176
- function newPolicy(
177
- uint256 triggerPrice,
178
- bool lower,
179
- uint256 payout,
180
- uint40 expiration
181
- ) external override returns (uint256) {
182
- (uint256 premium, uint256 lossProb) = pricePolicy(triggerPrice, lower, payout, expiration);
183
- require(premium > 0, "Either duration or percentage jump not supported");
184
-
185
- uint256 policyId = (uint256(uint160(address(this))) << 96) + _internalId;
186
- PolicyData storage priceRiskPolicy = _policies[policyId];
187
- address customer = _msgSender();
188
- priceRiskPolicy.ensuroPolicy = _newPolicy(
189
- payout,
190
- premium,
191
- lossProb,
192
- expiration,
193
- customer,
194
- _internalId
195
- );
196
- _internalId += 1;
197
- priceRiskPolicy.triggerPrice = triggerPrice;
198
- priceRiskPolicy.lower = lower;
199
- emit NewPricePolicy(customer, policyId, triggerPrice, lower);
200
- return policyId;
201
- }
202
-
203
- function triggerPolicy(uint256 policyId) external override whenNotPaused {
204
- PolicyData storage policy = _policies[policyId];
205
- uint256 currentPrice = _getCurrentPrice();
206
- require(
207
- !policy.lower || currentPrice <= policy.triggerPrice,
208
- "Condition not met CurrentPrice > triggerPrice"
209
- );
210
- require(
211
- policy.lower || currentPrice >= policy.triggerPrice,
212
- "Condition not met CurrentPrice < triggerPrice"
213
- );
214
-
215
- _policyPool.resolvePolicy(policy.ensuroPolicy, policy.ensuroPolicy.payout);
216
- }
217
-
218
- /**
219
- * @dev Sets the probability distribution for a given duration
220
- * @param duration Duration of the policy in hours (simetric rounding) positive if probability of lower price
221
- * negative if probability of higher price
222
- * @param cdf Array where cdf[i] = prob of price lower/higher than i% of current price
223
- */
224
- function setCDF(int40 duration, uint256[PRICE_SLOTS] calldata cdf)
225
- external
226
- onlyRole(PRICER_ROLE)
227
- whenNotPaused
228
- {
229
- _cdf[duration] = cdf;
230
- }
231
-
232
- function getCDF(int40 duration) external view returns (uint256[PRICE_SLOTS] memory) {
233
- return _cdf[duration];
234
- }
235
-
236
- function referenceCurrency() external view override returns (IERC20Metadata) {
237
- return _referenceCurrency;
238
- }
239
-
240
- function asset() external view override returns (IERC20Metadata) {
241
- return _asset;
242
- }
243
- }
@@ -1,23 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- /**
5
- * @title IAssetManager interface
6
- * @dev Interface for asset manager, that manages assets and refills pool wallet when needed
7
- * @author Ensuro
8
- */
9
- interface IAssetManager {
10
- /**
11
- * @dev This is called from PolicyPool when doesn't have enought money for payment.
12
- * After the call, there should be enought money in PolicyPool.currency().balanceOf(_policyPool) to
13
- * do the payment
14
- * @param paymentAmount The amount of the payment
15
- */
16
- function refillWallet(uint256 paymentAmount) external;
17
-
18
- /**
19
- * @dev Deinvest all the assets and return the cash back to the PolicyPool.
20
- * Called from PolicyPool when new asset manager is assigned
21
- */
22
- function deinvestAll() external;
23
- }
@@ -1,48 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
-
6
- /**
7
- * @title IEToken interface
8
- * @dev Interface for EToken smart contracts, these are the capital pools.
9
- * @author Ensuro
10
- */
11
- interface IEToken is IERC20 {
12
- event SCRLocked(uint256 interestRate, uint256 value);
13
- event SCRUnlocked(uint256 interestRate, uint256 value);
14
-
15
- function ocean() external view returns (uint256);
16
-
17
- function oceanForNewScr() external view returns (uint256);
18
-
19
- function scr() external view returns (uint256);
20
-
21
- function lockScr(uint256 policyInterestRate, uint256 scrAmount) external;
22
-
23
- function unlockScr(uint256 policyInterestRate, uint256 scrAmount) external;
24
-
25
- function discreteEarning(uint256 amount, bool positive) external;
26
-
27
- function assetEarnings(uint256 amount, bool positive) external;
28
-
29
- function deposit(address provider, uint256 amount) external returns (uint256);
30
-
31
- function totalWithdrawable() external view returns (uint256);
32
-
33
- function withdraw(address provider, uint256 amount) external returns (uint256);
34
-
35
- function accepts(address riskModule, uint40 policyExpiration) external view returns (bool);
36
-
37
- function lendToPool(uint256 amount, bool fromOcean) external returns (uint256);
38
-
39
- function repayPoolLoan(uint256 amount) external;
40
-
41
- function getPoolLoan() external view returns (uint256);
42
-
43
- function getInvestable() external view returns (uint256);
44
-
45
- function tokenInterestRate() external view returns (uint256);
46
-
47
- function scrInterestRate() external view returns (uint256);
48
- }
@@ -1,59 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- /**
5
- * @title IPriceOracle - Interface for external price oracle to get assets' prices
6
- * @author Ensuro
7
- */
8
- interface IPriceOracle {
9
- /**
10
- * @dev Returns the price of the asset in ETH
11
- * @param asset Address of a ERC20 asset
12
- * @return Price of the asset in ETH (Wad)
13
- */
14
- function getAssetPrice(address asset) external view returns (uint256);
15
- }
16
-
17
- /**
18
- * @title IExchange - Interface that handles exchange operations between tokens
19
- * @author Ensuro
20
- */
21
- interface IExchange {
22
- function convert(
23
- address assetFrom,
24
- address assetTo,
25
- uint256 amount
26
- ) external view returns (uint256);
27
-
28
- function getExchangeRate(address asset, address expressedInAsset) external view returns (uint256);
29
-
30
- function getAmountIn(
31
- address assetIn,
32
- address assetOut,
33
- uint256 amountOut
34
- ) external view returns (uint256);
35
-
36
- function getSwapRouter() external view returns (address);
37
-
38
- function getPriceOracle() external view returns (IPriceOracle);
39
-
40
- function sell(
41
- address assetIn,
42
- address assetOut,
43
- uint256 amountInExact,
44
- address outAddr,
45
- uint256 deadline
46
- ) external view returns (bytes memory);
47
-
48
- function buy(
49
- address assetIn,
50
- address assetOut,
51
- uint256 amountOutExact,
52
- address outAddr,
53
- uint256 deadline
54
- ) external view returns (bytes memory);
55
-
56
- function decodeSwapOut(bytes memory responseData) external view returns (uint256);
57
-
58
- function maxSlippage() external view returns (uint256);
59
- }
@@ -1,27 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- import {IEToken} from "./IEToken.sol";
5
-
6
- /**
7
- * @title IInsolvencyHook interface
8
- * @dev Interface for insolvency hook, the contract that manages the insolvency situation of the pool
9
- * @author Ensuro
10
- */
11
- interface IInsolvencyHook {
12
- /**
13
- * @dev This is called from PolicyPool when doesn't have enought money for payment.
14
- * After the call, there should be enought money in PolicyPool.currency().balanceOf(_policyPool) to
15
- * do the payment
16
- * @param paymentAmount The amount of the payment
17
- */
18
- function outOfCash(uint256 paymentAmount) external;
19
-
20
- /**
21
- * @dev This is called from EToken when doesn't have enought totalSupply to cover the SCR
22
- * The hook might choose not to do anything or solve the insolvency with a deposit
23
- * @param eToken The token that suffers insolvency
24
- * @param paymentAmount The amount of the payment
25
- */
26
- function insolventEToken(IEToken eToken, uint256 paymentAmount) external;
27
- }
@@ -1,44 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
5
- import {Policy} from "../contracts/Policy.sol";
6
- import {IEToken} from "./IEToken.sol";
7
- import {IPolicyPoolConfig} from "./IPolicyPoolConfig.sol";
8
- import {IAssetManager} from "./IAssetManager.sol";
9
-
10
- interface IPolicyPool {
11
- function currency() external view returns (IERC20Metadata);
12
-
13
- function config() external view returns (IPolicyPoolConfig);
14
-
15
- function policyNFT() external view returns (address);
16
-
17
- function setAssetManager(IAssetManager newAssetManager) external;
18
-
19
- function newPolicy(
20
- Policy.PolicyData memory policy,
21
- address customer,
22
- uint96 internalId
23
- ) external returns (uint256);
24
-
25
- function resolvePolicy(Policy.PolicyData calldata policy, uint256 payout) external;
26
-
27
- function resolvePolicyFullPayout(Policy.PolicyData calldata policy, bool customerWon) external;
28
-
29
- function receiveGrant(uint256 amount) external;
30
-
31
- function getInvestable() external view returns (uint256);
32
-
33
- function getETokenCount() external view returns (uint256);
34
-
35
- function getETokenAt(uint256 index) external view returns (IEToken);
36
-
37
- function assetEarnings(uint256 amount, bool positive) external;
38
-
39
- function deposit(IEToken eToken, uint256 amount) external;
40
-
41
- function withdraw(IEToken eToken, uint256 amount) external returns (uint256);
42
-
43
- function totalETokenSupply() external view returns (uint256);
44
- }
@@ -1,29 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- /**
5
- * @title IRiskModule interface
6
- * @dev Interface for RiskModule smart contracts. Gives access to RiskModule configuration parameters
7
- * @author Ensuro
8
- */
9
- interface IRiskModule {
10
- function name() external view returns (string memory);
11
-
12
- function scrPercentage() external view returns (uint256);
13
-
14
- function moc() external view returns (uint256);
15
-
16
- function ensuroFee() external view returns (uint256);
17
-
18
- function scrInterestRate() external view returns (uint256);
19
-
20
- function maxScrPerPolicy() external view returns (uint256);
21
-
22
- function scrLimit() external view returns (uint256);
23
-
24
- function totalScr() external view returns (uint256);
25
-
26
- function wallet() external view returns (address);
27
-
28
- function releaseScr(uint256 scrAmount) external;
29
- }