0x-api-starter-guide-code icon indicating copy to clipboard operation
0x-api-starter-guide-code copied to clipboard

Update SimpleTokenSwap.sol

Open dweng0 opened this issue 3 years ago • 0 comments

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");

dweng0 avatar Nov 24 '22 20:11 dweng0