update contract

This commit is contained in:
zhl 2022-01-12 11:42:55 +08:00
parent 822f71aab1
commit 239bcf1591
16 changed files with 20930 additions and 10526 deletions

File diff suppressed because one or more lines are too long

View File

@ -17899,10 +17899,193 @@
"links": {},
"address": "0xD80a641a28702064e3f5EF383bd2640d4ff795c8",
"transactionHash": "0x90f80c95582992eb3bbe034f8afa473276141dfaa2e7d3cc22e0fc4e49ed8c9b"
},
"1337": {
"events": {},
"links": {},
"address": "0x22aD50379cf42Ff035940454A33090489E93E189",
"transactionHash": "0xb584efc4667c249a8b362f9a106a80abae0892bdc984a957975ba83a20609359"
},
"1338": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
"0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa": {
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
}
},
"links": {},
"address": "0xD733FB8412c09aab9a4b24d06B607bEEA79c5810",
"transactionHash": "0xc2e3a40e56b93c879395a606f0cdf4926e0e210624199433f16011624c5cc095"
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-01-10T10:41:08.519Z",
"schemaVersion": "3.4.4",
"updatedAt": "2022-01-12T03:12:23.441Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

File diff suppressed because one or more lines are too long

View File

@ -29775,10 +29775,362 @@
"links": {},
"address": "0xB469331cEC98E52b7Eab07dFB586253bE232BBF7",
"transactionHash": "0x67a261ebf990a8156698187151caf09f35a8458844917d44800a46918f8158e4"
},
"1337": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0x72B68FE268B7e8CfED0a0fc9F70F34D2b6C1273a",
"transactionHash": "0xb3f06fa9e62f09ff69bbb96ce742f92bf2d5c29afd63b2748ea349e140a2bb2a"
},
"1338": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0xe4282f12C6Da2d2A27bBb192C1AA58e3Ad589EFB",
"transactionHash": "0x717703990a50a36cfce6ef00a4a997728fde7040ae00b8ff378c71d6f9cbcfe1"
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-01-10T10:40:08.107Z",
"schemaVersion": "3.4.4",
"updatedAt": "2022-01-12T03:12:23.375Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

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

@ -2314,15 +2314,21 @@
"address": "0x819677A74F316DD77Fe5f9759E44771Df89ccdf6",
"transactionHash": "0x6357aae5235e3b69ef91bba57c5d8c348da0d6a16dfe6b5596b2767dbfc9a256"
},
"1337": {
"events": {},
"links": {},
"address": "0xBA75742aAf838C118CF5DBA74b3aD9260710fb8B",
"transactionHash": "0x941e5e8551e766d16b9b07027d9cd5140bed474ded77a167df25b6926e5b4ba5"
},
"1338": {
"events": {},
"links": {},
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"transactionHash": "0xc62fd784e5fc778af0987072f3c3560722e4a573ed440c86ade7973a92477328"
"address": "0x5A9a2Adb814a7aE8a9d8F5ff0dc9bA9857C3AD62",
"transactionHash": "0xcfe20aeec14f2a2d7f3607e3b0a9ce1c6f2a7fe6aa1488ef068fe1f9cd86bf26"
}
},
"schemaVersion": "3.4.3",
"updatedAt": "2022-01-10T10:41:08.524Z",
"schemaVersion": "3.4.4",
"updatedAt": "2022-01-12T03:12:23.445Z",
"networkType": "ethereum",
"devdoc": {
"kind": "dev",

File diff suppressed because one or more lines are too long

View File

@ -208,4 +208,4 @@ contract Marketplace is Ownable, HasSignature {
)
);
}
}
}

View File

@ -10,7 +10,9 @@ interface IMintableERC721 is IERC721 {
contract MinterFactory is Ownable, Initializable {
// NFT contract
IMintableERC721 public erc721;
IMintableERC721 public hero;
IMintableERC721 public equip;
IMintableERC721 public chip;
bool public publicMintAllowed;
event TokenMinted(
@ -19,17 +21,37 @@ contract MinterFactory is Ownable, Initializable {
uint256 indexed tokenId
);
function init(address _erc721) external initializer onlyOwner {
erc721 = IMintableERC721(_erc721);
function init(address[] calldata _erc721s) external initializer onlyOwner {
hero = IMintableERC721(_erc721s[0]);
equip = IMintableERC721(_erc721s[1]);
chip = IMintableERC721(_erc721s[2]);
}
/**
* @dev mint function to distribute Blissful Elites NFT to user
* @dev mint function to distribute Blissful Elites Hero NFT to user
*/
function mintTo(address to, uint256 tokenId) external {
function mintHeroTo(address to, uint256 tokenId) external {
require(publicMintAllowed || _msgSender() == owner());
erc721.mint(to, tokenId);
emit TokenMinted(address(erc721), to, tokenId);
hero.mint(to, tokenId);
emit TokenMinted(address(hero), to, tokenId);
}
/**
* @dev mint function to distribute Blissful Elites Equipment NFT to user
*/
function mintEquipTo(address to, uint256 tokenId) external {
require(publicMintAllowed || _msgSender() == owner());
equip.mint(to, tokenId);
emit TokenMinted(address(equip), to, tokenId);
}
/**
* @dev mint function to distribute Blissful Elites Chip NFT to user
*/
function mintChipTo(address to, uint256 tokenId) external {
require(publicMintAllowed || _msgSender() == owner());
chip.mint(to, tokenId);
emit TokenMinted(address(chip), to, tokenId);
}
/**

View File

@ -0,0 +1,88 @@
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');
module.exports = async function (deployer) {
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(MarketPlace);
const marketInstance = await MarketPlace.deployed();
if(marketInstance) {
console.log("MarketPlace successfully deployed.")
}
try {
marketInstance.setFeeToAddress('0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1');
marketInstance.setPaymentTokens([coinInstance.address]);
} 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);
}
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})
console.log(jsons);
};

View File

@ -1,9 +0,0 @@
const Hero = artifacts.require('BEHero');
module.exports = async function (deployer) {
await deployer.deploy(Hero);
const instance = await Hero.deployed();
if(instance) {
console.log("BEHero successfully deployed.")
}
};

View File

@ -1,10 +0,0 @@
const Hero = artifacts.require('BEHero');
const MarketPlace = artifacts.require('MarketPlace');
module.exports = async function (deployer) {
await deployer.deploy(MarketPlace, Hero.address);
const instance = await MarketPlace.deployed();
if(instance) {
console.log("MarketPlace successfully deployed.")
}
};

View File

@ -1,9 +0,0 @@
const Coin = artifacts.require('BECoin');
module.exports = async function (deployer) {
await deployer.deploy(Coin);
const instance = await Coin.deployed();
if(instance) {
console.log("BECoin successfully deployed.")
}
};

View File

@ -4,7 +4,10 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"deploy:dev": "truffle migrate --network development",
"deploy:local": "truffle migrate --network local",
"deploy:bsctest": "truffle migrate --network bsc_testnet"
},
"author": "",
"license": "ISC",