The following block of code is responsible for the issue:
An attacker could drain the tokens from both pools by getting this incentive with low value transactions.
Also, the protocol follows a strict invariant of x * y = k
(plus fees). Where:
x
is the amount of the pool token
y
is the amount of the WETH token
k
is the constant product of the two balances
This means that whenever the balances change in the protocol, the ratio between the two amounts should remain constant, hence the k
. However, this is broken due to the extra incentive in the _swap
function. Meaning that over time, the procotol funds will be drained.
A user could maliciously drain the protocol of funds by doing a lot of swaps and collecting the extra incentive given out by the protocol.
A user swaps 10 times, and collects the extra incentive of 1_000_000_000_000_000_000
tokens
The user continues to swap until all the protocol funds are drained
Foundry and manual review
Remove the extra incentive mechanism.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.