dethcrypto / dethcrypto/TypeChain
Incorrect bindings when two contracts have the same name but different letter cases
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 376
- PR merge metrics
- No merged PRs in 30d
Description
## Description
When there are two (or more?) contracts that share the same name, but which have a different letter case, TypeChain fails to generate the bindings correctly.
## Reproduction
1. Clone https://github.com/hifi-finance/hifi/tree/9aa96fd38fb727049735993c4e6180990bad58db.
2. Install dependencies via `yarn`
3. Build packages via `yarn build`
4. Create a `.env` file by following the `.env.example`
5. Run `yarn workspace @hifi/flash-swap typechain`
6. Open the `packages/flash-swap/typechain/IErc20.d.ts` file.
You should see the same output as in this [gist](https://gist.github.com/paulrberg/b699dcc7663c6c6d48898140eb920c6e). Notice that:
1. The file name is `IErc20.d.ts`, although the class defined inside is `IERC20`.
2. There is no other `IERC20.d.ts` file in the `typechain` folder.
## Possible Solutions
1. Consider two contracts that differ even in the case of one letter case as two different contracts, and fix the bug.
2. Alert the user that they can't use two contracts with the same name, even if they may have different letter cases.
## Environment
- @typechain/hardhat@2.3.0
- typechain@5.1.2
Contributor guide
Assessment
This issue has not been assessed yet.