Skip to content

Instantly share code, notes, and snippets.

@bartubozkurt
Created February 2, 2023 11:29
Show Gist options
  • Save bartubozkurt/a3b06dd20ae9e06d86b33594f62d498f to your computer and use it in GitHub Desktop.
Save bartubozkurt/a3b06dd20ae9e06d86b33594f62d498f to your computer and use it in GitHub Desktop.
pragma solidity =0.4.22;
/* Bad */
contract BadERC20Token{
function transfer(address to, uint value) external;
//...
}
/* Better */
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/SafeERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
contract GoodERC20Token {
using SafeERC20 for IERC20;
IERC20 public _token;
function transfer(address to, uint value) external {
_token.transfer(to,value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment