function increaseDebt(
address _borrower,
address _to,
TokenAmount[] memory _debts,
MintMeta memory _meta,
bytes[] memory _priceUpdateData // Never used (skips due to being updated in swap)
) external payable override {
_requireCallerIsSwapOperations();
_increaseDebt(_borrower, _to, _debts, _meta, _priceUpdateData);
}
// increasing debt of a trove
function _increaseDebt(
address _borrower,
address _to,
TokenAmount[] memory _debts,
MintMeta memory _meta,
bytes[] memory _priceUpdateData
) internal {
(ContractsCache memory contractsCache, LocalVariables_adjustTrove memory vars) = _prepareTroveAdjustment(
_borrower,
_priceUpdateData, /// @audit Just don't use the value if it's not updated
true //will be called by swap operations, that handled the price update
);
Mitigation
Use emptyUpdateData like you have in repayDebtFromPoolBurn
Impact
In some instances of the code, you pass
memory
parameters such as_priceUpdateData
without using themThis incurrs additional costs that can be avoided by passing an empty memory object
https://github.com/blkswnStudio/ap/blob/8fab2b32b4f55efd92819bd1d0da9bed4b339e87/packages/contracts/contracts/BorrowerOperations.sol#L360-L383
Mitigation
Use
emptyUpdateData
like you have inrepayDebtFromPoolBurn
https://github.com/blkswnStudio/ap/blob/8fab2b32b4f55efd92819bd1d0da9bed4b339e87/packages/contracts/contracts/BorrowerOperations.sol#L500