OpenZeppelin / OpenZeppelin/openzeppelin-contracts
Unused class/interface in flattened code
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 27.2k
- Forks
- 12.4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 33
Description
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 and IERC1155Errors 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run npx hardhat flatten contracts/token/ERC20/ERC20.sol > ERC20.flat.sol and inspect contracts/token/ERC20/ERC20.sol alongside draft-IERC6093.sol. Determine whether the extra IERC721Errors and IERC1155Errors declarations originate in OpenZeppelin Contracts or the Truffle/Hardhat flattener. Done means the ownership and expected flattening behavior are established, with the issue routed or scoped accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100