In TSwapPool::_swap
the extra tokens given to users after every swapCount breaks the protocol invariant of x * y = k
The protocol maintains a strict invariant of x * y = k, where:
x is the balance of the pool token.
y is the balance of WETH.
k is a constant representing the product of the two balances.
This invariant ensures that the ratio between the pool token and WETH remains constant. However, the _swap function currently includes an extra token incentive that disrupts this invariant. Specifically, after every swapCount swaps, additional tokens are transferred to the user, breaking the balance and potentially draining the protocol's funds over time.
The problematic code block is:
Users can exploit this mechanism to repeatedly swap and collect the extra incentive tokens, eventually depleting the protocol's funds. This not only breaks the core invariant of the protocol but also poses a significant financial risk.
Place the following into TSwapPool.t.sol
.
Foundry
Remove the extra incentive mechanism or adjust the protocol to account for these additional tokens in maintaining the x * y = k
invariant. Alternatively, set aside tokens in a manner similar to how fees are handled.
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.