WTFAcademy / WTF-Ethers

我最近在重新学ethers.js,巩固一下细节,也写一个“WTF Ethers.js极简入门”,供小白们使用,每周更新1-3讲。Now supports English! 官网: https://wtf.academy
https://wtf.academy
Other
3.03k stars 489 forks source link

12_ERC721Check 不应用这种方案判断是否是erc721 #111

Closed 0FuzzingQ closed 10 months ago

0FuzzingQ commented 10 months ago


interface Temp {
    function supportsInterface(bytes4 interfaceId) external pure returns (bool);
}

contract Tmp is Temp {
    function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {
        return true;       
    }
}```

使用:
`
const selectorERC721 = "0x80ac58cd"
const isERC721 = await contractbayc.supportsInterface(selectorERC721)
`
将返回true ,但实际上该合约并不是erc721标准的
AmazingAng commented 10 months ago

这是根据erc165标准检测的,可以满足绝大多数情况。 一般不会有合约故意实现这个接口。