Skip to content

Commit

Permalink
Merge pull request #414 from liquity/fix-redemption-batch-update
Browse files Browse the repository at this point in the history
fix: effects of redemption missing from `BatchUpdated` event
  • Loading branch information
danielattilasimon authored Sep 13, 2024
2 parents c116963 + ea4ac5e commit dbcc6b9
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions contracts/src/TroveManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,19 @@ contract TroveManager is LiquityBase, ITroveManager, ITroveEvents {
_collChangeFromOperation: -int256(_singleRedemption.collLot)
});

if (_isTroveInBatch) {
emit BatchUpdated({
_interestBatchManager: _singleRedemption.batchAddress,
_operation: BatchOperation.troveChange,
_debt: batches[_singleRedemption.batchAddress].debt,
_coll: batches[_singleRedemption.batchAddress].coll,
_annualInterestRate: _singleRedemption.batch.annualInterestRate,
_annualManagementFee: _singleRedemption.batch.annualManagementFee,
_totalDebtShares: batches[_singleRedemption.batchAddress].totalDebtShares,
_debtIncreaseFromUpfrontFee: 0
});
}

emit RedemptionFeePaidToTrove(_singleRedemption.troveId, _singleRedemption.collFee);

return newDebt;
Expand Down Expand Up @@ -676,17 +689,6 @@ contract TroveManager is LiquityBase, ITroveManager, ITroveEvents {
batch.entireDebtWithoutRedistribution * batch.annualManagementFee;

_activePool.mintAggInterestAndAccountForTroveChange(batchTroveChange, _batchAddress);

emit BatchUpdated({
_interestBatchManager: _batchAddress,
_operation: BatchOperation.troveChange,
_debt: batch.entireDebtWithoutRedistribution,
_coll: batch.entireCollWithoutRedistribution,
_annualInterestRate: batch.annualInterestRate,
_annualManagementFee: batch.annualManagementFee,
_totalDebtShares: batches[_batchAddress].totalDebtShares,
_debtIncreaseFromUpfrontFee: 0
});
}

/* Send _boldamount Bold to the system and redeem the corresponding amount of collateral from as many Troves as are needed to fill the redemption
Expand Down

0 comments on commit dbcc6b9

Please sign in to comment.