forked from neptune-mutual-blue/protocol
-
Notifications
You must be signed in to change notification settings - Fork 1
/
IVault.sol
116 lines (101 loc) · 3.9 KB
/
IVault.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Neptune Mutual Protocol (https://neptunemutual.com)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./IMember.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
interface IVault is IMember, IERC20 {
struct VaultInfoType {
uint256 totalPods;
uint256 balance;
uint256 extendedBalance;
uint256 totalReassurance;
uint256 myPodBalance;
uint256 myShare;
uint256 withdrawalOpen;
uint256 withdrawalClose;
}
struct AddLiquidityArgs {
/// @dev Enter the cover key
bytes32 coverKey;
/// @dev Enter the amount of liquidity token to supply.
uint256 amount;
/// @dev Enter the amount of NPM token to stake. Will be locked for a minimum window of one withdrawal period.
uint256 npmStakeToAdd;
/// @dev Enter referral code
bytes32 referralCode;
}
event GovernanceTransfer(address indexed to, uint256 amount);
event StrategyTransfer(address indexed token, address indexed strategy, bytes32 indexed name, uint256 amount);
event StrategyReceipt(address indexed token, address indexed strategy, bytes32 indexed name, uint256 amount, uint256 income, uint256 loss);
event PodsIssued(address indexed account, uint256 issued, uint256 liquidityAdded, bytes32 indexed referralCode);
event PodsRedeemed(address indexed account, uint256 redeemed, uint256 liquidityReleased);
event FlashLoanBorrowed(address indexed lender, address indexed borrower, address indexed stablecoin, uint256 amount, uint256 fee);
event NpmStaken(address indexed account, uint256 amount);
event NpmUnstaken(address indexed account, uint256 amount);
event InterestAccrued(bytes32 indexed coverKey);
event Entered(bytes32 indexed coverKey, address indexed account);
event Exited(bytes32 indexed coverKey, address indexed account);
function key() external view returns (bytes32);
function sc() external view returns (address);
/**
* @dev Adds liquidity to the specified cover contract
*/
function addLiquidity(AddLiquidityArgs calldata args) external;
function accrueInterest() external;
/**
* @dev Removes liquidity from the specified cover contract
* @param coverKey Enter the cover key
* @param amount Enter the amount of liquidity token to remove.
* @param npmStake Enter the amount of NPM stake to remove.
* @param exit Indicates NPM stake exit.
*/
function removeLiquidity(
bytes32 coverKey,
uint256 amount,
uint256 npmStake,
bool exit
) external;
/**
* @dev Transfers liquidity to governance contract.
* @param coverKey Enter the cover key
* @param to Enter the destination account
* @param amount Enter the amount of liquidity token to transfer.
*/
function transferGovernance(
bytes32 coverKey,
address to,
uint256 amount
) external;
/**
* @dev Transfers liquidity to strategy contract.
* @param coverKey Enter the cover key
* @param strategyName Enter the strategy's name
* @param amount Enter the amount of liquidity token to transfer.
*/
function transferToStrategy(
IERC20 token,
bytes32 coverKey,
bytes32 strategyName,
uint256 amount
) external;
/**
* @dev Receives from strategy contract.
* @param coverKey Enter the cover key
* @param strategyName Enter the strategy's name
* @param amount Enter the amount of liquidity token to transfer.
*/
function receiveFromStrategy(
IERC20 token,
bytes32 coverKey,
bytes32 strategyName,
uint256 amount
) external;
function calculatePods(uint256 forStablecoinUnits) external view returns (uint256);
function calculateLiquidity(uint256 podsToBurn) external view returns (uint256);
function getInfo(address forAccount) external view returns (VaultInfoType memory info);
/**
* @dev Returns the stablecoin balance of this vault
* This also includes amounts lent out in lending strategies
*/
function getStablecoinBalanceOf() external view returns (uint256);
}