文件 1 的 35:AccessControl.sol
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
文件 2 的 35:Address.sol
pragma solidity ^0.8.9;
library Address {
function isContract(address account) internal view returns (bool) {
uint size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
文件 3 的 35:BitMaps.sol
pragma solidity ^0.8.0;
import "./BitScan.sol";
library BitMaps {
using BitScan for uint256;
uint256 private constant MASK_INDEX_ZERO = (1 << 255);
struct BitMap {
mapping(uint256 => uint256) _data;
}
function get(BitMap storage bitmap, uint256 index)
internal
view
returns (bool)
{
uint256 bucket = index >> 8;
uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
return bitmap._data[bucket] & mask != 0;
}
function setTo(
BitMap storage bitmap,
uint256 index,
bool value
) internal {
if (value) {
set(bitmap, index);
} else {
unset(bitmap, index);
}
}
function set(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
bitmap._data[bucket] |= mask;
}
function unset(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
bitmap._data[bucket] &= ~mask;
}
function scanForward(BitMap storage bitmap, uint256 index)
internal
view
returns (uint256)
{
uint256 bucket = index >> 8;
uint256 bucketIndex = (index & 0xff);
uint256 offset = 0xff ^ bucketIndex;
uint256 bb = bitmap._data[bucket];
bb = bb >> offset;
if (bb > 0) {
unchecked {
return (bucket << 8) | (bucketIndex - bb.bitScanForward256());
}
} else {
require(bucket > 0, "!exists");
unchecked {
bucket--;
bucketIndex = 255;
offset = 0;
}
while (true) {
bb = bitmap._data[bucket];
if (bb > 0) {
unchecked {
return
(bucket << 8) |
(bucketIndex - bb.bitScanForward256());
}
} else {
require(bucket > 0, "!existS");
unchecked {
bucket--;
}
}
}
}
}
function getBucket(BitMap storage bitmap, uint256 bucket)
internal
view
returns (uint256)
{
return bitmap._data[bucket];
}
}
文件 4 的 35:BitScan.sol
pragma solidity ^0.8.0;
library BitScan {
uint256 private constant DEBRUIJN_256 =
0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
bytes private constant LOOKUP_TABLE_256 =
hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8";
function isolateLSB256(uint256 bb) internal pure returns (uint256) {
require(bb > 0);
unchecked {
return bb & (0 - bb);
}
}
function isolateMSB256(uint256 bb) internal pure returns (uint256) {
require(bb > 0);
unchecked {
bb |= bb >> 256;
bb |= bb >> 128;
bb |= bb >> 64;
bb |= bb >> 32;
bb |= bb >> 16;
bb |= bb >> 8;
bb |= bb >> 4;
bb |= bb >> 2;
bb |= bb >> 1;
return (bb >> 1) + 1;
}
}
function bitScanForward256(uint256 bb) internal pure returns (uint8) {
unchecked {
return
uint8(
LOOKUP_TABLE_256[(isolateLSB256(bb) * DEBRUIJN_256) >> 248]
);
}
}
function bitScanReverse256(uint256 bb) internal pure returns (uint8) {
unchecked {
return
255 -
uint8(
LOOKUP_TABLE_256[
((isolateMSB256(bb) * DEBRUIJN_256) >> 248)
]
);
}
}
}
文件 5 的 35:BrawlerBearz.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {LockRegistry} from "./abstract/LockRegistry.sol";
import {IBrawlerBearz} from "./interfaces/IBrawlerBearz.sol";
import {IBrawlerBearzFaction} from "./interfaces/IBrawlerBearzFaction.sol";
import {IBrawlerBearzRenderer} from "./interfaces/IBrawlerBearzRenderer.sol";
import {IBrawlerBearzDynamicItems} from "./interfaces/IBrawlerBearzDynamicItems.sol";
import {ERC721Psi, ERC721PsiRandomSeedReveal, ERC721PsiRandomSeedRevealBurnable} from "./ERC721PsiRandomSeedRevealBurnable.sol";
contract BrawlerBearz is
IBrawlerBearz,
ERC721PsiRandomSeedRevealBurnable,
LockRegistry,
ReentrancyGuard,
AccessControl
{
address public constant DEAD_ADDRESS =
0x000000000000000000000000000000000000dEaD;
bytes32 constant XP_MUTATOR_ROLE = keccak256("XP_MUTATOR_ROLE");
bytes32 constant OWNER_ROLE = keccak256("OWNER_ROLE");
bytes32 constant HEAD_ITEM_TYPE = keccak256(abi.encodePacked("HEAD"));
bytes32 constant WEAPON_ITEM_TYPE = keccak256(abi.encodePacked("WEAPON"));
bytes32 constant BACKGROUND_ITEM_TYPE =
keccak256(abi.encodePacked("BACKGROUND"));
bytes32 constant ARMOR_ITEM_TYPE = keccak256(abi.encodePacked("ARMOR"));
bytes32 constant FACE_ARMOR_ITEM_TYPE =
keccak256(abi.encodePacked("FACE_ARMOR"));
bytes32 constant EYEWEAR_ITEM_TYPE = keccak256(abi.encodePacked("EYEWEAR"));
bytes32 constant MISC_ITEM_TYPE = keccak256(abi.encodePacked("MISC"));
bytes32 public immutable keyHash;
uint64 public immutable subscriptionId;
uint256 public teamMintAmount = 128;
address public treasury =
payable(0x39bfA2b4319581bc885A2d4b9F0C90C2e1c24B87);
uint256 public whitelistLiveAt = 1663336800;
uint256 public liveAt = 1663362000;
uint256 public maxSupply = 3335;
uint256 public price = 0.045 ether;
uint256 public maxPerWallet = 3;
bool private isShopDropEnabled = true;
bool public isRevealed = false;
bytes32 public merkleRoot;
mapping(uint256 => CustomMetadata) internal metadata;
mapping(address => uint256) public addressToMinted;
IBrawlerBearzDynamicItems public vendorContract;
IERC721 public accessPassContract;
IBrawlerBearzRenderer public renderer;
IBrawlerBearzFaction public factionContract;
modifier isTokenOwner(uint256 tokenId) {
if (ownerOf(tokenId) != _msgSender()) {
revert InvalidOwner();
}
_;
}
modifier isItemTokenOwner(uint256 itemTokenId) {
if (vendorContract.balanceOf(_msgSender(), itemTokenId) == 0) {
revert InvalidOwner();
}
_;
}
modifier isItemValidType(uint256 itemTokenId, string memory validTypeOf) {
if (
keccak256(abi.encodePacked(validTypeOf)) !=
keccak256(abi.encodePacked(vendorContract.getItemType(itemTokenId)))
) {
revert InvalidItemType();
}
_;
}
modifier isItemXPMet(uint256 itemTokenId, uint256 tokenId) {
if (metadata[tokenId].xp < vendorContract.getItemXPReq(itemTokenId)) {
revert ItemRequiresMoreXP();
}
_;
}
modifier isValidString(string calldata value) {
bytes memory str = bytes(value);
for (uint256 i; i < str.length; i++) {
bytes1 char = str[i];
if ((char == 0x22) || (char == 0x5c)) revert InvalidString();
}
_;
}
constructor(
address _vrfV2Coordinator,
bytes32 keyHash_,
uint64 subscriptionId_,
address _accessPassContract,
address _factionContract,
address _renderingContract,
address _vendorContract
)
ERC721Psi("Brawler Bearz", "BB")
ERC721PsiRandomSeedReveal(_vrfV2Coordinator, 400000, 3)
{
keyHash = keyHash_;
subscriptionId = subscriptionId_;
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(OWNER_ROLE, _msgSender());
accessPassContract = IERC721(_accessPassContract);
factionContract = IBrawlerBearzFaction(_factionContract);
renderer = IBrawlerBearzRenderer(_renderingContract);
vendorContract = IBrawlerBearzDynamicItems(_vendorContract);
_safeMint(_msgSender(), 1, "");
}
function setName(uint256 tokenId, string calldata name)
public
override
isTokenOwner(tokenId)
isValidString(name)
{
bytes memory n = bytes(name);
if (n.length > 25) revert InvalidLength();
if (keccak256(n) == keccak256(bytes(metadata[tokenId].name)))
revert InvalidValue();
metadata[tokenId].name = name;
emit NameChanged(tokenId, name);
}
function setLore(uint256 tokenId, string calldata lore)
public
override
isTokenOwner(tokenId)
isValidString(lore)
{
bytes memory n = bytes(lore);
if (keccak256(n) == keccak256(bytes(metadata[tokenId].lore)))
revert InvalidValue();
metadata[tokenId].lore = lore;
emit LoreChanged(tokenId, lore);
}
function equip(
uint256 tokenId,
string calldata typeOf,
uint256 itemTokenId
)
public
override
isTokenOwner(tokenId)
isItemTokenOwner(itemTokenId)
isItemValidType(itemTokenId, typeOf)
isItemXPMet(itemTokenId, tokenId)
nonReentrant
{
bytes32 itemType = keccak256(abi.encodePacked(typeOf));
CustomMetadata storage instance = metadata[tokenId];
if (WEAPON_ITEM_TYPE == itemType) {
require(instance.weapon == 0, "96");
instance.weapon = itemTokenId;
} else if (HEAD_ITEM_TYPE == itemType) {
require(instance.head == 0, "96");
instance.head = itemTokenId;
} else if (ARMOR_ITEM_TYPE == itemType) {
require(instance.armor == 0, "96");
instance.armor = itemTokenId;
} else if (BACKGROUND_ITEM_TYPE == itemType) {
require(instance.background == 0, "96");
instance.background = itemTokenId;
} else if (FACE_ARMOR_ITEM_TYPE == itemType) {
require(instance.faceArmor == 0, "96");
instance.faceArmor = itemTokenId;
} else if (EYEWEAR_ITEM_TYPE == itemType) {
require(instance.eyewear == 0, "96");
instance.eyewear = itemTokenId;
} else if (MISC_ITEM_TYPE == itemType) {
require(instance.misc == 0, "96");
instance.misc = itemTokenId;
} else {
revert InvalidItemType();
}
vendorContract.burnItemForOwnerAddress(itemTokenId, 1, _msgSender());
emit Equipped(tokenId, typeOf, itemTokenId);
}
function unequip(uint256 tokenId, string calldata typeOf)
public
override
isTokenOwner(tokenId)
nonReentrant
{
uint256 itemTokenId;
bytes32 itemType = keccak256(abi.encodePacked(typeOf));
CustomMetadata storage instance = metadata[tokenId];
if (WEAPON_ITEM_TYPE == itemType) {
itemTokenId = instance.weapon;
instance.weapon = 0;
} else if (HEAD_ITEM_TYPE == itemType) {
itemTokenId = instance.head;
instance.head = 0;
} else if (ARMOR_ITEM_TYPE == itemType) {
itemTokenId = instance.armor;
instance.armor = 0;
} else if (BACKGROUND_ITEM_TYPE == itemType) {
itemTokenId = instance.background;
instance.background = 0;
} else if (FACE_ARMOR_ITEM_TYPE == itemType) {
itemTokenId = instance.faceArmor;
instance.faceArmor = 0;
} else if (EYEWEAR_ITEM_TYPE == itemType) {
itemTokenId = instance.eyewear;
instance.eyewear = 0;
} else if (MISC_ITEM_TYPE == itemType) {
itemTokenId = instance.misc;
instance.misc = 0;
} else {
revert InvalidItemType();
}
require(itemTokenId > 0, "6969");
vendorContract.mintItemToAddress(itemTokenId, 1, _msgSender());
emit Unequipped(tokenId, typeOf, itemTokenId);
}
function reveal() external onlyRole(OWNER_ROLE) {
_reveal();
emit Revealed(totalSupply());
}
function getMetadata(uint256 tokenId)
external
view
override
returns (CustomMetadata memory)
{
require(_exists(tokenId), "0");
return metadata[tokenId];
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
if (isRevealed == false) {
return renderer.hiddenURI(tokenId);
}
require(_exists(tokenId), "0");
CustomMetadata memory md = metadata[tokenId];
md.isUnlocked = isUnlocked(tokenId);
md.faction = factionContract.getFaction(ownerOf(tokenId));
return renderer.tokenURI(tokenId, seed(tokenId), md);
}
function claim(uint256[] calldata _tokenIds) external nonReentrant {
require(isPublicLive(), "0");
for (uint256 i = 0; i < _tokenIds.length; i++) {
accessPassContract.transferFrom(
_msgSender(),
DEAD_ADDRESS,
_tokenIds[i]
);
}
_safeMint(_msgSender(), _tokenIds.length, "");
}
function whitelistMint(uint256 _amount, bytes32[] calldata _proof)
external
payable
nonReentrant
{
require(isWhitelistLive(), "0");
require(totalSupply() + _amount < maxSupply, "9");
require(msg.value >= _amount * price, "1");
require(addressToMinted[_msgSender()] + _amount < maxPerWallet, "2");
bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
require(MerkleProof.verify(_proof, merkleRoot, leaf), "4");
addressToMinted[_msgSender()] += _amount;
_safeMint(_msgSender(), _amount, "");
if (isShopDropEnabled) {
vendorContract.shopDrop(_msgSender(), _amount);
}
}
function mint(uint256 _amount) external payable {
require(isPublicLive(), "0");
require(totalSupply() + _amount < maxSupply, "9");
require(msg.value >= _amount * price, "1");
require(addressToMinted[_msgSender()] + _amount < maxPerWallet, "2");
addressToMinted[_msgSender()] += _amount;
_safeMint(_msgSender(), _amount, "");
}
function setPrice(uint256 _price) public onlyRole(OWNER_ROLE) {
price = _price;
}
function setTreasury(address _treasury) public onlyRole(OWNER_ROLE) {
treasury = payable(_treasury);
}
function setIsRevealed(bool _isRevealed) public onlyRole(OWNER_ROLE) {
isRevealed = _isRevealed;
}
function setMaxSupply(uint256 _maxSupply) external onlyRole(OWNER_ROLE) {
maxSupply = _maxSupply;
}
function setMaxPerWallet(uint256 _maxPerWallet)
external
onlyRole(OWNER_ROLE)
{
maxPerWallet = _maxPerWallet;
}
function setWhitelistLiveAt(uint256 _whitelistLiveAt)
external
onlyRole(OWNER_ROLE)
{
whitelistLiveAt = _whitelistLiveAt;
}
function setLiveAt(uint256 _liveAt) external onlyRole(OWNER_ROLE) {
liveAt = _liveAt;
}
function setMerkleRoot(bytes32 _merkleRoot) external onlyRole(OWNER_ROLE) {
merkleRoot = _merkleRoot;
}
function withdraw() public onlyRole(OWNER_ROLE) {
(bool success, ) = treasury.call{value: address(this).balance}("");
require(success, "999");
}
function teamMints(address _to) external onlyRole(OWNER_ROLE) {
require(teamMintAmount > 0, "69");
_safeMint(_to, teamMintAmount, "");
teamMintAmount = 0;
}
function setShopDropEnabled(bool _isShopDropEnabled)
external
onlyRole(OWNER_ROLE)
{
isShopDropEnabled = _isShopDropEnabled;
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
require(isUnlocked(tokenId), "1337");
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
require(isUnlocked(tokenId), "1337");
super.safeTransferFrom(from, to, tokenId, _data);
}
function lockId(uint256 tokenId) external onlyRole(XP_MUTATOR_ROLE) {
require(_exists(tokenId), "0");
_lockId(tokenId);
}
function unlockId(uint256 tokenId) external onlyRole(XP_MUTATOR_ROLE) {
require(_exists(tokenId), "0");
_unlockId(tokenId);
}
function freeId(uint256 tokenId, address contractAddress)
external
onlyRole(XP_MUTATOR_ROLE)
{
require(_exists(tokenId), "0");
_freeId(tokenId, contractAddress);
}
function addXP(uint256 tokenId, uint256 amount)
external
onlyRole(XP_MUTATOR_ROLE)
{
metadata[tokenId].xp += amount;
}
function subtractXP(uint256 tokenId, uint256 amount)
external
onlyRole(XP_MUTATOR_ROLE)
{
metadata[tokenId].xp -= amount;
}
function setRenderingContractAddress(address _renderingContractAddress)
external
onlyRole(OWNER_ROLE)
{
renderer = IBrawlerBearzRenderer(_renderingContractAddress);
}
function setVendorContractAddress(address _vendorContractAddress)
external
onlyRole(OWNER_ROLE)
{
vendorContract = IBrawlerBearzDynamicItems(_vendorContractAddress);
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721Psi, AccessControl)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function isWhitelistLive() public view returns (bool) {
return block.timestamp > whitelistLiveAt;
}
function isPublicLive() public view returns (bool) {
return block.timestamp > liveAt;
}
function getAddressMintsRemaining(address _address)
public
view
returns (uint256)
{
return maxPerWallet - addressToMinted[_address] - 1;
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) return new uint256[](0);
uint256[] memory tokensId = new uint256[](tokenCount);
for (uint256 i; i < tokenCount; i++) {
tokensId[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokensId;
}
function _keyHash() internal view override returns (bytes32) {
return keyHash;
}
function _subscriptionId() internal view override returns (uint64) {
return subscriptionId;
}
}
文件 6 的 35:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 7 的 35:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 8 的 35:ERC721Psi.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./BitMaps.sol";
import "./Address.sol";
contract ERC721Psi is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
using BitMaps for BitMaps.BitMap;
BitMaps.BitMap private _batchHead;
string private _name;
string private _symbol;
mapping(uint256 => address) internal _owners;
uint256 internal _minted;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(owner != address(0), "zero address");
uint256 count;
for (uint256 i; i < _minted; ++i) {
if (_exists(i)) {
if (owner == ownerOf(i)) {
++count;
}
}
}
return count;
}
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
(address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(
tokenId
);
return owner;
}
function _ownerAndBatchHeadOf(uint256 tokenId)
internal
view
returns (address owner, uint256 tokenIdBatchHead)
{
require(_exists(tokenId), "!exists");
tokenIdBatchHead = _getBatchHead(tokenId);
owner = _owners[tokenIdBatchHead];
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "!exists");
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
require(to != owner, "!approval");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"!approved"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(_exists(tokenId), "!exists");
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(operator != _msgSender(), "!approve");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "!approved");
_transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "!approved");
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"!ERC721Receiver"
);
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _minted;
}
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(_exists(tokenId), "!exist");
address owner = ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, "");
}
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
uint256 tokenIdBatchHead = _minted;
require(quantity > 0, "zero");
require(to != address(0), "!zeroaddress");
_beforeTokenTransfers(address(0), to, tokenIdBatchHead, quantity);
for (uint256 i = 0; i < quantity; i++) {
uint256 tokenId = tokenIdBatchHead + i;
emit Transfer(address(0), to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"!ERC721Receiver"
);
}
_owners[tokenIdBatchHead] = to;
_batchHead.set(tokenIdBatchHead);
_minted += quantity;
_afterTokenTransfers(address(0), to, tokenIdBatchHead, quantity);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
(address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(
tokenId
);
require(owner == from, "notown");
require(to != address(0), "zeroaddress");
_beforeTokenTransfers(from, to, tokenId, 1);
_approve(address(0), tokenId);
uint256 nextTokenId = tokenId + 1;
if (!_batchHead.get(nextTokenId) && nextTokenId < _minted) {
_owners[nextTokenId] = from;
_batchHead.set(nextTokenId);
}
_owners[tokenId] = to;
if (tokenId != tokenIdBatchHead) {
_batchHead.set(tokenId);
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("!ERC721Receiver");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _getBatchHead(uint256 tokenId)
internal
view
returns (uint256 tokenIdBatchHead)
{
tokenIdBatchHead = _batchHead.scanForward(tokenId);
}
function totalSupply() public view virtual override returns (uint256) {
return _minted;
}
function tokenByIndex(uint256 index)
public
view
virtual
override
returns (uint256)
{
require(index < totalSupply(), "oob");
uint256 count;
for (uint256 i; i < _minted; i++) {
if (_exists(i)) {
if (count == index) return i;
else count++;
}
}
}
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
virtual
override
returns (uint256 tokenId)
{
uint256 count;
for (uint256 i; i < _minted; i++) {
if (_exists(i) && owner == ownerOf(i)) {
if (count == index) return i;
else count++;
}
}
revert("oob");
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
文件 9 的 35:ERC721PsiBatchMetaData.sol
pragma solidity ^0.8.0;
import "./ERC721Psi.sol";
import "./BitMaps.sol";
abstract contract ERC721PsiBatchMetaData is ERC721Psi {
using BitMaps for BitMaps.BitMap;
BitMaps.BitMap private _metaDataBatchHead;
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual override {
uint256 tokenIdBatchHead = _minted;
_metaDataBatchHead.set(tokenIdBatchHead);
super._safeMint(to, quantity, _data);
}
function _getMetaDataBatchHead(uint256 tokenId)
internal
view
returns (uint256 tokenIdMetaDataBatchHead)
{
tokenIdMetaDataBatchHead = _metaDataBatchHead.scanForward(tokenId);
}
}
文件 10 的 35:ERC721PsiRandomSeedReveal.sol
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import "./interfaces/IERC721RandomSeed.sol";
import "./BitMaps.sol";
import "./ERC721PsiBatchMetaData.sol";
abstract contract ERC721PsiRandomSeedReveal is
IERC721RandomSeed,
ERC721PsiBatchMetaData,
VRFConsumerBaseV2
{
VRFCoordinatorV2Interface immutable COORDINATOR;
uint32 immutable callbackGasLimit;
uint16 immutable requestConfirmations;
uint16 constant numWords = 1;
mapping(uint256 => uint256) private requestIdToGenId;
mapping(uint256 => uint256) private genSeed;
mapping(uint256 => uint256) private _batchHeadtokenGen;
uint256 private currentGen = 1;
event RandomnessRequest(uint256 requestId);
constructor(
address coordinator,
uint32 _callbackGasLimit,
uint16 _requestConfirmations
) VRFConsumerBaseV2(coordinator) {
COORDINATOR = VRFCoordinatorV2Interface(coordinator);
callbackGasLimit = _callbackGasLimit;
requestConfirmations = _requestConfirmations;
}
function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords)
internal
override
{
uint256 randomness = randomWords[0];
uint256 genId = requestIdToGenId[requestId];
delete requestIdToGenId[genId];
genSeed[genId] = randomness;
_processRandomnessFulfillment(requestId, genId, randomness);
}
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual override {
uint256 tokenIdHead = _minted;
_batchHeadtokenGen[tokenIdHead] = currentGen;
super._safeMint(to, quantity, _data);
}
function _tokenGen(uint256 tokenId) internal view returns (uint256) {
require(_exists(tokenId), "!exists");
return _batchHeadtokenGen[_getMetaDataBatchHead(tokenId)];
}
function _reveal() internal virtual {
uint256 requestId = COORDINATOR.requestRandomWords(
_keyHash(),
_subscriptionId(),
requestConfirmations,
callbackGasLimit,
numWords
);
emit RandomnessRequest(requestId);
requestIdToGenId[requestId] = currentGen;
_processRandomnessRequest(requestId, currentGen);
currentGen++;
}
function seed(uint256 tokenId)
public
view
virtual
override
returns (uint256)
{
require(_exists(tokenId), "!exists");
unchecked {
uint256 _genSeed = genSeed[_tokenGen(tokenId)];
require(_genSeed != 0, "!fullfilled");
return uint256(keccak256(abi.encode(_genSeed, tokenId)));
}
}
function _keyHash() internal virtual returns (bytes32);
function _subscriptionId() internal virtual returns (uint64);
function _processRandomnessRequest(uint256 requestId, uint256 genId)
internal
{}
function _processRandomnessFulfillment(
uint256 requestId,
uint256 genId,
uint256 randomness
) internal {}
}
文件 11 的 35:ERC721PsiRandomSeedRevealBurnable.sol
pragma solidity ^0.8.0;
import "./BitMaps.sol";
import "./ERC721PsiRandomSeedReveal.sol";
abstract contract ERC721PsiRandomSeedRevealBurnable is
ERC721PsiRandomSeedReveal
{
using BitMaps for BitMaps.BitMap;
BitMaps.BitMap private _burnedToken;
function _burn(uint256 tokenId) internal virtual {
address from = ownerOf(tokenId);
_beforeTokenTransfers(from, address(0), tokenId, 1);
_burnedToken.set(tokenId);
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
}
function _exists(uint256 tokenId)
internal
view
virtual
override
returns (bool)
{
if (_burnedToken.get(tokenId)) {
return false;
}
return super._exists(tokenId);
}
function totalSupply() public view virtual override returns (uint256) {
return _minted - _burned();
}
function _burned() internal view returns (uint256 burned) {
uint256 totalBucket = (_minted >> 8) + 1;
for (uint256 i = 0; i < totalBucket; i++) {
uint256 bucket = _burnedToken.getBucket(i);
burned += _popcount(bucket);
}
}
function _popcount(uint256 x) private pure returns (uint256 count) {
unchecked {
for (count = 0; x != 0; count++) x &= x - 1;
}
}
}
文件 12 的 35:IAccessControl.sol
pragma solidity ^0.8.0;
interface IAccessControl {
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address account) external;
}
文件 13 的 35:IBrawlerBearz.sol
pragma solidity ^0.8.0;
import {IBrawlerBearzCommon} from "./IBrawlerBearzCommon.sol";
import {IBrawlerBearzEvents} from "./IBrawlerBearzEvents.sol";
import {IBrawlerBearzErrors} from "./IBrawlerBearzErrors.sol";
interface IBrawlerBearz is
IBrawlerBearzCommon,
IBrawlerBearzEvents,
IBrawlerBearzErrors
{
function getMetadata(uint256 tokenId)
external
view
returns (CustomMetadata memory);
function setName(uint256 tokenId, string calldata newName) external;
function setLore(uint256 tokenId, string calldata newLore) external;
function equip(
uint256 tokenId,
string calldata typeOf,
uint256 itemTokenId
) external;
function unequip(uint256 tokenId, string calldata typeOf) external;
function whitelistMint(uint256 amount, bytes32[] calldata proof)
external
payable;
function mint(uint256 amount) external payable;
function freeId(uint256 tokenId, address contractAddress) external;
function lockId(uint256 tokenId) external;
function unlockId(uint256 tokenId) external;
function addXP(uint256 tokenId, uint256 amount) external;
function subtractXP(uint256 tokenId, uint256 amount) external;
}
文件 14 的 35:IBrawlerBearzCommon.sol
pragma solidity ^0.8.0;
interface IBrawlerBearzCommon {
struct CustomMetadata {
string name;
string lore;
uint256 background;
uint256 head;
uint256 weapon;
uint256 armor;
uint256 faceArmor;
uint256 eyewear;
uint256 misc;
uint256 xp;
bool isUnlocked;
uint256 faction;
}
struct Traits {
uint256 strength;
uint256 endurance;
uint256 intelligence;
uint256 luck;
uint256 xp;
uint256 level;
string skin;
string head;
string eyes;
string outfit;
string mouth;
string background;
string weapon;
string armor;
string eyewear;
string faceArmor;
string misc;
string locked;
string faction;
}
struct Bear {
string name;
string description;
string dna;
Traits traits;
CustomMetadata dynamic;
}
}
文件 15 的 35:IBrawlerBearzDynamicItems.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";
interface IBrawlerBearzDynamicItems is IERC1155Upgradeable {
struct CustomMetadata {
string typeOf;
string name;
uint256 xp;
string rarity;
uint256 atk;
uint256 def;
uint256 usageChance;
string usageDuration;
string description;
}
function getMetadata(uint256 tokenId)
external
view
returns (CustomMetadata memory);
function getMetadataBatch(uint256[] calldata tokenIds)
external
view
returns (CustomMetadata[] memory);
function getItemType(uint256 tokenId) external view returns (string memory);
function getItemName(uint256 tokenId) external view returns (string memory);
function getItemXPReq(uint256 tokenId) external view returns (uint256);
function setItemMetadata(
uint256 tokenId,
string calldata typeOf,
string calldata name,
uint256 xp
) external;
function setItemMetadataStruct(
uint256 tokenId,
CustomMetadata memory metadata
) external;
function shopDrop(address _toAddress, uint256 _amount) external;
function dropItems(address _toAddress, uint256[] calldata itemIds) external;
function burnItemForOwnerAddress(
uint256 _typeId,
uint256 _quantity,
address _materialOwnerAddress
) external;
function mintItemToAddress(
uint256 _typeId,
uint256 _quantity,
address _toAddress
) external;
function mintBatchItemsToAddress(
uint256[] memory _typeIds,
uint256[] memory _quantities,
address _toAddress
) external;
function bulkSafeTransfer(
uint256 _typeId,
uint256 _quantityPerRecipient,
address[] calldata recipients
) external;
}
文件 16 的 35:IBrawlerBearzErrors.sol
pragma solidity ^0.8.0;
interface IBrawlerBearzErrors {
error InvalidRecipient();
error InvalidTokenIds();
error InvalidOwner();
error InvalidItemType();
error InvalidString();
error InvalidLength();
error InvalidValue();
error ItemRequiresMoreXP();
}
文件 17 的 35:IBrawlerBearzEvents.sol
pragma solidity ^0.8.0;
interface IBrawlerBearzEvents {
event Revealed(uint256 currentTokenId);
event NameChanged(uint256 indexed id, string name);
event LoreChanged(uint256 indexed id, string lore);
event Equipped(uint256 indexed id, string typeOf, uint256 itemTokenId);
event Unequipped(uint256 indexed id, string typeOf, uint256 itemTokenId);
event Staked(uint256 indexed id);
event UnStaked(uint256 indexed id, uint256 amount);
event ClaimedTokens(uint256 indexed id, uint256 amount);
}
文件 18 的 35:IBrawlerBearzFaction.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
interface IBrawlerBearzFaction is IERC1155 {
function getFaction(address _address) external view returns (uint256);
}
文件 19 的 35:IBrawlerBearzRenderer.sol
pragma solidity ^0.8.0;
import {IBrawlerBearzCommon} from "./IBrawlerBearzCommon.sol";
interface IBrawlerBearzRenderer is IBrawlerBearzCommon {
function hiddenURI(uint256 _tokenId) external view returns (string memory);
function tokenURI(
uint256 _tokenId,
uint256 _seed,
CustomMetadata memory _md
) external view returns (string memory);
function dna(
uint256 _tokenId,
uint256 _seed,
CustomMetadata memory _md
) external view returns (string memory);
}
文件 20 的 35:IERC1155.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
文件 21 的 35:IERC1155Upgradeable.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
interface IERC1155Upgradeable is IERC165Upgradeable {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
文件 22 的 35:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 23 的 35:IERC165Upgradeable.sol
pragma solidity ^0.8.0;
interface IERC165Upgradeable {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 24 的 35:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool _approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 25 的 35:IERC721Enumerable.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 26 的 35:IERC721Metadata.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 27 的 35:IERC721RandomSeed.sol
pragma solidity ^0.8.0;
interface IERC721RandomSeed {
function seed(uint256 tokenId) external view returns (uint256);
}
文件 28 的 35:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 29 的 35:LockRegistry.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
abstract contract LockRegistry is Ownable {
mapping(address => bool) public approvedContract;
mapping(uint256 => uint256) public lockCount;
mapping(uint256 => mapping(uint256 => address)) public lockMap;
mapping(uint256 => mapping(address => uint256)) public lockMapIndex;
event TokenLocked(
uint256 indexed tokenId,
address indexed approvedContract
);
event TokenUnlocked(
uint256 indexed tokenId,
address indexed approvedContract
);
function isUnlocked(uint256 _id) public view returns (bool) {
return lockCount[_id] == 0;
}
function updateApprovedContracts(
address[] calldata _contracts,
bool[] calldata _values
) external onlyOwner {
require(_contracts.length == _values.length, "!length");
for (uint256 i = 0; i < _contracts.length; i++)
approvedContract[_contracts[i]] = _values[i];
}
function _lockId(uint256 _id) internal {
require(approvedContract[msg.sender], "Cannot update map");
require(
lockMapIndex[_id][msg.sender] == 0,
"ID already locked by caller"
);
uint256 count = lockCount[_id] + 1;
lockMap[_id][count] = msg.sender;
lockMapIndex[_id][msg.sender] = count;
lockCount[_id]++;
emit TokenLocked(_id, msg.sender);
}
function _unlockId(uint256 _id) internal {
require(approvedContract[msg.sender], "Cannot update map");
uint256 index = lockMapIndex[_id][msg.sender];
require(index != 0, "ID not locked by caller");
uint256 last = lockCount[_id];
if (index != last) {
address lastContract = lockMap[_id][last];
lockMap[_id][index] = lastContract;
lockMap[_id][last] = address(0);
lockMapIndex[_id][lastContract] = index;
} else lockMap[_id][index] = address(0);
lockMapIndex[_id][msg.sender] = 0;
lockCount[_id]--;
emit TokenUnlocked(_id, msg.sender);
}
function _freeId(uint256 _id, address _contract) internal {
require(!approvedContract[_contract], "Cannot update map");
uint256 index = lockMapIndex[_id][_contract];
require(index != 0, "ID not locked");
uint256 last = lockCount[_id];
if (index != last) {
address lastContract = lockMap[_id][last];
lockMap[_id][index] = lastContract;
lockMap[_id][last] = address(0);
lockMapIndex[_id][lastContract] = index;
} else lockMap[_id][index] = address(0);
lockMapIndex[_id][_contract] = 0;
lockCount[_id]--;
emit TokenUnlocked(_id, _contract);
}
}
文件 30 的 35:MerkleProof.sol
pragma solidity ^0.8.0;
library MerkleProof {
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHash = _efficientHash(computedHash, proofElement);
} else {
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
文件 31 的 35:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 32 的 35:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 33 的 35:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
文件 34 的 35:VRFConsumerBaseV2.sol
pragma solidity ^0.8.4;
abstract contract VRFConsumerBaseV2 {
error OnlyCoordinatorCanFulfill(address have, address want);
address private immutable vrfCoordinator;
constructor(address _vrfCoordinator) {
vrfCoordinator = _vrfCoordinator;
}
function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;
function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
if (msg.sender != vrfCoordinator) {
revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
}
fulfillRandomWords(requestId, randomWords);
}
}
文件 35 的 35:VRFCoordinatorV2Interface.sol
pragma solidity ^0.8.0;
interface VRFCoordinatorV2Interface {
function getRequestConfig()
external
view
returns (
uint16,
uint32,
bytes32[] memory
);
function requestRandomWords(
bytes32 keyHash,
uint64 subId,
uint16 minimumRequestConfirmations,
uint32 callbackGasLimit,
uint32 numWords
) external returns (uint256 requestId);
function createSubscription() external returns (uint64 subId);
function getSubscription(uint64 subId)
external
view
returns (
uint96 balance,
uint64 reqCount,
address owner,
address[] memory consumers
);
function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;
function acceptSubscriptionOwnerTransfer(uint64 subId) external;
function addConsumer(uint64 subId, address consumer) external;
function removeConsumer(uint64 subId, address consumer) external;
function cancelSubscription(uint64 subId, address to) external;
}
{
"compilationTarget": {
"contracts/BrawlerBearz.sol": "BrawlerBearz"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"details": {
"constantOptimizer": true,
"cse": true,
"deduplicate": true,
"inliner": true,
"jumpdestRemover": true,
"orderLiterals": true,
"peephole": true,
"yul": false
},
"runs": 550
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_vrfV2Coordinator","type":"address"},{"internalType":"bytes32","name":"keyHash_","type":"bytes32"},{"internalType":"uint64","name":"subscriptionId_","type":"uint64"},{"internalType":"address","name":"_accessPassContract","type":"address"},{"internalType":"address","name":"_factionContract","type":"address"},{"internalType":"address","name":"_renderingContract","type":"address"},{"internalType":"address","name":"_vendorContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidItemType","type":"error"},{"inputs":[],"name":"InvalidLength","type":"error"},{"inputs":[],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidString","type":"error"},{"inputs":[],"name":"InvalidTokenIds","type":"error"},{"inputs":[],"name":"InvalidValue","type":"error"},{"inputs":[],"name":"ItemRequiresMoreXP","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimedTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"typeOf","type":"string"},{"indexed":false,"internalType":"uint256","name":"itemTokenId","type":"uint256"}],"name":"Equipped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"lore","type":"string"}],"name":"LoreChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"NameChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"RandomnessRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"currentTokenId","type":"uint256"}],"name":"Revealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"approvedContract","type":"address"}],"name":"TokenLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"approvedContract","type":"address"}],"name":"TokenUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"typeOf","type":"string"},{"indexed":false,"internalType":"uint256","name":"itemTokenId","type":"uint256"}],"name":"Unequipped","type":"event"},{"inputs":[],"name":"DEAD_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accessPassContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressToMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"typeOf","type":"string"},{"internalType":"uint256","name":"itemTokenId","type":"uint256"}],"name":"equip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factionContract","outputs":[{"internalType":"contract IBrawlerBearzFaction","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"contractAddress","type":"address"}],"name":"freeId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getAddressMintsRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getMetadata","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"lore","type":"string"},{"internalType":"uint256","name":"background","type":"uint256"},{"internalType":"uint256","name":"head","type":"uint256"},{"internalType":"uint256","name":"weapon","type":"uint256"},{"internalType":"uint256","name":"armor","type":"uint256"},{"internalType":"uint256","name":"faceArmor","type":"uint256"},{"internalType":"uint256","name":"eyewear","type":"uint256"},{"internalType":"uint256","name":"misc","type":"uint256"},{"internalType":"uint256","name":"xp","type":"uint256"},{"internalType":"bool","name":"isUnlocked","type":"bool"},{"internalType":"uint256","name":"faction","type":"uint256"}],"internalType":"struct IBrawlerBearzCommon.CustomMetadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicLive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRevealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"isUnlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWhitelistLive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liveAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lockId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockMap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"lockMapIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renderer","outputs":[{"internalType":"contract IBrawlerBearzRenderer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"seed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isRevealed","type":"bool"}],"name":"setIsRevealed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_liveAt","type":"uint256"}],"name":"setLiveAt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"lore","type":"string"}],"name":"setLore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPerWallet","type":"uint256"}],"name":"setMaxPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSupply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_renderingContractAddress","type":"address"}],"name":"setRenderingContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isShopDropEnabled","type":"bool"}],"name":"setShopDropEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vendorContractAddress","type":"address"}],"name":"setVendorContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_whitelistLiveAt","type":"uint256"}],"name":"setWhitelistLiveAt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"subscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"subtractXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamMintAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"teamMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"typeOf","type":"string"}],"name":"unequip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unlockId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_contracts","type":"address[]"},{"internalType":"bool[]","name":"_values","type":"bool[]"}],"name":"updateApprovedContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vendorContract","outputs":[{"internalType":"contract IBrawlerBearzDynamicItems","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"walletOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistLiveAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"whitelistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]