@ensuro/core 1.2.0

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 (55) hide show
  1. package/README.md +93 -0
  2. package/build/contracts/AaveAssetManager.sol/AaveAssetManager.json +772 -0
  3. package/build/contracts/BaseAssetManager.sol/BaseAssetManager.json +494 -0
  4. package/build/contracts/DataTypes.sol/DataTypes.json +10 -0
  5. package/build/contracts/EToken.sol/EToken.json +1148 -0
  6. package/build/contracts/FlightDelayRiskModule.sol/FlightDelayRiskModule.json +1093 -0
  7. package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +412 -0
  8. package/build/contracts/Policy.sol/Policy.json +10 -0
  9. package/build/contracts/PolicyNFT.sol/PolicyNFT.json +570 -0
  10. package/build/contracts/PolicyPool.sol/PolicyPool.json +1257 -0
  11. package/build/contracts/PolicyPoolComponent.sol/PolicyPoolComponent.json +281 -0
  12. package/build/contracts/PolicyPoolConfig.sol/PolicyPoolConfig.json +660 -0
  13. package/build/contracts/RiskModule.sol/RiskModule.json +748 -0
  14. package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +1032 -0
  15. package/build/contracts/WadRayMath.sol/WadRayMath.json +10 -0
  16. package/build/contracts/dependencies/ChainlinkClientUpgradeable.sol/ChainlinkClientUpgradeable.json +50 -0
  17. package/build/contracts/upgraded/IPolicyNFTv1.sol/IPolicyNFTv1.json +322 -0
  18. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1.json +571 -0
  19. package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1_Upgrade.json +602 -0
  20. package/build/interfaces/IAssetManager.sol/IAssetManager.json +31 -0
  21. package/build/interfaces/IEToken.sol/IEToken.json +491 -0
  22. package/build/interfaces/IInsolvencyHook.sol/IInsolvencyHook.json +42 -0
  23. package/build/interfaces/ILPWhitelist.sol/ILPWhitelist.json +74 -0
  24. package/build/interfaces/IPolicyNFT.sol/IPolicyNFT.json +321 -0
  25. package/build/interfaces/IPolicyPool.sol/IPolicyPool.json +445 -0
  26. package/build/interfaces/IPolicyPoolComponent.sol/IPolicyPoolComponent.json +24 -0
  27. package/build/interfaces/IPolicyPoolConfig.sol/IPolicyPoolConfig.json +328 -0
  28. package/build/interfaces/IRiskModule.sol/IRiskModule.json +141 -0
  29. package/contracts/AaveAssetManager.sol +326 -0
  30. package/contracts/BaseAssetManager.sol +283 -0
  31. package/contracts/DataTypes.sol +287 -0
  32. package/contracts/EToken.sol +773 -0
  33. package/contracts/FlightDelayRiskModule.sol +208 -0
  34. package/contracts/LPManualWhitelist.sol +57 -0
  35. package/contracts/Policy.sol +104 -0
  36. package/contracts/PolicyNFT.sol +96 -0
  37. package/contracts/PolicyPool.sol +716 -0
  38. package/contracts/PolicyPoolComponent.sol +164 -0
  39. package/contracts/PolicyPoolConfig.sol +231 -0
  40. package/contracts/RiskModule.sol +323 -0
  41. package/contracts/TrustfulRiskModule.sol +81 -0
  42. package/contracts/WadRayMath.sol +135 -0
  43. package/contracts/dependencies/ChainlinkClientUpgradeable.sol +371 -0
  44. package/contracts/upgraded/IPolicyNFTv1.sol +15 -0
  45. package/contracts/upgraded/PolicyNFTv1.sol +126 -0
  46. package/interfaces/IAssetManager.sol +23 -0
  47. package/interfaces/IEToken.sol +44 -0
  48. package/interfaces/IInsolvencyHook.sol +27 -0
  49. package/interfaces/ILPWhitelist.sol +23 -0
  50. package/interfaces/IPolicyNFT.sol +15 -0
  51. package/interfaces/IPolicyPool.sol +44 -0
  52. package/interfaces/IPolicyPoolComponent.sol +13 -0
  53. package/interfaces/IPolicyPoolConfig.sol +81 -0
  54. package/interfaces/IRiskModule.sol +29 -0
  55. package/package.json +30 -0
