@ensuro/core 2.6.2 → 2.8.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 (79) hide show
  1. package/README.md +11 -5
  2. package/contracts/AccessManager.sol +3 -13
  3. package/contracts/EToken.sol +29 -95
  4. package/contracts/LPManualWhitelist.sol +11 -26
  5. package/contracts/LiquidityThresholdAssetManager.sol +10 -21
  6. package/contracts/Policy.sol +6 -17
  7. package/contracts/PolicyPool.sol +39 -91
  8. package/contracts/PolicyPoolComponent.sol +9 -32
  9. package/contracts/PremiumsAccount.sol +16 -47
  10. package/contracts/Reserve.sol +10 -16
  11. package/contracts/RiskModule.sol +22 -80
  12. package/contracts/SignedBucketRiskModule.sol +18 -80
  13. package/contracts/SignedQuoteRiskModule.sol +13 -44
  14. package/contracts/TieredSignedQuoteRiskModule.sol +7 -13
  15. package/contracts/TimeScaled.sol +8 -39
  16. package/contracts/TrustfulRiskModule.sol +13 -48
  17. package/contracts/interfaces/IAccessManager.sol +2 -11
  18. package/contracts/interfaces/IEToken.sol +1 -5
  19. package/contracts/interfaces/ILPWhitelist.sol +2 -10
  20. package/contracts/interfaces/IPolicyHolder.sol +2 -11
  21. package/contracts/interfaces/IPremiumsAccount.sol +1 -5
  22. package/contracts/migration/LPManualWhitelistV20.sol +3 -15
  23. package/contracts/migration/LPManualWhitelistV20Upgraded.sol +1 -5
  24. package/contracts/mocks/FixedRateVault.sol +1 -6
  25. package/contracts/mocks/PolicyHolderMock.sol +73 -29
  26. package/contracts/mocks/PolicyPoolComponentMock.sol +1 -3
  27. package/contracts/mocks/PolicyPoolMock.sol +8 -28
  28. package/contracts/mocks/RiskModuleMock.sol +3 -16
  29. package/contracts/mocks/TestNFT.sol +1 -1
  30. package/js/constants.js +8 -2
  31. package/js/deploy.js +65 -62
  32. package/js/enums.js +26 -8
  33. package/js/test-utils.js +105 -23
  34. package/js/utils.js +78 -28
  35. package/package.json +1 -1
  36. package/scripts/utils.sh +23 -12
  37. package/build/contracts/AccessManager.sol/AccessManager.json +0 -618
  38. package/build/contracts/ERC4626AssetManager.sol/ERC4626AssetManager.json +0 -238
  39. package/build/contracts/EToken.sol/EToken.json +0 -1277
  40. package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +0 -647
  41. package/build/contracts/LiquidityThresholdAssetManager.sol/LiquidityThresholdAssetManager.json +0 -222
  42. package/build/contracts/Policy.sol/Policy.json +0 -10
  43. package/build/contracts/PolicyPool.sol/PolicyPool.json +0 -1416
  44. package/build/contracts/PolicyPoolComponent.sol/PolicyPoolComponent.json +0 -332
  45. package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +0 -970
  46. package/build/contracts/Reserve.sol/Reserve.json +0 -403
  47. package/build/contracts/RiskModule.sol/RiskModule.json +0 -559
  48. package/build/contracts/SignedBucketRiskModule.sol/SignedBucketRiskModule.json +0 -1262
  49. package/build/contracts/SignedQuoteRiskModule.sol/SignedQuoteRiskModule.json +0 -1110
  50. package/build/contracts/TieredSignedQuoteRiskModule.sol/TieredSignedQuoteRiskModule.json +0 -1316
  51. package/build/contracts/TimeScaled.sol/TimeScaled.json +0 -10
  52. package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +0 -984
  53. package/build/contracts/dependencies/ERC1967Proxy.sol/ERC1967Proxy.json +0 -64
  54. package/build/contracts/dependencies/IERC20Metadata.sol/IERC20Metadata.json +0 -233
  55. package/build/contracts/dependencies/WadRayMath.sol/WadRayMath.json +0 -10
  56. package/build/contracts/interfaces/IAccessManager.sol/IAccessManager.json +0 -343
  57. package/build/contracts/interfaces/IAssetManager.sol/IAssetManager.json +0 -128
  58. package/build/contracts/interfaces/IEToken.sol/IEToken.json +0 -460
  59. package/build/contracts/interfaces/ILPWhitelist.sol/ILPWhitelist.json +0 -103
  60. package/build/contracts/interfaces/IPolicyHolder.sol/IPolicyHolder.json +0 -108
  61. package/build/contracts/interfaces/IPolicyPool.sol/IPolicyPool.json +0 -501
  62. package/build/contracts/interfaces/IPolicyPoolComponent.sol/IPolicyPoolComponent.json +0 -43
  63. package/build/contracts/interfaces/IPremiumsAccount.sol/IPremiumsAccount.json +0 -315
  64. package/build/contracts/interfaces/IRiskModule.sol/IRiskModule.json +0 -165
  65. package/build/contracts/migration/LPManualWhitelistV20.sol/LPManualWhitelistV20.json +0 -481
  66. package/build/contracts/migration/LPManualWhitelistV20Upgraded.sol/LPManualWhitelistV20Upgraded.json +0 -492
  67. package/build/contracts/mocks/FixedRateVault.sol/FixedRateVault.json +0 -736
  68. package/build/contracts/mocks/ForwardProxy.sol/ForwardProxy.json +0 -43
  69. package/build/contracts/mocks/IMintableERC20.sol/IMintableERC20.json +0 -47
  70. package/build/contracts/mocks/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +0 -180
  71. package/build/contracts/mocks/PolicyHolderMock.sol/PolicyHolderMock.json +0 -228
  72. package/build/contracts/mocks/PolicyPoolComponentMock.sol/PolicyPoolComponentMock.json +0 -54
  73. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMock.json +0 -721
  74. package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMockForward.json +0 -92
  75. package/build/contracts/mocks/RiskModuleMock.sol/RiskModuleMock.json +0 -783
  76. package/build/contracts/mocks/TestCurrency.sol/TestCurrency.json +0 -343
  77. package/build/contracts/mocks/TestNFT.sol/TestNFT.json +0 -388
  78. package/contracts/dependencies/ERC1967Proxy.sol +0 -19
  79. package/contracts/dependencies/IERC20Metadata.sol +0 -19
