增加luckybox相关合约, 更新相关json

This commit is contained in:
cebgcontract 2022-04-17 12:33:29 +08:00
parent 635e4ceb53
commit 2b336a24bc
32 changed files with 125393 additions and 39578 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

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

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

@ -3143,6 +3143,12 @@
"address": "0x0a392137F85b2DeB7A6Ef3f483Ca9d8a73F33da0",
"transactionHash": "0x21601d21248ac7b19dd159612b9f109665392939dba1ff903e4602e0f111309d"
},
"321": {
"events": {},
"links": {},
"address": "0x95BaaB0De4a9ceb83d6d41dC2487E54Da2d7f93a",
"transactionHash": "0x6abeadd9ced7e4114e65ad1488843d4dc5951252ffc409537c8146306202f0fe"
},
"322": {
"events": {},
"links": {},
@ -3158,8 +3164,8 @@
"1338": {
"events": {},
"links": {},
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"transactionHash": "0xd609e4dfdc5ef642b3192d2f90ee390eacb6863bf145da078ffca2a0aa1ba67e"
"address": "0x6e0C31F3b2c076eA1B67dac75789E7117163569c",
"transactionHash": "0xe03a76f8796f8ff7feee3d6b25c156acc633bfeec1ddcd4c268173113211d877"
},
"1644989050832": {
"events": {},
@ -3169,7 +3175,7 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-03-17T01:17:17.124Z",
"updatedAt": "2022-04-17T04:30:42.771Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

View File

@ -56,7 +56,8 @@
}
],
"stateMutability": "view",
"type": "function"
"type": "function",
"constant": true
},
{
"inputs": [],
@ -69,7 +70,8 @@
}
],
"stateMutability": "view",
"type": "function"
"type": "function",
"constant": true
},
{
"inputs": [],
@ -82,7 +84,8 @@
}
],
"stateMutability": "view",
"type": "function"
"type": "function",
"constant": true
},
{
"inputs": [],
@ -95,7 +98,8 @@
}
],
"stateMutability": "view",
"type": "function"
"type": "function",
"constant": true
},
{
"inputs": [],
@ -8801,6 +8805,12 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang"
},
"networks": {
"321": {
"events": {},
"links": {},
"address": "0x871AFfb074540808C426d8A1aaD09E4359848309",
"transactionHash": "0x29eb19d42ab3f9d940b770a726bca84eca253dea6623237553193bb1109ac66e"
},
"322": {
"events": {
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
@ -8951,8 +8961,8 @@
}
},
"links": {},
"address": "0x6eD79Aa1c71FD7BdBC515EfdA3Bd4e26394435cC",
"transactionHash": "0x33fae5773448fc36835ab9f4ac8837cd8635ac4331930e6757535059c19434ab"
"address": "0x03B154bC82853fA963AC31754c4D76841EE0fDFB",
"transactionHash": "0x08ccc35d11a2edb2410bbf17c408218c8b1b93d89ad9de8463ba628b3ff1433b"
},
"1644989050832": {
"events": {},
@ -8962,7 +8972,8 @@
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-03-17T01:15:46.044Z",
"updatedAt": "2022-04-17T04:30:42.639Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",
"methods": {

View File

@ -1,14 +1,23 @@
const market = {
feeToAddress: "0x50A8e60041A206AcaA5F844a1104896224be6F39",
mallFeeAddress: "0x50A8e60041A206AcaA5F844a1104896224be6F39",
feeToAddress: "0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e",
mallFeeAddress: "0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e",
paymentTokens: [
"0x67f6a7BbE0da067A747C6b2bEdF8aBBF7D6f60dc", // USDT
"0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48", // USDT
],
}
const admins = {
proposers: ["0x50A8e60041A206AcaA5F844a1104896224be6F39"],
executors: ["0x50A8e60041A206AcaA5F844a1104896224be6F39"]
admin: "0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e",
proposers: [
"0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e",
"0x14248857e0E03982F2C48B0FD7B2a223a884fbF3",
"0x6D0F7A84d7184B02B97C403a3b147E1c2b064F63"
],
executors: [
"0x746338765a8FbDD1c5aB61bfb92CD6D960C3C662",
"0x84f165521886642D24c55FACc886ab5986AD2d8b",
"0xe77b50153d64d112F0ae705d8a743f95939cB00d"
]
}
const token = {

View File

@ -11,7 +11,7 @@ abstract contract BEBase is ERC721, AccessControlEnumerable, ERC721Enumerable, O
mapping(address => bool) public approvalWhitelists;
mapping(uint256 => bool) public lockedTokens;
string private _baseTokenURI;
string private _baseTokenURI = "https://market.cebg.games/api/nft/info/";
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURN_ROLE = keccak256("BURN_ROLE");

View File

@ -5,5 +5,5 @@ import "./BEBase.sol";
// this contract will transfer ownership to BETimelockController after deployed
// all onlyowner method would add timelock
contract BEChip is BEBase{
constructor() ERC721("Crypto Elite's Chip", "CECP") {}
constructor() ERC721("CRYPTO ELITE'S CHIP", "CHIP") {}
}

View File

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

View File

@ -5,5 +5,5 @@ import "./BEBase.sol";
// this contract will transfer ownership to BETimelockController after deployed
// all onlyowner method would add timelock
contract BEEquipment is BEBase{
constructor() ERC721("Crypto Elite's Equipment", "CEE") {}
constructor() ERC721("CRYPTO ELITE'S WEAPON", "WEAPON") {}
}

View File

@ -12,7 +12,7 @@ contract BEGold is ERC20, ERC20Burnable, Pausable, Ownable {
uint256 public constant INITIALIZED_CAP = 100000000 * 1e18;
constructor() ERC20("Crypto Elite's Gold", "CEG") {
constructor() ERC20("CRYPTO ELITE'S GOLD", "CEG") {
_mint(msg.sender, INITIALIZED_CAP);
}

View File

@ -5,5 +5,5 @@ import "./BEBase.sol";
// this contract will transfer ownership to BETimelockController after deployed
// all onlyowner method would add timelock
contract BEHero is BEBase{
constructor() ERC721("Crypto Elite's Hero", "CEH") {}
constructor() ERC721("CRYPTO ELITE'S HERO", "HERO") {}
}

View File

@ -0,0 +1,79 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
contract BELuckyBox is ERC1155, AccessControl {
bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURN_ROLE = keccak256("BURN_ROLE");
constructor() ERC1155("https://market.cebg.games/api/nft/info/{id}") {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(URI_SETTER_ROLE, msg.sender);
}
function setURI(string memory newuri) external onlyRole(URI_SETTER_ROLE) {
_setURI(newuri);
}
function mint(address account, uint256 id, uint256 amount, bytes memory data)
external
onlyRole(MINTER_ROLE)
{
_mint(account, id, amount, data);
}
function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
external
onlyRole(MINTER_ROLE)
{
_mintBatch(to, ids, amounts, data);
}
function burn(
address account,
uint256 id,
uint256 value
) external onlyRole(BURN_ROLE) {
_burn(account, id, value);
}
function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory values
) external onlyRole(BURN_ROLE) {
_burnBatch(account, ids, values);
}
// The following functions are overrides required by Solidity.
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155, AccessControl)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
/**
* @dev Add factory to mint/burn item
*/
function setMintFactory(address factory) external onlyRole(DEFAULT_ADMIN_ROLE) {
_grantRole(MINTER_ROLE, factory);
_grantRole(BURN_ROLE, factory);
}
/**
* @dev Remove factory
*/
function removeMintFactory(address factory) external onlyRole(DEFAULT_ADMIN_ROLE) {
_revokeRole(MINTER_ROLE, factory);
_revokeRole(BURN_ROLE, factory);
}
}

View File

@ -0,0 +1,165 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../HasSignature.sol";
interface IMintableERC1155 is IERC1155 {
function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) external;
function burn(address owner, uint256 tokenId, uint256 amount) external;
}
interface IMintableERC721 is IERC721 {
function mint(address to, uint256 tokenId) external;
}
contract LuckyBoxProxy is Ownable, Initializable, HasSignature {
IMintableERC1155 public box;
IMintableERC721 public hero;
IMintableERC721 public equip;
IMintableERC721 public chip;
address public executor;
mapping(bytes => bool) public usedSignatures;
event BoxMinted(
address contractAddress,
address indexed to,
uint256[] ids,
uint256[] amounts
);
event BoxOpened(
address indexed to,
uint256 indexed boxId,
uint256[] ids,
uint256[] types
);
constructor()
HasSignature("LuckyBoxProxy", "1"){
}
function init(address _erc1155, address[3] calldata _erc721s) external initializer onlyOwner {
box = IMintableERC1155(_erc1155);
hero = IMintableERC721(_erc721s[0]);
equip = IMintableERC721(_erc721s[1]);
chip = IMintableERC721(_erc721s[2]);
}
/**
* @dev update executor
*/
function updateExecutor(address account) external onlyOwner {
require(account != address(0), 'address can not be zero');
executor = account;
}
function mintBoxTo(address to, uint256[] memory ids, uint256[] memory amounts) external onlyOwner{
require(to != address(0), 'to address can not be zero');
box.mintBatch(to, ids, amounts, "");
emit BoxMinted(address(box), to, ids, amounts);
}
function openBox(
uint256 boxId,
uint256[3] memory ids,
uint256[3] memory types,
uint256 saltNonce,
bytes calldata signature
) external {
require(ids.length == types.length, "LuckyBoxProxy: ids and types length mismatch");
require(
!usedSignatures[signature],
"LuckyBoxProxy: signature used. please send another transaction with new signature"
);
bytes32 criteriaMessageHash = getMessageHash(
boxId,
ids[0],
ids[1],
ids[2],
types[0],
types[1],
types[2],
saltNonce
);
checkSigner(executor, criteriaMessageHash, signature);
usedSignatures[signature] = true;
address owner = msg.sender;
// open box
box.burn(owner, boxId, 1);
// random count
uint256 val = rand(owner, saltNonce, 100);
// mint nft
uint256[] memory results;
uint256[] memory resultTypes;
mint721WithType(owner, ids[0], types[0]);
results[0] = ids[0];
resultTypes[0] = types[0];
if (val > 80) {
mint721WithType(owner, ids[1], types[1]);
results[1] = ids[1];
resultTypes[1] = types[1];
}
if (val > 90) {
mint721WithType(owner, ids[2], types[2]);
results[2] = ids[2];
resultTypes[2] = types[2];
}
emit BoxOpened(
owner,
boxId,
results,
resultTypes
);
}
function mint721WithType(address to, uint256 tokenId, uint256 typeNum) private {
if (typeNum == 0) {
hero.mint(to, tokenId);
} else if (typeNum == 1) {
equip.mint(to, tokenId);
} else {
chip.mint(to, tokenId);
}
}
function rand(
address owner,
uint256 nonce,
uint256 _length
) internal view returns(uint256) {
uint256 random = uint256(keccak256(abi.encodePacked(owner, nonce, block.difficulty, block.timestamp)));
return random%_length;
}
function getMessageHash(
uint256 _boxId,
uint256 _firstToken,
uint256 _secondToken,
uint256 _thirdToken,
uint256 _type1,
uint256 _type2,
uint256 _type3,
uint256 _saltNonce
) public pure returns (bytes32) {
return
keccak256(
abi.encodePacked(
_boxId,
_firstToken,
_secondToken,
_thirdToken,
_type1,
_type2,
_type3,
_saltNonce
)
);
}
}

View File

@ -0,0 +1,119 @@
const MarketPlace = artifacts.require('MarketPlace');
const Factory = artifacts.require('MinterFactory');
const EvolveProxy = artifacts.require('EvolveProxy');
const Box = artifacts.require('BEBoxMall');
const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip');
const Coin = artifacts.require('BECoin');
const Gold = artifacts.require('BEGold');
// const TimelockController = artifacts.require('BETimelockController');
const config = require("../config/config");
module.exports = async function (deployer, network, accounts) {
const heroInstance = await Hero.deployed();
const equipInstance = await Equip.deployed();
const chipInstance = await Chip.deployed();
// await heroInstance.updateBaseURI(config.token.baseTokenURI)
// console.log("BEHero baseURI update success.")
// await equipInstance.updateBaseURI(config.token.baseTokenURI)
// console.log("Equip baseURI update success.")
// await chipInstance.updateBaseURI(config.token.baseTokenURI)
// console.log("Chip baseURI update success.")
const marketInstance = await MarketPlace.deployed();
const coinInstance = await Coin.deployed();
// if(marketInstance) {
// await marketInstance.setFeeToAddress(config.market.feeToAddress);
// await marketInstance.setTransactionFee(400);
// config.market.paymentTokens.push(coinInstance.address);
// await marketInstance.setPaymentTokens(config.market.paymentTokens);
// console.log(
// `finish update market config`
// );
// await heroInstance.addApprovalWhitelist(marketInstance.address);
// await heroInstance.setApprovalForAll(marketInstance.address, true);
// console.log('finish heroInstance.addApprovalWhitelist')
// await equipInstance.addApprovalWhitelist(marketInstance.address);
// await equipInstance.setApprovalForAll(marketInstance.address, true);
// console.log('finish equipInstance.addApprovalWhitelist')
// await chipInstance.addApprovalWhitelist(marketInstance.address);
// await chipInstance.setApprovalForAll(marketInstance.address, true);
// console.log('finish chipInstance.addApprovalWhitelist')
// await heroInstance.addApprovalWhitelist(config.admins.admin);
// await equipInstance.addApprovalWhitelist(config.admins.admin);
// await chipInstance.addApprovalWhitelist(config.admins.admin);
// console.log(
// `Allow operation ${marketInstance.address} to reduce gas fee`
// );
// }
const factoryInstance = await Factory.deployed();
if(!factoryInstance) {
console.error('no factoryInstance')
return
}
// await factoryInstance.init([
// heroInstance.address,
// equipInstance.address,
// chipInstance.address
// ])
// await heroInstance.setMintFactory(factoryInstance.address);
// await equipInstance.setMintFactory(factoryInstance.address);
// await 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}`
// );
const proxyInstance = await EvolveProxy.deployed();
if(!proxyInstance) {
console.error('no proxyInstance')
return
}
// await proxyInstance.init([
// heroInstance.address,
// equipInstance.address,
// chipInstance.address
// ])
// await heroInstance.setBurnProxy(proxyInstance.address);
// await equipInstance.setBurnProxy(proxyInstance.address);
// await 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}`
// );
const boxInstance = await Box.deployed();
if(!boxInstance) {
console.error('no boxInstance')
return
}
// await boxInstance.setPaymentReceivedAddress(config.market.mallFeeAddress);
// console.log(
// `update payment received address: ${config.market.mallFeeAddress}`
// );
const goldInstance = await Gold.deployed();
let jsons = []
jsons.push({name: 'coin', json: 'assets/contracts/BECoin.json', address: coinInstance.address})
jsons.push({name: 'gold', json: 'assets/contracts/BEGold.json', address: goldInstance.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: 'luckbox', json: 'assets/contracts/BELuckyBox.json', address: luckyBoxInstance.address})
// jsons.push({name: 'boxproxy', json: 'assets/contracts/LuckyBoxProxy.json', address: boxProxyInstance.address})
console.log(JSON.stringify(jsons));
}

View File

@ -1,88 +0,0 @@
const MarketPlace = artifacts.require('MarketPlace');
const Factory = artifacts.require('MinterFactory');
const EvolveProxy = artifacts.require('EvolveProxy');
const Box = artifacts.require('BEBoxMall');
const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip');
const Coin = artifacts.require('BECoin');
const config = require("../config/config");
module.exports = async function (deployer, network, accounts) {
const heroInstance = await Hero.deployed();
const equipInstance = await Equip.deployed();
const chipInstance = await Chip.deployed();
await heroInstance.updateBaseURI(config.token.baseTokenURI)
console.log("BEHero baseURI update success.")
await equipInstance.updateBaseURI(config.token.baseTokenURI)
console.log("Equip baseURI update success.")
await chipInstance.updateBaseURI(config.token.baseTokenURI)
console.log("Chip baseURI update success.")
const marketInstance = await MarketPlace.deployed();
if(marketInstance) {
await marketInstance.setFeeToAddress(config.market.feeToAddress);
await marketInstance.setTransactionFee(400);
const coinInstance = await Coin.deployed();
config.market.paymentTokens.push(coinInstance.address);
await marketInstance.setPaymentTokens(config.market.paymentTokens);
await heroInstance.addApprovalWhitelist(marketInstance.address);
await heroInstance.setApprovalForAll(marketInstance.address);
await equipInstance.addApprovalWhitelist(marketInstance.address);
await equipInstance.setApprovalForAll(marketInstance.address);
await chipInstance.addApprovalWhitelist(marketInstance.address);
await chipInstance.setApprovalForAll(marketInstance.address);
console.log(
`Allow operation ${marketInstance.address} to reduce gas fee`
);
}
const factoryInstance = await Factory.deployed();
if(factoryInstance) {
await factoryInstance.init([
heroInstance.address,
equipInstance.address,
chipInstance.address
])
await heroInstance.setMintFactory(factoryInstance.address);
await equipInstance.setMintFactory(factoryInstance.address);
await 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}`
);
}
const proxyInstance = await EvolveProxy.deployed();
if(proxyInstance) {
await proxyInstance.init([
heroInstance.address,
equipInstance.address,
chipInstance.address
])
await heroInstance.setBurnProxy(proxyInstance.address);
await equipInstance.setBurnProxy(proxyInstance.address);
await 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}`
);
}
const boxInstance = await Box.deployed();
if(boxInstance) {
await boxInstance.setPaymentReceivedAddress(config.market.mallFeeAddress);
console.log(
`update payment received address: ${config.market.mallFeeAddress}`
);
}
}

