The engine accepts two distinct collateral tokens (WETH and WBTC), and positions are tracked per token in user_to_token_address_to_amount_deposited. Events exist so off-chain consumers — indexers, dashboards, accounting systems, liquidation bots — can reconstruct this on-chain state without replaying every call. For that reconstruction to work, a deposit event must identify which token was deposited.
The specific problem is that CollateralDeposited logs only user and amount and omits the collateral token. The sibling CollateralRedeemed event does include the token, so the two halves of the same accounting flow are inconsistent: an observer can attribute redemptions to a token but not deposits.
Likelihood:
Every deposit emits this incomplete event, so the issue is always present.
Impact:
Off-chain systems cannot reliably rebuild per-token collateral balances from logs → incorrect dashboards, broken monitoring/liquidation bots, faulty accounting integrations.
No direct on-chain fund loss; the impact is on the correctness and usability of event-derived data.
Explanation: Two deposits of the same size for different collateral tokens emit byte-for-byte identical events, so no off-chain consumer can tell them apart. The test below makes one WETH deposit and one WBTC deposit and shows the emitted CollateralDeposited events are indistinguishable and carry no token field:
An indexer reading these logs cannot determine which deposit was WETH and which was WBTC, so any per-token balance it reconstructs is wrong.
Explanation: Add the token address as an indexed field on the event (mirroring CollateralRedeemed) and include it when logging in _deposit_collateral, so deposits are fully attributable per token.
(and update the log CollateralDeposited(...) call in _deposit_collateral to pass the token)
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.