Closed frangio closed 2 years ago
I just bumped into this problem after trying to use hardhat-exposed
in my code base:
TypeError: Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
--> contracts-exposed/core/balance-sheet/BalanceSheetV2.sol:10:59:
|
10 | function $vaults(address arg0) external view returns (SBalanceSheetV1.Vault memory) {
Thing is, I don't even need to expose this contract (BalanceSheetV2). So here's a feature request for you:
Let hardhat-exposed
accept a list of contract names that are due to be excluded from being exposed. This list of contracts should be configurable in the Hardhat config file.
Side note: I thought that this might deserve its own separate GitHub issue - but @frangio I'll let you decide if you want to keep the convo going in this issue or not.
@paulrberg I had been thinking about that feature as well. I've published a new version with the ability to exclude files. Check it out:
Haha so quick! Thanks.
I am having the same issue. Though in my case, I still need the the file for testing.
It's an internal data type that contains mapping struct, which can be storage only.
eg. MyStruct internal s; I am adding a local fix to exclude bunch of function name.
Forgot to close this but this feature was implemented in https://github.com/frangio/hardhat-exposed/commit/75673ee2d112a8238d54e5335832f417d70fba01.
@whhsw Can you open another issue about your problem? I'm not sure I understand.
If a library has functions with storage pointer arguments, we currently try to convert those to memory pointers, but that doesn't work well, for example mapping fields in a struct don't make sense in memory.
For every storage pointer to a type
struct S
we should generate a storage variable of typeS[]
, and for each function that takes a storage pointer toS
we should generate the exposed version with a number that will be used to index the array.