97 lines
3.6 KiB
JavaScript
97 lines
3.6 KiB
JavaScript
const FT = artifacts.require("tokens/erc20/FT");
|
|
const NFT = artifacts.require("tokens/erc20/NFT");
|
|
const BENftMarket = artifacts.require("market/BENftMarket");
|
|
const BENftMall = artifacts.require("market/BENftMall");
|
|
const GameItemMarket = artifacts.require("market/GameItemMarket");
|
|
const GameItemMall = artifacts.require("market/GameItemMall");
|
|
|
|
const config = require("../config/config");
|
|
const base = require("../scripts/base");
|
|
|
|
module.exports = async function main(callback) {
|
|
try {
|
|
// Our code will go here
|
|
const network = "arbitrum_testnet";
|
|
let cfgs = base.loadData({ network });
|
|
const accounts = await web3.eth.getAccounts();
|
|
console.log(accounts);
|
|
|
|
const heroInstance = await NFT.at(
|
|
cfgs.find((c) => c.name === "HERO").address
|
|
);
|
|
const equipInstance = await NFT.at(
|
|
cfgs.find((c) => c.name === "WEAPON").address
|
|
);
|
|
const chipInstance = await NFT.at(
|
|
cfgs.find((c) => c.name === "CHIP").address
|
|
);
|
|
|
|
const coinInstance = await FT.at(
|
|
cfgs.find((c) => c.name === "CEC").address
|
|
);
|
|
const goldInstance = await FT.at(
|
|
cfgs.find((c) => c.name === "CEG").address
|
|
);
|
|
|
|
config.market.paymentTokens.push(coinInstance.address);
|
|
config.market.paymentTokens.push(goldInstance.address);
|
|
|
|
const marketInstance = await BENftMarket.at(
|
|
cfgs.find((c) => c.name === "BENFTMarket").address
|
|
);
|
|
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.setFeeToAddress(config.market.feeToAddress);
|
|
console.log(
|
|
`market receive tax address set to : ${config.market.feeToAddress}`
|
|
);
|
|
await marketInstance.setTransactionFee((3 * ROUND) / 100);
|
|
await marketInstance.setTransactionTax((1 * ROUND) / 100);
|
|
await marketInstance.addERC721Support(heroInstance.address);
|
|
await marketInstance.addERC721Support(equipInstance.address);
|
|
await marketInstance.addERC721Support(chipInstance.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);
|
|
for (let token of config.market.paymentTokens) {
|
|
await marketInstance.addERC20Support(token);
|
|
console.log(`add token for market payment: ${token}`);
|
|
}
|
|
console.log(`finish update market config`);
|
|
}
|
|
const gameMallInstance = await GameItemMall.at(
|
|
cfgs.find((c) => c.name === "GameItemMall").address
|
|
);
|
|
if (gameMallInstance) {
|
|
await gameMallInstance.setFeeToAddress(config.market.feeToAddress);
|
|
console.log(
|
|
`mall receive fee address set to : ${config.market.feeToAddress}`
|
|
);
|
|
|
|
await gameMallInstance.updateExecutor(config.admins.admin);
|
|
console.log(`mall executor set to : ${config.admins.admin}`);
|
|
|
|
for (let token of config.market.paymentTokens) {
|
|
await gameMallInstance.addERC20Support(token);
|
|
console.log(`add token for mall payment: ${token}`);
|
|
}
|
|
}
|
|
|
|
callback(0);
|
|
} catch (error) {
|
|
console.error(error);
|
|
callback(1);
|
|
}
|
|
};
|