-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unused class/interface in flattened code #4629
Comments
Hello @vittominacori That is a flattener issue. Basically the flattener is not smart. Whenever any symbol is imported from a file, the flattener will get the entier file (and not just the symbols needed). Here, I see 3 options:
|
Thanks @Amxx Basing on your list, right now I can accept having unused errors :) As you are working on ERC6093, do you think OZ will keep all the custom errors into the same file or will we split them into distinct files? Regarding the other point, it could be good to write a smart flattener to avoid other unwanted code in flattened files. |
Where to put custom errors in something we discussed a lot.
I guess we will want to make ERC6093 final at some point, which will prevent us from adding more into it. As a consequence, we should plan for error interfaces outside ERC6093 |
Thank you for your answer. I didn't mean to add Also, when I said to keep |
Using flattener (both truffle or hardhat) all the custom errors from
draft-IERC6093.sol
are imported into the flattened file also if unused.I mean using the ERC20 contract we will find also the
IERC721Errors
andIERC1155Errors
into the code.It should import only the required (and necessary) file in
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
instead of importing the whole file.Is there a way to avoid this behavior?
Is this a flattener issue and should we reference it there?
To reproduce simply run:
npx hardhat flatten contracts/token/ERC20/ERC20.sol > ERC20.flat.sol
The text was updated successfully, but these errors were encountered: