0

I'm using the hardhat-deploy plugin to deploy the contracts, the plugin successfully deployed the two contracts but, not performing the same this time, what I've done is...

import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types"
import { ethers } from "hardhat";
import { VOTING_DELAY, QUORUM_PERCENTAGE, VOTING_PERIOD } from "../helperHardhatConfig";


const deployGovernorContract: DeployFunction = async function(hre: HardhatRuntimeEnvironment){
    const { getNamedAccounts, deployments, network } = hre;
    const { deploy, log, get } = deployments;
    //grabbing from config
    const { deployer } = await getNamedAccounts();
    const governanceToken = await get("GovernanceToken");
    const timeLock = await get("Timelock");
    log("deploying governor>>>>>>>>>>");
    const governorContract = await deploy("GovernorContract", {
        from: deployer,
        args: [
            //governanceToken.address,
            timeLock.address,
            VOTING_DELAY,
            VOTING_PERIOD,
            QUORUM_PERCENTAGE
        ],
        log: true,
    });
}

export default deployGovernorContract;

It is throwing the error at lines const governanceToken = await get("GovernanceToken"); and const timeLock = await get("Timelock");. "GovernanceToken", and "Timelock" are the already deployed contracts. The error says...

Error: ERROR processing /home/adil/Desktop/MakingDAO/deploy/deployGovernor.ts:
Error: No deployment found for: GovernanceToken
    at get (/home/adil/Desktop/MakingDAO/node_modules/hardhat-deploy/src/DeploymentsManager.ts:162:17)

When I followed the error in MakingDAO/node_modules/hardhat-deploy/src/DeploymentsManager.ts:162:17 exactly here, I got this...

get: async (name: string) => {
        await this.setup(false);
        const deployment = this.db.deployments[name];
        if (deployment === undefined) {
          throw new Error(`No deployment found for: ${name}`);
        }
        return deployment;
      },

Actually it is not getting the deployed contract.

1 Answer 1

0

Are you sure, you ran your node bevor running this and deployed your contracts on the correct chain?

so before getting the contract you need to run your node like

yarn hardhat node

depending on the chain you want to use, you need to fire the command like

yarn hardhat run scripts/propose.ts --network localhost

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.