@gearbox-protocol/periphery-v3 1.2.7 → 1.2.11

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.
@@ -184,7 +184,7 @@ contract DataCompressorV2_10 is
184
184
 
185
185
  result.addr = _creditManager;
186
186
  result.cfVersion = ver;
187
- result.description = cmDescriptions[_creditManager];
187
+ result.name = cmDescriptions[_creditManager];
188
188
 
189
189
  result.underlying = creditManagerV2.underlying();
190
190
 
@@ -7,7 +7,7 @@ pragma experimental ABIEncoderV2;
7
7
  import "@gearbox-protocol/core-v3/contracts/interfaces/IAddressProviderV3.sol";
8
8
  import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
9
9
  import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
10
-
10
+ import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
11
11
  import {PERCENTAGE_FACTOR, RAY} from "@gearbox-protocol/core-v2/contracts/libraries/Constants.sol";
12
12
 
13
13
  import {ContractsRegisterTrait} from "@gearbox-protocol/core-v3/contracts/traits/ContractsRegisterTrait.sol";
@@ -195,7 +195,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
195
195
  result.creditManager = _cm;
196
196
  result.addr = _creditAccount;
197
197
 
198
- result.underlying = creditManager.underlying();
198
+ result.underlying = _getUnderlying(creditManager);
199
199
 
200
200
  address pool = _getPool(_cm);
201
201
  result.baseBorrowRate = _getBaseInterestRate(pool);
@@ -258,7 +258,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
258
258
  returns (CollateralDebtData memory collateralDebtData) {
259
259
  result.accruedInterest = collateralDebtData.accruedInterest;
260
260
  result.accruedFees = collateralDebtData.accruedFees;
261
- result.healthFactor = collateralDebtData.twvUSD * PERCENTAGE_FACTOR / collateralDebtData.debt;
261
+ result.healthFactor = collateralDebtData.twvUSD * PERCENTAGE_FACTOR / collateralDebtData.totalDebtUSD;
262
262
  result.totalValue = collateralDebtData.totalValue;
263
263
  result.isSuccessful = true;
264
264
  } catch {
@@ -344,10 +344,10 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
344
344
  ICreditFacadeV3 creditFacade = _getCreditFacade(address(creditManager));
345
345
 
346
346
  result.addr = _cm;
347
- result.description = _getName(_cm);
347
+ result.name = _getName(_cm);
348
348
  result.cfVersion = _getVersion(address(creditFacade));
349
349
 
350
- result.underlying = creditManager.underlying();
350
+ result.underlying = _getUnderlying(creditManager);
351
351
 
352
352
  {
353
353
  result.pool = _getPool(_cm);
@@ -406,7 +406,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
406
406
 
407
407
  result.quotas = _getQuotas(result.pool);
408
408
 
409
- result.isPaused = CreditFacadeV3(address(creditFacade)).paused();
409
+ result.isPaused = _getPaused(address(creditFacade));
410
410
  }
411
411
 
412
412
  /// @dev Returns PoolData for a particular pool
@@ -459,22 +459,23 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
459
459
 
460
460
  result.quotas = _getQuotas(_pool);
461
461
  result.lirm = _getInterestRateModel(_pool);
462
+ result.isPaused = _getPaused(_pool);
462
463
 
463
- result.isPaused = pool.paused();
464
-
464
+ // Adding zappers
465
465
  address[] memory zappers = zapperRegister.zappers(address(pool));
466
466
  len = zappers.length;
467
467
  result.zappers = new ZapperInfo[](len);
468
468
 
469
469
  unchecked {
470
470
  for (uint256 i; i < len; ++i) {
471
- address tokenFrom = IZapper(zappers[i]).unwrappedToken();
472
- result.zappers[i] = ZapperInfo({tokenFrom: tokenFrom, zapper: zappers[i]});
471
+ address tokenIn = IZapper(zappers[i]).unwrappedToken();
472
+ address tokenOut = IZapper(zappers[i]).tokenOut();
473
+ result.zappers[i] = ZapperInfo({tokenIn: tokenIn, tokenOut: tokenOut, zapper: zappers[i]});
473
474
  }
474
475
  }
475
476
 
476
477
  result.poolQuotaKeeper = address(_getPoolQuotaKeeper(_pool));
477
- result.gauge = IPoolQuotaKeeperV3(result.poolQuotaKeeper).gauge();
478
+ result.gauge = _getGauge(IPoolQuotaKeeperV3(result.poolQuotaKeeper));
478
479
 
479
480
  return result;
480
481
  }
@@ -614,6 +615,18 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
614
615
  return ICreditManagerV3(_cm).collateralTokensCount();
615
616
  }
616
617
 
