-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
BAYC1155.sol
34 lines (28 loc) · 1002 Bytes
/
BAYC1155.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: MIT
// by 0xAA
pragma solidity ^0.8.21;
import "./ERC1155.sol";
contract BAYC1155 is ERC1155{
uint256 constant MAX_ID = 10000;
// 构造函数
constructor() ERC1155("BAYC1155", "BAYC1155"){
}
//BAYC的baseURI为ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/
function _baseURI() internal pure override returns (string memory) {
return "ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/";
}
// 铸造函数
function mint(address to, uint256 id, uint256 amount) external {
// id 不能超过10,000
require(id < MAX_ID, "id overflow");
_mint(to, id, amount, "");
}
// 批量铸造函数
function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts) external {
// id 不能超过10,000
for (uint256 i = 0; i < ids.length; i++) {
require(ids[i] < MAX_ID, "id overflow");
}
_mintBatch(to, ids, amounts, "");
}
}