https://www.twitch.tv/videos/1218449997后续工作坊
GitHub回购:https://github.com/PatrickAlphaC/battle-game
在命令npx hardhat deploy上得到一个错误:
An unexpected error occurred:
Error: ERROR processing /home/zage/code/HackChainLink/ChampionQuest/deploy/01_deploy_champion_quest_token.js:
Error: cannot find artifact "ChampionQuestToken"
at getArtifact (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/DeploymentsManager.ts:213:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at runNextTicks (internal/process/task_queues.js:64:3)
at listOnTimeout (internal/timers.js:526:9)
at processTimers (internal/timers.js:500:7)
at getArtifactFromOptions (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/helpers.ts:486:18)
at getLinkedArtifact (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/helpers.ts:496:38)
at _deploy (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/helpers.ts:517:54)
at _deployOne (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/helpers.ts:910:16)
at Object.deployMocks [as func] (/home/zage/code/HackChainLink/ChampionQuest/deploy/01_deploy_champion_quest_token.js:12:30)
at DeploymentsManager.executeDeployScripts (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1220:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at runNextTicks (internal/process/task_queues.js:64:3)
at listOnTimeout (internal/timers.js:526:9)
at processTimers (internal/timers.js:500:7)
at DeploymentsManager.runDeploy (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1050:5)
at SimpleTaskDefinition.action (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/index.ts:405:5)
at Environment._runTaskDefinition (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/home/zage/code/HackChainLink/ChampionQuest/node_modules/hardhat-deploy/src/index.ts:551:32)01_deploy_champion_quest_token.js代码在这里:
/* eslint-disable node/no-unpublished-import */
// eslint-disable-next-line node/no-missing-import
const hre = require("hardhat")
const deployMocks = async function (hre) {
const { deployments, getNamedAccounts, getChainId } = hre
const { deploy, log, get } = deployments
const { deployer } = await getNamedAccounts()
const chainId = await getChainId()
const ufoToken = await get("MockUFO")
const championQuestToken = await deploy("ChampionQuestToken", {
from: deployer,
log: true,
args: [ufoToken.address],
})
}
module.exports = deployMocks
deployMocks.tags = ["all", "token"]从github回购公司克隆的代码。
尝试删除cache和artifacts文件夹-没有帮助。
发布于 2021-11-29 18:29:02
我找到了解决办法,但这看起来很奇怪
在我的例子中,当我遇到这个问题时,我又有了一份合同ChampionQuest.sol,它几乎是空的。一旦我从github复制了ChampionQuest.sol,一切都很好。
但是,我不明白为什么部署脚本会在cannot find artifact "ChampionQuestToken"上抱怨。
原因是在另一个合同ChampionQuest.sol中进行了更改,该合同在01_deploy_champion_quest_token.js中没有使用
https://ethereum.stackexchange.com/questions/114586
复制相似问题