我正在使用硬件部署插件来部署合同,插件成功地部署了两个合同,但是,这次没有执行相同的操作,我所做的是.
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;它将错误抛到const governanceToken = await get("GovernanceToken");和const timeLock = await get("Timelock");行。"GovernanceToken“和"Timelock”是已经部署的合同。错误上说..。
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)当我在这里跟踪MakingDAO/node_modules/hardhat-deploy/src/DeploymentsManager.ts:162:17的错误时,我得到了这个.
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;
},实际上,它没有得到已部署的合同。
发布于 2022-06-22 17:26:51
您确定,您运行了节点bevor,并在正确的链上部署了您的合同吗?
因此,在获得契约之前,您需要运行节点,如
yarn hardhat node根据您想要使用的链,您需要启动以下命令
yarn hardhat run scripts/propose.ts --network localhosthttps://ethereum.stackexchange.com/questions/123756
复制相似问题