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

feat(swap): partial approve #5256

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open

feat(swap): partial approve #5256

wants to merge 21 commits into from

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Dec 24, 2024

Summary

Many users are asking for partial approve in swap because it might be dengerous to give an "infinite" approval amount.
Now we have an option in Swap settings which enables the partial approve feature.
When the option is on, then we will make an approval only for selling amount.

Important! When order is a buy order, then approval amount should be sell amount including all costs (fees, slippage, etc.).

Important! The option works only in Swap. I know, we have approvals in limit orders, tokens page, etc. But for now the feature is availabe only in Swap because it's not clear how it will affect other flows.

image

To Test

  1. Enable the option in Swap settings
  2. Reset allowance for the sell token (https://revoke.cash/)
  3. Post an order
  • for regular approve there should be an approval transaction with value == sell amount
  • for permittable token there should be a permit with value == sell amount
  • after order fill the sell token allowance should be still zero (or a small amount for buy orders)

Copy link

vercel bot commented Dec 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cosmos ✅ Ready (Inspect) Visit Preview Dec 26, 2024 9:47am
cowfi ✅ Ready (Inspect) Visit Preview Dec 26, 2024 9:47am
explorer-dev ✅ Ready (Inspect) Visit Preview Dec 26, 2024 9:47am
sdk-tools ✅ Ready (Inspect) Visit Preview Dec 26, 2024 9:47am
swap-dev ✅ Ready (Inspect) Visit Preview Dec 26, 2024 9:47am
widget-configurator ✅ Ready (Inspect) Visit Preview Dec 26, 2024 9:47am

@elena-zh
Copy link

The build has failed :(

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Hey @shoom3301 , great job!
I'm approving the PR.
Please don't forget to discuss with the team the 1st case reported in #5256 (comment)

And just FYI: I'm still facing issues with orders execution (1, 2, 3) on Gnosis chain (only). However, it might be related to a poor competition that we have on staging. I will retest this on Prod

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.

2 participants