@ensuro/core 2.0.0-beta1 → 2.0.0-beta10

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 (79) hide show
  1. package/README.md +23 -14
  2. package/build/contracts/AccessManager.sol/AccessManager.json +559 -0
  3. package/build/contracts/ERC4626AssetManager.sol/ERC4626AssetManager.json +219 -0
  4. package/build/contracts/EToken.sol/EToken.json +134 -52
  5. package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +4 -4
  6. package/build/contracts/LiquidityThresholdAssetManager.sol/LiquidityThresholdAssetManager.json +203 -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 +2 -2
  10. package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +123 -16
  11. package/build/contracts/Reserve.sol/Reserve.json +66 -8
  12. package/build/contracts/RiskModule.sol/RiskModule.json +2 -2
  13. package/build/contracts/SignedQuoteRiskModule.sol/SignedQuoteRiskModule.json +960 -0
  14. package/build/contracts/TimeScaled.sol/TimeScaled.json +3 -17
  15. package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +5 -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 +109 -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/IPremiumsAccount.sol/IPremiumsAccount.json +13 -0
  22. package/build/contracts/mocks/FixedRateVault.sol/FixedRateVault.json +736 -0
  23. package/build/contracts/mocks/ForwardProxy.sol/ForwardProxy.json +2 -2
  24. package/build/contracts/mocks/PolicyHolderMock.sol/PolicyHolderMock.json +28 -2
  25. package/build/contracts/mocks/PolicyPoolComponentMock.sol/PolicyPoolComponentMock.json +2 -2
  26. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMock.json +118 -19
  27. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMockForward.json +6 -6
  28. package/build/contracts/mocks/RiskModuleMock.sol/RiskModuleMock.json +764 -0
  29. package/build/contracts/mocks/TestCurrency.sol/TestCurrency.json +2 -2
  30. package/build/contracts/mocks/TestNFT.sol/TestNFT.json +2 -2
  31. package/contracts/AccessManager.sol +103 -0
  32. package/contracts/ERC4626AssetManager.sol +52 -0
  33. package/contracts/EToken.sol +123 -87
  34. package/contracts/LPManualWhitelist.sol +1 -1
  35. package/contracts/LiquidityThresholdAssetManager.sol +160 -0
  36. package/contracts/Policy.sol +1 -1
  37. package/contracts/PolicyPool.sol +333 -115
  38. package/contracts/PolicyPoolComponent.sol +36 -41
  39. package/contracts/PremiumsAccount.sol +285 -79
  40. package/contracts/Reserve.sol +183 -4
  41. package/contracts/RiskModule.sol +26 -19
  42. package/contracts/SignedQuoteRiskModule.sol +241 -0
  43. package/contracts/TimeScaled.sol +19 -15
  44. package/contracts/TrustfulRiskModule.sol +62 -2
  45. package/contracts/dependencies/WadRayMath.sol +126 -0
  46. package/contracts/interfaces/IAccessManager.sol +148 -0
  47. package/contracts/interfaces/IAssetManager.sol +84 -0
  48. package/contracts/interfaces/IEToken.sol +25 -2
  49. package/contracts/interfaces/ILPWhitelist.sol +17 -0
  50. package/contracts/interfaces/IPolicyPool.sol +20 -13
  51. package/contracts/interfaces/IPolicyPoolComponent.sol +3 -0
  52. package/contracts/interfaces/IPremiumsAccount.sol +5 -0
  53. package/contracts/interfaces/IRiskModule.sol +67 -4
  54. package/contracts/mocks/FixedRateVault.sol +85 -0
  55. package/contracts/mocks/PolicyHolderMock.sol +21 -0
  56. package/contracts/mocks/PolicyPoolMock.sol +41 -15
  57. package/contracts/mocks/RiskModuleMock.sol +75 -0
  58. package/js/test-utils.js +227 -149
  59. package/package.json +1 -1
  60. package/build/contracts/FlightDelayRiskModule.sol/FlightDelayRiskModule.json +0 -890
  61. package/build/contracts/PolicyNFT.sol/PolicyNFT.json +0 -583
  62. package/build/contracts/PolicyPoolConfig.sol/PolicyPoolConfig.json +0 -691
  63. package/build/contracts/dependencies/ChainlinkClientUpgradeable.sol/ChainlinkClientUpgradeable.json +0 -63
  64. package/build/contracts/interfaces/IPolicyNFT.sol/IPolicyNFT.json +0 -321
  65. package/build/contracts/mocks/LinkTokenMock.sol/LinkTokenMock.json +0 -370
  66. package/build/contracts/mocks/TestCurrencyUUPS.sol/TestCurrencyUUPS.json +0 -353
  67. package/build/contracts/upgraded/IPolicyNFTv1.sol/IPolicyNFTv1.json +0 -322
  68. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1.json +0 -584
  69. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1_Upgrade.json +0 -615
  70. package/contracts/FlightDelayRiskModule.sol +0 -217
  71. package/contracts/PolicyNFT.sol +0 -96
  72. package/contracts/PolicyPoolConfig.sol +0 -204
  73. package/contracts/WadRayMath.sol +0 -135
  74. package/contracts/dependencies/ChainlinkClientUpgradeable.sol +0 -371
  75. package/contracts/interfaces/IPolicyNFT.sol +0 -15
  76. package/contracts/interfaces/IPolicyPoolConfig.sol +0 -96
  77. package/contracts/mocks/LinkTokenMock.sol +0 -30
  78. package/contracts/upgraded/IPolicyNFTv1.sol +0 -15
  79. package/contracts/upgraded/PolicyNFTv1.sol +0 -126
