优化deploy流程

This commit is contained in:
cebgcontract 2022-02-21 16:00:00 +08:00
parent bc13b308cf
commit de5eb4bca8
16 changed files with 106 additions and 79 deletions

View File

@ -44538,8 +44538,8 @@
}
},
"links": {},
"address": "0x40ffB0642e0B4494c47b6ad781862C0BDB3256A8",
"transactionHash": "0x3343d55bd3d060fefb90703bc4b6330e23f30ff4fe11e7f6cd9062e2461396a7"
"address": "0xF278ff771F9E24968083B0bA54Cb42eb4B23C2d7",
"transactionHash": "0xee0f42f0e5420e8cfb454e8458f8ac0e67f34515ab1cce5041ae277a4f5684b6"
},
"1337": {
"events": {
@ -45142,7 +45142,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.159Z",
"updatedAt": "2022-02-18T08:03:21.417Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -24047,8 +24047,8 @@
}
},
"links": {},
"address": "0x3E5296621FAE29E44144Ba632C25148e7cb3dAD9",
"transactionHash": "0x72803d22210c4796148a83a96de61585b6d362dcc8f02d29bb77336130141637"
"address": "0xca191D827f1d042e27AeD858534830758E39C89E",
"transactionHash": "0xbddd6429b743d71aadcf908e683b7070a218ead7fa427b54c5eb7d4c2ce2fd1f"
},
"1337": {
"events": {
@ -24580,7 +24580,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.223Z",
"updatedAt": "2022-02-18T08:03:21.485Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -10114,8 +10114,8 @@
}
},
"links": {},
"address": "0x342927700cd93ED7a08F7f5A75844171276AADc4",
"transactionHash": "0x679ae298e758c17705d1f3dc06be3031b0533ce67d6dd3dc361ff2ab0f933b80"
"address": "0xfeFc3aab779863c1624eE008aba485c53805dCeb",
"transactionHash": "0xbedae77445aee6f04dd8e9d51a12d9917df1e7bc16799603faf9f2918621547f"
},
"1337": {
"events": {
@ -10359,7 +10359,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.179Z",
"updatedAt": "2022-02-18T08:03:21.433Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -24047,8 +24047,8 @@
}
},
"links": {},
"address": "0x500a39FF77A2F6A2d9FF90A145950E1e2B28bADa",
"transactionHash": "0x1d0510f1dc539054b4648139a520e1540c5850f7c204fec0e6ed9d619b02687a"
"address": "0x7E4cdCDFBC43e40d718B7FCb18cE59d114152094",
"transactionHash": "0xb0b2eb5726c104f40ed8228726132a31b2f44aa863cae335fd1ff0bc25babf37"
},
"1337": {
"events": {
@ -24580,7 +24580,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.206Z",
"updatedAt": "2022-02-18T08:03:21.465Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -24053,8 +24053,8 @@
}
},
"links": {},
"address": "0x7ddbE0A6069d6a807bd7fDB8D722875120e8966A",
"transactionHash": "0x4fb3327afaff1d083ef86c1befd6e5b297b417ad77bc50b0a07fcf1c2d0c6002"
"address": "0xb783184dc14fA90c33766c7e8992ded045FA4058",
"transactionHash": "0x434f9c2104edb85e179fdb561f5d74c0dfca9b4d98f993f32ca24b8f5a164f59"
},
"1337": {
"events": {
@ -24586,7 +24586,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.190Z",
"updatedAt": "2022-02-18T08:03:21.447Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -24239,6 +24239,12 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {
"322": {
"events": {},
"links": {},
"address": "0x4613089287F604Eff94c1ab34B31424Fc4BD5312",
"transactionHash": "0xa881622258e0ee6005ebdf0932028565ceaa9fdd5f49265f5720008606a6dbd8"
},
"1337": {
"events": {
"0xc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b58": {
@ -24647,7 +24653,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.138Z",
"updatedAt": "2022-02-18T08:03:21.389Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -24867,8 +24867,8 @@
}
},
"links": {},
"address": "0x8893624C7CbB824FF6b62A8d4F740F3151192D85",
"transactionHash": "0x84b3fa557e717eb583919aee8b8cae7321e648eed58e0c98e97d50137a0543f3"
"address": "0x00ad7758953f899aF5B2C8E960239f606BF29A3f",
"transactionHash": "0x2124f43f3bfd996cfc71ab6e1d5a88ab2e3d9fed4f84ac48378771b20a3bef6b"
},
"1337": {
"events": {
@ -25066,7 +25066,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.265Z",
"updatedAt": "2022-02-18T08:03:21.538Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -33586,8 +33586,8 @@
}
},
"links": {},
"address": "0xF23B5A4D36ae21E035A12c7Bfac6c4bfc65Db088",
"transactionHash": "0x8765c301e2432f0e21ebffef945f9b84f579eef59c09c34d2311a2741d88b1db"
"address": "0x807A43Ca45811A7077136814Da7D2451c0d2F51f",
"transactionHash": "0x77e5c21122e2550879a86d8502a64b0c2f1bfca2ddb7a8a4a70023a91113aa64"
},
"1337": {
"events": {
@ -33866,7 +33866,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.240Z",
"updatedAt": "2022-02-18T08:03:21.506Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -3146,8 +3146,8 @@
"322": {
"events": {},
"links": {},
"address": "0xC4f48dcb760E431E2D29752c5cA81180Cb31FA45",
"transactionHash": "0xb196323e6b2ffddb1a6df94615f18d4f423054477b201a44a77a66c6221e70f0"
"address": "0x5b36329D0DA1F56eD60F3C5DE1855c8dE0440140",
"transactionHash": "0xa21ab0e0b5eb5c5d1213e92deb7d3665e11b0552836b862d3a248acd3efd9d75"
},
"1337": {
"events": {},
@ -3169,7 +3169,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.275Z",
"updatedAt": "2022-02-18T08:03:21.545Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -8853,8 +8853,8 @@
}
},
"links": {},
"address": "0x10F883D6e26fBb56Ab20466502BFD9017a1ea144",
"transactionHash": "0x55be186130f938b282f7e56d9f176919a1a55ffd71a05304558cb691d04e7f58"
"address": "0x91155Fda04fA11b3ffd6213b33179DD67fE6B844",
"transactionHash": "0x06f167fb679dc1b6fef94687aa9351303be9b4b5628d431b423ba62349c0414a"
},
"1337": {
"events": {
@ -8966,7 +8966,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T06:20:26.255Z",
"updatedAt": "2022-02-18T08:03:21.522Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -4,7 +4,7 @@ import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
contract BECoin is ERC20Burnable {
uint256 public constant INITIALIZED_CAP = 20000000 * 1e18;
uint256 public constant INITIALIZED_CAP = 100000000 * 1e18;
constructor() ERC20("Crypto Elite's Coin", "CEC") {
_mint(_msgSender(), INITIALIZED_CAP);

View File

@ -16,6 +16,8 @@ contract EvolveProxy is Ownable, Initializable, HasSignature {
mapping(bytes => bool) public usedSignatures;
address public executor;
event TokenEvolved(
uint256 indexed evolveEventId,
address indexed owner,
@ -34,6 +36,14 @@ contract EvolveProxy is Ownable, Initializable, HasSignature {
chip = IBurnableERC721(_erc721s[2]);
}
/**
* @dev update executor
*/
function updateExecutor(address account) external onlyOwner {
require(account != address(0), 'address can not be zero');
executor = account;
}
/**
* @dev evolve function to Blissful Elites Hero NFT
* tokenIds: [hero_to_evolve, hero_for_burn, chip]
@ -64,7 +74,7 @@ contract EvolveProxy is Ownable, Initializable, HasSignature {
tokenIds[2],
saltNonce
);
checkSigner(msg.sender, criteriaMessageHash, signature);
checkSigner(executor, criteriaMessageHash, signature);
hero.burn(msg.sender, tokenIds[1]);
if (tokenIds[2] > 0) {
chip.burn(msg.sender, tokenIds[2]);
@ -103,7 +113,7 @@ contract EvolveProxy is Ownable, Initializable, HasSignature {
tokenIds[2],
saltNonce
);
checkSigner(msg.sender, criteriaMessageHash, signature);
checkSigner(executor, criteriaMessageHash, signature);
equip.burn(msg.sender, tokenIds[1]);
if (tokenIds[2] > 0) {
chip.burn(msg.sender, tokenIds[2]);

View File

@ -92,7 +92,7 @@ contract HasSignature {
address signer,
bytes32 structHash,
bytes memory signature
) public view{
) external view{
bytes32 digest = _hashTypedDataV4(structHash);
address recovered = ECDSA.recover(digest, signature);
require(recovered == signer, "[BE] invalid signature");
@ -103,7 +103,7 @@ contract HasSignature {
address signer,
bytes32 hash,
bytes memory signature
) public pure {
) external pure {
require(signature.length == 65, "[BE] invalid signature length");
bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(
hash

View File

@ -1,12 +1,4 @@
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");
@ -20,39 +12,4 @@ module.exports = async function (deployer, network, accounts) {
if(timelockInstance) {
console.log("TimelockController successfully deployed.")
}
try {
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);
console.log('============= begin generate config ==============')
const coinInstance = await Coin.deployed();
const factoryInstance = await Factory.deployed();
const proxyInstance = await EvolveProxy.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);
}
}

View 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);
}
}

View File

@ -5,10 +5,11 @@
"main": "index.js",
"scripts": {
"test": "npx truffle test",
"build": "truffle compile",
"deploy:dev": "truffle migrate --network development",
"deploy:22": "truffle migrate --network lan22",
"deploy:bsctest": "truffle migrate --network bsc_testnet",
"deploy:kcctest": "truffle migrate --network kcc_testnet"
"deploy:22": "truffle migrate --network lan22 --compile-none",
"deploy:bsctest": "truffle migrate --network bsc_testnet --compile-none",
"deploy:kcctest": "truffle migrate --network kcc_testnet --compile-none"
},
"author": "",
"license": "ISC",