@@ -108,11 +108,7 @@ interface IAccessManager is IAccessControlUpgradeable {
108
108
  * @param role2 Another role such as `keccak256("GUARDIAN_ROLE")` that's global
109
109
  * @param account The user address for who we want to verify the permission
110
110
  */
111
- function checkRole2(
112
- bytes32 role1,
113
- bytes32 role2,
114
- address account
115
- ) external view;
111
+ function checkRole2(bytes32 role1, bytes32 role2, address account) external view;
116
112
 
117
113
  /**
118
114
  * @dev Checks if a user has been granted a given component role and reverts if it doesn't
@@ -122,12 +118,7 @@ interface IAccessManager is IAccessControlUpgradeable {
122
118
  * @param alsoGlobal If true, it will accept not only the component role, but also the (global) `role` itself.
123
119
  * If false, only the component role is accepted
124
120
  */
125
- function checkComponentRole(
126
- address component,
127
- bytes32 role,
128
- address account,
129
- bool alsoGlobal
130
- ) external view;
121
+ function checkComponentRole(address component, bytes32 role, address account, bool alsoGlobal) external view;
131
122
 
132
123
  /**
133
124
  * @dev Checks if a user has been granted any of the two component roles specified and reverts if it doesn't
@@ -67,11 +67,7 @@ interface IEToken is IERC20 {
67
67
  * @param policyInterestRate The annualized interest rate that was paid for the `scrAmount`, must be the same that was
68
68
  * sent in `lockScr` call.
69
69
  */
70
- function unlockScr(
71
- uint256 scrAmount,
72
- uint256 policyInterestRate,
73
- int256 adjustment
74
- ) external;
70
+ function unlockScr(uint256 scrAmount, uint256 policyInterestRate, int256 adjustment) external;
75
71
 
76
72
  /**
77
73
  * @dev Registers a deposit of liquidity in the pool. Called from the PolicyPool, assumes the amount has already been
@@ -16,11 +16,7 @@ interface ILPWhitelist {
16
16
  * @param amount The amount of the deposit
17
17
  * @return true if `provider` deposit is accepted, false if not
18
18
  */
19
- function acceptsDeposit(
20
- IEToken etoken,
21
- address provider,
22
- uint256 amount
23
- ) external view returns (bool);
19
+ function acceptsDeposit(IEToken etoken, address provider, uint256 amount) external view returns (bool);
24
20
 
25
21
  /**
26
22
  * @dev Indicates whether or not the eTokens can be transferred from `providerFrom` to `providerTo`
@@ -46,9 +42,5 @@ interface ILPWhitelist {
46
42
  * @param amount The amount of the withdrawal
47
43
  * @return true if `provider` withdraw request is accepted, false if not
48
44
  */
49
- function acceptsWithdrawal(
50
- IEToken etoken,
51
- address provider,
52
- uint256 amount
53
- ) external view returns (bool);
45
+ function acceptsWithdrawal(IEToken etoken, address provider, uint256 amount) external view returns (bool);
54
46
  }
