From b4d9351552cbf0a9aca829b44fa8e2a5707b7ad3 Mon Sep 17 00:00:00 2001 From: owen05 Date: Thu, 15 Apr 2021 10:38:19 +0800 Subject: [PATCH] deploy mysterybox --- config/kovan-config.js | 10 ++++++++++ migrations/5_deploy_nft.js | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/config/kovan-config.js b/config/kovan-config.js index 9b23a9c..9269a32 100644 --- a/config/kovan-config.js +++ b/config/kovan-config.js @@ -74,5 +74,15 @@ module.exports = { DODONFTRegistry: "0xF405372b7808363DCfbb5Eb81204889B7a69Aa3e", DODONFTProxy: "0x0727dEd495E35f4bA4F5D64794145152301Db23f", + + + //================= MysteryBox ================= + MysteryBoxV1: "", + RandomGenerator: "", + RandomPool: [ + "0xa2e0ef85618732d80e5ef362773da1c92e8b1c57", + "0xaCfc959e0E85726d09A36E6DFdD56FB2e5dB8F77", + "0x7A733869CB210393f3c02B740c58498EB1f8815C" + ] } } \ No newline at end of file diff --git a/migrations/5_deploy_nft.js b/migrations/5_deploy_nft.js index 2488cf2..3931581 100644 --- a/migrations/5_deploy_nft.js +++ b/migrations/5_deploy_nft.js @@ -17,6 +17,9 @@ const InitializableERC721 = artifacts.require("InitializableERC721"); const InitializableERC1155 = artifacts.require("InitializableERC1155"); const NFTTokenFactory = artifacts.require("NFTTokenFactory"); +const MysteryBoxV1 = artifacts.require("MysteryBoxV1"); +const RandomGenerator = artifacts.require("RandomGenerator"); + module.exports = async (deployer, network, accounts) => { let CONFIG = GetConfig(network, accounts) if (CONFIG == null) return; @@ -41,9 +44,45 @@ module.exports = async (deployer, network, accounts) => { let ERC1155Address = CONFIG.InitializableERC1155; let NFTTokenFactoryAddress = CONFIG.NFTTokenFactory; + let MysteryBoxV1Address = CONFIG.MysteryBoxV1; + let RandomGeneratorAddress = CONFIG.RandomGenerator; + let RandomPool = CONFIG.RandomPool; + let multiSigAddress = CONFIG.multiSigAddress; let defaultMaintainer = CONFIG.defaultMaintainer; + if (deploySwitch.MYSTERYBOX_V1) { + logger.log("===================================================="); + logger.log("network type: " + network); + logger.log("Deploy time: " + new Date().toLocaleString()); + logger.log("Deploy type: MysteryBoxV1"); + + if (RandomGeneratorAddress == "") { + await deployer.deploy(RandomGenerator,[ + RandomPool[0], + RandomPool[1], + RandomPool[2], + ]); + RandomGeneratorAddress = RandomGenerator.address; + logger.log("RandomGeneratorAddress: ", RandomGeneratorAddress); + } + + if (MysteryBoxV1Address == "") { + await deployer.deploy(MysteryBoxV1); + MysteryBoxV1Address = MysteryBoxV1.address; + logger.log("MysteryBoxV1Address: ", MysteryBoxV1Address); + const MysteryBoxV1Instance = await MysteryBoxV1.at(MysteryBoxV1Address); + var tx = await MysteryBoxV1Instance.init( + "DODOMysteryBox", + "DODOBox", + "", + multiSigAddress, + RandomGeneratorAddress + ); + logger.log("Init MysteryBoxV1 Tx:", tx.tx); + } + } + if (deploySwitch.DEPLOY_NFT) { logger.log("===================================================="); logger.log("network type: " + network);