1

Following workshop of https://www.twitch.tv/videos/1218449997

GitHub repo: https://github.com/PatrickAlphaC/battle-game

On the command npx hardhat deploy getting an error:

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 code is here:

    /* 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"]

Code cloned from github repo.

Tried to delete cache and artifacts folders - did't help.

2 Answers 2

0

I found solution, but it seems really weird

In my case I had one more contract ChampionQuest.sol which was almost empty, when I had that problem. Once I copy ChampionQuest.sol from github repo everything went fine.

However I don't understand why deploy scripts would complain on cannot find artifact "ChampionQuestToken".

Cause changes was made in another contract ChampionQuest.sol which is not used inside of 01_deploy_champion_quest_token.js

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Nov 30, 2021 at 19:37
-2

You can try:

console.log('hre artifacts:', await hre.artifacts.getArtifactPaths());

to show the list of artifact then find out whether ChampionQuestToken.json appears in this list.

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.