1

I am trying to use a contract file with same name in 2 different folders:

src/
├── StfxVault.sol
├── gmx
│   ├── Reader.sol
│   ├── Stfx.sol
│   └── interfaces
│       └── IStfxGmx.sol
├── perp
│   ├── Reader.sol
│   ├── Stfx.sol
│   └── interfaces
│       └── IStfxPerp.sol

Here, I want to use Reader & Stfx from different directories in my Hardhat deploy script's ethers.getContractFactory() line.

In order to successfully deploy, right now I changed these for Gmx:

  • Reader -> GmxReader
  • Stfx -> GmxStfx

Is there any way to not change the name & still deploy successfully in case of hardhat?

Please help! 🙏

1 Answer 1

1

It's possible by specifying the full path:

const GmxReaderFactory = await ethers.getContractFactory("src/gmx/Reader.sol:Reader");

const PerpReaderFactory = await ethers.getContractFactory("src/perp/Reader.sol:Reader");
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.