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

Handle USDT approval quirks #103

Open
jmrossy opened this issue Jan 3, 2024 · 0 comments
Open

Handle USDT approval quirks #103

jmrossy opened this issue Jan 3, 2024 · 0 comments
Labels
bug Something isn't working UX end user experience warp-UI

Comments

@jmrossy
Copy link
Collaborator

jmrossy commented Jan 3, 2024

From USDT's contract code in etherscan:

    function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {

        // To change the approve amount you first have to reduce the addresses`
        //  allowance to zero by calling `approve(_spender, 0)` if it is not
        //  already 0 to mitigate the race condition described here:
        //  https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
        require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));

        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
    }

Due to this quirk, there's an edge case we aren't currently covering. If a user does the approve tx and then following transfer tx isn't successful, the lingering approval amount can cause problems (unless the user retries the transfer with the exact same amount right away, in which case the previous approval will get used).

@jmrossy jmrossy added bug Something isn't working warp-UI labels Jan 3, 2024
@avious00 avious00 added the UX end user experience label Mar 27, 2024
@avious00 avious00 moved this to Icebox in Hyperlane Tasks Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working UX end user experience warp-UI
Projects
Status: No status
Development

No branches or pull requests

2 participants