首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“找不到文物”在部署中的应用

“找不到文物”在部署中的应用
EN

Ethereum用户
提问于 2021-11-29 18:01:25
回答 1查看 1.6K关注 0票数 1

https://www.twitch.tv/videos/1218449997后续工作坊

GitHub回购:https://github.com/PatrickAlphaC/battle-game

在命令npx hardhat deploy上得到一个错误:

代码语言:javascript
复制
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代码在这里:

代码语言:javascript
复制
    /* 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回购公司克隆的代码。

尝试删除cacheartifacts文件夹-没有帮助。

EN

回答 1

Ethereum用户

发布于 2021-11-29 18:29:02

我找到了解决办法,但这看起来很奇怪

在我的例子中,当我遇到这个问题时,我又有了一份合同ChampionQuest.sol,它几乎是空的。一旦我从github复制了ChampionQuest.sol,一切都很好。

但是,我不明白为什么部署脚本会在cannot find artifact "ChampionQuestToken"上抱怨。

原因是在另一个合同ChampionQuest.sol中进行了更改,该合同在01_deploy_champion_quest_token.js中没有使用

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/114586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档