Uniswap / v2-core

🦄 🦄 Core smart contracts of Uniswap V2
https://uniswap.org/docs
GNU General Public License v3.0
2.93k stars 3.15k forks source link

restrict skim to when balances exceed uint112(-1) #60

Closed NoahZinsmeister closed 4 years ago

NoahZinsmeister commented 4 years ago

another option is to change the implementation to the following 2 lines:

if (balance0 > uint112(-1)) _safeTransfer(_token0, to, balance0 - uint112(-1));
if (balance1 > uint112(-1)) _safeTransfer(_token1, to, balance1 - uint112(-1));
MicahZoltu commented 4 years ago

Out of curiosity, what is the point of this change? Doesn't this make it so skim is almost never callable? I thought the idea with Skim was that it could be used to get out funds that may have been accidentally sent to the contract?

NoahZinsmeister commented 4 years ago

@MicahZoltu there's no point really, i was just exploring an idea, i don't think this is going to get merged. the motivation was that skim is superfluous in the case when both reserves are <= uint112(-1) because any extra tokens sent to the contract can already be taken via swap. but restricting skim to the case when it's strictly necessary (when either reserve is > uint112(-1)) seems unnecessary so late in the game.