@@ -18,11 +18,7 @@ interface IPolicyHolder is IERC721Receiver {
18
18
  *
19
19
  * The selector can be obtained in Solidity with `IPolicyPool.onPolicyExpired.selector`.
20
20
  */
21
- function onPolicyExpired(
22
- address operator,
23
- address from,
24
- uint256 policyId
25
- ) external returns (bytes4);
21
+ function onPolicyExpired(address operator, address from, uint256 policyId) external returns (bytes4);
26
22
 
27
23
  /**
28
24
  * @dev Whenever an Policy is resolved with payout > 0, this function is called
@@ -33,10 +29,5 @@ interface IPolicyHolder is IERC721Receiver {
33
29
  *
34
30
  * The selector can be obtained in Solidity with `IPolicyPool.onPayoutReceived.selector`.
35
31
  */
36
- function onPayoutReceived(
37
- address operator,
38
- address from,
39
- uint256 policyId,
40
- uint256 amount
41
- ) external returns (bytes4);
32
+ function onPayoutReceived(address operator, address from, uint256 policyId, uint256 amount) external returns (bytes4);
42
33
  }
@@ -39,11 +39,7 @@ interface IPremiumsAccount {
39
39
  * @param policy The policy that was resolved
40
40
  * @param payout The amount that has to be transferred to `policyHolder`
41
41
  */
42
- function policyResolvedWithPayout(
43
- address policyHolder,
44
- Policy.PolicyData memory policy,
45
- uint256 payout
46
- ) external;
42
+ function policyResolvedWithPayout(address policyHolder, Policy.PolicyData memory policy, uint256 payout) external;
47
43
 
48
44
  /**
49
45
  * @dev The PremiumsAccount is notified that the policy has expired, unlocks the SCR and earns the pure premium.
@@ -30,10 +30,7 @@ abstract contract LPManualWhitelistV20 is ILPWhitelist, PolicyPoolComponent {
30
30
  __PolicyPoolComponent_init();
31
31
  }
32
32
 
33
- function whitelistAddress(address provider, bool whitelisted)
34
- external
35
- onlyComponentRole(LP_WHITELIST_ROLE)
36
- {
33
+ function whitelistAddress(address provider, bool whitelisted) external onlyComponentRole(LP_WHITELIST_ROLE) {
37
34
  if (_whitelisted[provider] != whitelisted) {
38
35
  _whitelisted[provider] = whitelisted;
39
36
  emit LPWhitelisted(provider, whitelisted);
@@ -47,20 +44,11 @@ abstract contract LPManualWhitelistV20 is ILPWhitelist, PolicyPoolComponent {
47
44
  return super.supportsInterface(interfaceId) || interfaceId == type(ILPWhitelist).interfaceId;
48
45
  }
49
46
 
50
- function acceptsDeposit(
51
- IEToken,
52
- address provider,
53
- uint256
54
- ) external view override returns (bool) {
47
+ function acceptsDeposit(IEToken, address provider, uint256) external view override returns (bool) {
55
48
  return _whitelisted[provider];
56
49
  }
57
50
 
58
- function acceptsTransfer(
59
- IEToken,
60
- address,
61
- address providerTo,
62
- uint256
63
- ) external view override returns (bool) {
51
+ function acceptsTransfer(IEToken, address, address providerTo, uint256) external view override returns (bool) {
64
52
  return _whitelisted[providerTo];
65
53
  }
66
54
 
@@ -15,11 +15,7 @@ import {LPManualWhitelistV20} from "./LPManualWhitelistV20.sol";
15
15
  contract LPManualWhitelistV20Upgraded is LPManualWhitelistV20 {
16
16
  constructor(IPolicyPool policyPool_) LPManualWhitelistV20(policyPool_) {}
17
17
 
18
- function acceptsWithdrawal(
19
- IEToken etk,
20
- address provider,
21
- uint256 amount
22
- ) external view override returns (bool) {
18
+ function acceptsWithdrawal(IEToken etk, address provider, uint256 amount) external view override returns (bool) {
23
19
  return this.acceptsDeposit(etk, provider, amount);
24
20
  }
25
21
  }
@@ -33,12 +33,7 @@ contract FixedRateVault is ERC4626 {
33
33
  /**
34
34
  * @dev Deposit/mint common workflow.
35
35
  */
36
- function _deposit(
37
- address caller,
38
- address receiver,
39
- uint256 assets,
40
- uint256 shares
41
- ) internal virtual override {
36
+ function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual override {
42
37
  require(!_broken, "Vault is broken");
43
38
  _totalAssets.add(assets, _interestRate);
44
39
  super._deposit(caller, receiver, assets, shares);
@@ -3,18 +3,31 @@ pragma solidity ^0.8.0;
3
3
 
4
4
  import {IPolicyHolder} from "../interfaces/IPolicyHolder.sol";
5
5
  import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
6
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
7
 
7
8
  contract PolicyHolderMock is IPolicyHolder {
8
9
  uint256 public policyId;
9
10
  uint256 public payout;
10
11
  bool public fail;
12
+ bool public emptyRevert;
11
13
  bool public notImplemented;
14
+ bool public badlyImplemented;
15
+ bool public noERC165;
12
16
 
13
- event NotificationReceived(uint256 kind, uint256 policyId, address operator, address from);
17
+ enum NotificationKind {
18
+ PolicyReceived,
19
+ PayoutReceived,
20
+ PolicyExpired
21
+ }
14
22
 
15
- constructor(bool fail_) {
16
- fail = fail_;
23
+ event NotificationReceived(NotificationKind kind, uint256 policyId, address operator, address from);
24
+
25
+ constructor() {
26
+ fail = false;
17
27
  notImplemented = false;
28
+ badlyImplemented = false;
29
+ emptyRevert = false;
30
+ noERC165 = false;
18
31
  payout = type(uint256).max;
19
32
  }
20
33
 
@@ -26,37 +39,65 @@ contract PolicyHolderMock is IPolicyHolder {
26
39
  notImplemented = notImplemented_;
27
40
  }
28
41
 
42
+ function setBadlyImplemented(bool badlyImplemented_) external {
43
+ badlyImplemented = badlyImplemented_;
44
+ }
45
+
46
+ function setNoERC165(bool noERC165_) external {
47
+ noERC165 = noERC165_;
48
+ }
49
+
50
+ function setEmptyRevert(bool emptyRevert_) external {
51
+ emptyRevert = emptyRevert_;
52
+ }
53
+
54
+ /**
55
+ * @dev See {IERC165-supportsInterface}.
56
+ */
57
+ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
58
+ if (noERC165)
59
+ assembly {
60
+ revert(0, 0)
61
+ }
62
+ if (notImplemented) return false;
63
+ return interfaceId == type(IPolicyHolder).interfaceId || interfaceId == type(IERC165).interfaceId;
64
+ }
65
+
29
66
  function onERC721Received(
30
67
  address operator,
31
68
  address from,
32
69
  uint256 policyId_,
33
70
  bytes calldata
34
71
  ) external override returns (bytes4) {
35
- if (notImplemented)
36
- // solhint-disable-next-line no-inline-assembly
37
- assembly {
38
- revert(0, 0)
39
- }
40
- if (fail) revert("onERC721Received: They told me I have to fail");
72
+ if (fail)
73
+ if (emptyRevert)
74
+ assembly {
75
+ revert(0, 0)
76
+ }
77
+ else revert("onERC721Received: They told me I have to fail");
78
+
41
79
  policyId = policyId_;
42
- emit NotificationReceived(0, policyId_, operator, from);
80
+ payout = type(uint256).max;
81
+ emit NotificationReceived(NotificationKind.PolicyReceived, policyId_, operator, from);
82
+
83
+ if (badlyImplemented) return bytes4(0x0badf00d);
84
+
43
85
  return IERC721Receiver.onERC721Received.selector;
44
86
  }
45
87
 
46
- function onPolicyExpired(
47
- address operator,
48
- address from,
49
- uint256 policyId_
50
- ) external override returns (bytes4) {
51
- if (notImplemented)
52
- // solhint-disable-next-line no-inline-assembly
53
- assembly {
54
- revert(0, 0)
55
- }
56
- if (fail) revert("onPolicyExpired: They told me I have to fail");
88
+ function onPolicyExpired(address operator, address from, uint256 policyId_) external override returns (bytes4) {
89
+ if (fail)
90
+ if (emptyRevert)
91
+ assembly {
92
+ revert(0, 0)
93
+ }
94
+ else revert("onPolicyExpired: They told me I have to fail");
57
95
  policyId = policyId_;
58
96
  payout = 0;
59
- emit NotificationReceived(1, policyId_, operator, from);
97
+ emit NotificationReceived(NotificationKind.PolicyExpired, policyId_, operator, from);
98
+
99
+ if (badlyImplemented) return bytes4(0x0badf00d);
100
+
60
101
  return IPolicyHolder.onPolicyExpired.selector;
61
102
  }
62
103
 
@@ -75,15 +116,18 @@ contract PolicyHolderMock is IPolicyHolder {
75
116
  uint256 policyId_,
76
117
  uint256 amount
77
118
  ) external override returns (bytes4) {
78
- if (notImplemented)
79
- // solhint-disable-next-line no-inline-assembly
80
- assembly {
81
- revert(0, 0)
82
- }
83
- if (fail) revert("onPayoutReceived: They told me I have to fail");
119
+ if (fail)
120
+ if (emptyRevert)
121
+ assembly {
122
+ revert(0, 0)
123
+ }
124
+ else revert("onPayoutReceived: They told me I have to fail");
84
125
  policyId = policyId_;
85
126
  payout = amount;
86
- emit NotificationReceived(2, policyId_, operator, from);
127
+ emit NotificationReceived(NotificationKind.PayoutReceived, policyId_, operator, from);
128
+
129
+ if (badlyImplemented) return bytes4(0x0badf00d);
130
+
87
131
  return IPolicyHolder.onPayoutReceived.selector;
88
132
  }
89
133
  }
@@ -20,8 +20,6 @@ contract PolicyPoolComponentMock is IPolicyPoolComponent {
20
20
  * @dev See {IERC165-supportsInterface}.
21
21
  */
22
22
  function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
23
- return
24
- interfaceId == type(IERC165).interfaceId ||
25
- interfaceId == type(IPolicyPoolComponent).interfaceId;
23
+ return interfaceId == type(IERC165).interfaceId || interfaceId == type(IPolicyPoolComponent).interfaceId;
26
24
  }
27
25
  }
@@ -5,7 +5,6 @@ import {IPolicyPool} from "../interfaces/IPolicyPool.sol";
5
5
  import {IRiskModule} from "../interfaces/IRiskModule.sol";
6
6
  import {IEToken} from "../interfaces/IEToken.sol";
7
7
  import {IAccessManager} from "../interfaces/IAccessManager.sol";
8
- import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
9
8
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
10
9
  import {Policy} from "../Policy.sol";
11
10
  import {ForwardProxy} from "./ForwardProxy.sol";
@@ -13,8 +12,7 @@ import {ForwardProxy} from "./ForwardProxy.sol";
13
12
  contract PolicyPoolMock is IPolicyPool {
14
13
  using Policy for Policy.PolicyData;
15
14
 
16
- uint256 public constant MAX_INT =
17
- 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
15
+ uint256 public constant MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
18
16
 
19
17
  IERC20Metadata internal _currency;
20
18
  IAccessManager internal _access;
@@ -44,8 +42,8 @@ contract PolicyPoolMock is IPolicyPool {
44
42
 
45
43
  function newPolicy(
46
44
  Policy.PolicyData memory policy,
47
- address, /* caller */
48
- address, /* policyHolder */
45
+ address /* caller */,
46
+ address /* policyHolder */,
49
47
  uint96 internalId
50
48
  ) external override returns (uint256) {
51
49
  policy.id = (uint256(uint160(address(policy.riskModule))) << 96) + internalId;
@@ -57,10 +55,7 @@ contract PolicyPoolMock is IPolicyPool {
57
55
  function _resolvePolicy(Policy.PolicyData memory policy, uint256 payout) internal {
58
56
  require(policy.id != 0, "Policy not found");
59
57
  require(policy.hash() == policyHashes[policy.id], "Hash doesn't match");
60
- require(
61
- msg.sender == address(policy.riskModule),
62
- "Only riskModule is authorized to resolve the policy"
63
- );
58
+ require(msg.sender == address(policy.riskModule), "Only riskModule is authorized to resolve the policy");
64
59
  delete policies[policy.id];
65
60
  delete policyHashes[policy.id];
66
61
  emit PolicyResolved(IRiskModule(msg.sender), policy.id, payout);
@@ -74,10 +69,7 @@ contract PolicyPoolMock is IPolicyPool {
74
69
  _resolvePolicy(policy, 0);
75
70
  }
76
71
 
77
- function resolvePolicyFullPayout(Policy.PolicyData calldata policy, bool customerWon)
78
- external
79
- override
80
- {
72
+ function resolvePolicyFullPayout(Policy.PolicyData calldata policy, bool customerWon) external override {
81
73
  return _resolvePolicy(policy, customerWon ? policy.payout : 0);
82
74
  }
83
75
 
@@ -108,14 +100,7 @@ contract PolicyPoolMock is IPolicyPool {
108
100
  uint256 lossProb,
109
101
  uint40 expiration
110
102
  ) external {
111
- Policy.PolicyData memory policy = Policy.initialize(
112
- riskModule,
113
- rmParams,
114
- premium,
115
- payout,
116
- lossProb,
117
- expiration
118
- );
103
+ Policy.PolicyData memory policy = Policy.initialize(riskModule, rmParams, premium, payout, lossProb, expiration);
119
104
 
120
105
  emit NewPolicy(riskModule, policy);
121
106
  }
@@ -127,17 +112,12 @@ contract PolicyPoolMock is IPolicyPool {
127
112
  * and other contracts that have functions that can be called only from PolicyPool
128
113
  */
129
114
  contract PolicyPoolMockForward is ForwardProxy {
130
- uint256 public constant MAX_INT =
131
- 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
115
+ uint256 public constant MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
132
116
 
133
117
  IERC20Metadata internal _currency;
134
118
  IAccessManager internal _access;
135
119
 
136
- constructor(
137
- address forwardTo,
138
- IERC20Metadata currency_,
139
- IAccessManager access_
140
- ) ForwardProxy(forwardTo) {
120
+ constructor(address forwardTo, IERC20Metadata currency_, IAccessManager access_) ForwardProxy(forwardTo) {
141
121
  _currency = currency_;
142
122
  _access = access_;
143
123
  }
@@ -20,9 +20,7 @@ contract RiskModuleMock is RiskModule {
20
20
 
21
21
  /// @custom:oz-upgrades-unsafe-allow constructor
22
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
23
+ constructor(IPolicyPool policyPool_, IPremiumsAccount premiumsAccount_) RiskModule(policyPool_, premiumsAccount_) {}
26
24
 
27
25
  /**
28
26
  * @dev Initializes the RiskModule
@@ -43,15 +41,7 @@ contract RiskModuleMock is RiskModule {
43
41
  uint256 exposureLimit_,
44
42
  address wallet_
45
43
  ) public initializer {
46
- __RiskModule_init(
47
- name_,
48
- collRatio_,
49
- ensuroPpFee_,
50
- srRoc_,
51
- maxPayoutPerPolicy_,
52
- exposureLimit_,
53
- wallet_
54
- );
44
+ __RiskModule_init(name_, collRatio_, ensuroPpFee_, srRoc_, maxPayoutPerPolicy_, exposureLimit_, wallet_);
55
45
  }
56
46
 
57
47
  function newPolicy(
@@ -66,10 +56,7 @@ contract RiskModuleMock is RiskModule {
66
56
  return _newPolicy(payout, premium, lossProb, expiration, payer, onBehalfOf, internalId).id;
67
57
  }
68
58
 
69
- function resolvePolicy(Policy.PolicyData calldata policy, uint256 payout)
70
- external
71
- onlyComponentRole(RESOLVER_ROLE)
72
- {
59
+ function resolvePolicy(Policy.PolicyData calldata policy, uint256 payout) external onlyComponentRole(RESOLVER_ROLE) {
73
60
  _policyPool.resolvePolicy(policy, payout);
74
61
  }
75
62
  }
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.0;
3
3
  pragma experimental ABIEncoderV2;
4
4
 
5
- import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5
+ import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
6
6
 
7
7
  contract TestNFT is ERC721 {
8
8
  address private _owner;
package/js/constants.js CHANGED
@@ -1,7 +1,13 @@
1
- const WEEK = 3600 * 24 * 7;
2
- const DAY = 3600 * 24;
1
+ const HOUR = 3600;
2
+ const WEEK = HOUR * 24 * 7;
3
+ const DAY = HOUR * 24;
4
+
5
+ // From https://eips.ethereum.org/EIPS/eip-1967
6
+ const IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
3
7
 
4
8
  module.exports = {
5
9
  WEEK,
6
10
  DAY,
11
+ HOUR,
12
+ IMPLEMENTATION_SLOT,
7
13
  };