From b1a9b25d9a3b0fd36513f02f3e7ae02b1b0789eb Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 14 Jun 2023 13:37:29 +0800 Subject: [PATCH] add deploy script of claim activity --- migrations/8_deploy_claim_activity.js | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 migrations/8_deploy_claim_activity.js diff --git a/migrations/8_deploy_claim_activity.js b/migrations/8_deploy_claim_activity.js new file mode 100644 index 0000000..d224f2e --- /dev/null +++ b/migrations/8_deploy_claim_activity.js @@ -0,0 +1,41 @@ +const Factory = artifacts.require("activity/ClaimBoxFactory"); +const Box = artifacts.require("tokens/erc721/NFTSbt"); +const base = require("../scripts/base"); + +module.exports = async function (deployer, network, accounts) { + const name = "Gacha"; + const symbol = "GACHA"; + await deployer.deploy(Box, name, symbol, 0); + const boxInstance = await Box.deployed(); + if (boxInstance) { + console.log("claim box successfully deployed."); + } + base.updateArray({ + name: "NFTSbt", + type: "erc721", + json: "assets/contracts/NFTSbt.json", + address: boxInstance.address, + network, + }); + + await deployer.deploy(Factory); + const factoryInstance = await Factory.deployed(); + if (factoryInstance) { + console.log("claim box factory successfully deployed."); + } + base.updateArray({ + name: "ClaimBoxFactory", + type: "logic", + json: "assets/contracts/ClaimBoxFactory.json", + address: factoryInstance.address, + network, + }); + + await boxInstance.setMintRole(factoryInstance.address); + console.log( + `success set mint role to: ${factoryInstance.address} claim box ` + ); + + await factoryInstance.addTokenSupport(boxInstance.address); + console.log(`success add token support to: ${boxInstance.address}`); +};