Summary
CharonLiquidator emits LiquidationExecuted(address indexed borrower, address indexed debtToken, uint256 repayAmount, uint256 profit) in step j of executeOperation. This is the primary accounting event for off-chain indexers — the Rust off-chain bot reads this event to confirm successful liquidations and record profit.
No test in CharonLiquidator.t.sol calls vm.expectEmit for this event. The event arguments — particularly profit — depend on correct execution of steps c-i. An incorrect argument order or value would silently produce wrong off-chain accounting without any on-chain revert.
Location
contracts/src/CharonLiquidator.sol:executeOperation — step j (emit LiquidationExecuted)
contracts/test/CharonLiquidator.t.sol — no expectEmit for LiquidationExecuted anywhere
Risk
Off-chain indexers that parse this event for profit accounting would silently receive wrong values. Given the Rust bot's role in triggering future liquidations based on historical profit data, incorrect event arguments propagate into business logic errors.
Fix
In the executeOperation happy-path test (to be added per issue #N from finding F3), include:
vm.expectEmit(true, true, false, true);
emit CharonLiquidator.LiquidationExecuted(p.borrower, p.debtToken, p.repayAmount, expectedProfit);
Assert the exact profit value based on controlled mock return amounts.
Refs #38
Summary
CharonLiquidatoremitsLiquidationExecuted(address indexed borrower, address indexed debtToken, uint256 repayAmount, uint256 profit)in step j ofexecuteOperation. This is the primary accounting event for off-chain indexers — the Rust off-chain bot reads this event to confirm successful liquidations and record profit.No test in CharonLiquidator.t.sol calls
vm.expectEmitfor this event. The event arguments — particularlyprofit— depend on correct execution of steps c-i. An incorrect argument order or value would silently produce wrong off-chain accounting without any on-chain revert.Location
contracts/src/CharonLiquidator.sol:executeOperation— step j (emit LiquidationExecuted)contracts/test/CharonLiquidator.t.sol— no expectEmit for LiquidationExecuted anywhereRisk
Off-chain indexers that parse this event for profit accounting would silently receive wrong values. Given the Rust bot's role in triggering future liquidations based on historical profit data, incorrect event arguments propagate into business logic errors.
Fix
In the executeOperation happy-path test (to be added per issue #N from finding F3), include:
Assert the exact profit value based on controlled mock return amounts.
Refs #38