更新script of update setting

This commit is contained in:
CounterFire2023 2023-11-23 13:01:29 +08:00
parent 37afe482c7
commit 775fc91697
2 changed files with 104 additions and 104 deletions

View File

@ -11,7 +11,7 @@ const base = require("../scripts/base");
module.exports = async function main(callback) {
try {
// Our code will go here
const network = "arbitrum_testnet";
const network = this.config.network;
let cfgs = base.loadData({ network });
const accounts = await web3.eth.getAccounts();
console.log(accounts);
@ -19,12 +19,12 @@ module.exports = async function main(callback) {
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 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
@ -36,75 +36,75 @@ module.exports = async function main(callback) {
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.setTaxToAddress(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 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.setTaxToAddress(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}`
// );
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}`);
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}`);
// }
// }
for (let token of config.market.paymentTokens) {
await gameMallInstance.addERC20Support(token);
console.log(`add token for mall payment: ${token}`);
}
}
// const gameMarketInstance = await GameItemMarket.at(
// cfgs.find((c) => c.name === "GameItemMarket").address
// );
// if (gameMarketInstance) {
// await gameMarketInstance.setFeeToAddress(config.market.feeToAddress);
// console.log(
// `mall receive fee address set to : ${config.market.feeToAddress}`
// );
const gameMarketInstance = await GameItemMarket.at(
cfgs.find((c) => c.name === "GameItemMarket").address
);
if (gameMarketInstance) {
await gameMarketInstance.setFeeToAddress(config.market.feeToAddress);
console.log(
`mall receive fee address set to : ${config.market.feeToAddress}`
);
// await gameMarketInstance.updateExecutor(config.admins.admin);
// console.log(`mall executor set to : ${config.admins.admin}`);
await gameMarketInstance.updateExecutor(config.admins.admin);
console.log(`mall executor set to : ${config.admins.admin}`);
// for (let token of config.market.paymentTokens) {
// await gameMarketInstance.addERC20Support(token);
// console.log(`add token for mall payment: ${token}`);
// }
// }
for (let token of config.market.paymentTokens) {
await gameMarketInstance.addERC20Support(token);
console.log(`add token for mall payment: ${token}`);
}
}
const nftMallInstance = await BENftMall.at(
cfgs.find((c) => c.name === "BENftMall").address
);
@ -124,13 +124,13 @@ module.exports = async function main(callback) {
await nftMallInstance.addERC721Support(heroInstance.address);
console.log(`add token for mall sell: ${heroInstance.address}`);
await nftMallInstance.addERC721Support(equipInstance.address);
console.log(`add token for mall sell: ${equipInstance.address}`);
await nftMallInstance.addERC721Support(chipInstance.address);
console.log(`add token for mall sell: ${chipInstance.address}`);
// await nftMallInstance.addERC721Support(equipInstance.address);
// console.log(`add token for mall sell: ${equipInstance.address}`);
// await nftMallInstance.addERC721Support(chipInstance.address);
// console.log(`add token for mall sell: ${chipInstance.address}`);
await heroInstance.setMintRole(nftMallInstance.address);
await equipInstance.setMintRole(nftMallInstance.address);
await chipInstance.setMintRole(nftMallInstance.address);
// await equipInstance.setMintRole(nftMallInstance.address);
// await chipInstance.setMintRole(nftMallInstance.address);
const testHeroInstance = await NFT.at(
cfgs.find((c) => c.name === "TestHERO").address

View File

@ -9,7 +9,7 @@ const base = require("../scripts/base");
module.exports = async function main(callback) {
try {
// Our code will go here
const network = "arbitrum_testnet";
const network = this.config.network;
let cfgs = base.loadData({ network });
const accounts = await web3.eth.getAccounts();
console.log(accounts);
@ -17,12 +17,12 @@ module.exports = async function main(callback) {
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 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
@ -45,7 +45,7 @@ module.exports = async function main(callback) {
// console.log("Equip baseURI update success.");
const marketInstance = await MarketPlace.at(
cfgs.find((c) => c.name === "BENFTMarket").address
cfgs.find((c) => c.name === "BENftMarket").address
);
const ROUND = 1000000;
const DECIMALS = 1000000000000000000;
@ -56,17 +56,17 @@ module.exports = async function main(callback) {
);
await marketInstance.setTransactionFee((4 * ROUND) / 100);
await marketInstance.addERC721Support(heroInstance.address);
await marketInstance.addERC721Support(equipInstance.address);
await marketInstance.addERC721Support(chipInstance.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);
// 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}`);
@ -74,22 +74,22 @@ module.exports = async function main(callback) {
console.log(`finish update market config`);
// // await heroInstance.grantLockRole(marketInstance.address);
// // await heroInstance.setLockRole(marketInstance.address);
// // await heroInstance.setApprovalForAll(marketInstance.address, true);
// // console.log("finish heroInstance.addApprovalWhitelist");
// // await equipInstance.grantLockRole(marketInstance.address);
// // await equipInstance.setLockRole(marketInstance.address);
// // await equipInstance.setApprovalForAll(marketInstance.address, true);
// // console.log("finish equipInstance.addApprovalWhitelist");
// // await chipInstance.grantLockRole(marketInstance.address);
// // await chipInstance.setLockRole(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);
// console.log(
// `Allow operation ${marketInstance.address} to reduce gas fee`
// );
// await heroInstance.setLockRole(config.admins.admin);
// await equipInstance.setLockRole(config.admins.admin);
// await chipInstance.setLockRole(config.admins.admin);
console.log(
`Allow operation ${marketInstance.address} to reduce gas fee`
);
}
const factoryInstance = await await UserMinterFactory.at(
@ -103,15 +103,15 @@ module.exports = async function main(callback) {
await factoryInstance.updateExecutor(config.admins.admin);
await heroInstance.setMintRole(factoryInstance.address);
await equipInstance.setMintRole(factoryInstance.address);
await chipInstance.setMintRole(factoryInstance.address);
// await equipInstance.setMintRole(factoryInstance.address);
// await chipInstance.setMintRole(factoryInstance.address);
await factoryInstance.addTokenSupport(heroInstance.address);
await factoryInstance.addTokenSupport(equipInstance.address);
await factoryInstance.addTokenSupport(chipInstance.address);
// await factoryInstance.addTokenSupport(equipInstance.address);
// await factoryInstance.addTokenSupport(chipInstance.address);
console.log(
`Allow factory ${factoryInstance.address} to mint contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
`Allow factory ${factoryInstance.address} to mint contract \n hero: ${heroInstance.address}, `
);
callback(0);