Skip to content

Commit

Permalink
Merge pull request #817 from liquity/fix_multitrove_getter_2
Browse files Browse the repository at this point in the history
Fix multitrove getter
  • Loading branch information
bingen authored Feb 26, 2025
2 parents 9137d18 + 9fa01ab commit 31ff465
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contracts/addresses/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"collateralRegistry": "0xd99de73b95236f69a559117ecd6f519af780f3f7",
"boldToken": "0xb01dd87b29d187f3e3a4bf6cdaebfb97f3d9ab98",
"hintHelpers": "0xe3bb97ee79ac4bdfc0c30a95ad82c243c9913ada",
"multiTroveGetter": "0x51f54b400d3114ff8abe8c44fc78e27e42571710",
"multiTroveGetter": "0x0C6Ae14FFdfA799b6d456483bEBf52D7bC2Ec978",
"exchangeHelpers": "0x28c9decfacee0e796409b4b63eb263610e5e38dc",
"branches": [
{
Expand Down
14 changes: 9 additions & 5 deletions contracts/src/Interfaces/IMultiTroveGetter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ pragma solidity ^0.8.0;
interface IMultiTroveGetter {
struct CombinedTroveData {
uint256 id;
uint256 debt;
uint256 coll;
uint256 stake;
uint256 entireDebt;
uint256 entireColl;
uint256 redistBoldDebtGain;
uint256 redistCollGain;
uint256 accruedInterest;
uint256 recordedDebt;
uint256 annualInterestRate;
uint256 lastDebtUpdateTime;
uint256 accruedBatchManagementFee;
uint256 lastInterestRateAdjTime;
uint256 stake;
uint256 lastDebtUpdateTime;
address interestBatchManager;
uint256 batchDebtShares;
uint256 batchCollShares;
uint256 snapshotETH;
uint256 snapshotBoldDebt;
}
Expand Down
21 changes: 16 additions & 5 deletions contracts/src/MultiTroveGetter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,28 @@ contract MultiTroveGetter is IMultiTroveGetter {
function _getOneTrove(ITroveManager _troveManager, uint256 _id, CombinedTroveData memory _out) internal view {
_out.id = _id;

LatestTroveData memory troveData = _troveManager.getLatestTroveData(_id);
_out.entireDebt = troveData.entireDebt;
_out.entireColl = troveData.entireColl;
_out.redistBoldDebtGain = troveData.redistBoldDebtGain;
_out.redistCollGain = troveData.redistCollGain;
_out.accruedInterest = troveData.accruedInterest;
_out.recordedDebt = troveData.recordedDebt;
_out.annualInterestRate = troveData.annualInterestRate;
_out.accruedBatchManagementFee = troveData.accruedBatchManagementFee;
_out.lastInterestRateAdjTime = troveData.lastInterestRateAdjTime;

(
_out.debt,
_out.coll,
, // debt
, // coll
_out.stake,
, // status
, // arrayIndex
_out.annualInterestRate,
_out.lastDebtUpdateTime,
_out.lastInterestRateAdjTime,
, // lastInterestRateAdjTime
, // annualInterestRate
_out.interestBatchManager,
//_out.batchDebtShares,
_out.batchDebtShares
) = _troveManager.Troves(_id);

(_out.snapshotETH, _out.snapshotBoldDebt) = _troveManager.rewardSnapshots(_id);
Expand Down

0 comments on commit 31ff465

Please sign in to comment.