0

I have this code...

            try IERC165(_token.assetContract).supportsInterface(0x80ac58cd) returns (bool supported721) {
                require(!supported721, "!TokenType");
                try IERC165(_token.assetContract).supportsInterface(0xd9b67a26) returns (bool supported1155) {
                    require(!supported1155, "!TokenType");
                } catch Error(string memory) {}
            } catch Error(string memory) {}      

and a contract that does not implement ERC165.

How can I modify the code so it does not fail when it tries to run the first line?

1 Answer 1

1

If you want to avoid the contract breaking, you could delete the require()statement and change to something like:

if (supported721) then {
//do if is supported
} else {
// do if is not supported
}

Hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.