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

Allow transaction to execute "swap+pool deposit" and "pool withdraw+swap" in one call #106

Closed
3esmit opened this issue Sep 21, 2020 · 2 comments

Comments

@3esmit
Copy link

3esmit commented Sep 21, 2020

Currently it's complicated to join or withdraw a pool at the right moment, unless user is using a smart contract wallet with custom logic.

To facilitate and reduce gas costs, add a secondary function which allows the swap ("correction of price") + deposit in pool, so the uniswap interface can be extended to allow user to correct the price of the pool to then deposit on the pool.

This procedure is even is even a requirement in the docs: When other liquidity providers add to an existing pool, they must deposit pair tokens proportional to the current price.
If the docs themselves suggest this, then the contract could and should allow this to happen in a single call.

Users without smart contract wallets with custom code, cannot safely do this, because they are in risk of being front-runned while doing this two transaction operation, so is important that the contact provide this common use.

As a workaround for current pools contracts and router, a secondary contract, common to any pool, could do the two calls from one call, and the uni-swap interface can start using it.

See this discussion from last year, on reddit: https://www.reddit.com/r/UniSwap/comments/bf1g9q/how_to_mitigate_impermanent_loss/.

@moodysalem
Copy link
Contributor

See Uniswap/v2-periphery#26

@moodysalem
Copy link
Contributor

And Uniswap/interface#1079

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

2 participants