-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathIBasketFacet.sol
198 lines (167 loc) · 5.97 KB
/
IBasketFacet.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
interface IBasketFacet {
event TokenAdded(address indexed _token);
event TokenRemoved(address indexed _token);
event EntryFeeSet(uint256 fee);
event ExitFeeSet(uint256 fee);
event AnnualizedFeeSet(uint256 fee);
event FeeBeneficiarySet(address indexed beneficiary);
event EntryFeeBeneficiaryShareSet(uint256 share);
event ExitFeeBeneficiaryShareSet(uint256 share);
event PoolJoined(address indexed who, uint256 amount);
event PoolExited(address indexed who, uint256 amount);
event FeeCharged(uint256 amount);
event LockSet(uint256 lockBlock);
event CapSet(uint256 cap);
/**
@notice Sets entry fee paid when minting
@param _fee Amount of fee. 1e18 == 100%, capped at 10%
*/
function setEntryFee(uint256 _fee) external;
/**
@notice Get the entry fee
@return Current entry fee
*/
function getEntryFee() external view returns(uint256);
/**
@notice Set the exit fee paid when exiting
@param _fee Amount of fee. 1e18 == 100%, capped at 10%
*/
function setExitFee(uint256 _fee) external;
/**
@notice Get the exit fee
@return Current exit fee
*/
function getExitFee() external view returns(uint256);
/**
@notice Set the annualized fee. Often referred to as streaming fee
@param _fee Amount of fee. 1e18 == 100%, capped at 10%
*/
function setAnnualizedFee(uint256 _fee) external;
/**
@notice Get the annualized fee.
@return Current annualized fee.
*/
function getAnnualizedFee() external view returns(uint256);
/**
@notice Set the address receiving the fees.
*/
function setFeeBeneficiary(address _beneficiary) external;
/**
@notice Get the fee benificiary
@return The current fee beneficiary
*/
function getFeeBeneficiary() external view returns(address);
/**
@notice Set the fee beneficiaries share of the entry fee
@notice _share Share of the fee. 1e18 == 100%. Capped at 100%
*/
function setEntryFeeBeneficiaryShare(uint256 _share) external;
/**
@notice Get the entry fee beneficiary share
@return Feeshare amount
*/
function getEntryFeeBeneficiaryShare() external view returns(uint256);
/**
@notice Set the fee beneficiaries share of the exit fee
@notice _share Share of the fee. 1e18 == 100%. Capped at 100%
*/
function setExitFeeBeneficiaryShare(uint256 _share) external;
/**
@notice Get the exit fee beneficiary share
@return Feeshare amount
*/
function getExitFeeBeneficiaryShare() external view returns(uint256);
/**
@notice Calculate the oustanding annualized fee
@return Amount of pool tokens to be minted to charge the annualized fee
*/
function calcOutStandingAnnualizedFee() external view returns(uint256);
/**
@notice Charges the annualized fee
*/
function chargeOutstandingAnnualizedFee() external;
/**
@notice Pulls underlying from caller and mints the pool token
@param _amount Amount of pool tokens to mint
*/
function joinPool(uint256 _amount) external;
/**
@notice Burns pool tokens from the caller and returns underlying assets
*/
function exitPool(uint256 _amount) external;
/**
@notice Get if the pool is locked or not. (not accepting exit and entry)
@return Boolean indicating if the pool is locked
*/
function getLock() external view returns (bool);
/**
@notice Get the block until which the pool is locked
@return The lock block
*/
function getLockBlock() external view returns (uint256);
/**
@notice Set the lock block
@param _lock Block height of the lock
*/
function setLock(uint256 _lock) external;
/**
@notice Get the maximum of pool tokens that can be minted
@return Cap
*/
function getCap() external view returns (uint256);
/**
@notice Set the maximum of pool tokens that can be minted
@param _maxCap Max cap
*/
function setCap(uint256 _maxCap) external;
/**
@notice Get the amount of tokens owned by the pool
@param _token Addres of the token
@return Amount owned by the contract
*/
function balance(address _token) external view returns (uint256);
/**
@notice Get the tokens in the pool
@return Array of tokens in the pool
*/
function getTokens() external view returns (address[] memory);
/**
@notice Add a token to the pool. Should have at least a balance of 10**6
@param _token Address of the token to add
*/
function addToken(address _token) external;
/**
@notice Removes a token from the pool
@param _token Address of the token to remove
*/
function removeToken(address _token) external;
/**
@notice Checks if a token was added to the pool
@param _token address of the token
@return If token is in the pool or not
*/
function getTokenInPool(address _token) external view returns (bool);
/**
@notice Calculate the amounts of underlying needed to mint that pool amount.
@param _amount Amount of pool tokens to mint
@return tokens Tokens needed
@return amounts Amounts of underlying needed
*/
function calcTokensForAmount(uint256 _amount)
external
view
returns (address[] memory tokens, uint256[] memory amounts);
/**
@notice Calculate the amounts of underlying to receive when burning that pool amount
@param _amount Amount of pool tokens to burn
@return tokens Tokens returned
@return amounts Amounts of underlying returned
*/
function calcTokensForAmountExit(uint256 _amount)
external
view
returns (address[] memory tokens, uint256[] memory amounts);
}