@ensuro/core 1.2.7 → 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.
- package/README.md +63 -27
- package/build/contracts/AccessManager.sol/AccessManager.json +559 -0
- package/build/contracts/ERC4626AssetManager.sol/ERC4626AssetManager.json +219 -0
- package/build/contracts/EToken.sol/EToken.json +217 -190
- package/build/contracts/LPManualWhitelist.sol/LPManualWhitelist.json +17 -4
- package/build/contracts/{extras/IPriceRiskModule.sol/IPriceRiskModule.json → LiquidityThresholdAssetManager.sol/LiquidityThresholdAssetManager.json} +81 -131
- package/build/contracts/Policy.sol/Policy.json +2 -2
- package/build/contracts/PolicyPool.sol/PolicyPool.json +425 -295
- package/build/contracts/PolicyPoolComponent.sol/PolicyPoolComponent.json +15 -2
- package/build/contracts/PremiumsAccount.sol/PremiumsAccount.json +868 -0
- package/build/contracts/{BaseAssetManager.sol/BaseAssetManager.json → Reserve.sol/Reserve.json} +37 -166
- package/build/contracts/RiskModule.sol/RiskModule.json +85 -312
- package/build/contracts/SignedQuoteRiskModule.sol/SignedQuoteRiskModule.json +960 -0
- package/build/contracts/{DataTypes.sol/DataTypes.json → TimeScaled.sol/TimeScaled.json} +4 -4
- package/build/contracts/TrustfulRiskModule.sol/TrustfulRiskModule.json +134 -336
- package/build/contracts/dependencies/ERC1967Proxy.sol/ERC1967Proxy.json +64 -0
- package/build/{interfaces/IExchange.sol/IExchange.json → contracts/dependencies/IERC20Metadata.sol/IERC20Metadata.json} +83 -79
- package/build/contracts/{WadRayMath.sol → dependencies/WadRayMath.sol}/WadRayMath.json +3 -3
- package/build/{interfaces/IPolicyPoolConfig.sol/IPolicyPoolConfig.json → contracts/interfaces/IAccessManager.sol/IAccessManager.json} +79 -77
- package/build/contracts/interfaces/IAssetManager.sol/IAssetManager.json +109 -0
- package/build/{interfaces → contracts/interfaces}/IEToken.sol/IEToken.json +39 -91
- package/build/{interfaces → contracts/interfaces}/ILPWhitelist.sol/ILPWhitelist.json +1 -1
- package/build/{interfaces → contracts/interfaces}/IPolicyHolder.sol/IPolicyHolder.json +1 -1
- package/build/{interfaces → contracts/interfaces}/IPolicyPool.sol/IPolicyPool.json +137 -100
- package/build/{interfaces → contracts/interfaces}/IPolicyPoolComponent.sol/IPolicyPoolComponent.json +1 -1
- package/build/contracts/interfaces/IPremiumsAccount.sol/IPremiumsAccount.json +315 -0
- package/build/{interfaces → contracts/interfaces}/IRiskModule.sol/IRiskModule.json +58 -34
- package/build/contracts/mocks/FixedRateVault.sol/FixedRateVault.json +736 -0
- package/build/contracts/mocks/ForwardProxy.sol/ForwardProxy.json +43 -0
- package/build/{interfaces/IInsolvencyHook.sol/IInsolvencyHook.json → contracts/mocks/IMintableERC20.sol/IMintableERC20.json} +13 -8
- package/build/contracts/mocks/PolicyHolderMock.sol/PolicyHolderMock.json +228 -0
- package/build/contracts/mocks/PolicyPoolComponentMock.sol/PolicyPoolComponentMock.json +35 -0
- package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMock.json +702 -0
- package/build/contracts/mocks/PolicyPoolMock.sol/PolicyPoolMockForward.json +92 -0
- package/build/contracts/mocks/RiskModuleMock.sol/RiskModuleMock.json +764 -0
- package/build/contracts/mocks/TestCurrency.sol/TestCurrency.json +343 -0
- package/build/contracts/mocks/TestNFT.sol/TestNFT.json +388 -0
- package/contracts/AccessManager.sol +103 -0
- package/contracts/ERC4626AssetManager.sol +52 -0
- package/contracts/EToken.sol +254 -299
- package/contracts/LPManualWhitelist.sol +4 -4
- package/contracts/LiquidityThresholdAssetManager.sol +160 -0
- package/contracts/Policy.sol +49 -45
- package/contracts/PolicyPool.sol +379 -514
- package/contracts/PolicyPoolComponent.sol +41 -41
- package/contracts/PremiumsAccount.sol +480 -0
- package/contracts/Reserve.sol +213 -0
- package/contracts/RiskModule.sol +233 -174
- package/contracts/SignedQuoteRiskModule.sol +241 -0
- package/contracts/TimeScaled.sol +138 -0
- package/contracts/TrustfulRiskModule.sol +85 -23
- package/contracts/dependencies/ERC1967Proxy.sol +19 -0
- package/contracts/dependencies/IERC20Metadata.sol +19 -0
- package/contracts/dependencies/WadRayMath.sol +126 -0
- package/contracts/interfaces/IAccessManager.sol +148 -0
- package/contracts/interfaces/IAssetManager.sol +84 -0
- package/contracts/interfaces/IEToken.sol +195 -0
- package/contracts/interfaces/ILPWhitelist.sol +40 -0
- package/{interfaces → contracts/interfaces}/IPolicyHolder.sol +0 -0
- package/contracts/interfaces/IPolicyPool.sol +145 -0
- package/{interfaces → contracts/interfaces}/IPolicyPoolComponent.sol +3 -0
- package/contracts/interfaces/IPremiumsAccount.sol +76 -0
- package/contracts/interfaces/IRiskModule.sol +123 -0
- package/contracts/mocks/FixedRateVault.sol +85 -0
- package/contracts/mocks/ForwardProxy.sol +66 -0
- package/contracts/mocks/IMintableERC20.sol +13 -0
- package/contracts/mocks/PolicyHolderMock.sol +89 -0
- package/contracts/mocks/PolicyPoolComponentMock.sol +17 -0
- package/contracts/mocks/PolicyPoolMock.sol +148 -0
- package/contracts/mocks/RiskModuleMock.sol +75 -0
- package/contracts/mocks/TestCurrency.sol +35 -0
- package/contracts/mocks/TestNFT.sol +23 -0
- package/js/test-utils.js +356 -0
- package/package.json +2 -2
- package/build/contracts/AaveAssetManager.sol/AaveAssetManager.json +0 -742
- package/build/contracts/Exchange.sol/Exchange.json +0 -591
- package/build/contracts/FlightDelayRiskModule.sol/FlightDelayRiskModule.json +0 -1112
- package/build/contracts/PolicyNFT.sol/PolicyNFT.json +0 -570
- package/build/contracts/PolicyPoolConfig.sol/PolicyPoolConfig.json +0 -686
- package/build/contracts/dependencies/ChainlinkClientUpgradeable.sol/ChainlinkClientUpgradeable.json +0 -50
- package/build/contracts/extras/PriceRiskModule.sol/PriceRiskModule.json +0 -1055
- package/build/contracts/upgraded/IPolicyNFTv1.sol/IPolicyNFTv1.json +0 -322
- package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1.json +0 -571
- package/build/contracts/upgraded/PolicyNFTv1.sol/PolicyNFTv1_Upgrade.json +0 -602
- package/build/interfaces/IAssetManager.sol/IAssetManager.json +0 -31
- package/build/interfaces/IExchange.sol/IPriceOracle.json +0 -30
- package/build/interfaces/IPolicyNFT.sol/IPolicyNFT.json +0 -321
- package/contracts/AaveAssetManager.sol +0 -298
- package/contracts/BaseAssetManager.sol +0 -301
- package/contracts/DataTypes.sol +0 -287
- package/contracts/Exchange.sol +0 -189
- package/contracts/FlightDelayRiskModule.sol +0 -208
- package/contracts/PolicyNFT.sol +0 -96
- package/contracts/PolicyPoolConfig.sol +0 -247
- package/contracts/WadRayMath.sol +0 -135
- package/contracts/dependencies/ChainlinkClientUpgradeable.sol +0 -371
- package/contracts/extras/IPriceRiskModule.sol +0 -41
- package/contracts/extras/PriceRiskModule.sol +0 -243
- package/contracts/upgraded/IPolicyNFTv1.sol +0 -15
- package/contracts/upgraded/PolicyNFTv1.sol +0 -126
- package/interfaces/IAssetManager.sol +0 -23
- package/interfaces/IEToken.sol +0 -48
- package/interfaces/IExchange.sol +0 -59
- package/interfaces/IInsolvencyHook.sol +0 -27
- package/interfaces/ILPWhitelist.sol +0 -23
- package/interfaces/IPolicyNFT.sol +0 -15
- package/interfaces/IPolicyPool.sol +0 -44
- package/interfaces/IPolicyPoolConfig.sol +0 -87
- package/interfaces/IRiskModule.sol +0 -29
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity ^0.8.2;
|
|
3
|
-
|
|
4
|
-
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
5
|
-
import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
|
|
6
|
-
import {CountersUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
|
|
7
|
-
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
|
|
8
|
-
import {IPolicyPool} from "../../interfaces/IPolicyPool.sol";
|
|
9
|
-
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|
10
|
-
import {IPolicyNFTv1} from "./IPolicyNFTv1.sol";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @title PolicyNFT - NFT that keeps track of issued policies and its owners
|
|
14
|
-
* @dev Every time a new policy is accepted by the PolicyPool, a new NFT is minted generating a new
|
|
15
|
-
* policyId owned by the customer. Only the PolicyPool can mint NFTs.
|
|
16
|
-
* After creation, NFTs can be transferred in the ERC721 standard way and that changes the policy holder.
|
|
17
|
-
* @custom:security-contact security@ensuro.co
|
|
18
|
-
* @author Ensuro
|
|
19
|
-
*/
|
|
20
|
-
contract PolicyNFTv1 is UUPSUpgradeable, ERC721Upgradeable, PausableUpgradeable, IPolicyNFTv1 {
|
|
21
|
-
using CountersUpgradeable for CountersUpgradeable.Counter;
|
|
22
|
-
|
|
23
|
-
bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
|
|
24
|
-
bytes32 public constant LEVEL1_ROLE = keccak256("LEVEL1_ROLE");
|
|
25
|
-
|
|
26
|
-
CountersUpgradeable.Counter private _tokenIdCounter;
|
|
27
|
-
IPolicyPool internal _policyPool;
|
|
28
|
-
|
|
29
|
-
modifier onlyPolicyPool() {
|
|
30
|
-
require(_msgSender() == address(_policyPool), "The caller must be the PolicyPool");
|
|
31
|
-
_;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
modifier onlyPoolRole2(bytes32 role1, bytes32 role2) {
|
|
35
|
-
_policyPool.config().checkRole2(role1, role2, msg.sender);
|
|
36
|
-
_;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
modifier onlyPoolRole(bytes32 role) {
|
|
40
|
-
_policyPool.config().checkRole(role, msg.sender);
|
|
41
|
-
_;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function initialize(
|
|
45
|
-
string memory name_,
|
|
46
|
-
string memory symbol_,
|
|
47
|
-
IPolicyPool policyPool_
|
|
48
|
-
) public initializer {
|
|
49
|
-
__UUPSUpgradeable_init();
|
|
50
|
-
__Pausable_init();
|
|
51
|
-
__ERC721_init(name_, symbol_);
|
|
52
|
-
__PolicyNFT_init_unchained(policyPool_);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// solhint-disable-next-line func-name-mixedcase
|
|
56
|
-
function __PolicyNFT_init_unchained(IPolicyPool policyPool_) internal initializer {
|
|
57
|
-
_policyPool = policyPool_;
|
|
58
|
-
_tokenIdCounter.increment(); // I don't want _tokenId==0
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// solhint-disable-next-line no-empty-blocks
|
|
62
|
-
function _authorizeUpgrade(address) internal override onlyPoolRole2(GUARDIAN_ROLE, LEVEL1_ROLE) {}
|
|
63
|
-
|
|
64
|
-
function pause() public onlyPoolRole(GUARDIAN_ROLE) {
|
|
65
|
-
_pause();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function unpause() public onlyPoolRole2(GUARDIAN_ROLE, LEVEL1_ROLE) {
|
|
69
|
-
_unpause();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @dev This function can be called only once in contract's lifetime. It links the NFT with the
|
|
74
|
-
* PolicyPool contract. It's called in PolicyPool initialization.
|
|
75
|
-
*/
|
|
76
|
-
function connect() external override {
|
|
77
|
-
require(
|
|
78
|
-
address(_policyPool) == address(0) || address(_policyPool) == _msgSender(),
|
|
79
|
-
"PolicyPool already connected"
|
|
80
|
-
);
|
|
81
|
-
_policyPool = IPolicyPool(_msgSender());
|
|
82
|
-
// Not possible to do this validation because connect is called in _policyPool initialize :'(
|
|
83
|
-
// require(_policyPool.policyNFT() == address(this), "PolicyPool not connected to this config");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function safeMint(address to)
|
|
87
|
-
external
|
|
88
|
-
virtual
|
|
89
|
-
override
|
|
90
|
-
onlyPolicyPool
|
|
91
|
-
whenNotPaused
|
|
92
|
-
returns (uint256)
|
|
93
|
-
{
|
|
94
|
-
uint256 tokenId = _tokenIdCounter.current();
|
|
95
|
-
_safeMint(to, tokenId);
|
|
96
|
-
_tokenIdCounter.increment();
|
|
97
|
-
return tokenId;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function _beforeTokenTransfer(
|
|
101
|
-
address from,
|
|
102
|
-
address to,
|
|
103
|
-
uint256 tokenId
|
|
104
|
-
) internal override whenNotPaused {
|
|
105
|
-
super._beforeTokenTransfer(from, to, tokenId);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function nextId() external view returns (uint256) {
|
|
109
|
-
return _tokenIdCounter.current();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// solhint-disable-next-line contract-name-camelcase
|
|
114
|
-
contract PolicyNFTv1_Upgrade is PolicyNFTv1 {
|
|
115
|
-
function safeMint(address to, uint256 policyId) external onlyPolicyPool whenNotPaused {
|
|
116
|
-
_safeMint(to, policyId, "");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function safeMint(address) external view override onlyPolicyPool whenNotPaused returns (uint256) {
|
|
120
|
-
revert("Not supported anymore");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function policyPool() external view returns (IPolicyPool) {
|
|
124
|
-
return _policyPool;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -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
|
-
}
|
package/interfaces/IEToken.sol
DELETED
|
@@ -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
|
-
}
|
package/interfaces/IExchange.sol
DELETED
|
@@ -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,23 +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 ILPWhitelist - Interface that handles the whitelisting of Liquidity Providers
|
|
8
|
-
* @author Ensuro
|
|
9
|
-
*/
|
|
10
|
-
interface ILPWhitelist {
|
|
11
|
-
function acceptsDeposit(
|
|
12
|
-
IEToken etoken,
|
|
13
|
-
address provider,
|
|
14
|
-
uint256 amount
|
|
15
|
-
) external view returns (bool);
|
|
16
|
-
|
|
17
|
-
function acceptsTransfer(
|
|
18
|
-
IEToken etoken,
|
|
19
|
-
address providerFrom,
|
|
20
|
-
address providerTo,
|
|
21
|
-
uint256 amount
|
|
22
|
-
) external view returns (bool);
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @title IPolicyNFT interface
|
|
8
|
-
* @dev Interface for mintable NFT token that returns tokenId
|
|
9
|
-
* @author Ensuro
|
|
10
|
-
*/
|
|
11
|
-
interface IPolicyNFT is IERC721Upgradeable {
|
|
12
|
-
function safeMint(address to, uint256 policyId) external;
|
|
13
|
-
|
|
14
|
-
function connect() external;
|
|
15
|
-
}
|
|
@@ -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,87 +0,0 @@
|
|
|
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
|
-
import {IExchange} from "./IExchange.sol";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @title IPolicyPoolAccess - Interface for the contract that handles roles for the PolicyPool and components
|
|
13
|
-
* @dev Interface for the contract that handles roles for the PolicyPool and components
|
|
14
|
-
* @author Ensuro
|
|
15
|
-
*/
|
|
16
|
-
interface IPolicyPoolConfig is IAccessControlUpgradeable {
|
|
17
|
-
enum GovernanceActions {
|
|
18
|
-
none,
|
|
19
|
-
setTreasury, // Changes PolicyPool treasury address
|
|
20
|
-
setAssetManager, // Changes PolicyPool AssetManager
|
|
21
|
-
setInsolvencyHook, // Changes PolicyPool InsolvencyHook
|
|
22
|
-
setLPWhitelist, // Changes PolicyPool Liquidity Providers Whitelist
|
|
23
|
-
addRiskModule,
|
|
24
|
-
removeRiskModule,
|
|
25
|
-
// RiskModule Governance Actions
|
|
26
|
-
setScrPercentage,
|
|
27
|
-
setMoc,
|
|
28
|
-
setScrInterestRate,
|
|
29
|
-
setEnsuroFee,
|
|
30
|
-
setMaxScrPerPolicy,
|
|
31
|
-
setScrLimit,
|
|
32
|
-
setSharedCoverageMinPercentage,
|
|
33
|
-
setSharedCoveragePercentage,
|
|
34
|
-
setWallet,
|
|
35
|
-
// EToken Governance Actions
|
|
36
|
-
setLiquidityRequirement,
|
|
37
|
-
setMaxUtilizationRate,
|
|
38
|
-
setPoolLoanInterestRate,
|
|
39
|
-
// AssetManager Governance Actions
|
|
40
|
-
setLiquidityMin,
|
|
41
|
-
setLiquidityMiddle,
|
|
42
|
-
setLiquidityMax,
|
|
43
|
-
// AaveAssetManager Governance Actions
|
|
44
|
-
setClaimRewardsMin,
|
|
45
|
-
setReinvestRewardsMin,
|
|
46
|
-
setMaxSlippage,
|
|
47
|
-
setAcceptAllRMs, // EToken Governance action - value == boolean
|
|
48
|
-
setAcceptException, // EToken Governance action - value == (!isException << 255)|address
|
|
49
|
-
setExchange, // Changes exchange helper contract
|
|
50
|
-
setPriceOracle, // Changes exchange's PriceOracle
|
|
51
|
-
setSwapRouter, // Changes exchange's SwapRouter
|
|
52
|
-
last
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
enum RiskModuleStatus {
|
|
56
|
-
inactive, // newPolicy and resolvePolicy rejected
|
|
57
|
-
active, // newPolicy and resolvePolicy accepted
|
|
58
|
-
deprecated, // newPolicy rejected, resolvePolicy accepted
|
|
59
|
-
suspended // newPolicy and resolvePolicy rejected (temporarily)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
event RiskModuleStatusChanged(IRiskModule indexed riskModule, RiskModuleStatus newStatus);
|
|
63
|
-
|
|
64
|
-
function checkRole(bytes32 role, address account) external view;
|
|
65
|
-
|
|
66
|
-
function checkRole2(
|
|
67
|
-
bytes32 role1,
|
|
68
|
-
bytes32 role2,
|
|
69
|
-
address account
|
|
70
|
-
) external view;
|
|
71
|
-
|
|
72
|
-
function connect() external;
|
|
73
|
-
|
|
74
|
-
function assetManager() external view returns (IAssetManager);
|
|
75
|
-
|
|
76
|
-
function insolvencyHook() external view returns (IInsolvencyHook);
|
|
77
|
-
|
|
78
|
-
function lpWhitelist() external view returns (ILPWhitelist);
|
|
79
|
-
|
|
80
|
-
function exchange() external view returns (IExchange);
|
|
81
|
-
|
|
82
|
-
function treasury() external view returns (address);
|
|
83
|
-
|
|
84
|
-
function checkAcceptsNewPolicy(IRiskModule riskModule) external view;
|
|
85
|
-
|
|
86
|
-
function checkAcceptsResolvePolicy(IRiskModule riskModule) external view;
|
|
87
|
-
}
|
|
@@ -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
|
-
}
|