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

Slippage Check #143

Merged
merged 8 commits into from
May 10, 2022
Merged

Slippage Check #143

merged 8 commits into from
May 10, 2022

Conversation

parv3213
Copy link
Member

@parv3213 parv3213 commented Apr 6, 2022

Use Uniswap quoter to get amountOut for small amountIn. Assuming for this small amount the slippage percentage is 0, calculate the asset price. Then while calling actual swap, pass amountOut as amountIN*assetPrice*slippagePercent. This would ensure the assets aren't migrated at unexpected slippage.

Issues:

  • _swap cost increases by around 10%
  • Issue with setting correct amountIn for getting correct amountOut.
  • For example, while swapping DAI -> WETH, we cannot set amountIn to be just 1. As then the amountOut will be 0.

@zgorizzo69 @cartercarlson

@parv3213 parv3213 requested a review from pegahcarter April 6, 2022 08:39
Base automatically changed from fix/cancelResubscribe to main April 7, 2022 22:30
parv3213 and others added 7 commits May 3, 2022 17:06
- `_swap` cost increases by around 10%
- Issue with setting correct amountIn for getting correct amountOut.
- For example, while swapping DAI -> WETH, we cannot set amountIn to be just 1.
-> As then the amountOut will be 0.
@zgorizzo69 zgorizzo69 force-pushed the feat/slippage-check branch from 7083f8d to e305865 Compare May 3, 2022 15:15
@pegahcarter
Copy link
Member

We need additional coverage for cancelResubscribe() and to fail if slippage exceeds 5%. Also review view funcs within migrations for any redundancy.

@pegahcarter pegahcarter merged commit 95dc9bf into main May 10, 2022
Copy link
Member

@pegahcarter pegahcarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@parv3213 parv3213 deleted the feat/slippage-check branch June 6, 2022 14:34
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

Successfully merging this pull request may close these issues.

3 participants