diff --git a/packages/ethernaut-zeronaut/src/tasks/get-campaign.js b/packages/ethernaut-zeronaut/src/tasks/get-campaign.js index 6d3d59f..d87e906 100644 --- a/packages/ethernaut-zeronaut/src/tasks/get-campaign.js +++ b/packages/ethernaut-zeronaut/src/tasks/get-campaign.js @@ -1,8 +1,7 @@ const types = require('ethernaut-common/src/validation/types') const output = require('ethernaut-common/src/ui/output') const { getChainId } = require('ethernaut-common/src/util/network') -const { connect } = require('../internal/connect') -const debug = require('ethernaut-common/src/ui/debug') +const { connect, getLevelContract } = require('../internal/connect') require('../scopes/zeronaut') .task('get-campaign', 'Retrieves details for a campaign') @@ -21,8 +20,18 @@ require('../scopes/zeronaut') const campaign = await contract.getCampaign(id) let str = '' - str += `\n name: ${hre.ethers.decodeBytes32String(campaign.id)}` + str += ` name: ${hre.ethers.decodeBytes32String(campaign.id)}` str += `\n owner: ${campaign.owner}` + str += `\n levels: ${campaign.levels.length}` + + for (let i = 0; i < campaign.levels.length; i++) { + const levelId = campaign.levels[i] + const levelData = await contract.getLevel(levelId) + const levelAddress = levelData.addr + const level = await getLevelContract(hre, levelAddress) + const levelName = hre.ethers.decodeBytes32String(await level.name()) + str += `\n [${i + 1}] "${levelName}"` + } return output.resultBox(str) } catch (err) {