Skip to content

ERC165 Cache Mixin #1127

Description

@shrugs

🎉 Description

While browsing EIP 820 I found code like

    function erc165InterfaceSupported(address _contract, bytes4 _interfaceId) constant public returns (bool) {
        if (!erc165Cache[_contract][_interfaceId]) {
            erc165UpdateCache(_contract, _interfaceId);
        }
        return interfaces[_contract][_interfaceId] != 0;
    }

    function erc165UpdateCache(address _contract, bytes4 _interfaceId) public {
        interfaces[_contract][_interfaceId] =
            erc165InterfaceSupported_NoCache(_contract, _interfaceId) ? _contract : 0;
        erc165Cache[_contract][_interfaceId] = true;
    }

which cleverly caches the results of 165 lookups.

We should

  1. profile the gas gains
  2. develop a mixin contract that can be added to ERC165Checker.sol
  • 🐛 This is a bug report.
  • 📈 This is a feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contractsSmart contract code.featureNew contracts, functions, or helpers.good first issueLow hanging fruit for new contributors to get involved!

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions