becrypto/migrations/8_deploy_claim_activity.js
2023-06-14 13:37:29 +08:00

42 lines
1.2 KiB
JavaScript

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}`);
};