pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyContract is ERC721, Ownable {
using Strings for uint256;
using Counters for Counters.Counter;
Counters.Counter private totalSupply;
Counters.Counter private commonSupply;
Counters.Counter private rareSupply;
....发布于 2022-12-01 14:58:25
无论你喜欢什么:)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/utils/Counters.sol";
contract EnumerableMap {
using Counters for Counters.Counter;
Counters.Counter public totalSupply;
Counters.Counter public commonSupply;
Counters.Counter public rareSupply;
enum Counts {
totalSupply,
commonSupply,
rareSupply
}
function increment(Counts _count) external {
if(_count == Counts.totalSupply) {
totalSupply.increment();
} else if (_count == Counts.commonSupply) {
commonSupply.increment();
} else {
rareSupply.increment();
}
}
}https://ethereum.stackexchange.com/questions/121863
复制相似问题