文件 1 的 15:Address.sol
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 15: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;
}
}
文件 3 的 15:ERC1155.sol
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
mapping(uint256 => mapping(address => uint256)) private _balances;
mapping(address => mapping(address => bool)) private _operatorApprovals;
string private _uri;
constructor(string memory uri_) {
_setURI(uri_);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
function setApprovalForAll(address operator, bool approved) public virtual override {
require(_msgSender() != operator, "ERC1155: setting approval status for self");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account] += amount;
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
}
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
emit TransferSingle(operator, account, address(0), id, amount);
}
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
}
emit TransferBatch(operator, account, address(0), ids, amounts);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
文件 4 的 15:ERC1155Supply.sol
pragma solidity ^0.8.0;
import "../ERC1155.sol";
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual override {
super._mint(account, id, amount, data);
_totalSupply[id] += amount;
}
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._mintBatch(to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual override {
super._burn(account, id, amount);
_totalSupply[id] -= amount;
}
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual override {
super._burnBatch(account, ids, amounts);
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] -= amounts[i];
}
}
}
文件 5 的 15: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;
}
}
文件 6 的 15: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;
}
文件 7 的 15:IERC1155MetadataURI.sol
pragma solidity ^0.8.0;
import "../IERC1155.sol";
interface IERC1155MetadataURI is IERC1155 {
function uri(uint256 id) external view returns (string memory);
}
文件 8 的 15:IERC1155Receiver.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155Receiver is IERC165 {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
文件 9 的 15:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 10 的 15:INFTCForgeComponents_ForTheGallery.sol
pragma solidity ^0.8.9;
interface INFTCForgeComponents_ForTheGallery {
function getYieldFromMapping(string calldata tokenUri) external view returns (uint256);
}
文件 11 的 15:INFTCult_ForTheGallery.sol
pragma solidity ^0.8.9;
interface INFTCult_ForTheGallery {
function ownerOf(uint256 tokenId) external view returns (address);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 12 的 15:NFTCultureCollectionBase.sol
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import './INFTCult_ForTheGallery.sol';
import './INFTCForgeComponents_ForTheGallery.sol';
abstract contract NFTCultureCollectionBase is
ERC1155Supply,
Ownable,
ReentrancyGuard
{
uint256 public constant EMBER_SUPPLY = 10**12;
uint256 public constant NFT_CULT_TOKEN_COUNT = 3333;
uint256 public constant OG_FOURD_PIECE_ID = 1;
uint256 public constant OG_PAVEL_PIECE_ID = 2;
uint256 public constant OG_CHISS_PIECE_ID = 3;
uint256 public constant OG_ANONY_PIECE_ID = 4;
string public name;
uint256 public pricePerToken;
bool public claimingActive;
uint256 public emberPieceId;
uint256[] public emberIds;
uint256[] public pieceIds;
INFTCult_ForTheGallery private _nftCult;
INFTCForgeComponents_ForTheGallery private _nftCultForgeComponents;
mapping(uint256 => uint256) private _emberLookup;
mapping(uint256 => mapping(uint256 => uint256)) private _cache;
uint256 private _cacheIndexer = 1;
function _getForgeComponentYieldFromMapping(uint256 nftCultTokenId)
internal
view
returns (uint256)
{
return
_nftCultForgeComponents.getYieldFromMapping(
_nftCult.tokenURI(nftCultTokenId)
);
}
constructor(
string memory __name,
string memory __uri,
uint256 __pricePerToken,
address __nftCult,
address __nftCultForgeComponents
) ERC1155(__uri) {
name = __name;
pricePerToken = __pricePerToken;
emberPieceId = 0;
emberIds.push(0);
_emberLookup[0] = 1;
_setNewDependencies(__nftCult, __nftCultForgeComponents);
_mint(msg.sender, emberPieceId, EMBER_SUPPLY, '');
_mint(msg.sender, OG_FOURD_PIECE_ID, NFT_CULT_TOKEN_COUNT, '');
_mint(msg.sender, OG_PAVEL_PIECE_ID, NFT_CULT_TOKEN_COUNT, '');
_mint(msg.sender, OG_CHISS_PIECE_ID, NFT_CULT_TOKEN_COUNT, '');
_mint(msg.sender, OG_ANONY_PIECE_ID, NFT_CULT_TOKEN_COUNT, '');
pieceIds = [
OG_FOURD_PIECE_ID,
OG_PAVEL_PIECE_ID,
OG_CHISS_PIECE_ID,
OG_ANONY_PIECE_ID
];
}
function _setNewDependencies(
address __nftCult,
address __nftCultForgeComponents
) internal {
if (__nftCult != address(0)) {
_nftCult = INFTCult_ForTheGallery(__nftCult);
}
if (__nftCultForgeComponents != address(0)) {
_nftCultForgeComponents = INFTCForgeComponents_ForTheGallery(
__nftCultForgeComponents
);
}
}
function getClaimsRemaining(uint256 nftCultTokenId)
external
view
returns (uint256)
{
if (_cache[_cacheIndexer][nftCultTokenId] == 0) {
return _getForgeComponentYieldFromMapping(nftCultTokenId) >> 128;
}
uint256 statsBitMap = _cache[_cacheIndexer][nftCultTokenId];
return uint64(statsBitMap >> 128) - uint64(statsBitMap >> 192);
}
function getEmberRemaining(uint256 nftCultTokenId)
external
view
returns (uint256)
{
if (_cache[_cacheIndexer][nftCultTokenId] == 0) {
return uint128(_getForgeComponentYieldFromMapping(nftCultTokenId));
}
uint256 statsBitMap = _cache[_cacheIndexer][nftCultTokenId];
return uint64(statsBitMap) - uint64(statsBitMap >> 64);
}
function isEmber(uint256 pieceId) external view returns (bool) {
return _emberLookup[pieceId] == 1;
}
function setMintingState(
bool __claimingActive,
uint256 __pricePerToken,
uint256 __emberPieceId,
uint256 __cacheIndexer
) external onlyOwner {
claimingActive = __claimingActive;
if (__pricePerToken > 0) {
pricePerToken = __pricePerToken;
}
if (__emberPieceId > 0) {
emberPieceId = __emberPieceId;
emberIds.push(emberPieceId);
_emberLookup[emberPieceId] = 1;
}
if (__cacheIndexer > 0) {
_cacheIndexer = __cacheIndexer;
}
}
function setNewURI(string memory newURI) external onlyOwner {
_setURI(newURI);
}
function setNewDependencies(
address __nftCult,
address __nftCultForgeComponents
) external onlyOwner {
_setNewDependencies(__nftCult, __nftCultForgeComponents);
}
function withdraw() external onlyOwner {
payable(msg.sender).transfer(address(this).balance);
}
function addPieceToCollection(uint256 pieceId, uint256 tokenQuantity)
external
onlyOwner
{
require(balanceOf(msg.sender, pieceId) == 0, 'Cant add to collection');
_mint(msg.sender, pieceId, tokenQuantity, '');
pieceIds.push(pieceId);
}
function burnRemainingPieces(uint256 pieceId) external onlyOwner {
uint256 balance = balanceOf(msg.sender, pieceId);
_burn(msg.sender, pieceId, balance);
}
function claimPiecesInCollection(
uint256 nftCultTokenId,
uint256 pieceId,
uint256 count
) external payable nonReentrant {
require(claimingActive == true, 'Claiming disabled');
require(exists(pieceId), 'Invalid piece to claim');
require(
_nftCult.ownerOf(nftCultTokenId) == msg.sender,
'Cult token not owned'
);
uint256 statsBitMap = _cache[_cacheIndexer][nftCultTokenId];
if (statsBitMap == 0) {
statsBitMap = _getForgeComponentYieldFromMapping(nftCultTokenId);
}
require(statsBitMap > 0, 'Invalid forge component Id');
uint64 claimYield = uint64(statsBitMap >> 128);
uint64 claimsConsumed = uint64(statsBitMap >> 192);
require(claimYield > 0, 'Cult token has no claims');
require(claimsConsumed + count <= claimYield, 'No claims remaining');
_safeTransferFrom(owner(), msg.sender, pieceId, count, '');
uint64 emberYield = uint64(statsBitMap);
uint64 embersReceived = uint64(statsBitMap >> 64);
uint256 emberCount;
if (emberYield > embersReceived) {
emberCount = emberYield - embersReceived;
_safeTransferFrom(
owner(),
msg.sender,
emberPieceId,
emberCount,
''
);
}
_cache[_cacheIndexer][nftCultTokenId] =
statsBitMap +
(count << 192) +
(emberCount << 64);
}
function batchClaimPiecesInCollection(
uint256[] calldata nftCultTokens,
uint256[] calldata pieceIdsToClaim,
uint256[] calldata pieceCounts,
bool useAlter
) external payable nonReentrant {
require(claimingActive == true, 'Claiming disabled');
require(nftCultTokens.length > 0, 'Must have claims');
require(
nftCultTokens.length == pieceIdsToClaim.length &&
nftCultTokens.length == pieceCounts.length,
'Bad inputs'
);
uint256 perTokenStatsBitMap;
uint64[4] memory perToken;
uint256 bonusEmber;
uint256[] memory idsArr = new uint256[](nftCultTokens.length + 1);
uint256[] memory countArr = new uint256[](nftCultTokens.length + 1);
for (uint256 i = 0; i < nftCultTokens.length; i++) {
perToken[0] = uint64(pieceCounts[i]);
require(exists(pieceIdsToClaim[i]), 'Invalid piece to claim');
require(
_nftCult.ownerOf(nftCultTokens[i]) == msg.sender,
'Cult token not owned'
);
perTokenStatsBitMap = _cache[_cacheIndexer][nftCultTokens[i]];
if (perTokenStatsBitMap == 0) {
perTokenStatsBitMap = _getForgeComponentYieldFromMapping(
nftCultTokens[i]
);
}
require(perTokenStatsBitMap > 0, 'Invalid forge component Id');
perToken[1] = uint64(perTokenStatsBitMap >> 128);
perToken[2] = uint64(perTokenStatsBitMap >> 192);
require(perToken[1] > 0, 'Cult token has no claims');
require(
perToken[2] + perToken[0] <= perToken[1],
'No claims remaining'
);
if (pieceIdsToClaim[i] == emberPieceId) {
require(useAlter, 'Use alter to claim ember.');
}
idsArr[i] = pieceIdsToClaim[i];
countArr[i] = perToken[0];
perToken[3] = uint64(_computeBonusEmber(perTokenStatsBitMap));
bonusEmber += perToken[3];
_cache[_cacheIndexer][nftCultTokens[i]] =
perTokenStatsBitMap +
(uint256(perToken[0]) << 192) +
(uint256(perToken[3]) << 64);
}
idsArr[nftCultTokens.length] = emberPieceId;
countArr[nftCultTokens.length] = bonusEmber;
_safeBatchTransferFrom(owner(), msg.sender, idsArr, countArr, '');
}
function _computeBonusEmber(uint256 bitMap)
internal
pure
returns (uint256)
{
uint256 perTokenEmberYield = uint64(bitMap);
uint256 pertokenEmbersRecieved = uint64(bitMap >> 64);
uint256 bonusEmber;
if (perTokenEmberYield > pertokenEmbersRecieved) {
bonusEmber = perTokenEmberYield - pertokenEmbersRecieved;
}
return bonusEmber;
}
}
文件 13 的 15: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() {
_setOwner(_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 {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 14 的 15: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;
}
}
文件 15 的 15:TheGalleryByNFTCulture.sol
pragma solidity ^0.8.9;
import './NFTCultureCollectionBase.sol';
contract TheGalleryByNFTCulture is NFTCultureCollectionBase {
constructor()
NFTCultureCollectionBase(
'The Gallery by NFT Culture',
'https://gateway.pinata.cloud/ipfs/QmNrPi8VYbjorH9Ms4BShUFerAn7CfG6CJqWcSRb5oN4bW/{id}.json',
0,
0x5d75c1b764AFd64fe02a28B5eFF79E2f81DB5bad,
0x8C811d9E8F4b734066cF2832168421504FA441b0
)
{
}
}
{
"compilationTarget": {
"contracts/TheGalleryByNFTCulture.sol": "TheGalleryByNFTCulture"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","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":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"EMBER_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NFT_CULT_TOKEN_COUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_ANONY_PIECE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_CHISS_PIECE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_FOURD_PIECE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_PAVEL_PIECE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pieceId","type":"uint256"},{"internalType":"uint256","name":"tokenQuantity","type":"uint256"}],"name":"addPieceToCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"nftCultTokens","type":"uint256[]"},{"internalType":"uint256[]","name":"pieceIdsToClaim","type":"uint256[]"},{"internalType":"uint256[]","name":"pieceCounts","type":"uint256[]"},{"internalType":"bool","name":"useAlter","type":"bool"}],"name":"batchClaimPiecesInCollection","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pieceId","type":"uint256"}],"name":"burnRemainingPieces","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftCultTokenId","type":"uint256"},{"internalType":"uint256","name":"pieceId","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"claimPiecesInCollection","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"emberIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emberPieceId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftCultTokenId","type":"uint256"}],"name":"getClaimsRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftCultTokenId","type":"uint256"}],"name":"getEmberRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pieceId","type":"uint256"}],"name":"isEmber","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"","type":"uint256"}],"name":"pieceIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","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":"__claimingActive","type":"bool"},{"internalType":"uint256","name":"__pricePerToken","type":"uint256"},{"internalType":"uint256","name":"__emberPieceId","type":"uint256"},{"internalType":"uint256","name":"__cacheIndexer","type":"uint256"}],"name":"setMintingState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__nftCult","type":"address"},{"internalType":"address","name":"__nftCultForgeComponents","type":"address"}],"name":"setNewDependencies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setNewURI","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":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]