@@ -9,6 +9,9 @@ import {IPremiumsAccount} from "./IPremiumsAccount.sol";
9
9
  * @author Ensuro
10
10
  */
11
11
  interface IRiskModule {
12
+ /**
13
+ * @dev Enum with the different parameters of the risk module, used in {RiskModule-setParam}.
14
+ */
12
15
  enum Parameter {
13
16
  moc,
14
17
  jrCollRatio,
@@ -22,28 +25,85 @@ interface IRiskModule {
22
25
  maxDuration
23
26
  }
24
27
 
28
+ /**
29
+ * Struct of the parameters of the risk module that are used to calculate the different Policy fields (see
30
+ * {Policy-PolicyData}.
31
+ */
25
32
  struct Params {
33
+ /**
34
+ * @dev MoC (Margin of Conservativism) is a factor that multiplies the lossProb to increase or decrease the pure
35
+ * premium.
36
+ */
26
37
  uint256 moc;
38
+ /**
39
+ * @dev Junior Collateralization Ratio is the percentage of policy exposure (payout) that will be covered with the
40
+ * purePremium and the Junior EToken
41
+ */
27
42
  uint256 jrCollRatio;
43
+ /**
44
+ * @dev Collateralization Ratio is the percentage of policy exposure (payout) that will be covered by the
45
+ * purePremium and the Junior and Senior EToken. Usually is calculated as the relation between VAR99.5% and VAR100
46
+ * (full collateralization).
47
+ */
28
48
  uint256 collRatio;
49
+ /**
50
+ * @dev Ensuro PurePremium Fee is the percentage that will be multiplied by the pure premium to obtain the part of
51
+ * the Ensuro Fee that's proportional to the pure premium.
52
+ */
29
53
  uint256 ensuroPpFee;
54
+ /**
55
+ * @dev Ensuro Cost of Capital Fee is the percentage that will be multiplied by the cost of capital (CoC) to
56
+ * obtain the part of the Ensuro Fee that's proportional to the CoC.
57
+ */
30
58
  uint256 ensuroCocFee;
59
+ /**
60
+ * @dev Junior Return on Capital is the annualized interest rate that's charged for the capital locked in the Junior
61
+ * EToken.
62
+ */
31
63
  uint256 jrRoc;
64
+ /**
65
+ * @dev Senior Return on Capital is the annualized interest rate that's charged for the capital locked in the Senior
66
+ * EToken.
67
+ */
32
68
  uint256 srRoc;
33
69
  }
34
70
 
71
+ /**
72
+ * @dev A readable name of this risk module. Never changes.
73
+ */
35
74
  function name() external view returns (string memory);
36
75
 
76
+ /**
77
+ * @dev Returns different parameters of the risk module (see {Params})
78
+ */
37
79
  function params() external view returns (Params memory);
38
80
 
39
- function maxPayoutPerPolicy() external view returns (uint256);
40
-
41
- function exposureLimit() external view returns (uint256);
42
-
81
+ /**
82
+ * @dev Returns the maximum duration (in hours) of the policies of this risk module.
83
+ * The `expiration` of the policies has to be `<= (block.timestamp + 3600 * maxDuration())`
84
+ */
43
85
  function maxDuration() external view returns (uint256);
44
86
 
87
+ /**
88
+ * @dev Returns the maximum payout accepted for new policies.
89
+ */
90
+ function maxPayoutPerPolicy() external view returns (uint256);
91
+
92
+ /**
93
+ * @dev Returns sum of the (maximum) payout of the active policies of this risk module, i.e. the maximum possible
94
+ * amount of money that's exposed for this risk module.
95
+ */
45
96
  function activeExposure() external view returns (uint256);
46
97
 
98
+ /**
99
+ * @dev Returns maximum exposure (sum of the (maximum) payout of the active policies) of this risk module.
100
+ * `activeExposure() <= exposureLimit()` always
101
+ */
102
+ function exposureLimit() external view returns (uint256);
103
+
104
+ /**
105
+ * @dev Returns the address of the partner that receives the partnerCommission
106
+ */
47
107
  function wallet() external view returns (address);
48
108
 
49
109
  /**
@@ -56,5 +116,8 @@ interface IRiskModule {
56
116
  */
57
117
  function releaseExposure(uint256 payout) external;
58
118
 
119
+ /**
120
+ * @dev Returns the {PremiumsAccount} where the premiums of this risk module are collected. Never changes.
121
+ */
59
122
  function premiumsAccount() external view returns (IPremiumsAccount);
60
123
  }
@@ -0,0 +1,85 @@
1
+ //SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
5
+ import {ERC4626} from "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";
6
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
7
+ import {IMintableERC20} from "./IMintableERC20.sol";
8
+ import {TimeScaled} from "../TimeScaled.sol";
9
+
10
+ contract FixedRateVault is ERC4626 {
11
+ using TimeScaled for TimeScaled.ScaledAmount;
12
+
13
+ uint256 internal _interestRate;
14
+ TimeScaled.ScaledAmount internal _totalAssets;
15
+ bool internal _broken;
16
+
17
+ constructor(
18
+ string memory name_,
19
+ string memory symbol_,
20
+ IERC20Metadata asset_,
21
+ uint256 interestRate_
22
+ ) ERC20(name_, symbol_) ERC4626(asset_) {
23
+ _interestRate = interestRate_;
24
+ _totalAssets.init();
25
+ }
26
+
27
+ /** @dev See {IERC4262-totalAssets}. */
28
+ function totalAssets() public view virtual override returns (uint256) {
29
+ require(!_broken, "Vault is broken");
30
+ return _totalAssets.getScaledAmount(_interestRate);
31
+ }
32
+
33
+ /**
34
+ * @dev Deposit/mint common workflow.
35
+ */
36
+ function _deposit(
37
+ address caller,
38
+ address receiver,
39
+ uint256 assets,
40
+ uint256 shares
41
+ ) internal virtual override {
42
+ require(!_broken, "Vault is broken");
43
+ _totalAssets.add(assets, _interestRate);
44
+ super._deposit(caller, receiver, assets, shares);
45
+ }
46
+
47
+ /**
48
+ * @dev Withdraw/redeem common workflow.
49
+ */
50
+ function _withdraw(
51
+ address caller,
52
+ address receiver,
53
+ address owner,
54
+ uint256 assets,
55
+ uint256 shares
56
+ ) internal virtual override {
57
+ require(!_broken, "Vault is broken");
58
+ _totalAssets.sub(assets, _interestRate);
59
+ uint256 balance = IERC20Metadata(asset()).balanceOf(address(this));
60
+ if (balance < assets) {
61
+ // Here comes the magic! Free money!
62
+ IMintableERC20(asset()).mint(address(this), assets - balance);
63
+ }
64
+ super._withdraw(caller, receiver, owner, assets, shares);
65
+ }
66
+
67
+ /*
68
+ * @dev Adds or remove assets not generated by deposits/withdraw - For testing discrete earnings/losses
69
+ */
70
+ function discreteEarning(int256 assets) external {
71
+ if (assets > 0) {
72
+ _totalAssets.add(uint256(assets), _interestRate);
73
+ } else {
74
+ _totalAssets.sub(uint256(-assets), _interestRate);
75
+ }
76
+ }
77
+
78
+ function setBroken(bool broken_) external {
79
+ _broken = broken_;
80
+ }
81
+
82
+ function broken() external view returns (bool) {
83
+ return _broken;
84
+ }
85
+ }
@@ -8,11 +8,13 @@ contract PolicyHolderMock is IPolicyHolder {
8
8
  uint256 public policyId;
9
9
  uint256 public payout;
10
10
  bool public fail;
11
+ bool public notImplemented;
11
12
 
12
13
  event NotificationReceived(uint256 kind, uint256 policyId, address operator, address from);
13
14
 
14
15
  constructor(bool fail_) {
15
16
  fail = fail_;
17
+ notImplemented = false;
16
18
  payout = type(uint256).max;
17
19
  }
18
20
 
@@ -20,12 +22,21 @@ contract PolicyHolderMock is IPolicyHolder {
20
22
  fail = fail_;
21
23
  }
22
24
 
25
+ function setNotImplemented(bool notImplemented_) external {
26
+ notImplemented = notImplemented_;
27
+ }
28
+
23
29
  function onERC721Received(
24
30
  address operator,
25
31
  address from,
26
32
  uint256 policyId_,
27
33
  bytes calldata
28
34
  ) external override returns (bytes4) {
35
+ if (notImplemented)
36
+ // solhint-disable-next-line no-inline-assembly
37
+ assembly {
38
+ revert(0, 0)
39
+ }
29
40
  if (fail) revert("onERC721Received: They told me I have to fail");
30
41
  policyId = policyId_;
31
42
  emit NotificationReceived(0, policyId_, operator, from);
@@ -37,6 +48,11 @@ contract PolicyHolderMock is IPolicyHolder {
37
48
  address from,
38
49
  uint256 policyId_
39
50
  ) external override returns (bytes4) {
51
+ if (notImplemented)
52
+ // solhint-disable-next-line no-inline-assembly
53
+ assembly {
54
+ revert(0, 0)
55
+ }
40
56
  if (fail) revert("onPolicyExpired: They told me I have to fail");
41
57
  policyId = policyId_;
42
58
  payout = 0;
@@ -59,6 +75,11 @@ contract PolicyHolderMock is IPolicyHolder {
59
75
  uint256 policyId_,
60
76
  uint256 amount
61
77
  ) external override returns (bytes4) {
78
+ if (notImplemented)
79
+ // solhint-disable-next-line no-inline-assembly
80
+ assembly {
81
+ revert(0, 0)
82
+ }
62
83
  if (fail) revert("onPayoutReceived: They told me I have to fail");
63
84
  policyId = policyId_;
64
85
  payout = amount;
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
4
4
  import {IPolicyPool} from "../interfaces/IPolicyPool.sol";
5
5
  import {IRiskModule} from "../interfaces/IRiskModule.sol";
6
6
  import {IEToken} from "../interfaces/IEToken.sol";
7
- import {IPolicyPoolConfig} from "../interfaces/IPolicyPoolConfig.sol";
7
+ import {IAccessManager} from "../interfaces/IAccessManager.sol";
8
8
  import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
9
9
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
10
10
  import {Policy} from "../Policy.sol";
@@ -17,7 +17,7 @@ contract PolicyPoolMock is IPolicyPool {
17
17
  0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
18
18
 
19
19
  IERC20Metadata internal _currency;
20
- IPolicyPoolConfig internal _config;
20
+ IAccessManager internal _access;
21
21
 
22
22
  mapping(uint256 => Policy.PolicyData) internal policies;
23
23
  mapping(uint256 => bytes32) internal policyHashes;
@@ -25,27 +25,27 @@ contract PolicyPoolMock is IPolicyPool {
25
25
  event NewPolicy(IRiskModule indexed riskModule, Policy.PolicyData policy);
26
26
  event PolicyResolved(IRiskModule indexed riskModule, uint256 indexed policyId, uint256 payout);
27
27
 
28
- constructor(IERC20Metadata currency_, IPolicyPoolConfig config_) {
28
+ constructor(IERC20Metadata currency_, IAccessManager access_) {
29
29
  _currency = currency_;
30
- _config = config_;
31
- _config.connect();
30
+ _access = access_;
32
31
  }
33
32
 
34
33
  function currency() external view override returns (IERC20Metadata) {
35
34
  return _currency;
36
35
  }
37
36
 
38
- function config() external view override returns (IPolicyPoolConfig) {
39
- return _config;
37
+ function access() external view override returns (IAccessManager) {
38
+ return _access;
40
39
  }
41
40
 
42
- function policyNFT() external pure override returns (address) {
41
+ function treasury() external pure override returns (address) {
43
42
  return address(0);
44
43
  }
45
44
 
46
45
  function newPolicy(
47
46
  Policy.PolicyData memory policy,
48
- address, /* customer */
47
+ address, /* caller */
48
+ address, /* policyHolder */
49
49
  uint96 internalId
50
50
  ) external override returns (uint256) {
51
51
  policy.id = (uint256(uint160(address(policy.riskModule))) << 96) + internalId;
@@ -81,6 +81,10 @@ contract PolicyPoolMock is IPolicyPool {
81
81
  return _resolvePolicy(policy, customerWon ? policy.payout : 0);
82
82
  }
83
83
 
84
+ function isActive(uint256 policyId) external view override returns (bool) {
85
+ return policyHashes[policyId] != bytes32(0);
86
+ }
87
+
84
88
  function deposit(IEToken, uint256) external pure override {
85
89
  revert("Not Implemented deposit");
86
90
  }
@@ -88,6 +92,29 @@ contract PolicyPoolMock is IPolicyPool {
88
92
  function withdraw(IEToken, uint256) external pure override returns (uint256) {
89
93
  revert("Not Implemented withdraw");
90
94
  }
95
+
96
+ /**
97
+ * @dev Simple passthrough method for testing Policy.initialize
98
+ */
99
+ function initializeAndEmitPolicy(
100
+ IRiskModule riskModule,
101
+ IRiskModule.Params memory rmParams,
102
+ uint256 premium,
103
+ uint256 payout,
104
+ uint256 lossProb,
105
+ uint40 expiration
106
+ ) external {
107
+ Policy.PolicyData memory policy = Policy.initialize(
108
+ riskModule,
109
+ rmParams,
110
+ premium,
111
+ payout,
112
+ lossProb,
113
+ expiration
114
+ );
115
+
116
+ emit NewPolicy(riskModule, policy);
117
+ }
91
118
  }
92
119
 
93
120
  /**
@@ -100,23 +127,22 @@ contract PolicyPoolMockForward is ForwardProxy {
100
127
  0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
101
128
 
102
129
  IERC20Metadata internal _currency;
103
- IPolicyPoolConfig internal _config;
130
+ IAccessManager internal _access;
104
131
 
105
132
  constructor(
106
133
  address forwardTo,
107
134
  IERC20Metadata currency_,
108
- IPolicyPoolConfig config_
135
+ IAccessManager access_
109
136
  ) ForwardProxy(forwardTo) {
110
137
  _currency = currency_;
111
- _config = config_;
112
- _config.connect();
138
+ _access = access_;
113
139
  }
114
140
 
115
141
  function currency() external view returns (IERC20Metadata) {
116
142
  return _currency;
117
143
  }
118
144
 
119
- function config() external view returns (IPolicyPoolConfig) {
120
- return _config;
145
+ function access() external view returns (IAccessManager) {
146
+ return _access;
121
147
  }
122
148
  }
@@ -0,0 +1,75 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {IPolicyPool} from "../interfaces/IPolicyPool.sol";
5
+ import {IPremiumsAccount} from "../interfaces/IPremiumsAccount.sol";
6
+ import {RiskModule} from "../RiskModule.sol";
7
+ import {Policy} from "../Policy.sol";
8
+
9
+ /**
10
+ * @title Trustful Risk Module
11
+ * @dev Risk Module without any validation, just the newPolicy and resolvePolicy need to be called by
12
+ authorized users
13
+ * @custom:security-contact security@ensuro.co
14
+ * @author Ensuro
15
+ */
16
+
17
+ contract RiskModuleMock is RiskModule {
18
+ bytes32 public constant PRICER_ROLE = keccak256("PRICER_ROLE");
19
+ bytes32 public constant RESOLVER_ROLE = keccak256("RESOLVER_ROLE");
20
+
21
+ /// @custom:oz-upgrades-unsafe-allow constructor
22
+ // solhint-disable-next-line no-empty-blocks
23
+ constructor(IPolicyPool policyPool_, IPremiumsAccount premiumsAccount_)
24
+ RiskModule(policyPool_, premiumsAccount_)
25
+ {} // solhint-disable-line no-empty-blocks
26
+
27
+ /**
28
+ * @dev Initializes the RiskModule
29
+ * @param name_ Name of the Risk Module
30
+ * @param collRatio_ Collateralization ratio to compute solvency requirement as % of payout (in ray)
31
+ * @param ensuroPpFee_ % of pure premium that will go for Ensuro treasury (in ray)
32
+ * @param srRoc_ return on capital paid to Senior LPs (annualized percentage - in ray)
33
+ * @param maxPayoutPerPolicy_ Maximum payout per policy (in wad)
34
+ * @param exposureLimit_ Max exposure (sum of payouts) to be allocated to this module (in wad)
35
+ * @param wallet_ Address of the RiskModule provider
36
+ */
37
+ function initialize(
38
+ string memory name_,
39
+ uint256 collRatio_,
40
+ uint256 ensuroPpFee_,
41
+ uint256 srRoc_,
42
+ uint256 maxPayoutPerPolicy_,
43
+ uint256 exposureLimit_,
44
+ address wallet_
45
+ ) public initializer {
46
+ __RiskModule_init(
47
+ name_,
48
+ collRatio_,
49
+ ensuroPpFee_,
50
+ srRoc_,
51
+ maxPayoutPerPolicy_,
52
+ exposureLimit_,
53
+ wallet_
54
+ );
55
+ }
56
+
57
+ function newPolicy(
58
+ uint256 payout,
59
+ uint256 premium,
60
+ uint256 lossProb,
61
+ uint40 expiration,
62
+ address payer,
63
+ address onBehalfOf,
64
+ uint96 internalId
65
+ ) external onlyComponentRole(PRICER_ROLE) returns (uint256) {
66
+ return _newPolicy(payout, premium, lossProb, expiration, payer, onBehalfOf, internalId).id;
67
+ }
68
+
69
+ function resolvePolicy(Policy.PolicyData calldata policy, uint256 payout)
70
+ external
71
+ onlyComponentRole(RESOLVER_ROLE)
72
+ {
73
+ _policyPool.resolvePolicy(policy, payout);
74
+ }
75
+ }