Closed imckl closed 1 year ago
Sometimes contract name is fixed but not specified, eg: use const contractName = 'ActualContract'
thus use getContractFactory
to obtain contract instead of directly using ActualContract__Factory is a need.
In the sence, contract name could be anything depending on which contract I want to deploy.
Currently i'm heavily using the type assertion approach by getContractFactory.attach and those stuck the migration process. Any fix/workaround could be appreciated :)
Nvm, just found hre.ethers.getContractAt
as a substitution :)
I'm trying to migrate hardhat to newer version with the use of ethers-v6, and then find a minor issue below (v6):
and v5 behavior:
With typehint I notice that exact contract type fallbacks to BaseContract in v6, differing from v5, which infers the actual type of contract This could use Type Assertion
as ActualContract
, or directly use AcutalContract__Factory as workarounds, but should be nice if fixed in attach.