View File

@ -0,0 +1,43 @@
const LuckyBox = artifacts.require('luckybox/BELuckyBox');
const BoxProxy = artifacts.require('luckybox/LuckyBoxProxy');
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(
LuckyBox
);
const luckyBoxInstance = await LuckyBox.deployed();
if(luckyBoxInstance) {
console.log("BELuckyBox successfully deployed.")
}
await deployer.deploy(
BoxProxy
);
const boxProxyInstance = await BoxProxy.deployed();
if(boxProxyInstance) {
console.log("LuckyBoxProxy successfully deployed.")
}
const heroInstance = await Hero.deployed();
const equipInstance = await Equip.deployed();
const chipInstance = await Chip.deployed();
await boxProxyInstance.init(
luckyBoxInstance.address,
[
heroInstance.address,
equipInstance.address,
chipInstance.address
]
)
await heroInstance.setMintFactory(boxProxyInstance.address);
await equipInstance.setMintFactory(boxProxyInstance.address);
await chipInstance.setMintFactory(boxProxyInstance.address);
await luckyBoxInstance.setMintFactory(boxProxyInstance.address);
}

View File

@ -1,12 +1,15 @@
const TimelockController = artifacts.require('BETimelockController');
const Box = artifacts.require('BEBoxMall');
const Coin = artifacts.require('BECoin');
const Gold = artifacts.require('BEGold');
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 LuckyBox = artifacts.require('luckybox/BELuckyBox');
const BoxProxy = artifacts.require('luckybox/LuckyBoxProxy');
const config = require("../config/config");
@ -15,26 +18,30 @@ module.exports = async function (deployer, network, accounts) {
try {
const timelockInstance = await TimelockController.deployed();
const marketInstance = await MarketPlace.deployed();
await marketInstance.transferOwnership(timelockInstance.address);
// await marketInstance.transferOwnership(timelockInstance.address);
console.log('MarketPlace onwer has change to: ', timelockInstance.address);
const heroInstance = await Hero.deployed();
await heroInstance.transferOwnership(timelockInstance.address);
// await heroInstance.transferOwnership(timelockInstance.address);
console.log('Hero onwer has change to: ', timelockInstance.address);
const equipInstance = await Equip.deployed();
await equipInstance.transferOwnership(timelockInstance.address);
// await equipInstance.transferOwnership(timelockInstance.address);
console.log('Equip onwer has change to: ', timelockInstance.address);
const chipInstance = await Chip.deployed();
await chipInstance.transferOwnership(timelockInstance.address);
// await chipInstance.transferOwnership(timelockInstance.address);
console.log('Chip onwer has change to: ', timelockInstance.address);
const proxyInstance = await EvolveProxy.deployed();
await proxyInstance.transferOwnership(timelockInstance.address);
// 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();
const luckyBoxInstance = await LuckyBox.deployed();
const boxProxyInstance = await BoxProxy.deployed();
const goldInstance = await Gold.deployed;
let jsons = []
jsons.push({name: 'coin', json: 'assets/contracts/BECoin.json', address: coinInstance.address})
jsons.push({name: 'gold', json: 'assets/contracts/BEGold.json', address: goldInstance.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})
@ -43,6 +50,8 @@ module.exports = async function (deployer, network, accounts) {
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})
jsons.push({name: 'luckbox', json: 'assets/contracts/BELuckyBox.json', address: luckyBoxInstance.address})
jsons.push({name: 'boxproxy', json: 'assets/contracts/LuckyBoxProxy.json', address: boxProxyInstance.address})
console.log(jsons);
console.log(`export const userAddress = '${accounts[0]}';`)
console.log(`export const privateKey = '';`)

View File

@ -89,9 +89,9 @@ module.exports = {
provider: () => new HDWalletProvider(mnemonic, `https://rpc-mainnet.kcc.network`),
network_id: 321,
confirmations: 10,
timeoutBlocks: 200,
timeoutBlocks: 5000,
skipDryRun: true,
from: '0x50A8e60041A206AcaA5F844a1104896224be6F39'
from: '0x565edA4ef351EB78F03B8AfCb6dCF02E29cAD62e'
},
bsc_testnet: {
provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s1.binance.org:8545`),