@gearbox-protocol/periphery-v3 1.2.3 → 1.2.5
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.
|
@@ -7,6 +7,8 @@ pragma experimental ABIEncoderV2;
|
|
|
7
7
|
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
|
|
8
8
|
|
|
9
9
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
10
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
11
|
+
|
|
10
12
|
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
|
|
11
13
|
|
|
12
14
|
import {PERCENTAGE_FACTOR} from "@gearbox-protocol/core-v2/contracts/libraries/PercentageMath.sol";
|
|
@@ -257,6 +259,10 @@ contract DataCompressorV2_10 is IDataCompressorV2_10, ContractsRegisterTrait, Li
|
|
|
257
259
|
result.baseInterestRate = pool.borrowAPY_RAY();
|
|
258
260
|
result.underlying = pool.underlyingToken();
|
|
259
261
|
result.dieselToken = pool.dieselToken();
|
|
262
|
+
|
|
263
|
+
result.symbol = IERC20Metadata(result.dieselToken).symbol();
|
|
264
|
+
result.name = IERC20Metadata(result.dieselToken).name();
|
|
265
|
+
|
|
260
266
|
result.dieselRate_RAY = pool.getDieselRate_RAY();
|
|
261
267
|
result.withdrawFee = pool.withdrawFee();
|
|
262
268
|
result.baseInterestIndexLU = pool._timestampLU();
|
|
@@ -6,6 +6,8 @@ pragma experimental ABIEncoderV2;
|
|
|
6
6
|
|
|
7
7
|
import "@gearbox-protocol/core-v3/contracts/interfaces/IAddressProviderV3.sol";
|
|
8
8
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
9
|
+
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
10
|
+
|
|
9
11
|
import {PERCENTAGE_FACTOR, RAY} from "@gearbox-protocol/core-v2/contracts/libraries/Constants.sol";
|
|
10
12
|
|
|
11
13
|
import {ContractsRegisterTrait} from "@gearbox-protocol/core-v3/contracts/traits/ContractsRegisterTrait.sol";
|
|
@@ -54,7 +56,8 @@ import {
|
|
|
54
56
|
GaugeQuotaParams,
|
|
55
57
|
CreditManagerDebtParams,
|
|
56
58
|
GaugeVote,
|
|
57
|
-
ZapperInfo
|
|
59
|
+
ZapperInfo,
|
|
60
|
+
LinearModel
|
|
58
61
|
} from "./Types.sol";
|
|
59
62
|
|
|
60
63
|
// EXCEPTIONS
|
|
@@ -165,22 +168,22 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
165
168
|
{
|
|
166
169
|
ICreditAccountV3 creditAccount = ICreditAccountV3(_creditAccount);
|
|
167
170
|
|
|
168
|
-
address
|
|
169
|
-
_ensureRegisteredCreditManager(
|
|
171
|
+
address _cm = creditAccount.creditManager();
|
|
172
|
+
_ensureRegisteredCreditManager(_cm);
|
|
170
173
|
|
|
171
|
-
if (!_isContractV3(
|
|
174
|
+
if (!_isContractV3(_cm)) revert CreditManagerIsNotV3Exception();
|
|
172
175
|
|
|
173
|
-
_updatePrices(
|
|
176
|
+
_updatePrices(_cm, priceUpdates);
|
|
174
177
|
|
|
175
|
-
return _getCreditAccountData(
|
|
178
|
+
return _getCreditAccountData(_cm, _creditAccount);
|
|
176
179
|
}
|
|
177
180
|
|
|
178
|
-
function _getCreditAccountData(address
|
|
181
|
+
function _getCreditAccountData(address _cm, address _creditAccount)
|
|
179
182
|
internal
|
|
180
183
|
view
|
|
181
184
|
returns (CreditAccountData memory result)
|
|
182
185
|
{
|
|
183
|
-
ICreditManagerV3 creditManager = ICreditManagerV3(
|
|
186
|
+
ICreditManagerV3 creditManager = ICreditManagerV3(_cm);
|
|
184
187
|
ICreditFacadeV3 creditFacade = _getCreditFacade(address(creditManager));
|
|
185
188
|
// ICreditConfiguratorV3 creditConfigurator = ICreditConfiguratorV3(creditManager.creditConfigurator());
|
|
186
189
|
|
|
@@ -189,15 +192,15 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
189
192
|
address borrower = _getBorrowerOrRevert(address(creditManager), _creditAccount);
|
|
190
193
|
|
|
191
194
|
result.borrower = borrower;
|
|
192
|
-
result.creditManager =
|
|
195
|
+
result.creditManager = _cm;
|
|
193
196
|
result.addr = _creditAccount;
|
|
194
197
|
|
|
195
198
|
result.underlying = creditManager.underlying();
|
|
196
199
|
|
|
197
|
-
address pool =
|
|
200
|
+
address pool = _getPool(_cm);
|
|
198
201
|
result.baseBorrowRate = _getBaseInterestRate(pool);
|
|
199
202
|
|
|
200
|
-
uint256 collateralTokenCount = creditManager
|
|
203
|
+
uint256 collateralTokenCount = _getCollateralTokensCount(address(creditManager));
|
|
201
204
|
|
|
202
205
|
result.enabledTokensMask = creditManager.enabledTokensMaskOf(_creditAccount);
|
|
203
206
|
|
|
@@ -259,7 +262,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
259
262
|
result.totalValue = collateralDebtData.totalValue;
|
|
260
263
|
result.isSuccessful = true;
|
|
261
264
|
} catch {
|
|
262
|
-
_getPriceFeedFailedList(
|
|
265
|
+
_getPriceFeedFailedList(_cm, result.balances);
|
|
263
266
|
result.isSuccessful = false;
|
|
264
267
|
}
|
|
265
268
|
|
|
@@ -276,13 +279,13 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
276
279
|
// address borrower;
|
|
277
280
|
|
|
278
281
|
(result.debt, result.cumulativeIndexLastUpdate, result.cumulativeQuotaInterest,,,, result.since,) =
|
|
279
|
-
CreditManagerV3(
|
|
282
|
+
CreditManagerV3(_cm).creditAccountInfo(_creditAccount);
|
|
280
283
|
|
|
281
284
|
result.expirationDate = creditFacade.expirationDate();
|
|
282
285
|
result.maxApprovedBots = CreditFacadeV3(address(creditFacade)).maxApprovedBots();
|
|
283
286
|
|
|
284
287
|
result.activeBots =
|
|
285
|
-
IBotListV3(CreditFacadeV3(address(creditFacade)).botList()).getActiveBots(
|
|
288
|
+
IBotListV3(CreditFacadeV3(address(creditFacade)).botList()).getActiveBots(_cm, _creditAccount);
|
|
286
289
|
|
|
287
290
|
// QuotaInfo[] quotas;
|
|
288
291
|
result.schedultedWithdrawals = IWithdrawalManagerV3(CreditFacadeV3(address(creditFacade)).withdrawalManager())
|
|
@@ -303,10 +306,10 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
303
306
|
}
|
|
304
307
|
|
|
305
308
|
for (uint256 i = 0; i < len; ++i) {
|
|
306
|
-
address
|
|
309
|
+
address _cm = IContractsRegister(contractsRegister).creditManagers(i);
|
|
307
310
|
|
|
308
|
-
if (_isContractV3(
|
|
309
|
-
if (op == QUERY) result[index] =
|
|
311
|
+
if (_isContractV3(_cm)) {
|
|
312
|
+
if (op == QUERY) result[index] = _cm;
|
|
310
313
|
++index;
|
|
311
314
|
}
|
|
312
315
|
}
|
|
@@ -314,8 +317,8 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
314
317
|
}
|
|
315
318
|
}
|
|
316
319
|
|
|
317
|
-
function _isContractV3(address
|
|
318
|
-
uint256 cmVersion = _getVersion(
|
|
320
|
+
function _isContractV3(address _cm) internal view returns (bool) {
|
|
321
|
+
uint256 cmVersion = _getVersion(_cm);
|
|
319
322
|
return cmVersion >= 3_00 && cmVersion < 3_99;
|
|
320
323
|
}
|
|
321
324
|
|
|
@@ -341,22 +344,23 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
341
344
|
ICreditFacadeV3 creditFacade = _getCreditFacade(address(creditManager));
|
|
342
345
|
|
|
343
346
|
result.addr = _cm;
|
|
347
|
+
result.description = _getDescription(_cm);
|
|
344
348
|
result.cfVersion = _getVersion(address(creditFacade));
|
|
345
349
|
|
|
346
350
|
result.underlying = creditManager.underlying();
|
|
347
351
|
|
|
348
352
|
{
|
|
349
|
-
result.pool =
|
|
353
|
+
result.pool = _getPool(_cm);
|
|
350
354
|
IPoolV3 pool = IPoolV3(result.pool);
|
|
351
355
|
result.baseBorrowRate = _getBaseInterestRate(address(pool));
|
|
352
356
|
result.availableToBorrow = pool.creditManagerBorrowable(_cm);
|
|
353
|
-
result.lirm =
|
|
357
|
+
result.lirm = _getInterestRateModel(address(pool));
|
|
354
358
|
}
|
|
355
359
|
|
|
356
360
|
(result.minDebt, result.maxDebt) = creditFacade.debtLimits();
|
|
357
361
|
|
|
358
362
|
{
|
|
359
|
-
uint256 collateralTokenCount = creditManager
|
|
363
|
+
uint256 collateralTokenCount = _getCollateralTokensCount(address(creditManager));
|
|
360
364
|
|
|
361
365
|
result.collateralTokens = new address[](collateralTokenCount);
|
|
362
366
|
result.liquidationThresholds = new uint256[](collateralTokenCount);
|
|
@@ -415,10 +419,11 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
415
419
|
result.availableLiquidity = pool.availableLiquidity();
|
|
416
420
|
|
|
417
421
|
result.dieselRate_RAY = pool.convertToAssets(RAY);
|
|
418
|
-
result.linearCumulativeIndex = pool.
|
|
422
|
+
result.linearCumulativeIndex = pool.baseInterestIndex();
|
|
419
423
|
result.baseInterestRate = _getBaseInterestRate(address(pool));
|
|
420
424
|
result.underlying = pool.underlyingToken();
|
|
421
425
|
result.dieselToken = address(pool);
|
|
426
|
+
(result.symbol, result.name) = _getSymbolAndName(_pool);
|
|
422
427
|
|
|
423
428
|
result.dieselRate_RAY = pool.convertToAssets(RAY);
|
|
424
429
|
result.withdrawFee = pool.withdrawFee();
|
|
@@ -453,7 +458,8 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
453
458
|
result.version = _getVersion(address(pool));
|
|
454
459
|
|
|
455
460
|
result.quotas = _getQuotas(_pool);
|
|
456
|
-
result.lirm =
|
|
461
|
+
result.lirm = _getInterestRateModel(_pool);
|
|
462
|
+
|
|
457
463
|
result.isPaused = pool.paused();
|
|
458
464
|
|
|
459
465
|
address[] memory zappers = zapperRegister.zappers(address(pool));
|
|
@@ -583,10 +589,35 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
583
589
|
return ICreditFacadeV3(ICreditManagerV3(cm).creditFacade());
|
|
584
590
|
}
|
|
585
591
|
|
|
592
|
+
function _getSymbolAndName(address token) internal view returns (string memory symbol, string memory name) {
|
|
593
|
+
symbol = IERC20Metadata(token).symbol();
|
|
594
|
+
name = IERC20Metadata(token).name();
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function _getInterestRateModel(address pool) internal view returns (LinearModel memory) {
|
|
598
|
+
return getLIRMData(IPoolV3(pool).interestRateModel());
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function _getQuotedTokens(IPoolQuotaKeeperV3 pqk) internal view returns (address[] memory result) {
|
|
602
|
+
result = pqk.quotedTokens();
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function _getPool(address cnt) internal view returns (address) {
|
|
606
|
+
return ICreditManagerV3(cnt).pool();
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function _getDescription(address _cm) internal view returns (string memory) {
|
|
610
|
+
return ICreditManagerV3(_cm).description();
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function _getCollateralTokensCount(address _cm) internal view returns (uint256) {
|
|
614
|
+
return ICreditManagerV3(_cm).collateralTokensCount();
|
|
615
|
+
}
|
|
616
|
+
|
|
586
617
|
function _getQuotas(address _pool) internal view returns (QuotaInfo[] memory quotas) {
|
|
587
618
|
IPoolQuotaKeeperV3 pqk = _getPoolQuotaKeeper(_pool);
|
|
588
619
|
|
|
589
|
-
address[] memory quotaTokens = pqk
|
|
620
|
+
address[] memory quotaTokens = _getQuotedTokens(pqk);
|
|
590
621
|
uint256 len = quotaTokens.length;
|
|
591
622
|
quotas = new QuotaInfo[](len);
|
|
592
623
|
unchecked {
|
|
@@ -615,8 +646,10 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
615
646
|
IPoolQuotaKeeperV3 pqk = _getPoolQuotaKeeper(poolsV3[i]);
|
|
616
647
|
address gauge = pqk.gauge();
|
|
617
648
|
gaugeInfo.addr = gauge;
|
|
649
|
+
gaugeInfo.pool = _getPool(gauge);
|
|
650
|
+
(gaugeInfo.symbol, gaugeInfo.name) = _getSymbolAndName(gaugeInfo.pool);
|
|
618
651
|
|
|
619
|
-
address[] memory quotaTokens = pqk
|
|
652
|
+
address[] memory quotaTokens = _getQuotedTokens(pqk);
|
|
620
653
|
uint256 quotaTokensLen = quotaTokens.length;
|
|
621
654
|
gaugeInfo.quotaParams = new GaugeQuotaParams[](quotaTokensLen);
|
|
622
655
|
|
|
@@ -665,7 +698,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
|
|
|
665
698
|
IPoolQuotaKeeperV3 pqk = _getPoolQuotaKeeper(poolsV3[i]);
|
|
666
699
|
gauge = pqk.gauge();
|
|
667
700
|
|
|
668
|
-
quotaTokens = pqk
|
|
701
|
+
quotaTokens = _getQuotedTokens(pqk);
|
|
669
702
|
}
|
|
670
703
|
uint256 quotaTokensLen = quotaTokens.length;
|
|
671
704
|
|
package/contracts/data/Types.sol
CHANGED
|
@@ -44,6 +44,7 @@ struct CreditAccountData {
|
|
|
44
44
|
address addr;
|
|
45
45
|
address borrower;
|
|
46
46
|
address creditManager;
|
|
47
|
+
string cmDescription;
|
|
47
48
|
address creditFacade;
|
|
48
49
|
address underlying;
|
|
49
50
|
uint256 debt;
|
|
@@ -85,6 +86,7 @@ struct LinearModel {
|
|
|
85
86
|
|
|
86
87
|
struct CreditManagerData {
|
|
87
88
|
address addr;
|
|
89
|
+
string description;
|
|
88
90
|
uint256 cfVersion;
|
|
89
91
|
address creditFacade; // V2 only: address of creditFacade
|
|
90
92
|
address creditConfigurator; // V2 only: address of creditConfigurator
|
|
@@ -126,6 +128,8 @@ struct PoolData {
|
|
|
126
128
|
address addr;
|
|
127
129
|
address underlying;
|
|
128
130
|
address dieselToken;
|
|
131
|
+
string symbol;
|
|
132
|
+
string name;
|
|
129
133
|
///
|
|
130
134
|
uint256 linearCumulativeIndex;
|
|
131
135
|
uint256 availableLiquidity;
|
|
@@ -166,6 +170,9 @@ struct GaugeQuotaParams {
|
|
|
166
170
|
|
|
167
171
|
struct GaugeInfo {
|
|
168
172
|
address addr;
|
|
173
|
+
address pool;
|
|
174
|
+
string symbol;
|
|
175
|
+
string name;
|
|
169
176
|
GaugeQuotaParams[] quotaParams;
|
|
170
177
|
}
|
|
171
178
|
|
|
@@ -175,79 +182,3 @@ struct GaugeVote {
|
|
|
175
182
|
uint96 totalVotesLpSide;
|
|
176
183
|
uint96 totalVotesCaSide;
|
|
177
184
|
}
|
|
178
|
-
|
|
179
|
-
struct CreditManagerDataV2 {
|
|
180
|
-
address addr;
|
|
181
|
-
address underlying;
|
|
182
|
-
address pool;
|
|
183
|
-
bool isWETH;
|
|
184
|
-
bool canBorrow;
|
|
185
|
-
uint256 borrowRate;
|
|
186
|
-
uint256 minAmount;
|
|
187
|
-
uint256 maxAmount;
|
|
188
|
-
uint256 maxLeverageFactor; // for V1 only
|
|
189
|
-
uint256 availableLiquidity;
|
|
190
|
-
address[] collateralTokens;
|
|
191
|
-
ContractAdapter[] adapters;
|
|
192
|
-
uint256[] liquidationThresholds;
|
|
193
|
-
uint8 version;
|
|
194
|
-
address creditFacade; // V2 only: address of creditFacade
|
|
195
|
-
address creditConfigurator; // V2 only: address of creditConfigurator
|
|
196
|
-
bool isDegenMode; // V2 only: true if contract is in Degen mode
|
|
197
|
-
address degenNFT; // V2 only: degenNFT, address(0) if not in degen mode
|
|
198
|
-
bool isIncreaseDebtForbidden; // V2 only: true if increasing debt is forbidden
|
|
199
|
-
uint256 forbiddenTokenMask; // V2 only: mask which forbids some particular tokens
|
|
200
|
-
uint8 maxEnabledTokensLength; // V2 only: in V1 as many tokens as the CM can support (256)
|
|
201
|
-
uint16 feeInterest; // Interest fee protocol charges: fee = interest accrues * feeInterest
|
|
202
|
-
uint16 feeLiquidation; // Liquidation fee protocol charges: fee = totalValue * feeLiquidation
|
|
203
|
-
uint16 liquidationDiscount; // Miltiplier to get amount which liquidator should pay: amount = totalValue * liquidationDiscount
|
|
204
|
-
uint16 feeLiquidationExpired; // Liquidation fee protocol charges on expired accounts
|
|
205
|
-
uint16 liquidationDiscountExpired; // Multiplier for the amount the liquidator has to pay when closing an expired account
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
struct CreditAccountDataV2 {
|
|
209
|
-
address addr;
|
|
210
|
-
address borrower;
|
|
211
|
-
bool inUse;
|
|
212
|
-
address creditManager;
|
|
213
|
-
address underlying;
|
|
214
|
-
uint256 borrowedAmountPlusInterest;
|
|
215
|
-
uint256 borrowedAmountPlusInterestAndFees;
|
|
216
|
-
uint256 totalValue;
|
|
217
|
-
uint256 healthFactor;
|
|
218
|
-
uint256 borrowRate;
|
|
219
|
-
TokenBalance[] balances;
|
|
220
|
-
uint256 repayAmount; // for v1 accounts only
|
|
221
|
-
uint256 liquidationAmount; // for v1 accounts only
|
|
222
|
-
bool canBeClosed; // for v1 accounts only
|
|
223
|
-
uint256 borrowedAmount;
|
|
224
|
-
uint256 cumulativeIndexAtOpen;
|
|
225
|
-
uint256 since;
|
|
226
|
-
uint8 version;
|
|
227
|
-
uint256 enabledTokenMask;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
struct PoolDataV2 {
|
|
231
|
-
address addr;
|
|
232
|
-
bool isWETH;
|
|
233
|
-
address underlying;
|
|
234
|
-
address dieselToken;
|
|
235
|
-
uint256 linearCumulativeIndex;
|
|
236
|
-
uint256 availableLiquidity;
|
|
237
|
-
uint256 expectedLiquidity;
|
|
238
|
-
uint256 expectedLiquidityLimit;
|
|
239
|
-
uint256 totalBorrowed;
|
|
240
|
-
uint256 depositAPY_RAY;
|
|
241
|
-
uint256 borrowAPY_RAY;
|
|
242
|
-
uint256 dieselRate_RAY;
|
|
243
|
-
uint256 withdrawFee;
|
|
244
|
-
uint256 cumulativeIndex_RAY;
|
|
245
|
-
uint256 timestampLU;
|
|
246
|
-
uint8 version;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
struct TokenInfoV2 {
|
|
250
|
-
address addr;
|
|
251
|
-
string symbol;
|
|
252
|
-
uint8 decimals;
|
|
253
|
-
}
|
|
@@ -14,7 +14,7 @@ import {NetworkDetector} from "@gearbox-protocol/sdk-gov/contracts/NetworkDetect
|
|
|
14
14
|
|
|
15
15
|
import "forge-std/console.sol";
|
|
16
16
|
|
|
17
|
-
address constant ap =
|
|
17
|
+
address constant ap = 0xfb78A83730aBd595A362645368D10fE5a20525a6;
|
|
18
18
|
|
|
19
19
|
contract DCTest {
|
|
20
20
|
DataCompressorV2_10 public dc2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/periphery-v3",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": "git@github.com:Gearbox-protocol/periphery-v3.git",
|
|
6
6
|
"author": "Mikael <26343374+0xmikko@users.noreply.github.com>",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"@commitlint/cli": "^17.6.3",
|
|
19
19
|
"@commitlint/config-conventional": "17.6.0",
|
|
20
20
|
"@gearbox-protocol/core-v2": "1.19.0-base.14",
|
|
21
|
-
"@gearbox-protocol/core-v3": "^1.39.
|
|
21
|
+
"@gearbox-protocol/core-v3": "^1.39.2",
|
|
22
|
+
"@gearbox-protocol/integrations-v3": "^1.16.0",
|
|
22
23
|
"@gearbox-protocol/oracles-v3": "^1.7.2",
|
|
23
24
|
"@gearbox-protocol/sdk-gov": "^1.5.10",
|
|
24
|
-
"@gearbox-protocol/integrations-v3": "^1.16.0",
|
|
25
25
|
"@openzeppelin/contracts": "4.8.3"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
@@ -1,53 +0,0 @@
|
|
|
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
|
-
}
|