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

CoW AMM Router: CoW Sender transfers to Vault upfront (No approval) #1264

Open
wants to merge 66 commits into
base: main
Choose a base branch
from

Conversation

joaobrunoah
Copy link
Contributor

Description

The sender (CoW Settlement, or any EOA/contract calling the CoW Router) currently needs to give approval to the router, so the router is able to transfer funds from the sender to the vault. However, this approach is not very flexible, in a way that if the token has any fee on transfer implemented, the router reverts.

In order to simplify this interaction and don't rely on approvals, the sender can transfer the funds directly to the vault, and only inform the router what's the amount that has been transferred (transferHint). This approach is more flexible, the user is able to transfer more tokens in case of a fee on transfer, or any other use case that requires more flexibility.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Optimization: [ ] gas / [ ] bytecode
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

Copy link
Collaborator

@EndymionJkb EndymionJkb left a comment

Choose a reason for hiding this comment

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

Looks pretty straightforward; just some naming/comment suggestions.

pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
pkg/interfaces/contracts/pool-cow/ICowRouter.sol Outdated Show resolved Hide resolved
pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
pkg/pool-cow/contracts/CowRouter.sol Outdated Show resolved Hide resolved
@joaobrunoah joaobrunoah mentioned this pull request Jan 29, 2025
12 tasks
Base automatically changed from cow-amm-router to main January 29, 2025 15:24
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