Hey guys, I am trying to deploy an upgradable contract via hardhat and I am getting errors like
Artifact for contract "@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20" not found.
I used the hardhat flatten keyword to get the code flattened as I was using open zeppelin contracts, can anyone help me with this?
Feb 25, 2022, 9:09 AM
Well you need the ERC20Upgradable if you want the contract to be upgradable
Feb 25, 2022, 9:33 AM
Yes I have added that, everything is upgradable, still it is giving me this error
Feb 25, 2022, 9:34 AM
How does you deploy script look like
Feb 25, 2022, 9:35 AM
Via deployproxy
Feb 25, 2022, 9:36 AM
Share that deploy.ts (use pastebin or such)
Its gotta be using the wrong artifact
Feb 25, 2022, 9:38 AM
Yes on it, that ms grim
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using node you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');
// We get the contract to deploy
const GamiTestToken = await ethers.getContractFactory("GamiTestToken");
const GamiTestTokenProxy = await upgrades.deployProxy(GamiTestToken, { kind: 'uups', initializer: 'initialize' });
console.log("Gami Token deployed to:", GamiTestTokenProxy.address);
}
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using node you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');
// We get the contract to deploy
const GamiTestToken = await ethers.getContractFactory("GamiTestToken");
const GamiTestTokenProxy = await upgrades.deployProxy(GamiTestToken, { kind: 'uups', initializer: 'initialize' });
console.log("Gami Token deployed to:", GamiTestTokenProxy.address);
}
Hey guys, I am trying to deploy an upgradable contract via hardhat and I am getting errors like
Artifact for contract "@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20" not found.
I used the hardhat flatten keyword to get the code flattened as I was using open zeppelin contracts, can anyone help me with this?
Artifact for contract "@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20" not found.
I used the hardhat flatten keyword to get the code flattened as I was using open zeppelin contracts, can anyone help me with this?
Feb 25, 2022, 11:47 AM
did you install openseppelin npm package?
npm i @openzeppelin/contracts
Feb 25, 2022, 12:02 PM
yes, i did. let me do it again
Feb 25, 2022, 12:03 PM
wait shoe me this line
Feb 25, 2022, 12:04 PM
Feb 25, 2022, 12:05 PM
show solidity code on that line
Feb 25, 2022, 12:05 PM
no line is mentioined in the error
Feb 25, 2022, 12:06 PM
if you simply compile
works?
npx hardhat compile
Feb 25, 2022, 12:06 PM
imports used
Feb 25, 2022, 12:08 PM
does this work?
Feb 25, 2022, 12:08 PM
yes
Feb 25, 2022, 12:08 PM
well n
it gives error
Feb 25, 2022, 12:09 PM
i am able to compile the contract
Feb 25, 2022, 12:09 PM
looks no
oh wait
npm install @openzeppelin/contracts-upgradeable
this
Feb 25, 2022, 12:09 PM
Feb 25, 2022, 12:10 PM
did this?
Feb 25, 2022, 12:10 PM
same error
Feb 25, 2022, 12:11 PM
so you don't import ERC20
anyewhere
Feb 25, 2022, 12:12 PM
yes, i dont import it anywhere
i have on one contract with these imports which i flattened using hardhat
Feb 25, 2022, 12:14 PM