Open ghost opened 9 months ago
function _getMirrorERC721(address possibleDN404) internal view returns (address result) {
assembly {
mstore(0x00, 0x4ef41efc) // `mirrorERC721()`.
if and(
gt(returndatasize(), 0x1f),
staticcall(gas(), possibleDN404, 0x1c, 0x04, 0x00, 0x20)
) {
// If result is a non-zero address, contract is very likely DN404.
result := shr(96, mload(0x0c))
}
}
}
@Vectorized Would be great if we have a set of functions like this as a library contract
Sounds like good suggestion.
Currently, it would be possible to use
staticcall
formirrorERC721
in order to detect if the contract is DN404 however this could also cause an issue withabi.decode
since it doesn't catch decoding errors effectivelyhttps://github.com/ethereum/solidity/issues/10381
Therefore, the cleanest method would be supporting an arbitrary value for supportsInterface function
https://github.com/Vectorized/dn404/pull/68