修改合约发布脚本, 切分更细
This commit is contained in:
parent
987711d4af
commit
beb6119d67
15
migrations/10_deploy_box.js
Normal file
15
migrations/10_deploy_box.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const Box = artifacts.require('BEBoxMall');
|
||||||
|
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(
|
||||||
|
Box,
|
||||||
|
config.admins.proposers,
|
||||||
|
config.admins.executors
|
||||||
|
);
|
||||||
|
const boxInstance = await Box.deployed();
|
||||||
|
if(boxInstance) {
|
||||||
|
console.log("BEBoxMall successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
15
migrations/11_deploy_timelock.js
Normal file
15
migrations/11_deploy_timelock.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const TimelockController = artifacts.require('BETimelockController');
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(
|
||||||
|
TimelockController,
|
||||||
|
config.admins.proposers,
|
||||||
|
config.admins.executors
|
||||||
|
);
|
||||||
|
const timelockInstance = await TimelockController.deployed();
|
||||||
|
if(timelockInstance) {
|
||||||
|
console.log("TimelockController successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
88
migrations/12_update_nft_setting.js
Normal file
88
migrations/12_update_nft_setting.js
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
const MarketPlace = artifacts.require('MarketPlace');
|
||||||
|
const Factory = artifacts.require('MinterFactory');
|
||||||
|
const EvolveProxy = artifacts.require('EvolveProxy');
|
||||||
|
const Box = artifacts.require('BEBoxMall');
|
||||||
|
const Hero = artifacts.require('BEHero');
|
||||||
|
const Equip = artifacts.require('BEEquipment');
|
||||||
|
const Chip = artifacts.require('BEChip');
|
||||||
|
const Coin = artifacts.require('BECoin');
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
|
||||||
|
const heroInstance = await Hero.deployed();
|
||||||
|
const equipInstance = await Equip.deployed();
|
||||||
|
const chipInstance = await Chip.deployed();
|
||||||
|
|
||||||
|
await heroInstance.updateBaseURI(config.token.baseTokenURI)
|
||||||
|
console.log("BEHero baseURI update success.")
|
||||||
|
|
||||||
|
|
||||||
|
await equipInstance.updateBaseURI(config.token.baseTokenURI)
|
||||||
|
console.log("Equip baseURI update success.")
|
||||||
|
|
||||||
|
await chipInstance.updateBaseURI(config.token.baseTokenURI)
|
||||||
|
console.log("Chip baseURI update success.")
|
||||||
|
|
||||||
|
const marketInstance = await MarketPlace.deployed();
|
||||||
|
if(marketInstance) {
|
||||||
|
await marketInstance.setFeeToAddress(config.market.feeToAddress);
|
||||||
|
await marketInstance.setTransactionFee(400);
|
||||||
|
const coinInstance = await Coin.deployed();
|
||||||
|
config.market.paymentTokens.push(coinInstance.address);
|
||||||
|
await marketInstance.setPaymentTokens(config.market.paymentTokens);
|
||||||
|
|
||||||
|
|
||||||
|
await heroInstance.addApprovalWhitelist(marketInstance.address);
|
||||||
|
await heroInstance.setApprovalForAll(marketInstance.address);
|
||||||
|
await equipInstance.addApprovalWhitelist(marketInstance.address);
|
||||||
|
await equipInstance.setApprovalForAll(marketInstance.address);
|
||||||
|
await chipInstance.addApprovalWhitelist(marketInstance.address);
|
||||||
|
await chipInstance.setApprovalForAll(marketInstance.address);
|
||||||
|
console.log(
|
||||||
|
`Allow operation ${marketInstance.address} to reduce gas fee`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const factoryInstance = await Factory.deployed();
|
||||||
|
if(factoryInstance) {
|
||||||
|
await factoryInstance.init([
|
||||||
|
heroInstance.address,
|
||||||
|
equipInstance.address,
|
||||||
|
chipInstance.address
|
||||||
|
])
|
||||||
|
await heroInstance.setMintFactory(factoryInstance.address);
|
||||||
|
await equipInstance.setMintFactory(factoryInstance.address);
|
||||||
|
await chipInstance.setMintFactory(factoryInstance.address);
|
||||||
|
console.log(
|
||||||
|
`Allow factory ${factoryInstance.address} to mint contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const proxyInstance = await EvolveProxy.deployed();
|
||||||
|
if(proxyInstance) {
|
||||||
|
await proxyInstance.init([
|
||||||
|
heroInstance.address,
|
||||||
|
equipInstance.address,
|
||||||
|
chipInstance.address
|
||||||
|
])
|
||||||
|
await heroInstance.setBurnProxy(proxyInstance.address);
|
||||||
|
await equipInstance.setBurnProxy(proxyInstance.address);
|
||||||
|
await chipInstance.setBurnProxy(proxyInstance.address);
|
||||||
|
console.log(
|
||||||
|
`Allow proxy ${proxyInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const boxInstance = await Box.deployed();
|
||||||
|
if(boxInstance) {
|
||||||
|
await boxInstance.setPaymentReceivedAddress(config.market.mallFeeAddress);
|
||||||
|
console.log(
|
||||||
|
`update payment received address: ${config.market.mallFeeAddress}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
53
migrations/13_update_timelock.js
Normal file
53
migrations/13_update_timelock.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
const TimelockController = artifacts.require('BETimelockController');
|
||||||
|
const Box = artifacts.require('BEBoxMall');
|
||||||
|
const Coin = artifacts.require('BECoin');
|
||||||
|
const Hero = artifacts.require('BEHero');
|
||||||
|
const Equip = artifacts.require('BEEquipment');
|
||||||
|
const Chip = artifacts.require('BEChip');
|
||||||
|
const MarketPlace = artifacts.require('MarketPlace');
|
||||||
|
const Factory = artifacts.require('MinterFactory');
|
||||||
|
const EvolveProxy = artifacts.require('EvolveProxy');
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const timelockInstance = await TimelockController.deployed();
|
||||||
|
const marketInstance = await MarketPlace.deployed();
|
||||||
|
await marketInstance.transferOwnership(timelockInstance.address);
|
||||||
|
console.log('MarketPlace onwer has change to: ', timelockInstance.address);
|
||||||
|
const heroInstance = await Hero.deployed();
|
||||||
|
await heroInstance.transferOwnership(timelockInstance.address);
|
||||||
|
console.log('Hero onwer has change to: ', timelockInstance.address);
|
||||||
|
const equipInstance = await Equip.deployed();
|
||||||
|
await equipInstance.transferOwnership(timelockInstance.address);
|
||||||
|
console.log('Equip onwer has change to: ', timelockInstance.address);
|
||||||
|
const chipInstance = await Chip.deployed();
|
||||||
|
await chipInstance.transferOwnership(timelockInstance.address);
|
||||||
|
console.log('Chip onwer has change to: ', timelockInstance.address);
|
||||||
|
const proxyInstance = await EvolveProxy.deployed();
|
||||||
|
await proxyInstance.transferOwnership(timelockInstance.address);
|
||||||
|
console.log('EvolveProxy onwer has change to: ', timelockInstance.address);
|
||||||
|
console.log('============= begin generate config ==============')
|
||||||
|
const coinInstance = await Coin.deployed();
|
||||||
|
const factoryInstance = await Factory.deployed();
|
||||||
|
const boxInstance = await Box.deployed();
|
||||||
|
let jsons = []
|
||||||
|
jsons.push({name: 'coin', json: 'assets/contracts/BECoin.json', address: coinInstance.address})
|
||||||
|
jsons.push({name: 'hero', json: 'assets/contracts/BEHero.json', address: heroInstance.address})
|
||||||
|
jsons.push({name: 'equip', json: 'assets/contracts/BEEquipment.json', address: equipInstance.address})
|
||||||
|
jsons.push({name: 'chip', json: 'assets/contracts/BEChip.json', address: chipInstance.address})
|
||||||
|
jsons.push({name: 'factory', json: 'assets/contracts/MinterFactory.json', address: factoryInstance.address})
|
||||||
|
jsons.push({name: 'market', json: 'assets/contracts/MarketPlace.json', address: marketInstance.address})
|
||||||
|
jsons.push({name: 'mall', json: 'assets/contracts/BEBoxMall.json', address: boxInstance.address})
|
||||||
|
jsons.push({name: 'proxy', json: 'assets/contracts/EvolveProxy.json', address: proxyInstance.address})
|
||||||
|
jsons.push({name: 'timelock', json: 'assets/contracts/BETimelockController.json', address: timelockInstance.address})
|
||||||
|
console.log(jsons);
|
||||||
|
console.log(`export const userAddress = '${accounts[0]}';`)
|
||||||
|
console.log(`export const privateKey = '';`)
|
||||||
|
console.log(`export const userBuyAddress = '${accounts[1]}';`)
|
||||||
|
} catch(err) {
|
||||||
|
console.log('generate config with error: ', err);
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,6 @@
|
|||||||
const Coin = artifacts.require('BECoin');
|
const Coin = artifacts.require('BECoin');
|
||||||
|
|
||||||
module.exports = async function (deployer, network, accounts) {
|
module.exports = async function (deployer, network, accounts) {
|
||||||
const account = accounts[0];
|
|
||||||
console.log('current account: ', account);
|
|
||||||
|
|
||||||
await deployer.deploy(Coin);
|
await deployer.deploy(Coin);
|
||||||
const coinInstance = await Coin.deployed();
|
const coinInstance = await Coin.deployed();
|
||||||
|
10
migrations/3_deploy_gold.js
Normal file
10
migrations/3_deploy_gold.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const Coin = artifacts.require('BEGold');
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(Coin);
|
||||||
|
const coinInstance = await Coin.deployed();
|
||||||
|
if(coinInstance) {
|
||||||
|
// tmpData.writeKeyVal('coin', coinInstance.address);
|
||||||
|
console.log("BEGold successfully deployed.")
|
||||||
|
}
|
||||||
|
};
|
10
migrations/4_deploy_hero.js
Normal file
10
migrations/4_deploy_hero.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const Hero = artifacts.require('BEHero');
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(Hero);
|
||||||
|
const heroInstance = await Hero.deployed();
|
||||||
|
if(heroInstance) {
|
||||||
|
console.log("BEHero successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
10
migrations/5_deploy_equip.js
Normal file
10
migrations/5_deploy_equip.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const Equip = artifacts.require('BEEquipment');
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(Equip);
|
||||||
|
const equipInstance = await Equip.deployed();
|
||||||
|
if(equipInstance) {
|
||||||
|
console.log("Equip successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
10
migrations/6_deploy_chip.js
Normal file
10
migrations/6_deploy_chip.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const Chip = artifacts.require('BEChip');
|
||||||
|
const config = require("../config/config");
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(Chip);
|
||||||
|
const chipInstance = await Chip.deployed();
|
||||||
|
if(chipInstance) {
|
||||||
|
console.log("Chip successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
9
migrations/7_deploy_market.js
Normal file
9
migrations/7_deploy_market.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const MarketPlace = artifacts.require('MarketPlace');
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(MarketPlace);
|
||||||
|
const marketInstance = await MarketPlace.deployed();
|
||||||
|
if(marketInstance) {
|
||||||
|
console.log("MarketPlace successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
10
migrations/8_deploy_factory.js
Normal file
10
migrations/8_deploy_factory.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const Factory = artifacts.require('MinterFactory');
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(Factory);
|
||||||
|
const factoryInstance = await Factory.deployed();
|
||||||
|
if(factoryInstance) {
|
||||||
|
console.log("Mint Factory successfully deployed.")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
9
migrations/9_deploy_proxy.js
Normal file
9
migrations/9_deploy_proxy.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
const EvolveProxy = artifacts.require('EvolveProxy');
|
||||||
|
|
||||||
|
module.exports = async function (deployer, network, accounts) {
|
||||||
|
await deployer.deploy(EvolveProxy);
|
||||||
|
const proxyInstance = await EvolveProxy.deployed();
|
||||||
|
if(proxyInstance) {
|
||||||
|
console.log("EvolveProxy successfully deployed.")
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user