@@ -0,0 +1,13 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {IPolicyPool} from "./IPolicyPool.sol";
5
+
6
+ /**
7
+ * @title IPolicyPoolComponent interface
8
+ * @dev Interface for Contracts linked (owned) by a PolicyPool. Useful to avoid cyclic dependencies
9
+ * @author Ensuro
10
+ */
11
+ interface IPolicyPoolComponent {
12
+ function policyPool() external view returns (IPolicyPool);
13
+ }
@@ -0,0 +1,81 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {IAccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
5
+ import {IAssetManager} from "./IAssetManager.sol";
6
+ import {IInsolvencyHook} from "./IInsolvencyHook.sol";
7
+ import {ILPWhitelist} from "./ILPWhitelist.sol";
8
+ import {IRiskModule} from "./IRiskModule.sol";
9
+
10
+ /**
11
+ * @title IPolicyPoolAccess - Interface for the contract that handles roles for the PolicyPool and components
12
+ * @dev Interface for the contract that handles roles for the PolicyPool and components
13
+ * @author Ensuro
14
+ */
15
+ interface IPolicyPoolConfig is IAccessControlUpgradeable {
16
+ enum GovernanceActions {
17
+ none,
18
+ setTreasury, // Changes PolicyPool treasury address
19
+ setAssetManager, // Changes PolicyPool AssetManager
20
+ setInsolvencyHook, // Changes PolicyPool InsolvencyHook
21
+ setLPWhitelist, // Changes PolicyPool Liquidity Providers Whitelist
22
+ addRiskModule,
23
+ removeRiskModule,
24
+ // RiskModule Governance Actions
25
+ setScrPercentage,
26
+ setMoc,
27
+ setScrInterestRate,
28
+ setEnsuroFee,
29
+ setMaxScrPerPolicy,
30
+ setScrLimit,
31
+ setSharedCoverageMinPercentage,
32
+ setSharedCoveragePercentage,
33
+ setWallet,
34
+ // EToken Governance Actions
35
+ setLiquidityRequirement,
36
+ setMaxUtilizationRate,
37
+ setPoolLoanInterestRate,
38
+ // AssetManager Governance Actions
39
+ setLiquidityMin,
40
+ setLiquidityMiddle,
41
+ setLiquidityMax,
42
+ // AaveAssetManager Governance Actions
43
+ setClaimRewardsMin,
44
+ setReinvestRewardsMin,
45
+ setMaxSlippage,
46
+ setAcceptAllRMs, // EToken Governance action - value == boolean
47
+ setAcceptException, // EToken Governance action - value == (!isException << 255)|address
48
+ last
49
+ }
50
+
51
+ enum RiskModuleStatus {
52
+ inactive, // newPolicy and resolvePolicy rejected
53
+ active, // newPolicy and resolvePolicy accepted
54
+ deprecated, // newPolicy rejected, resolvePolicy accepted
55
+ suspended // newPolicy and resolvePolicy rejected (temporarily)
56
+ }
57
+
58
+ event RiskModuleStatusChanged(IRiskModule indexed riskModule, RiskModuleStatus newStatus);
59
+
60
+ function checkRole(bytes32 role, address account) external view;
61
+
62
+ function checkRole2(
63
+ bytes32 role1,
64
+ bytes32 role2,
65
+ address account
66
+ ) external view;
67
+
68
+ function connect() external;
69
+
70
+ function assetManager() external view returns (IAssetManager);
71
+
72
+ function insolvencyHook() external view returns (IInsolvencyHook);
73
+
74
+ function lpWhitelist() external view returns (ILPWhitelist);
75
+
76
+ function treasury() external view returns (address);
77
+
78
+ function checkAcceptsNewPolicy(IRiskModule riskModule) external view;
79
+
80
+ function checkAcceptsResolvePolicy(IRiskModule riskModule) external view;
81
+ }
@@ -0,0 +1,29 @@
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
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@ensuro/core",
3
+ "description": "Ensuro - Decentralized insurance protocol",
4
+ "version": "1.2.0",
5
+ "files": [
6
+ "**/*.sol",
7
+ "/build/contracts/*.json",
8
+ "/build/interfaces/*.json",
9
+ "!/mocks/**/*"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git@github.com:ensuro/ensuro.git"
14
+ },
15
+ "keywords": [
16
+ "solidity",
17
+ "ethereum",
18
+ "smart",
19
+ "contracts",
20
+ "decentralized",
21
+ "insurance",
22
+ "ensuro"
23
+ ],
24
+ "author": "Ensuro <guillermo@ensuro.co>",
25
+ "license": "Apache-2.0",
26
+ "bugs": {
27
+ "url": "https://github.com/ensuro/ensuro/issues"
28
+ },
29
+ "homepage": "https://ensuro.co/"
30
+ }