增加distributor发布脚本

This commit is contained in:
zhl 2023-04-19 10:14:38 +08:00
parent 06f177fcc1
commit 27e9002873
7 changed files with 3192 additions and 1438 deletions

View File

@ -30590,7 +30590,7 @@
} }
}, },
"schemaVersion": "3.4.11", "schemaVersion": "3.4.11",
"updatedAt": "2023-04-11T03:22:29.574Z", "updatedAt": "2023-04-19T02:14:02.484Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -33387,7 +33387,7 @@
} }
}, },
"schemaVersion": "3.4.11", "schemaVersion": "3.4.11",
"updatedAt": "2023-04-11T03:22:29.589Z", "updatedAt": "2023-04-19T02:14:02.512Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"events": { "events": {

View File

@ -16789,7 +16789,7 @@
} }
}, },
"schemaVersion": "3.4.11", "schemaVersion": "3.4.11",
"updatedAt": "2023-04-11T03:22:29.581Z", "updatedAt": "2023-04-19T02:14:02.502Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -3235,7 +3235,7 @@
} }
}, },
"schemaVersion": "3.4.11", "schemaVersion": "3.4.11",
"updatedAt": "2023-04-11T03:22:29.594Z", "updatedAt": "2023-04-19T02:14:02.528Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,6 @@ contract NftDistributor is AccessControlEnumerable {
mapping(uint256 => bool) public nftMinted; mapping(uint256 => bool) public nftMinted;
IBEERC721 public nft; IBEERC721 public nft;
address public source;
event Minted( event Minted(
address indexed user, address indexed user,
@ -33,7 +32,7 @@ contract NftDistributor is AccessControlEnumerable {
* - _nftSource: The address of the source NFT that will check if user has mint permission. * - _nftSource: The address of the source NFT that will check if user has mint permission.
* - _manageAddress: The address that will have the MANAGE_ROLE assigned. * - _manageAddress: The address that will have the MANAGE_ROLE assigned.
*/ */
constructor(address _nftTarget, address _nftSource, address _manageAddress) { constructor(address _nftTarget, address[] memory _manageAddress) {
// Set up the ADMIN_ROLE and MANAGE_ROLE // Set up the ADMIN_ROLE and MANAGE_ROLE
_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE); _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
_setRoleAdmin(MANAGE_ROLE, ADMIN_ROLE); _setRoleAdmin(MANAGE_ROLE, ADMIN_ROLE);
@ -43,13 +42,12 @@ contract NftDistributor is AccessControlEnumerable {
_setupRole(ADMIN_ROLE, address(this)); _setupRole(ADMIN_ROLE, address(this));
// Grant the MANAGE_ROLE to the specified address // Grant the MANAGE_ROLE to the specified address
_setupRole(MANAGE_ROLE, _manageAddress); for (uint256 i = 0; i < _manageAddress.length; ++i) {
_setupRole(MANAGE_ROLE, _manageAddress[i]);
}
// Initialize the nft contract with IBEERC721 interface // Initialize the nft contract with IBEERC721 interface
nft = IBEERC721(_nftTarget); nft = IBEERC721(_nftTarget);
// Set the source contract address
source = _nftSource;
} }
/** /**

View File

@ -1,11 +1,12 @@
const Badge = artifacts.require("tokens/erc721/BEBadge"); const Badge = artifacts.require("tokens/erc721/BEBadge");
const Coin = artifacts.require("tokens/erc20/BEUSDT"); const Coin = artifacts.require("tokens/erc20/BEUSDT");
const Wallet = artifacts.require("tokens/erc721/BEMultiSigWallet"); const Wallet = artifacts.require("core/BEMultiSigWallet");
const Distributor = artifacts.require("logic/NftDistributor");
const config = require("../config/config"); const config = require("../config/config");
module.exports = async function (deployer, network, accounts) { module.exports = async function (deployer, network, accounts) {
// await deployer.deploy(Badge, "BE Badge", "Badge", "0"); // await deployer.deploy(Badge, "BE Badge", "Badge", "0");
// const badgeInstance = await Badge.deployed(); const badgeInstance = await Badge.deployed();
// if (badgeInstance) { // if (badgeInstance) {
// console.log("BEBadge successfully deployed. "); // console.log("BEBadge successfully deployed. ");
// console.log("address: " + badgeInstance.address); // console.log("address: " + badgeInstance.address);
@ -17,21 +18,34 @@ module.exports = async function (deployer, network, accounts) {
// console.log("BEUSDT successfully deployed. "); // console.log("BEUSDT successfully deployed. ");
// console.log("address: " + coinInstance.address); // console.log("address: " + coinInstance.address);
// } // }
await deployer.deploy( // await deployer.deploy(
Wallet, // Wallet,
60, // 60,
1, // 1,
config.admins.proposers, // config.admins.proposers,
config.admins.confirmers, // config.admins.confirmers,
config.admins.executors // config.admins.executors
); // );
const walletInstance = await Wallet.deployed(); // const walletInstance = await Wallet.deployed();
if (walletInstance) { // if (walletInstance) {
console.log("BEMultiSigWallet successfully deployed."); // console.log("BEMultiSigWallet successfully deployed.");
console.log("address: " + walletInstance.address); // console.log("address: " + walletInstance.address);
} // }
// await badgeInstance.setMintRole(walletInstance.address); // await badgeInstance.setMintRole(walletInstance.address);
// console.log("success add wallet to badge's mint role"); // console.log("success add wallet to badge's mint role");
// await coinInstance.setMintRole(walletInstance.address); // await coinInstance.setMintRole(walletInstance.address);
// console.log("success add wallet to usdt's mint role"); // console.log("success add wallet to usdt's mint role");
await deployer.deploy(
Distributor,
badgeInstance.address,
config.admins.executors
);
const distributorInstance = await Distributor.deployed();
if (distributorInstance) {
console.log("NftDistributor successfully deployed.");
console.log("address: " + distributorInstance.address);
}
await badgeInstance.setMintRole(distributorInstance.address);
console.log("success add distributor to badge's mint role");
}; };