GalloDaSballo / Apollon-Review

Notes for the Apollon Solo Security Review
0 stars 0 forks source link

`LiquidationsOperations` Comment around `_emitLiquidationSummaryEvent` is incorrect #76

Open GalloDaSballo opened 3 months ago

GalloDaSballo commented 3 months ago

Impact

_emitLiquidationSummaryEvent has the following comment https://github.com/blkswnStudio/ap/blob/8fab2b32b4f55efd92819bd1d0da9bed4b339e87/packages/contracts/contracts/LiquidationOperations.sol#L447-L455


  function _emitLiquidationSummaryEvent(LocalVariables_OuterLiquidationFunction memory vars) internal {
    TokenAmount[] memory liquidatedColl = new TokenAmount[](vars.priceCache.collPrices.length);
    for (uint i = 0; i < vars.priceCache.collPrices.length; i++) {
      liquidatedColl[i] = TokenAmount(
        vars.priceCache.collPrices[i].tokenAddress,
        vars.tokensToRedistribute[i].amount // works because of the initialisation of the array (first debts, then colls) /// @audit Wrong comment
      );
    }

The comment looks wrong since the array fills in collaterals first and then debts

Mitigation

Check the comments and fix them

sambP commented 3 months ago
Screenshot 2024-08-27 at 6 50 22 PM