Open code423n4 opened 2 years ago
@LilYeti: The idea was that on launch we will likely use a curve pool to route through so this contract would change slightly. However it is valid and some more checks would be good to add. Moving to level 1 issue.
A medium severity rating is warranted.
Handle
cmichel
Vulnerability details
The
sYETIToken.lastBuyBackPrice
is set inbuyBack
and hardcoded as:It divides the first and second return
amounts
of the swap, however, these amounts depend on the swappath
parameter that is used by the caller. If a swap path of length 3 is used, then this is obviously wrong. It also assumes that each router sorts the pairs the same way (which is true for Uniswap/Sushiswap).Impact
The
lastBuyBackPrice
will be wrong when using a different path. This will leadrebase
s using a different yeti amount and theeffectiveYetiTokenBalance
being updated wrong.Recommended Mitigation Steps
Verify the first and last element of the path are YETI/YUSD and use the first and last amount parameter.