The protocol adheres to the invariant x * y = k, where:
x: The pool's token balance
y: The pool's WETH balance
k: The constant product of these two balances
Whenever the pool balances change, the ratio between the token and WETH amounts must remain constant to preserve the invariant x * y = k. However, the _swap function disrupts this balance by providing extra tokens as incentives each time the swapCount condition is met. This breaks the invariant over time, leading to a potential drain of the protocol's funds.
Proof of Concept:
A user performs 10 swaps and accumulates an additional 1_000_000_000_000_000_000 tokens as an incentive.
The user continues to swap repeatedly until the protocol's funds are completely drained.
Place the following into TSwapPool.t.sol
.
Users can exploit the protocol by performing numerous swaps to repeatedly collect the additional incentives, potentially draining the protocol's funds.
Manual Review
Remove the extra incentive mechanism. If retaining it is essential, adjust the protocol to maintain the x * y = k invariant. Alternatively, allocate a separate pool of tokens for incentives, similar to how fees are managed.
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.