Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multitrove getter #817

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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