Skip to content

Instantly share code, notes, and snippets.

@bartubozkurt
Last active February 2, 2023 11:31
Show Gist options
  • Save bartubozkurt/6f68ba8bc3a3214c41b6cce9e2cf0917 to your computer and use it in GitHub Desktop.
Save bartubozkurt/6f68ba8bc3a3214c41b6cce9e2cf0917 to your computer and use it in GitHub Desktop.
pragma solidity =0.4.22;
/* Bad */
contract BadERC721Token{
function ownerOf(uint256 _tokenId) external view returns (bool);
//...
}
/* Better */
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/SafeERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol";
contract GoodERC721Token {
using SafeERC721 for IERC721;
IERC721 public _token;
function ownerOf(uint256 _tokenId) view returns (bool) {
return _token.ownerOf(_tokenId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment