Skip to content

Instantly share code, notes, and snippets.

@shingonu
Created August 7, 2022 08:47
Show Gist options
  • Save shingonu/b4672193268a8a59ceaffbf7c35d5773 to your computer and use it in GitHub Desktop.
Save shingonu/b4672193268a8a59ceaffbf7c35d5773 to your computer and use it in GitHub Desktop.
pragma solidity >=0.7.0 <0.9.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool _approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
contract ERC721 {
IERC721 i;
function a () view external returns (bytes4){
return i.balanceOf.selector ^
i.ownerOf.selector ^
i.transferFrom.selector ^
i.approve.selector ^
i.setApprovalForAll.selector ^
i.getApproved.selector ^
i.isApprovedForAll.selector;
// i.safeTransferFrom is overloaded
}
function b () pure external returns (bytes4) {
return type(IERC721).interfaceId;
}
function c () pure external returns (bytes4) {
return this.a.selector;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment