修改deploy脚本, 拆分成多个脚本

This commit is contained in:
zhl 2022-02-09 13:52:40 +08:00
parent 54892267fb
commit 80527418cd
20 changed files with 42481 additions and 38304 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22913,6 +22913,12 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {
"322": {
"events": {},
"links": {},
"address": "0x3AE517Af7e96B7b72bF36F8fA412bf9d05C8b8c2",
"transactionHash": "0xcfe3a4514451fe86948b732c36a81fb4bb79518899a19f841f6381fbabc9a0cc"
},
"1338": {
"events": {
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
@ -23035,12 +23041,12 @@
}
},
"links": {},
"address": "0x67B5656d60a809915323Bf2C40A8bEF15A152e3e",
"transactionHash": "0x8330493fdc794ff3cec83ed8d2b2b67ad8c96142db9859bb26675f14e8fdd221"
"address": "0xED7dfD0332e81Ba6eAF50a9500EfE34C5Cd5Ca2A",
"transactionHash": "0x225c8225646cef00529fd1992b0b8ef14d4a82c95187ac97c7781977d22f3b6d"
}
},
"schemaVersion": "3.4.4",
"updatedAt": "2022-01-28T05:54:43.816Z",
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-09T05:50:54.749Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -8805,6 +8805,12 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {
"322": {
"events": {},
"links": {},
"address": "0x4D8de00CFBA6b029ba661B928a085E710bd711eA",
"transactionHash": "0x09fdbc60b9e3c11f96ffe766ca5e465b536a128a998529f83859829a693bf908"
},
"1337": {
"events": {},
"links": {},
@ -8859,12 +8865,12 @@
}
},
"links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0xffc6e7fcd0fdfe16a56c20b57e3639c8d89f3bcdb05e933865475a2a2f118003"
"address": "0xd2E79E14739a883B89D593F97a22B76d7496DE08",
"transactionHash": "0xe828175849da124a45ba059cea7b4d29c0951ef2d777675d09f757fadd2566ea"
}
},
"schemaVersion": "3.4.4",
"updatedAt": "2022-01-28T05:54:43.776Z",
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-09T05:50:54.738Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

17
config/config.js Normal file
View File

@ -0,0 +1,17 @@
const market = {
feeToAddress: "0x50A8e60041A206AcaA5F844a1104896224be6F39",
paymentTokens: [
"0x67f6a7BbE0da067A747C6b2bEdF8aBBF7D6f60dc", // USDT
],
}
const token = {
baseTokenURI: '',
}
var config = {
market,
token
}
module.exports = config;

View File

@ -1,136 +0,0 @@
const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip');
const Factory = artifacts.require('MinterFactory');
const MarketPlace = artifacts.require('MarketPlace');
const Coin = artifacts.require('BECoin');
const Box = artifacts.require('BEBoxMall');
const EvolveProxy = artifacts.require('EvolveProxy');
module.exports = async function (deployer, network, accounts) {
const account = accounts[0];
console.log('current account: ', account);
await deployer.deploy(Coin);
const coinInstance = await Coin.deployed();
if(coinInstance) {
console.log("BECoin successfully deployed.")
}
await deployer.deploy(Hero);
const heroInstance = await Hero.deployed();
if(heroInstance) {
console.log("BEHero successfully deployed.")
}
await deployer.deploy(Equip);
const equipInstance = await Equip.deployed();
if(equipInstance) {
console.log("Equip successfully deployed.")
}
await deployer.deploy(Chip);
const chipInstance = await Chip.deployed();
if(chipInstance) {
console.log("Chip successfully deployed.")
}
await deployer.deploy(Factory);
const factoryInstance = await Factory.deployed();
if(factoryInstance) {
console.log("Mint Factory successfully deployed.")
}
try {
factoryInstance.init([
heroInstance.address,
equipInstance.address,
chipInstance.address
])
heroInstance.setMintFactory(factoryInstance.address);
equipInstance.setMintFactory(factoryInstance.address);
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}`
);
} catch(err) {
console.log(err);
}
await deployer.deploy(EvolveProxy);
const proxyInstance = await EvolveProxy.deployed();
if(proxyInstance) {
console.log("EvolveProxy successfully deployed.")
}
try {
proxyInstance.init([
heroInstance.address,
equipInstance.address,
chipInstance.address
])
heroInstance.setBurnProxy(proxyInstance.address);
equipInstance.setBurnProxy(proxyInstance.address);
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}`
);
} catch(err) {
console.log(err);
}
await deployer.deploy(MarketPlace);
const marketInstance = await MarketPlace.deployed();
if(marketInstance) {
console.log("MarketPlace successfully deployed.")
}
try {
marketInstance.setFeeToAddress(account);
marketInstance.setPaymentTokens([coinInstance.address]);
} catch(err) {
console.log(err);
}
await deployer.deploy(Box);
const boxInstance = await Box.deployed();
if(boxInstance) {
console.log("BEBoxMall successfully deployed.")
}
try {
await boxInstance.setPaymentReceivedAddress(account);
console.log(
`update payment received address: ${account}`
);
} catch (err) {
console.log(err);
}
// add marketplace to whitelist
try {
await heroInstance.addApprovalWhitelist(marketInstance.address);
await equipInstance.addApprovalWhitelist(marketInstance.address);
await chipInstance.addApprovalWhitelist(marketInstance.address);
console.log(
`Allow operation ${marketInstance.address} to reduce gas fee`
);
} catch (err) {
console.log(err);
}
if (network == "lan22" || network == "development") {
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})
console.log(jsons);
console.log(`export const userAddress = '${accounts[0]}';`)
console.log(`export const privateKey = '';`)
console.log(`export const userBuyAddress = '${accounts[1]}';`)
}
};

View File

@ -0,0 +1,30 @@
const Coin = artifacts.require('BECoin');
module.exports = async function (deployer, network, accounts) {
const account = accounts[0];
console.log('current account: ', account);
await deployer.deploy(Coin);
const coinInstance = await Coin.deployed();
if(coinInstance) {
// tmpData.writeKeyVal('coin', coinInstance.address);
console.log("BECoin successfully deployed.")
}
// if (network == "lan22" || network == "development") {
// 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})
// console.log(jsons);
// console.log(`export const userAddress = '${accounts[0]}';`)
// console.log(`export const privateKey = '';`)
// console.log(`export const userBuyAddress = '${accounts[1]}';`)
// }
};

View File

@ -0,0 +1,28 @@
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(Hero);
const heroInstance = await Hero.deployed();
if(heroInstance) {
heroInstance.updateBaseURI(config.token.baseTokenURI)
console.log("BEHero successfully deployed.")
}
await deployer.deploy(Equip);
const equipInstance = await Equip.deployed();
if(equipInstance) {
equipInstance.updateBaseURI(config.token.baseTokenURI)
console.log("Equip successfully deployed.")
}
await deployer.deploy(Chip);
const chipInstance = await Chip.deployed();
if(chipInstance) {
chipInstance.updateBaseURI(config.token.baseTokenURI)
console.log("Chip successfully deployed.")
}
}

View File

@ -0,0 +1,34 @@
const MarketPlace = artifacts.require('MarketPlace');
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(MarketPlace);
const marketInstance = await MarketPlace.deployed();
if(marketInstance) {
console.log("MarketPlace successfully deployed.")
}
try {
marketInstance.setFeeToAddress(config.market.feeToAddress);
marketInstance.setPaymentTokens(config.market.paymentTokens);
} catch(err) {
console.log(err);
}
// add marketplace to whitelist
try {
let heroInstance = await Hero.deployed();
await heroInstance.addApprovalWhitelist(marketInstance.address);
let equipInstance = await Equip.deployed();
await equipInstance.addApprovalWhitelist(marketInstance.address);
let chipInstance = await Chip.deployed();
await chipInstance.addApprovalWhitelist(marketInstance.address);
console.log(
`Allow operation ${marketInstance.address} to reduce gas fee`
);
} catch (err) {
console.log(err);
}
}

View File

@ -0,0 +1,30 @@
const Factory = artifacts.require('MinterFactory');
const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip');
module.exports = async function (deployer, network, accounts) {
await deployer.deploy(Factory);
const factoryInstance = await Factory.deployed();
if(factoryInstance) {
console.log("Mint Factory successfully deployed.")
}
try {
let heroInstance = await Hero.deployed();
let equipInstance = await Equip.deployed();
let chipInstance = await Chip.deployed();
factoryInstance.init([
heroInstance.address,
equipInstance.address,
chipInstance.address
])
heroInstance.setMintFactory(factoryInstance.address);
equipInstance.setMintFactory(factoryInstance.address);
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}`
);
} catch(err) {
console.log(err);
}
}

View File

@ -0,0 +1,30 @@
const EvolveProxy = artifacts.require('EvolveProxy');
const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip');
module.exports = async function (deployer, network, accounts) {
await deployer.deploy(EvolveProxy);
const proxyInstance = await EvolveProxy.deployed();
if(proxyInstance) {
console.log("EvolveProxy successfully deployed.")
}
try {
let heroInstance = await Hero.deployed();
let equipInstance = await Equip.deployed();
let chipInstance = await Chip.deployed();
proxyInstance.init([
heroInstance.address,
equipInstance.address,
chipInstance.address
])
heroInstance.setBurnProxy(proxyInstance.address);
equipInstance.setBurnProxy(proxyInstance.address);
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}`
);
} catch(err) {
console.log(err);
}
}

View File

@ -0,0 +1,49 @@
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) {
await deployer.deploy(Box);
const boxInstance = await Box.deployed();
if(boxInstance) {
console.log("BEBoxMall successfully deployed.")
}
try {
await boxInstance.setPaymentReceivedAddress(config.market.feeToAddress);
console.log(
`update payment received address: ${config.market.feeToAddress}`
);
} catch (err) {
console.log(err);
}
try{
const heroInstance = await Hero.deployed();
const equipInstance = await Equip.deployed();
const chipInstance = await Chip.deployed();
const coinInstance = await Coin.deployed();
const marketInstance = await MarketPlace.deployed();
const factoryInstance = await Factory.deployed();
const proxyInstance = await EvolveProxy.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})
console.log(jsons);
} catch (err) {
console.log(err);
}
}

View File

@ -7,7 +7,8 @@
"test": "npx truffle test",
"deploy:dev": "truffle migrate --network development",
"deploy:22": "truffle migrate --network lan22",
"deploy:bsctest": "truffle migrate --network bsc_testnet"
"deploy:bsctest": "truffle migrate --network bsc_testnet",
"deploy:kcctest": "truffle migrate --network kcc_testnet"
},
"author": "",
"license": "ISC",

View File

@ -76,6 +76,23 @@ module.exports = {
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// }
kcc_testnet: {
provider: () => new HDWalletProvider(mnemonic, `https://rpc-testnet.kcc.network`),
network_id: 322,
confirmations: 6,
timeoutBlocks: 200,
skipDryRun: true,
production: true,
from: '0x50A8e60041A206AcaA5F844a1104896224be6F39'
},
kcc: {
provider: () => new HDWalletProvider(mnemonic, `https://rpc-mainnet.kcc.network`),
network_id: 321,
confirmations: 10,
timeoutBlocks: 200,
skipDryRun: true,
from: '0x50A8e60041A206AcaA5F844a1104896224be6F39'
},
bsc_testnet: {
provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s1.binance.org:8545`),
network_id: 97,