调整badge批量mint的数量限制, 改为可更改

This commit is contained in:
CounterFire2023 2023-07-07 15:36:08 +08:00
parent c563b732c6
commit 13a5741c3e

View File

@ -12,6 +12,7 @@ contract BEBadge is AccessControl, ERC721Enumerable {
bytes32 public constant LOCK_ROLE = keccak256("LOCK_ROLE"); bytes32 public constant LOCK_ROLE = keccak256("LOCK_ROLE");
uint256 public immutable supplyLimit; uint256 public immutable supplyLimit;
uint256 tokenIndex; uint256 tokenIndex;
uint256 public maxBatchSize = 500;
event Lock(uint256 indexed tokenId); event Lock(uint256 indexed tokenId);
event UnLock(uint256 indexed tokenId); event UnLock(uint256 indexed tokenId);
@ -46,7 +47,8 @@ contract BEBadge is AccessControl, ERC721Enumerable {
address to, address to,
uint256 count uint256 count
) external onlyRole(MINTER_ROLE) returns (uint256[] memory) { ) external onlyRole(MINTER_ROLE) returns (uint256[] memory) {
require(count <= 100, "tokenIds too many"); require(count > 0, "tokenIds too small");
require(count <= maxBatchSize, "tokenIds too many");
if (supplyLimit > 0) { if (supplyLimit > 0) {
require( require(
(totalSupply() + count) <= supplyLimit, (totalSupply() + count) <= supplyLimit,
@ -126,13 +128,6 @@ contract BEBadge is AccessControl, ERC721Enumerable {
emit UnLock(tokenId); emit UnLock(tokenId);
} }
/**
* @dev Get lock status
*/
function isLocked(uint256 tokenId) external view returns (bool) {
return lockedTokens[tokenId];
}
/** /**
* @dev Set token URI * @dev Set token URI
*/ */
@ -142,6 +137,11 @@ contract BEBadge is AccessControl, ERC721Enumerable {
_metaAddress = metaAddress; _metaAddress = metaAddress;
} }
function updateDuation(uint256 valNew) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(valNew > 1, "batch size too short");
maxBatchSize = valNew;
}
/** /**
* @dev one type badge has same tokenURI * @dev one type badge has same tokenURI
*/ */