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

Update SimpleTokenSwap.sol #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update SimpleTokenSwap.sol
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");
```
  • Loading branch information
dweng0 authored Nov 24, 2022
commit f4ae5de9940228b0bc53a2696a0b381fbc3d3e19
4 changes: 2 additions & 2 deletions contracts/SimpleTokenSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ contract SimpleTokenSwap {
// Payable fallback to allow this contract to receive protocol fee refunds.
receive() external payable {}

// Transfer tokens held by this contrat to the sender/owner.
// Transfer tokens held by this contract to the sender/owner.
function withdrawToken(IERC20 token, uint256 amount)
external
onlyOwner
{
require(token.transfer(msg.sender, amount));
}

// Transfer ETH held by this contrat to the sender/owner.
// Transfer ETH held by this contract to the sender/owner.
function withdrawETH(uint256 amount)
external
onlyOwner
Expand Down