The deposit() function should transfer tokens into the contract first, then update the exchange rate based on newly received funds.
The issue is that deposit() calls updateExchangeRate() BEFORE safeTransferFrom(), so the exchange rate inflates based on tokens not yet in the contract, causing subsequent depositors to receive fewer asset tokens than they deserve.
Likelihood:
This occurs on every single call to deposit() by any user at any time.
The impact compounds with each subsequent deposit made to the protocol.
Impact:
Depositors receive fewer asset tokens than entitled for their deposited amount.
Upon calling redeem(), liquidity providers recover less underlying than deposited, resulting in permanent loss of funds.
Add this test to test/ and run forge test --match-test testDepositInflatesRateBeforeTransfer -vv:
Test output: [PASS] — lpB receives ~99.7e18 shares instead of 100e18. On redeem, lpB recovers less than 100 tokens deposited.
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.