I’m trying to deploy a proxy with hardhat upgrades, but I get this error.
Not too sure how to progress from here.
Thank you in advance
I’m trying to deploy a proxy with hardhat upgrades, but I get this error.
Not too sure how to progress from here.
Thank you in advance
It seems like you do not write correctly, I think when you deploy contracts, it should be
const ERC20 = await ethers.getContractFactory("Token");
const erc20 = await ERC20.deploy(
Name,
Symbol,
Decimals
);
await erc20.deployed();
they don’t have name, symbol & decimal in the constructor
I mean it should be 3 steps:
await ethers.getContractFactory("xxx")
deploy()
deployed()
Hi @lucusra,
I assume DHedgeFactory has an initialize function that takes three parameters (which is why you haven’t specified the initialize function name). I would console.log
the parameters prior to calling deployProxy
to check your parameters.
I assume the error is in your test. I would print out the value of await factory.getDaoAddress
As @Skyge advised, you should add an await factory.deployed()
. See the documentation for details: https://docs.openzeppelin.com/upgrades-plugins/1.x/hardhat-upgrades#script-usage
As an aside, screen shots of code are much harder to read, it would be much easier if you posted code snippets, along with any outputs showing errors. See: Format code in the forum
Got it to work now. I added the deployed() to everything & console logged the addresses (they were exactly the same).
Turns out I had
expect((await factory.getDaoAddress()).to.equal(dao.address));
instead of
expect(await factory.getDaoAddress()).to.equal(dao.address);
which was causing the errors…
Pesky brackets
Hi @lucusra,
That happens all the time .
I generally use console.log
and break up the code to track it down, but also spend a fair amount of time banging my head against JavaScript syntax.
Glad you were able to resolve.
I’m definitely going to be using console.log
a lot more now. Seems like the only way to display what’s actually happening. Better than keeping track of everything in my head
I’m not too familiar with JS either, primarily smart contracts, so that may be another reason