dn404
dn404 copied to clipboard
DN404 identification
Currently, it would be possible to use staticcall for mirrorERC721 in order to detect if the contract is DN404 however this could also cause an issue with abi.decode since it doesn't catch decoding errors effectively
https://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
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.