@gearbox-protocol/periphery-v3 1.0.5 → 1.0.6
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/contracts/data/Types.sol
CHANGED
|
@@ -160,3 +160,79 @@ struct GaugeVote {
|
|
|
160
160
|
uint96 totalVotesLpSide;
|
|
161
161
|
uint96 totalVotesCaSide;
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
struct CreditManagerDataV2 {
|
|
165
|
+
address addr;
|
|
166
|
+
address underlying;
|
|
167
|
+
address pool;
|
|
168
|
+
bool isWETH;
|
|
169
|
+
bool canBorrow;
|
|
170
|
+
uint256 borrowRate;
|
|
171
|
+
uint256 minAmount;
|
|
172
|
+
uint256 maxAmount;
|
|
173
|
+
uint256 maxLeverageFactor; // for V1 only
|
|
174
|
+
uint256 availableLiquidity;
|
|
175
|
+
address[] collateralTokens;
|
|
176
|
+
ContractAdapter[] adapters;
|
|
177
|
+
uint256[] liquidationThresholds;
|
|
178
|
+
uint8 version;
|
|
179
|
+
address creditFacade; // V2 only: address of creditFacade
|
|
180
|
+
address creditConfigurator; // V2 only: address of creditConfigurator
|
|
181
|
+
bool isDegenMode; // V2 only: true if contract is in Degen mode
|
|
182
|
+
address degenNFT; // V2 only: degenNFT, address(0) if not in degen mode
|
|
183
|
+
bool isIncreaseDebtForbidden; // V2 only: true if increasing debt is forbidden
|
|
184
|
+
uint256 forbiddenTokenMask; // V2 only: mask which forbids some particular tokens
|
|
185
|
+
uint8 maxEnabledTokensLength; // V2 only: in V1 as many tokens as the CM can support (256)
|
|
186
|
+
uint16 feeInterest; // Interest fee protocol charges: fee = interest accrues * feeInterest
|
|
187
|
+
uint16 feeLiquidation; // Liquidation fee protocol charges: fee = totalValue * feeLiquidation
|
|
188
|
+
uint16 liquidationDiscount; // Miltiplier to get amount which liquidator should pay: amount = totalValue * liquidationDiscount
|
|
189
|
+
uint16 feeLiquidationExpired; // Liquidation fee protocol charges on expired accounts
|
|
190
|
+
uint16 liquidationDiscountExpired; // Multiplier for the amount the liquidator has to pay when closing an expired account
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
struct CreditAccountDataV2 {
|
|
194
|
+
address addr;
|
|
195
|
+
address borrower;
|
|
196
|
+
bool inUse;
|
|
197
|
+
address creditManager;
|
|
198
|
+
address underlying;
|
|
199
|
+
uint256 borrowedAmountPlusInterest;
|
|
200
|
+
uint256 borrowedAmountPlusInterestAndFees;
|
|
201
|
+
uint256 totalValue;
|
|
202
|
+
uint256 healthFactor;
|
|
203
|
+
uint256 borrowRate;
|
|
204
|
+
TokenBalance[] balances;
|
|
205
|
+
uint256 repayAmount; // for v1 accounts only
|
|
206
|
+
uint256 liquidationAmount; // for v1 accounts only
|
|
207
|
+
bool canBeClosed; // for v1 accounts only
|
|
208
|
+
uint256 borrowedAmount;
|
|
209
|
+
uint256 cumulativeIndexAtOpen;
|
|
210
|
+
uint256 since;
|
|
211
|
+
uint8 version;
|
|
212
|
+
uint256 enabledTokenMask;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
struct PoolDataV2 {
|
|
216
|
+
address addr;
|
|
217
|
+
bool isWETH;
|
|
218
|
+
address underlying;
|
|
219
|
+
address dieselToken;
|
|
220
|
+
uint256 linearCumulativeIndex;
|
|
221
|
+
uint256 availableLiquidity;
|
|
222
|
+
uint256 expectedLiquidity;
|
|
223
|
+
uint256 expectedLiquidityLimit;
|
|
224
|
+
uint256 totalBorrowed;
|
|
225
|
+
uint256 depositAPY_RAY;
|
|
226
|
+
uint256 borrowAPY_RAY;
|
|
227
|
+
uint256 dieselRate_RAY;
|
|
228
|
+
uint256 withdrawFee;
|
|
229
|
+
uint256 cumulativeIndex_RAY;
|
|
230
|
+
uint256 timestampLU;
|
|
231
|
+
uint8 version;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
struct TokenInfoV2 {
|
|
235
|
+
address addr;
|
|
236
|
+
string symbol;
|
|
237
|
+
uint8 decimals;
|
|
238
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Gearbox Protocol. Generalized leverage for DeFi protocols
|
|
3
|
+
// (c) Gearbox Holdings, 2022
|
|
4
|
+
pragma solidity ^0.8.10;
|
|
5
|
+
|
|
6
|
+
import {CreditAccountDataV2, CreditManagerDataV2, PoolDataV2, TokenInfoV2} from "../data/Types.sol";
|
|
7
|
+
import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";
|
|
8
|
+
|
|
9
|
+
interface IDataCompressorV2Exceptions {
|
|
10
|
+
/// @dev Thrown if attempting to get data on a contract that is not a registered
|
|
11
|
+
/// Credit Manager
|
|
12
|
+
error NotCreditManagerException();
|
|
13
|
+
|
|
14
|
+
/// @dev Thrown if attempting the get data on a contract that is not a registered
|
|
15
|
+
/// pool
|
|
16
|
+
error NotPoolException();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface IDataCompressorV2 is IDataCompressorV2Exceptions, IVersion {
|
|
20
|
+
/// @dev Returns CreditAccountData for all opened accounts for particular borrower
|
|
21
|
+
/// @param borrower Borrower address
|
|
22
|
+
function getCreditAccountList(address borrower) external view returns (CreditAccountDataV2[] memory);
|
|
23
|
+
|
|
24
|
+
/// @dev Returns whether the borrower has an open credit account with the credit manager
|
|
25
|
+
/// @param creditManager Credit manager to check
|
|
26
|
+
/// @param borrower Borrower to check
|
|
27
|
+
function hasOpenedCreditAccount(address creditManager, address borrower) external view returns (bool);
|
|
28
|
+
|
|
29
|
+
/// @dev Returns CreditAccountData for a particular Credit Account account, based on creditManager and borrower
|
|
30
|
+
/// @param _creditManager Credit manager address
|
|
31
|
+
/// @param borrower Borrower address
|
|
32
|
+
function getCreditAccountData(address _creditManager, address borrower)
|
|
33
|
+
external
|
|
34
|
+
view
|
|
35
|
+
returns (CreditAccountDataV2 memory);
|
|
36
|
+
|
|
37
|
+
/// @dev Returns CreditManagerData for all Credit Managers
|
|
38
|
+
function getCreditManagersList() external view returns (CreditManagerDataV2[] memory);
|
|
39
|
+
|
|
40
|
+
/// @dev Returns CreditManagerData for a particular _creditManager
|
|
41
|
+
/// @param _creditManager CreditManager address
|
|
42
|
+
function getCreditManagerData(address _creditManager) external view returns (CreditManagerDataV2 memory);
|
|
43
|
+
|
|
44
|
+
/// @dev Returns PoolData for a particular pool
|
|
45
|
+
/// @param _pool Pool address
|
|
46
|
+
function getPoolData(address _pool) external view returns (PoolDataV2 memory);
|
|
47
|
+
|
|
48
|
+
/// @dev Returns PoolData for all registered pools
|
|
49
|
+
function getPoolsList() external view returns (PoolDataV2[] memory);
|
|
50
|
+
|
|
51
|
+
/// @dev Returns the adapter address for a particular creditManager and targetContract
|
|
52
|
+
function getAdapter(address _creditManager, address _allowedContract) external view returns (address adapter);
|
|
53
|
+
}
|
package/package.json
CHANGED