Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Update SimpleTokenSwap.sol#6

Open
dweng0 wants to merge 1 commit into0xProject:masterfrom
dweng0:patch-1
Open

Update SimpleTokenSwap.sol#6
dweng0 wants to merge 1 commit into0xProject:masterfrom
dweng0:patch-1

Conversation

@dweng0
Copy link

@dweng0 dweng0 commented Nov 24, 2022

Fixed typos, worth also noting that require(sellToken.approve(spender, uint256(-1))); cant be used from >0.8.0. Users should declare a max constant as a member variable and pass that instead something like:

    // as a member on the contract
    uint256 public constant MASK = type(uint128).max;

    ....
    require(sellToken.approve(spender, MASK), "approve failed");

Fixed typos, worth also noting that  `require(sellToken.approve(spender, uint256(-1)));` cant be used from >0.8.0. Users must should declare a max constant as a member variable and pass that instead something like: 
```
    // as a member on the contract
    uint256 public constant MASK = type(uint128).max;

    ....
    require(sellToken.approve(spender, MASK), "approve failed");
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant