-1

Please help I am quite confused since I was following a course online and i've double checked everything I can and compare his code to mine yet I have an error and he doesn't. please help. :)

pragma solidity ^0.8.7;

interface IERC165 {

    // this is an interface because we have statically declared it as an interface.
    // and it contains only unimplemented functions. 

    // what is the calculation for this function supportsInterface:
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

contract ERC165 is IERC165 {

    // write a calculation interface function algorithm

    function calcFingerPrint() public view returns(bytes4) {
        return bytes4(keccak256('supportedInterface(bytes4)'));
    }

    // hash table to keep track of contract fingerprint data of byte function covers
    mapping(bytes => bool) private _supportedInterfaces;


     function supportsInterface(bytes4 interfaceId) external override view returns (bool) {
         _supportedInterfaces[interfaceId];
     }



    /*
    The ERC165 standard actually requires that the supportsInterface function "use less than 30,000 gas"
    So rather than re-calculating interfaceIDs every time someone cals supportsInterface, lets keep our
    supported interfaceID in a mapping.

    bytes4 Bytes is dynamic array of bytes. It's shortened for byte[]

    bytes4 is exactly 4 bytes long.

    You can define a available by using the keyword bytesX where X represents
    the sequence of bytes. X can be from 1 up to 32

    keccak26: keccak256 compute the keccak-256 hash of the input. Creating a deterministic unique ID from an input.
    */

} ```
Koruma
  • 9
  • 6

1 Answers1

0

This line causing issue

 mapping(bytes => bool) private _supportedInterfaces;

You defined your mapping bytes=>bool.

mapping(bytes4 => bool) private _supportedInterfaces;
Yilmaz
  • 35,338
  • 10
  • 157
  • 202