修正批量mint时, 如果传入数量少于用户可mint数量时, 会被撤销的bug

This commit is contained in:
zhl 2023-04-26 16:22:32 +08:00
parent d35db0b407
commit 81b4465341
8 changed files with 607 additions and 553 deletions

View File

@ -31421,7 +31421,7 @@
} }
}, },
"schemaVersion": "3.4.11", "schemaVersion": "3.4.11",
"updatedAt": "2023-04-23T02:44:39.956Z", "updatedAt": "2023-04-26T07:39:54.101Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -34799,7 +34799,7 @@
} }
}, },
"schemaVersion": "3.4.11", "schemaVersion": "3.4.11",
"updatedAt": "2023-04-23T02:44:39.976Z", "updatedAt": "2023-04-26T07:39:54.120Z",
"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-23T02:44:39.968Z", "updatedAt": "2023-04-26T07:39:54.112Z",
"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-23T02:44:39.989Z", "updatedAt": "2023-04-26T07:39:54.133Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

File diff suppressed because one or more lines are too long

View File

@ -83,7 +83,7 @@ contract NftDistributor is AccessControlEnumerable {
for (uint256 i = 0; i < nfts.length; i++) { for (uint256 i = 0; i < nfts.length; i++) {
uint256 nftSId = nfts[i]; uint256 nftSId = nfts[i];
// Check if the NFT is mintable // Check if the NFT is mintable
if (!nftMinted[nftSId]) { if (!nftMinted[nftSId] && index < count) {
// Add the NFT's source ID to the list of sources // Add the NFT's source ID to the list of sources
nftSource[index] = nftSId; nftSource[index] = nftSId;
nftMinted[nftSId] = true; nftMinted[nftSId] = true;

View File

@ -36,12 +36,6 @@ contract BEBadge is AccessControl, ERC721Enumerable {
return _baseTokenURI; return _baseTokenURI;
} }
function setBaseURI(
string memory baseURI_
) external onlyRole(DEFAULT_ADMIN_ROLE) {
_baseTokenURI = baseURI_;
}
/** /**
* @dev Batch mint tokens and transfer to specified address. * @dev Batch mint tokens and transfer to specified address.
* *

View File

@ -5,36 +5,36 @@ 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);
} }
await badgeInstance.updateBaseURI(config.token.baseTokenURI); // await badgeInstance.updateBaseURI(config.token.baseTokenURI);
// await deployer.deploy(Coin, "BE test USDT", "USDT"); // await deployer.deploy(Coin, "BE test USDT", "USDT");
const coinInstance = await Coin.deployed(); const coinInstance = await Coin.deployed();
// if (coinInstance) { // if (coinInstance) {
// 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( await deployer.deploy(
Distributor, Distributor,