Skip to content

Commit ef95877

Browse files
committed
fix: health factor computation bug fixed
1 parent a9a1ebe commit ef95877

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

contracts/data/DataCompressor_2_1.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ contract DataCompressorV2_10 is
184184

185185
result.addr = _creditManager;
186186
result.cfVersion = ver;
187-
result.description = cmDescriptions[_creditManager];
187+
result.name = cmDescriptions[_creditManager];
188188

189189
result.underlying = creditManagerV2.underlying();
190190

contracts/data/DataCompressor_3_0.sol

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
258258
returns (CollateralDebtData memory collateralDebtData) {
259259
result.accruedInterest = collateralDebtData.accruedInterest;
260260
result.accruedFees = collateralDebtData.accruedFees;
261-
result.healthFactor = collateralDebtData.twvUSD * PERCENTAGE_FACTOR / collateralDebtData.debt;
261+
result.healthFactor = collateralDebtData.twvUSD * PERCENTAGE_FACTOR / collateralDebtData.totalDebtUSD;
262262
result.totalValue = collateralDebtData.totalValue;
263263
result.isSuccessful = true;
264264
} catch {
@@ -344,7 +344,7 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
344344
ICreditFacadeV3 creditFacade = _getCreditFacade(address(creditManager));
345345

346346
result.addr = _cm;
347-
result.description = _getName(_cm);
347+
result.name = _getName(_cm);
348348
result.cfVersion = _getVersion(address(creditFacade));
349349

350350
result.underlying = creditManager.underlying();
@@ -707,17 +707,17 @@ contract DataCompressorV3_00 is IDataCompressorV3_00, ContractsRegisterTrait, Li
707707

708708
(uint96 votesLpSide, uint96 votesCaSide) = IGaugeV3(gauge).userTokenVotes(staker, token);
709709

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;
710+
if (op == QUERY) {
711+
gaugeVotes[index] = GaugeVote({
712+
gauge: gauge,
713+
token: token,
714+
currentEpoch: IGaugeV3(gauge).epochLastUpdate(),
715+
epochFrozen: IGaugeV3(gauge).epochFrozen(),
716+
totalVotesLpSide: votesLpSide,
717+
totalVotesCaSide: votesCaSide
718+
});
720719
}
720+
++index;
721721
}
722722
}
723723
}

contracts/data/Types.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct LinearModel {
8686

8787
struct CreditManagerData {
8888
address addr;
89-
string description;
89+
string name;
9090
uint256 cfVersion;
9191
address creditFacade; // V2 only: address of creditFacade
9292
address creditConfigurator; // V2 only: address of creditConfigurator
@@ -179,6 +179,8 @@ struct GaugeInfo {
179179
struct GaugeVote {
180180
address gauge;
181181
address token;
182+
uint16 currentEpoch;
183+
bool epochFrozen;
182184
uint96 totalVotesLpSide;
183185
uint96 totalVotesCaSide;
184186
}

0 commit comments

Comments
 (0)