Skip to content

Commit

Permalink
Fix quote verifications for USDT (#3168)
Browse files Browse the repository at this point in the history
# Description
#3160 introduced problems
with verifying quotes with `USDT` as the sell token. The reason is that
`USDT` is not ERC20 compliant and does not return a `bool` from
`approve()` as it's supposed to. This then leads to reverts like
[this](https://dashboard.tenderly.co/cow-protocol/production/simulator/6042dc35-e2ef-4732-959b-aba737842982)
where solidity is not able to decode which function to call afterwards
because the previous `approve()` messed up the memory.

# Changes
Revert back to using `safeApprove()` which handles this case gracefully.
Unfortunately we can't use `try-catch` with `safeApprove()` because it's
not an `external` function. But that will not make the simulation less
correct. It will just cause us to get a suboptimal error message in case
one of the approvals actually reverts.

## How to test
Added a forked e2e test that verifies a quote with `USDT` as the sell
token. This fails without the fix.
  • Loading branch information
MartinquaXD authored Dec 17, 2024
1 parent ec5c475 commit 8761e43
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 8 deletions.
Loading

0 comments on commit 8761e43

Please sign in to comment.