215 lines
9.1 KiB
JavaScript
215 lines
9.1 KiB
JavaScript
const BEHero = artifacts.require("tokens/erc721/BEHero");
|
|
const BEEquipment = artifacts.require("tokens/erc721/BEEquipment");
|
|
const BECoin = artifacts.require("tokens/erc20/BECoin");
|
|
const BEGold = artifacts.require("tokens/erc20/BEGold");
|
|
const BEUsdt = artifacts.require("tokens/erc20/BEUSDT");
|
|
const BEChip1155 = artifacts.require("tokens/erc1155/BEChip1155");
|
|
const BEShard = artifacts.require("tokens/erc1155/BEShard");
|
|
const MarketPlace = artifacts.require("market/BENFTMarket");
|
|
// const BEBoxMall = artifacts.require('market/BEBoxMall')
|
|
const MinterFactory = artifacts.require("logic/MinterFactory");
|
|
const UserMinterFactory = artifacts.require("logic/UserMinterFactory");
|
|
const EvolveFactory = artifacts.require("logic/EvolveFactory");
|
|
const UserEvolveFactory = artifacts.require("logic/UserEvolveFactory");
|
|
const BENftMall = artifacts.require("market/BENftMall");
|
|
const NftChipLocker = artifacts.require("logic/NftChipLocker");
|
|
|
|
const config = require("../config/config");
|
|
|
|
module.exports = async function main(callback) {
|
|
try {
|
|
// Our code will go here
|
|
const accounts = await web3.eth.getAccounts();
|
|
console.log(accounts);
|
|
|
|
const heroInstance = await BEHero.deployed();
|
|
const equipInstance = await BEEquipment.deployed();
|
|
const chipInstance = await BEChip1155.deployed();
|
|
const shardInstance = await BEShard.deployed();
|
|
const coinInstance = await BECoin.deployed();
|
|
const goldInstance = await BEGold.deployed();
|
|
const usdtInstance = await BEUsdt.deployed();
|
|
config.market.paymentTokens.push(coinInstance.address);
|
|
config.market.paymentTokens.push(goldInstance.address);
|
|
config.market.paymentTokens.push(usdtInstance.address);
|
|
|
|
// await heroInstance.updateBaseURI(config.token.baseTokenURI);
|
|
// console.log("BEHero baseURI update success.");
|
|
|
|
// await equipInstance.updateBaseURI(config.token.baseTokenURI);
|
|
// console.log("Equip baseURI update success.");
|
|
|
|
const marketInstance = await MarketPlace.deployed();
|
|
const ROUND = 1000000;
|
|
const DECIMALS = 1000000000000000000
|
|
if (marketInstance) {
|
|
await marketInstance.setFeeToAddress(config.market.feeToAddress);
|
|
console.log(
|
|
`market receive fee address set to : ${config.market.feeToAddress}`
|
|
);
|
|
await marketInstance.setTransactionFee((4 * ROUND) / 100);
|
|
await marketInstance.addERC721Support(heroInstance.address);
|
|
await marketInstance.addERC721Support(equipInstance.address);
|
|
await marketInstance.addERC1155Support(chipInstance.address);
|
|
await marketInstance.addERC1155Support(shardInstance.address);
|
|
const maxPrice = web3.utils.toWei('99990000')
|
|
const minPrice = web3.utils.toWei('0.01')
|
|
await marketInstance.setNFTPriceMaxLimit(
|
|
heroInstance.address,
|
|
maxPrice
|
|
);
|
|
await marketInstance.setNFTPriceMinLimit(
|
|
heroInstance.address,
|
|
minPrice
|
|
);
|
|
await marketInstance.setNFTPriceMaxLimit(
|
|
equipInstance.address,
|
|
maxPrice
|
|
);
|
|
await marketInstance.setNFTPriceMinLimit(
|
|
equipInstance.address,
|
|
minPrice
|
|
);
|
|
await marketInstance.setNFTPriceMaxLimit(
|
|
chipInstance.address,
|
|
maxPrice
|
|
);
|
|
await marketInstance.setNFTPriceMinLimit(
|
|
chipInstance.address,
|
|
minPrice
|
|
);
|
|
await marketInstance.setNFTPriceMaxLimit(
|
|
shardInstance.address,
|
|
maxPrice
|
|
);
|
|
await marketInstance.setNFTPriceMinLimit(
|
|
shardInstance.address,
|
|
minPrice
|
|
);
|
|
for (let token of config.market.paymentTokens) {
|
|
await marketInstance.addERC20Support(token);
|
|
}
|
|
|
|
console.log(`finish update market config`);
|
|
|
|
// await heroInstance.grantLockRole(marketInstance.address);
|
|
// await heroInstance.setApprovalForAll(marketInstance.address, true);
|
|
// console.log("finish heroInstance.addApprovalWhitelist");
|
|
// await equipInstance.grantLockRole(marketInstance.address);
|
|
// await equipInstance.setApprovalForAll(marketInstance.address, true);
|
|
// console.log("finish equipInstance.addApprovalWhitelist");
|
|
// await chipInstance.grantLockRole(marketInstance.address);
|
|
// await chipInstance.setApprovalForAll(marketInstance.address, true);
|
|
// console.log("finish chipInstance.addApprovalWhitelist");
|
|
|
|
// await heroInstance.grantLockRole(config.admins.admin);
|
|
// await equipInstance.grantLockRole(config.admins.admin);
|
|
// await chipInstance.grantLockRole(config.admins.admin);
|
|
// await shardInstance.grantLockRole(config.admins.admin);
|
|
// console.log(
|
|
// `Allow operation ${marketInstance.address} to reduce gas fee`
|
|
// );
|
|
}
|
|
|
|
// const factoryInstance = await MinterFactory.deployed();
|
|
// if (!factoryInstance) {
|
|
// console.error("no factoryInstance");
|
|
// return;
|
|
// }
|
|
// await factoryInstance.init([
|
|
// heroInstance.address,
|
|
// equipInstance.address,
|
|
// chipInstance.address,
|
|
// shardInstance.address,
|
|
// ]);
|
|
// await factoryInstance.setFeeToAddress(config.market.feeToAddress);
|
|
// await factoryInstance.updateExecutor(config.admins.admin);
|
|
// await heroInstance.setMintFactory(factoryInstance.address);
|
|
// await equipInstance.setMintFactory(factoryInstance.address);
|
|
// await chipInstance.setMintFactory(factoryInstance.address);
|
|
// await shardInstance.setMintFactory(factoryInstance.address);
|
|
|
|
// console.log(
|
|
// `Allow factory ${factoryInstance.address} to mint contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
|
|
// );
|
|
// await heroInstance.grantBurnRole(factoryInstance.address);
|
|
// await equipInstance.grantBurnRole(factoryInstance.address);
|
|
// await chipInstance.grantBurnRole(factoryInstance.address);
|
|
// await shardInstance.grantBurnRole(factoryInstance.address);
|
|
|
|
// console.log(
|
|
// `Allow factory ${factoryInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
|
|
// );
|
|
|
|
// const userFactoryInstance = await UserMinterFactory.deployed();
|
|
// if (!userFactoryInstance) {
|
|
// console.error("no userFactoryInstance");
|
|
// return;
|
|
// }
|
|
// await factoryInstance.addApprovalList(userFactoryInstance.address);
|
|
// await userFactoryInstance.init([
|
|
// heroInstance.address,
|
|
// equipInstance.address,
|
|
// chipInstance.address,
|
|
// shardInstance.address,
|
|
// factoryInstance.address,
|
|
// ]);
|
|
// const proxyInstance = await EvolveFactory.deployed();
|
|
// if (!proxyInstance) {
|
|
// console.error("no proxyInstance");
|
|
// return;
|
|
// }
|
|
// await proxyInstance.init(chipInstance.address);
|
|
// await proxyInstance.addNFTTokenSupport(heroInstance.address);
|
|
// await proxyInstance.addNFTTokenSupport(equipInstance.address);
|
|
// await proxyInstance.updateExecutor(config.admins.admin);
|
|
// await heroInstance.grantBurnRole(proxyInstance.address);
|
|
// await equipInstance.grantBurnRole(proxyInstance.address);
|
|
// await chipInstance.grantBurnRole(proxyInstance.address);
|
|
// console.log(
|
|
// `Allow proxy ${proxyInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
|
|
// );
|
|
// const userProxyInstance = await UserEvolveFactory.deployed();
|
|
// if (!userProxyInstance) {
|
|
// console.error("no userProxyInstance");
|
|
// return;
|
|
// }
|
|
// await proxyInstance.addApprovalList(userProxyInstance.address);
|
|
// await userProxyInstance.init(proxyInstance.address);
|
|
|
|
// // const boxInstance = await BEBoxMall.deployed();
|
|
// // if (!boxInstance) {
|
|
// // console.error("no boxInstance");
|
|
// // return;
|
|
// // }
|
|
// // await boxInstance.setPaymentReceivedAddress(config.market.mallFeeAddress);
|
|
// // console.log(
|
|
// // `update payment received address: ${config.market.mallFeeAddress}`
|
|
// // );
|
|
|
|
// const nftMallInstance = await BENftMall.deployed();
|
|
// if (nftMallInstance) {
|
|
// await nftMallInstance.setFeeToAddress(config.market.feeToAddress);
|
|
// await nftMallInstance.setPaymentTokens(config.market.paymentTokens);
|
|
// await nftMallInstance.addNFTTokenSupport(heroInstance.address);
|
|
// await nftMallInstance.addNFTTokenSupport(equipInstance.address);
|
|
// await nftMallInstance.addNFTTokenSupport(chipInstance.address);
|
|
// await heroInstance.setMintFactory(nftMallInstance.address);
|
|
// await equipInstance.setMintFactory(nftMallInstance.address);
|
|
// await chipInstance.setMintFactory(nftMallInstance.address);
|
|
// console.log("update nftMallInstance settings success");
|
|
// }
|
|
// const lockerInstance = await NftChipLocker.deployed();
|
|
// if (lockerInstance) {
|
|
// await lockerInstance.addNFTTokenSupport(heroInstance.address);
|
|
// await lockerInstance.addNFTTokenSupport(equipInstance.address);
|
|
// await lockerInstance.addNFTTokenSupport(chipInstance.address);
|
|
// console.log("update NftChipLocker addNFTTokenSupport success");
|
|
// }
|
|
callback(0);
|
|
} catch (error) {
|
|
console.error(error);
|
|
callback(1);
|
|
}
|
|
};
|