618
+ function _getGauge(IPoolQuotaKeeperV3 pqk) internal view returns (address) {
619
+ return pqk.gauge();
620
+ }
621
+
622
+ function _getPaused(address pausableContract) internal view returns (bool) {
623
+ return Pausable(pausableContract).paused();
624
+ }
625
+
626
+ function _getUnderlying(ICreditManagerV3 cm) internal view returns (address) {
627
+ return cm.underlying();
628
+ }
629
+
617
630
  function _getQuotas(address _pool) internal view returns (QuotaInfo[] memory quotas) {
618
631
  IPoolQuotaKeeperV3 pqk = _getPoolQuotaKeeper(_pool);
619
632
 
@@ -644,7 +657,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
644
657
  for (uint256 i; i < len; ++i) {
645
658
  GaugeInfo memory gaugeInfo = result[i];
646
659
  IPoolQuotaKeeperV3 pqk = _getPoolQuotaKeeper(poolsV3[i]);
647
- address gauge = pqk.gauge();
660
+ address gauge = _getGauge(pqk);
648
661
  gaugeInfo.addr = gauge;
649
662
  gaugeInfo.pool = _getPool(gauge);
650
663
  (gaugeInfo.symbol, gaugeInfo.name) = _getSymbolAndName(gaugeInfo.pool);
@@ -696,28 +709,34 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
696
709
  address gauge;
697
710
  {
698
711
  IPoolQuotaKeeperV3 pqk = _getPoolQuotaKeeper(poolsV3[i]);
699
- gauge = pqk.gauge();
712
+ gauge = _getGauge(pqk);
700
713
 
701
714
  quotaTokens = _getQuotedTokens(pqk);
702
715
  }
703
716
  uint256 quotaTokensLen = quotaTokens.length;
704
717
 
705
718
  for (uint256 j; j < quotaTokensLen; ++j) {
706
- address token = quotaTokens[j];
719
+ if (op == QUERY) {
720
+ address token = quotaTokens[j];
721
+ GaugeVote memory gaugeVote = gaugeVotes[index];
707
722
 
708
- (uint96 votesLpSide, uint96 votesCaSide) = IGaugeV3(gauge).userTokenVotes(staker, token);
723
+ (gaugeVote.stakerVotesLpSide, gaugeVote.stakerVotesCaSide) =
724
+ IGaugeV3(gauge).userTokenVotes(staker, token);
709
725
 
710
- if (votesLpSide > 0 || votesCaSide > 0) {
711
- if (op == QUERY) {
712
- gaugeVotes[index] = GaugeVote({
713
- gauge: gauge,
714
- token: token,
715
- totalVotesLpSide: votesLpSide,
716
- totalVotesCaSide: votesCaSide
717
- });
718
- }
719
- ++index;
726
+ (
727
+ gaugeVote.minRate,
728
+ gaugeVote.maxRate,
729
+ gaugeVote.totalVotesLpSide,
730
+ gaugeVote.totalVotesCaSide
731
+ ) = IGaugeV3(gauge).quotaRateParams(token);
732
+
733
+ gaugeVote.currentEpoch = IGaugeV3(gauge).epochLastUpdate();
734
+ gaugeVote.epochFrozen = IGaugeV3(gauge).epochFrozen();
735
+
736
+ gaugeVote.gauge = gauge;
737
+ gaugeVote.token = token;
720
738
  }
739
+ ++index;
721
740
  }
722
741
  }
723
742
  }
@@ -33,8 +33,9 @@ struct ContractAdapter {
33
33
  }
34
34
 
35
35
  struct ZapperInfo {
36
- address tokenFrom;
37
36
  address zapper;
37
+ address tokenIn;
38
+ address tokenOut;
38
39
  }
39
40
 
40
41
  struct CreditAccountData {
@@ -86,7 +87,7 @@ struct LinearModel {
86
87
 
87
88
  struct CreditManagerData {
88
89
  address addr;
89
- string description;
90
+ string name;
90
91
  uint256 cfVersion;
91
92
  address creditFacade; // V2 only: address of creditFacade
92
93
  address creditConfigurator; // V2 only: address of creditConfigurator
@@ -179,6 +180,12 @@ struct GaugeInfo {
179
180
  struct GaugeVote {
180
181
  address gauge;
181
182
  address token;
183
+ uint16 minRate;
184
+ uint16 maxRate;
185
+ uint16 currentEpoch;
186
+ bool epochFrozen;
182
187
  uint96 totalVotesLpSide;
183
188
  uint96 totalVotesCaSide;
189
+ uint96 stakerVotesLpSide;
190
+ uint96 stakerVotesCaSide;
184
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/periphery-v3",
3
- "version": "1.2.7",
3
+ "version": "1.2.11",
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>",
@@ -17,10 +17,10 @@
17
17
  "@1inch/solidity-utils": "^2.2.27",
18
18
  "@commitlint/cli": "^17.6.3",
19
19
  "@commitlint/config-conventional": "17.6.0",
20
- "@gearbox-protocol/core-v2": "1.19.0-base.14",
21
- "@gearbox-protocol/core-v3": "^1.40.0",
22
- "@gearbox-protocol/integrations-v3": "^1.16.0",
23
- "@gearbox-protocol/oracles-v3": "^1.7.2",
20
+ "@gearbox-protocol/core-v2": "1.19.0-base.16",
21
+ "@gearbox-protocol/core-v3": "^1.40.2",
22
+ "@gearbox-protocol/integrations-v3": "^1.17.0",
23
+ "@gearbox-protocol/oracles-v3": "^1.7.6",
24
24
  "@gearbox-protocol/sdk-gov": "^1.5.10",
25
25
  "@openzeppelin/contracts": "^4.9.3"
26
26
  },