Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide commentary on _why_ the sync function should exist. #35

Closed
MicahZoltu opened this issue Dec 27, 2019 · 2 comments
Closed

Provide commentary on _why_ the sync function should exist. #35

MicahZoltu opened this issue Dec 27, 2019 · 2 comments

Comments

@MicahZoltu
Copy link

https://github.com/Uniswap/uniswap-v2-core/blob/d2ddbd95e8500cfd3669ab81b64f48956521ea6b/contracts/UniswapV2.sol#L158-L161

I believe that this function exists to deal with some obscure edge cases (rounding perhaps)/attacks as it allows one to "reset" the exchange if it somehow ends up short on capital (e.g., the token contract burns Uniswap balances either on purpose or on accident). However, these situations are incredibly obscure and while I normally don't advocate for a lot of comments on code (the code should be easy to read without comments), in cases like this where the why is not obvious I believe there is significant value.

@haydenadams
Copy link
Collaborator

I believe that this function exists to deal with some obscure edge cases (rounding perhaps)/attacks as it allows one to "reset" the exchange if it somehow ends up short on capital

Correct!

@NoahZinsmeister
Copy link
Contributor

closed by #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants