Skip to content

feature(forge selectors): Add selectors to cache from a folder of ABIs #12702

@JuaniRios

Description

@JuaniRios

Component

Forge

Describe the feature you would like

What

  • Add the possibility to add selectors to the foundry cache from a folder of JSON ABIs

Why

  • We had a situation at work where we wanted to decode an error from a complex contract flow, but the error could possibly be in any of multiple contracts and repos, and this decoding needed to happen in a CLI tool. So forcing the CLI user to compile all the possible repos was not a reasonable option. We ended up storing all ABIs in one place and developing a decoder tool. If this would have been possible with cast we would have really appreciated it.

How

  • At first I thought about extending cast decode-error to accept an optional --extra-abis flag that would add the selectors to the in-memory cache by calling cache.extend_from_abi(json_abi) from all the files in the folder path.
  • George in the telegram group suggested instead to achieve the same result by extending forge selectors cache with a new flag that would add all the selectors in the ABIs to the foundry cache. This method makes more sense since it will also be usable for other tools.

Anything Else?

I will be implementing this feature and submitting a PR soon

Additional context

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions