Merge branch 'arbitrum' of git.kingsome.cn:crypto/becrypto into arbitrum
This commit is contained in:
commit
e13b938a90
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,4 +6,7 @@ node_modules
|
||||
contract_whole
|
||||
openzeppelin
|
||||
.key
|
||||
.addr
|
||||
.addr
|
||||
.selfaddr
|
||||
.selfkey
|
||||
.env
|
File diff suppressed because one or more lines are too long
@ -15,6 +15,8 @@ contract NFTSbt is AccessControl, ERC721Enumerable {
|
||||
|
||||
Counters.Counter private _tokenIdCounter;
|
||||
|
||||
uint256 public maxBatchSize = 500;
|
||||
|
||||
constructor(
|
||||
string memory _name,
|
||||
string memory _symbol,
|
||||
@ -73,6 +75,28 @@ contract NFTSbt is AccessControl, ERC721Enumerable {
|
||||
return IMetaData(_metaAddress).getMetaData(address(this), tokenId);
|
||||
}
|
||||
|
||||
function batchMint(
|
||||
address to,
|
||||
uint256 count
|
||||
) external onlyRole(MINTER_ROLE) returns (uint256[] memory) {
|
||||
require(count > 0, "tokenIds too small");
|
||||
require(count <= maxBatchSize, "tokenIds too many");
|
||||
if (supplyLimit > 0) {
|
||||
require(
|
||||
(totalSupply() + count) <= supplyLimit,
|
||||
"Exceed the total supply"
|
||||
);
|
||||
}
|
||||
uint256[] memory tokenIds = new uint256[](count);
|
||||
for (uint256 i = 0; i < count; i++) {
|
||||
_tokenIdCounter.increment();
|
||||
uint256 tokenId = _tokenIdCounter.current();
|
||||
_safeMint(to, tokenId);
|
||||
tokenIds[i] = tokenId;
|
||||
}
|
||||
return tokenIds;
|
||||
}
|
||||
|
||||
function mint(address to) external onlyRole(MINTER_ROLE) returns (uint256) {
|
||||
require(to != address(0), "Cannot mint to zero address");
|
||||
if (supplyLimit > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user