ApeWorX / ethpm-types

Implementation of EIP-2678
Apache License 2.0
14 stars 8 forks source link

feat: adds identifier_definitions and identifier_lookup props to ContractType #106

Closed mikeshultz closed 9 months ago

mikeshultz commented 9 months ago

What I did

Added props to ContractType for easy selector <-> signature mapping. Useful for looking up what a selector might be, or if a selector/topic is part of a known contract. Might follow this up with a command/plugin for tabular display output.

Or at least I knew them as selector/signature, but terminology seems to be different in this source. I went looking for official defs and they're all over the place as well. Even the Solidity ABI spec interchanges Method ID and selector. I did my best to stick within the convention but my naming is probably off.

I often find myself in a situation where I have an event topic or function or error selector that I'm curious if its a member of one of the contracts in my project. So it would be nice to have a method for easy lookup that doesn't require me to compute them manually every time.

How I did it

See code

How to verify it

Tests do

Checklist