becrypto/migrations/13_deploy_luckybox.js
2022-04-18 21:15:00 +08:00

48 lines
1.6 KiB
JavaScript

const LuckyBox = artifacts.require('luckybox/BELuckyBox');
const BoxProxy = artifacts.require('luckybox/LuckyBoxProxy');
const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip');
const config = require("../config/config");
module.exports = async function (deployer, network, accounts) {
await deployer.deploy(
LuckyBox
);
const luckyBoxInstance = await LuckyBox.deployed();
if(luckyBoxInstance) {
console.log("BELuckyBox successfully deployed.")
}
await deployer.deploy(
BoxProxy
);
const boxProxyInstance = await BoxProxy.deployed();
if(boxProxyInstance) {
console.log("LuckyBoxProxy successfully deployed.")
}
const heroInstance = await Hero.deployed();
const equipInstance = await Equip.deployed();
const chipInstance = await Chip.deployed();
await boxProxyInstance.init(
[
heroInstance.address,
equipInstance.address,
chipInstance.address,
luckyBoxInstance.address
]
)
await boxProxyInstance.updateExecutor(accounts[0]);
await heroInstance.setMintFactory(boxProxyInstance.address);
await equipInstance.setMintFactory(boxProxyInstance.address);
await chipInstance.setMintFactory(boxProxyInstance.address);
await luckyBoxInstance.setMintFactory(boxProxyInstance.address);
await heroInstance.setBurnProxy(boxProxyInstance.address);
await equipInstance.setBurnProxy(boxProxyInstance.address);
await chipInstance.setBurnProxy(boxProxyInstance.address);
await luckyBoxInstance.setBurnProxy(boxProxyInstance.address);
}