contract ToyInterfaceSupport {
    // mapping of all possible interfaces to whether they are supported
    mapping (bytes4 => bool) interfaceIdToIsSupported;
    
    //-------------------------------------------------------------------------
    /// @notice ToyInterfaceSupport constructor. Sets to true interfaces
    ///  supported at launch.
    //-------------------------------------------------------------------------
    constructor () public {
        // supports ERC-165
        interfaceIdToIsSupported[0x01ffc9a7] = true;
        // supports ERC-721
        interfaceIdToIsSupported[0x80ac58cd] = true;
        // supports ERC-721 Enumeration
        interfaceIdToIsSupported[0x780e9d63] = true;
        // supports ERC-721 Metadata
        interfaceIdToIsSupported[0x5b5e139f] = true;
    }

    //-------------------------------------------------------------------------
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    //-------------------------------------------------------------------------
    function supportsInterface(
        bytes4 interfaceID
    ) external view returns (bool) {
        if(interfaceID == 0xffffffff) {
            return false;
        } else {
            return interfaceIdToIsSupported[interfaceID];
        }
    }
}
//-----------------------------------------------------------------------------
function supportsInterface(
    bytes4 interfaceID
) external view returns (bool) {
    if(interfaceID == 0xffffffff) {
        return false;
    } else {
        return interfaceIdToIsSupported[interfaceID];
    }
}

//-------------------------------------------------------------------------