frangio / hardhat-exposed

Automatically expose internal Solidity functions for smart contract testing.
82 stars 13 forks source link

feat: adds ability to exclude vars by name #7

Closed jurajpiar closed 1 year ago

jurajpiar commented 2 years ago

Adds a simple array of var names to exclude from the var lookup.

TODO: extend filter to include contract names for better filtering.

frangio commented 2 years ago

Thanks @jurajpiar.

You seem to have run a code formatter on the whole codebase. Can you undo those changes?

Partly because of the above, I don't understand what this PR is adding. Can you explain further?

jurajpiar commented 2 years ago

Thanks @jurajpiar.

You seem to have run a code formatter on the whole codebase. Can you undo those changes?

Partly because of the above, I don't understand what this PR is adding. Can you explain further?

Hi, sorry about the formatting. I'll remove that. The idea of this PR is to allow exclusion of some internal variables from exposing. The motivation for it is to prevent compilation errors for generated exposed getters for storage variable, such as mappings inside structs.

As mentioned in the description, this implementation could be improved to allow definition of contracts in which these named methods would be excluded.

Hope that makes sense?

frangio commented 2 years ago

If this is about compilation errors, I'd favor an approach where we can detect the scenarios that would lead to compilation errors and ignores those variables.

jurajpiar commented 2 years ago

yea makes sense

I only needed to make this work for our project and with a tight deadline I did what found the easiest

once I have little bit more time (should be soon) I'll try to detect these instead.