ERC-1155
Overview
Max Total Supply
62
Holders
19
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
WoWLotmRewards
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; import {ERC1155Supply, ERC1155} from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import {ERC1155Burnable} from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol"; error InvalidAddress(); error InvalidToken(uint256 token); error InvalidPartnerToken(uint256 token); error InvalidTokenAmount(); error ERC1155InvalidArrayLength(); contract WoWLotmRewards is ERC1155Supply, ERC2981, Ownable, ReentrancyGuard { struct Reward { uint256 tokenId; bool haveNft; bool exists; } mapping(uint256 => Reward) public rewardOptions; uint256 public maxTokenId = 1; address public partnerContract; constructor( string memory uri_, uint256 maxTokenId_, address partnerContract_, address royaltyAddress_, uint96 royaltyFee_ ) ERC1155(uri_) Ownable(msg.sender) { partnerContract = partnerContract_; _setCurrentTokenId(maxTokenId_); _setDefaultRoyalty(royaltyAddress_, royaltyFee_); uint256[] memory partnerTokens = new uint256[](5); partnerTokens[0] = 23; partnerTokens[1] = 24; partnerTokens[2] = 25; partnerTokens[3] = 26; partnerTokens[4] = 27; uint256[] memory tokensId = new uint256[](5); tokensId[0] = 0; tokensId[1] = 1; tokensId[2] = 2; tokensId[3] = 3; tokensId[4] = 4; bool[] memory haveNft = new bool[](5); haveNft[0] = true; haveNft[1] = true; haveNft[2] = true; haveNft[3] = true; haveNft[4] = false; _setRewardOptions(partnerTokens, tokensId, haveNft); } //----------------- MODIFIERS -----------------// modifier amountIsPositive(uint256 amount_) { if (amount_ == 0) { revert InvalidTokenAmount(); } _; } modifier tokensAreSupported(uint256[] memory tokensIds_) { for (uint256 i = 0; i < tokensIds_.length; i++) { if (tokensIds_[i] > maxTokenId) { revert InvalidToken(tokensIds_[i]); } } _; } modifier partnerTokenIsSupported(uint256 partnerToken_) { Reward memory reward = rewardOptions[partnerToken_]; if (reward.tokenId > maxTokenId || reward.exists != true) { revert InvalidPartnerToken(partnerToken_); } _; } //----------------- COMMON -----------------// function _setCurrentTokenId(uint256 maxTokenId_) internal { maxTokenId = maxTokenId_; } function _setRewardOptions( uint256[] memory partnerTokens_, uint256[] memory tokensId_, bool[] memory haveNft_ ) internal { if (partnerTokens_.length != tokensId_.length) { revert ERC1155InvalidArrayLength(partnerTokens_.length, tokensId_.length); } if (tokensId_.length != haveNft_.length) { revert ERC1155InvalidArrayLength(tokensId_.length, haveNft_.length); } for (uint256 i = 0; i < partnerTokens_.length; i++) { rewardOptions[partnerTokens_[i]].tokenId = tokensId_[i]; rewardOptions[partnerTokens_[i]].haveNft = haveNft_[i]; rewardOptions[partnerTokens_[i]].exists = true; } } //----------------- ONLY OWNER -----------------// function setURI(string memory uri_) external onlyOwner { _setURI(uri_); } function setCurrentTokenId(uint256 maxTokenId_) external onlyOwner { _setCurrentTokenId(maxTokenId_); } function setPartnerContract(address partnerContract_) external onlyOwner { if (partnerContract_ == address(0)) { revert InvalidAddress(); } partnerContract = partnerContract_; } function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); } function setTokensRoyalty( address[] memory receivers_, uint256[] memory tokensId_, uint96[] memory feeNumerators_ ) external onlyOwner { if (receivers_.length != tokensId_.length) { revert ERC1155InvalidArrayLength(receivers_.length, tokensId_.length); } if (tokensId_.length != feeNumerators_.length) { revert ERC1155InvalidArrayLength(tokensId_.length, feeNumerators_.length); } for (uint256 i = 0; i < receivers_.length; i++) { _setTokenRoyalty(tokensId_[i], receivers_[i], feeNumerators_[i]); } } function setRewardOptions( uint256[] memory partnerTokens_, uint256[] memory tokensId_, bool[] memory haveNft_ ) external onlyOwner tokensAreSupported(tokensId_) { _setRewardOptions(partnerTokens_, tokensId_, haveNft_); } function mintReward( uint256 partnerToken_, uint256 amount_ ) external nonReentrant partnerTokenIsSupported(partnerToken_) amountIsPositive(amount_) { uint256 fromBalance_ = ERC1155Burnable(partnerContract).balanceOf(msg.sender, partnerToken_); if (fromBalance_ < amount_) { revert ERC1155InsufficientBalance(msg.sender, fromBalance_, amount_, partnerToken_); } ERC1155Burnable(partnerContract).burn(msg.sender, partnerToken_, amount_); Reward memory reward_ = rewardOptions[partnerToken_]; if (reward_.haveNft) { _mint(msg.sender, reward_.tokenId, amount_, ""); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol) pragma solidity ^0.8.20; import {IERC2981} from "../../interfaces/IERC2981.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator); /** * @dev The default royalty receiver is invalid. */ error ERC2981InvalidDefaultRoyaltyReceiver(address receiver); /** * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator); /** * @dev The royalty receiver for `tokenId` is invalid. */ error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidDefaultRoyaltyReceiver(address(0)); } _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0)); } _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "./IERC1155.sol"; import {IERC1155Receiver} from "./IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol"; import {Context} from "../../utils/Context.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {Arrays} from "../../utils/Arrays.sol"; import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 */ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; mapping(uint256 id => mapping(address account => uint256)) private _balances; mapping(address account => mapping(address operator => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256 /* id */) public view virtual returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual returns (uint256[] memory) { if (accounts.length != ids.length) { revert ERC1155InvalidArrayLength(ids.length, accounts.length); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i)); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeTransferFrom(from, to, id, value, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeBatchTransferFrom(from, to, ids, values, data); } /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from` * (or `to`) is the zero address. * * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise. * * Requirements: * * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} * or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. * - `ids` and `values` must have the same length. * * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead. */ function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual { if (ids.length != values.length) { revert ERC1155InvalidArrayLength(ids.length, values.length); } address operator = _msgSender(); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids.unsafeMemoryAccess(i); uint256 value = values.unsafeMemoryAccess(i); if (from != address(0)) { uint256 fromBalance = _balances[id][from]; if (fromBalance < value) { revert ERC1155InsufficientBalance(from, fromBalance, value, id); } unchecked { // Overflow not possible: value <= fromBalance _balances[id][from] = fromBalance - value; } } if (to != address(0)) { _balances[id][to] += value; } } if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); emit TransferSingle(operator, from, to, id, value); } else { emit TransferBatch(operator, from, to, ids, values); } } /** * @dev Version of {_update} that performs the token acceptance check by calling * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it * contains code (eg. is a smart contract at the moment of execution). * * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any * update to the contract state after this function would break the check-effect-interaction pattern. Consider * overriding {_update} instead. */ function _updateWithAcceptanceCheck( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal virtual { _update(from, to, ids, values); if (to != address(0)) { address operator = _msgSender(); if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data); } else { _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data); } } } /** * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. * - `ids` and `values` must have the same length. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the values in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev Destroys a `value` amount of tokens of type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. */ function _burn(address from, uint256 id, uint256 value) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. * - `ids` and `values` must have the same length. */ function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC1155InvalidOperator(address(0)); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address * if it contains code at the moment of execution. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 value, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address * if it contains code at the moment of execution. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Creates an array in memory with only one value for each of the elements provided. */ function _asSingletonArrays( uint256 element1, uint256 element2 ) private pure returns (uint256[] memory array1, uint256[] memory array2) { /// @solidity memory-safe-assembly assembly { // Load the free memory pointer array1 := mload(0x40) // Set array length to 1 mstore(array1, 1) // Store the single element at the next word after the length (where content starts) mstore(add(array1, 0x20), element1) // Repeat for next array locating it right after the first array array2 := add(array1, 0x40) mstore(array2, 1) mstore(add(array2, 0x20), element2) // Update the free memory pointer by pointing after the second array mstore(0x40, add(array2, 0x40)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.20; import {ERC1155} from "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. */ abstract contract ERC1155Burnable is ERC1155 { function burn(address account, uint256 id, uint256 value) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burn(account, id, value); } function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burnBatch(account, ids, values); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol) pragma solidity ^0.8.20; import {ERC1155} from "../ERC1155.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. * * NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens * that can be minted. * * CAUTION: This extension should not be added in an upgrade to an already deployed contract. */ abstract contract ERC1155Supply is ERC1155 { mapping(uint256 id => uint256) private _totalSupply; uint256 private _totalSupplyAll; /** * @dev Total value of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { return _totalSupply[id]; } /** * @dev Total value of tokens. */ function totalSupply() public view virtual returns (uint256) { return _totalSupplyAll; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; } /** * @dev See {ERC1155-_update}. */ function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override { super._update(from, to, ids, values); if (from == address(0)) { uint256 totalMintValue = 0; for (uint256 i = 0; i < ids.length; ++i) { uint256 value = values[i]; // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply[ids[i]] += value; totalMintValue += value; } // Overflow check required: The rest of the code assumes that totalSupplyAll never overflows _totalSupplyAll += totalMintValue; } if (to == address(0)) { uint256 totalBurnValue = 0; for (uint256 i = 0; i < ids.length; ++i) { uint256 value = values[i]; unchecked { // Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i]) _totalSupply[ids[i]] -= value; // Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll totalBurnValue += value; } } unchecked { // Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll _totalSupplyAll -= totalBurnValue; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { uint256 low = 0; uint256 high = array.length; if (high == 0) { return 0; } while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds towards zero (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"uri_","type":"string"},{"internalType":"uint256","name":"maxTokenId_","type":"uint256"},{"internalType":"address","name":"partnerContract_","type":"address"},{"internalType":"address","name":"royaltyAddress_","type":"address"},{"internalType":"uint96","name":"royaltyFee_","type":"uint96"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"InvalidPartnerToken","type":"error"},{"inputs":[{"internalType":"uint256","name":"token","type":"uint256"}],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidTokenAmount","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"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":[{"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":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"maxTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"partnerToken_","type":"uint256"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"mintReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"partnerContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardOptions","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"haveNft","type":"bool"},{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","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":"value","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":"uint256","name":"maxTokenId_","type":"uint256"}],"name":"setCurrentTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"partnerContract_","type":"address"}],"name":"setPartnerContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"partnerTokens_","type":"uint256[]"},{"internalType":"uint256[]","name":"tokensId_","type":"uint256[]"},{"internalType":"bool[]","name":"haveNft_","type":"bool[]"}],"name":"setRewardOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers_","type":"address[]"},{"internalType":"uint256[]","name":"tokensId_","type":"uint256[]"},{"internalType":"uint96[]","name":"feeNumerators_","type":"uint96[]"}],"name":"setTokensRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri_","type":"string"}],"name":"setURI","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":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"}]
Contract Creation Code
60806040526001600a553480156200001657600080fd5b5060405162002d0b38038062002d0b833981016040819052620000399162000654565b3385620000468162000377565b506001600160a01b0381166200007757604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000828162000389565b506001600855600b80546001600160a01b0319166001600160a01b038516179055620000ad84600a55565b620000b98282620003db565b60408051600580825260c082019092526000916020820160a080368337019050509050601781600081518110620000f457620000f46200076b565b6020026020010181815250506018816001815181106200011857620001186200076b565b6020026020010181815250506019816002815181106200013c576200013c6200076b565b602002602001018181525050601a816003815181106200016057620001606200076b565b602002602001018181525050601b816004815181106200018457620001846200076b565b602090810291909101015260408051600580825260c08201909252600091816020016020820280368337019050509050600081600081518110620001cc57620001cc6200076b565b602002602001018181525050600181600181518110620001f057620001f06200076b565b6020026020010181815250506002816002815181106200021457620002146200076b565b6020026020010181815250506003816003815181106200023857620002386200076b565b6020026020010181815250506004816004815181106200025c576200025c6200076b565b602090810291909101015260408051600580825260c08201909252600091816020016020820280368337019050509050600181600081518110620002a457620002a46200076b565b602002602001019015159081151581525050600181600181518110620002ce57620002ce6200076b565b602002602001019015159081151581525050600181600281518110620002f857620002f86200076b565b6020026020010190151590811515815250506001816003815181106200032257620003226200076b565b6020026020010190151590811515815250506000816004815181106200034c576200034c6200076b565b911515602092830291909101909101526200036983838362000482565b5050505050505050620008de565b600262000385828262000812565b5050565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382168110156200041c57604051636f483d0960e01b81526001600160601b0383166004820152602481018290526044016200006e565b6001600160a01b0383166200044857604051635b6cc80560e11b8152600060048201526024016200006e565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600555565b8151835114620004b35782518251604051635b05999160e01b8152600481019290925260248201526044016200006e565b8051825114620004e45781518151604051635b05999160e01b8152600481019290925260248201526044016200006e565b60005b835181101562000603578281815181106200050657620005066200076b565b6020026020010151600960008684815181106200052757620005276200076b565b60200260200101518152602001908152602001600020600001819055508181815181106200055957620005596200076b565b6020026020010151600960008684815181106200057a576200057a6200076b565b6020026020010151815260200190815260200160002060010160006101000a81548160ff021916908315150217905550600160096000868481518110620005c557620005c56200076b565b6020026020010151815260200190815260200160002060010160016101000a81548160ff0219169083151502179055508080600101915050620004e7565b50505050565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200063757600080fd5b919050565b80516001600160601b03811681146200063757600080fd5b600080600080600060a086880312156200066d57600080fd5b85516001600160401b03808211156200068557600080fd5b818801915088601f8301126200069a57600080fd5b815181811115620006af57620006af62000609565b604051601f8201601f19908116603f01168101908382118183101715620006da57620006da62000609565b81604052828152602093508b84848701011115620006f757600080fd5b600091505b828210156200071b5784820184015181830185015290830190620006fc565b600084848301015280995050505080880151955050506200073f604087016200061f565b92506200074f606087016200061f565b91506200075f608087016200063c565b90509295509295909350565b634e487b7160e01b600052603260045260246000fd5b600181811c908216806200079657607f821691505b602082108103620007b757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200080d576000816000526020600020601f850160051c81016020861015620007e85750805b601f850160051c820191505b818110156200080957828155600101620007f4565b5050505b505050565b81516001600160401b038111156200082e576200082e62000609565b62000846816200083f845462000781565b84620007bd565b602080601f8311600181146200087e5760008415620008655750858301515b600019600386901b1c1916600185901b17855562000809565b600085815260208120601f198616915b82811015620008af578886015182559484019460019091019084016200088e565b5085821015620008ce5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61241d80620008ee6000396000f3fe608060405234801561001057600080fd5b50600436106101a25760003560e01c80634e1273f4116100ee57806391ba317a11610097578063bd85b03911610071578063bd85b039146103d6578063e985e9c5146103f6578063f242432a14610432578063f2fde38b1461044557600080fd5b806391ba317a146103a75780639e05a882146103b0578063a22cb465146103c357600080fd5b8063715018a6116100c8578063715018a61461037b5780638329de2f146103835780638da5cb5b1461039657600080fd5b80634e1273f4146102e95780634f558e7914610309578063686dd20b1461032b57600080fd5b806318160ddd116101505780632d744b111161012a5780632d744b11146102985780632eb2c2d6146102c3578063473d0c96146102d657600080fd5b806318160ddd1461024b57806326afbe41146102535780632a55205a1461026657600080fd5b806304634d8d1161018157806304634d8d146102055780630e6602fb146102185780630e89341c1461022b57600080fd5b8062fdd58e146101a757806301ffc9a7146101cd57806302fe5305146101f0575b600080fd5b6101ba6101b53660046119d7565b610458565b6040519081526020015b60405180910390f35b6101e06101db366004611a17565b610480565b60405190151581526020016101c4565b6102036101fe366004611ada565b61048b565b005b610203610213366004611b47565b61049f565b610203610226366004611b7a565b6104b5565b61023e610239366004611b9c565b610753565b6040516101c49190611bfb565b6004546101ba565b610203610261366004611c0e565b6107e7565b610279610274366004611b7a565b61085e565b604080516001600160a01b0390931683526020830191909152016101c4565b600b546102ab906001600160a01b031681565b6040516001600160a01b0390911681526020016101c4565b6102036102d1366004611cdc565b610919565b6102036102e4366004611d96565b61099f565b6102fc6102f7366004611ee1565b610a40565b6040516101c49190611f81565b6101e0610317366004611b9c565b600090815260036020526040902054151590565b61035e610339366004611b9c565b6009602052600090815260409020805460019091015460ff8082169161010090041683565b6040805193845291151560208401521515908201526060016101c4565b610203610b0d565b610203610391366004611b9c565b610b21565b6007546001600160a01b03166102ab565b6101ba600a5481565b6102036103be366004611f94565b610b32565b6102036103d136600461206a565b610c02565b6101ba6103e4366004611b9c565b60009081526003602052604090205490565b6101e0610404366004612094565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6102036104403660046120be565b610c0d565b610203610453366004611c0e565b610c8b565b6000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b600061047a82610cdf565b610493610d1d565b61049c81610d63565b50565b6104a7610d1d565b6104b18282610d6f565b5050565b6104bd610e53565b6000828152600960209081526040918290208251606081018452815480825260019092015460ff8082161515948301949094526101009004909216151592820192909252600a5484921180610519575060408101511515600114155b15610558576040517fbada3012000000000000000000000000000000000000000000000000000000008152600481018390526024015b60405180910390fd5b8280600003610593576040517f2160733900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b546040517efdd58e000000000000000000000000000000000000000000000000000000008152336004820152602481018790526000916001600160a01b03169062fdd58e90604401602060405180830381865afa1580156105fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061e9190612123565b905084811015610658576040516303dee4c560e01b815233600482015260248101829052604481018690526064810187905260840161054f565b600b546040517ff5298aca00000000000000000000000000000000000000000000000000000000815233600482015260248101889052604481018790526001600160a01b039091169063f5298aca90606401600060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b50505060008781526009602090815260409182902082516060810184528154815260019091015460ff8082161580159484019490945261010090910416151592810192909252909150610744576107443382600001518860405180602001604052806000815250610e96565b50505050506104b16001600855565b6060600280546107629061213c565b80601f016020809104026020016040519081016040528092919081815260200182805461078e9061213c565b80156107db5780601f106107b0576101008083540402835291602001916107db565b820191906000526020600020905b8154815290600101906020018083116107be57829003601f168201915b50505050509050919050565b6107ef610d1d565b6001600160a01b03811661082f576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60008281526006602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916108dd5750604080518082019091526005546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090610901906bffffffffffffffffffffffff168761218c565b61090b91906121a3565b915196919550909350505050565b336001600160a01b038616811480159061095957506001600160a01b0380871660009081526001602090815260408083209385168352929052205460ff16155b1561098a5760405163711bec9160e11b81526001600160a01b0380831660048301528716602482015260440161054f565b6109978686868686610ef3565b505050505050565b6109a7610d1d565b8160005b8151811015610a2e57600a548282815181106109c9576109c96121c5565b60200260200101511115610a26578181815181106109e9576109e96121c5565b60200260200101516040517f925d6b1800000000000000000000000000000000000000000000000000000000815260040161054f91815260200190565b6001016109ab565b50610a3a848484610f5a565b50505050565b60608151835114610a715781518351604051635b05999160e01b81526004810192909252602482015260440161054f565b6000835167ffffffffffffffff811115610a8d57610a8d611a3b565b604051908082528060200260200182016040528015610ab6578160200160208202803683370190505b50905060005b8451811015610b0557602080820286010151610ae090602080840287010151610458565b828281518110610af257610af26121c5565b6020908102919091010152600101610abc565b509392505050565b610b15610d1d565b610b1f60006110c6565b565b610b29610d1d565b61049c81600a55565b610b3a610d1d565b8151835114610b695782518251604051635b05999160e01b81526004810192909252602482015260440161054f565b8051825114610b985781518151604051635b05999160e01b81526004810192909252602482015260440161054f565b60005b8351811015610a3a57610bfa838281518110610bb957610bb96121c5565b6020026020010151858381518110610bd357610bd36121c5565b6020026020010151848481518110610bed57610bed6121c5565b6020026020010151611125565b600101610b9b565b6104b1338383611228565b336001600160a01b0386168114801590610c4d57506001600160a01b0380871660009081526001602090815260408083209385168352929052205460ff16155b15610c7e5760405163711bec9160e11b81526001600160a01b0380831660048301528716602482015260440161054f565b61099786868686866112d8565b610c93610d1d565b6001600160a01b038116610cd6576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526000600482015260240161054f565b61049c816110c6565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061047a575061047a82611366565b6007546001600160a01b03163314610b1f576040517f118cdaa700000000000000000000000000000000000000000000000000000000815233600482015260240161054f565b60026104b18282612228565b6127106bffffffffffffffffffffffff8216811015610dd1576040517f6f483d090000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201526024810182905260440161054f565b6001600160a01b038316610e14576040517fb6d9900a0000000000000000000000000000000000000000000000000000000081526000600482015260240161054f565b50604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217600555565b600260085403610e8f576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600855565b6001600160a01b038416610ec057604051632bfa23e760e11b81526000600482015260240161054f565b60408051600180825260208201869052818301908152606082018590526080820190925290610997600087848487611401565b6001600160a01b038416610f1d57604051632bfa23e760e11b81526000600482015260240161054f565b6001600160a01b038516610f4657604051626a0d4560e21b81526000600482015260240161054f565b610f538585858585611401565b5050505050565b8151835114610f895782518251604051635b05999160e01b81526004810192909252602482015260440161054f565b8051825114610fb85781518151604051635b05999160e01b81526004810192909252602482015260440161054f565b60005b8351811015610a3a57828181518110610fd657610fd66121c5565b602002602001015160096000868481518110610ff457610ff46121c5565b6020026020010151815260200190815260200160002060000181905550818181518110611023576110236121c5565b602002602001015160096000868481518110611041576110416121c5565b6020026020010151815260200190815260200160002060010160006101000a81548160ff021916908315150217905550600160096000868481518110611089576110896121c5565b6020026020010151815260200190815260200160002060010160016101000a81548160ff0219169083151502179055508080600101915050610fbb565b600780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106bffffffffffffffffffffffff821681101561118e576040517fdfd1fc1b000000000000000000000000000000000000000000000000000000008152600481018590526bffffffffffffffffffffffff831660248201526044810182905260640161054f565b6001600160a01b0383166111d8576040517f969f0852000000000000000000000000000000000000000000000000000000008152600481018590526000602482015260440161054f565b506040805180820182526001600160a01b0393841681526bffffffffffffffffffffffff92831660208083019182526000968752600690529190942093519051909116600160a01b029116179055565b6001600160a01b03821661126b576040517fced3e1000000000000000000000000000000000000000000000000000000000081526000600482015260240161054f565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03841661130257604051632bfa23e760e11b81526000600482015260240161054f565b6001600160a01b03851661132b57604051626a0d4560e21b81526000600482015260240161054f565b6040805160018082526020820186905281830190815260608201859052608082019092529061135d8787848487611401565b50505050505050565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806113c957506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061047a57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461047a565b61140d85858585611454565b6001600160a01b03841615610f535782513390600103611446576020848101519084015161143f83898985858961159a565b5050610997565b6109978187878787876116be565b611460848484846117a7565b6001600160a01b03841661150a576000805b83518110156114f057600083828151811061148f5761148f6121c5565b6020026020010151905080600360008785815181106114b0576114b06121c5565b6020026020010151815260200190815260200160002060008282546114d591906122e8565b909155506114e5905081846122e8565b925050600101611472565b50806004600082825461150391906122e8565b9091555050505b6001600160a01b038316610a3a576000805b8351811015611589576000838281518110611539576115396121c5565b60200260200101519050806003600087858151811061155a5761155a6121c5565b60209081029190910181015182528101919091526040016000208054919091039055919091019060010161151c565b506004805491909103905550505050565b6001600160a01b0384163b156109975760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906115de90899089908890889088906004016122fb565b6020604051808303816000875af1925050508015611619575060408051601f3d908101601f191682019092526116169181019061233e565b60015b611682573d808015611647576040519150601f19603f3d011682016040523d82523d6000602084013e61164c565b606091505b50805160000361167a57604051632bfa23e760e11b81526001600160a01b038616600482015260240161054f565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b1461135d57604051632bfa23e760e11b81526001600160a01b038616600482015260240161054f565b6001600160a01b0384163b156109975760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611702908990899088908890889060040161235b565b6020604051808303816000875af192505050801561173d575060408051601f3d908101601f1916820190925261173a9181019061233e565b60015b61176b573d808015611647576040519150601f19603f3d011682016040523d82523d6000602084013e61164c565b6001600160e01b0319811663bc197c8160e01b1461135d57604051632bfa23e760e11b81526001600160a01b038616600482015260240161054f565b80518251146117d65781518151604051635b05999160e01b81526004810192909252602482015260440161054f565b3360005b83518110156118dc576020818102858101820151908501909101516001600160a01b0388161561188d576000828152602081815260408083206001600160a01b038c16845290915290205481811015611866576040516303dee4c560e01b81526001600160a01b038a16600482015260248101829052604481018390526064810184905260840161054f565b6000838152602081815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b038716156118d2576000828152602081815260408083206001600160a01b038b168452909152812080548392906118cc9084906122e8565b90915550505b50506001016117da565b50825160010361195d5760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62858560405161194e929190918252602082015260400190565b60405180910390a45050610f53565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516119ac9291906123b9565b60405180910390a45050505050565b80356001600160a01b03811681146119d257600080fd5b919050565b600080604083850312156119ea57600080fd5b6119f3836119bb565b946020939093013593505050565b6001600160e01b03198116811461049c57600080fd5b600060208284031215611a2957600080fd5b8135611a3481611a01565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611a7a57611a7a611a3b565b604052919050565b600067ffffffffffffffff831115611a9c57611a9c611a3b565b611aaf601f8401601f1916602001611a51565b9050828152838383011115611ac357600080fd5b828260208301376000602084830101529392505050565b600060208284031215611aec57600080fd5b813567ffffffffffffffff811115611b0357600080fd5b8201601f81018413611b1457600080fd5b611b2384823560208401611a82565b949350505050565b80356bffffffffffffffffffffffff811681146119d257600080fd5b60008060408385031215611b5a57600080fd5b611b63836119bb565b9150611b7160208401611b2b565b90509250929050565b60008060408385031215611b8d57600080fd5b50508035926020909101359150565b600060208284031215611bae57600080fd5b5035919050565b6000815180845260005b81811015611bdb57602081850181015186830182015201611bbf565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000611a346020830184611bb5565b600060208284031215611c2057600080fd5b611a34826119bb565b600067ffffffffffffffff821115611c4357611c43611a3b565b5060051b60200190565b600082601f830112611c5e57600080fd5b81356020611c73611c6e83611c29565b611a51565b8083825260208201915060208460051b870101935086841115611c9557600080fd5b602086015b84811015611cb15780358352918301918301611c9a565b509695505050505050565b600082601f830112611ccd57600080fd5b611a3483833560208501611a82565b600080600080600060a08688031215611cf457600080fd5b611cfd866119bb565b9450611d0b602087016119bb565b9350604086013567ffffffffffffffff80821115611d2857600080fd5b611d3489838a01611c4d565b94506060880135915080821115611d4a57600080fd5b611d5689838a01611c4d565b93506080880135915080821115611d6c57600080fd5b50611d7988828901611cbc565b9150509295509295909350565b803580151581146119d257600080fd5b600080600060608486031215611dab57600080fd5b833567ffffffffffffffff80821115611dc357600080fd5b611dcf87838801611c4d565b9450602091508186013581811115611de657600080fd5b611df288828901611c4d565b945050604086013581811115611e0757600080fd5b86019050601f81018713611e1a57600080fd5b8035611e28611c6e82611c29565b81815260059190911b82018301908381019089831115611e4757600080fd5b928401925b82841015611e6c57611e5d84611d86565b82529284019290840190611e4c565b80955050505050509250925092565b600082601f830112611e8c57600080fd5b81356020611e9c611c6e83611c29565b8083825260208201915060208460051b870101935086841115611ebe57600080fd5b602086015b84811015611cb157611ed4816119bb565b8352918301918301611ec3565b60008060408385031215611ef457600080fd5b823567ffffffffffffffff80821115611f0c57600080fd5b611f1886838701611e7b565b93506020850135915080821115611f2e57600080fd5b50611f3b85828601611c4d565b9150509250929050565b60008151808452602080850194506020840160005b83811015611f7657815187529582019590820190600101611f5a565b509495945050505050565b602081526000611a346020830184611f45565b600080600060608486031215611fa957600080fd5b833567ffffffffffffffff80821115611fc157600080fd5b611fcd87838801611e7b565b9450602091508186013581811115611fe457600080fd5b611ff088828901611c4d565b94505060408601358181111561200557600080fd5b86019050601f8101871361201857600080fd5b8035612026611c6e82611c29565b81815260059190911b8201830190838101908983111561204557600080fd5b928401925b82841015611e6c5761205b84611b2b565b8252928401929084019061204a565b6000806040838503121561207d57600080fd5b612086836119bb565b9150611b7160208401611d86565b600080604083850312156120a757600080fd5b6120b0836119bb565b9150611b71602084016119bb565b600080600080600060a086880312156120d657600080fd5b6120df866119bb565b94506120ed602087016119bb565b93506040860135925060608601359150608086013567ffffffffffffffff81111561211757600080fd5b611d7988828901611cbc565b60006020828403121561213557600080fd5b5051919050565b600181811c9082168061215057607f821691505b60208210810361217057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761047a5761047a612176565b6000826121c057634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f821115612223576000816000526020600020601f850160051c810160208610156122045750805b601f850160051c820191505b8181101561099757828155600101612210565b505050565b815167ffffffffffffffff81111561224257612242611a3b565b61225681612250845461213c565b846121db565b602080601f83116001811461228b57600084156122735750858301515b600019600386901b1c1916600185901b178555610997565b600085815260208120601f198616915b828110156122ba5788860151825594840194600190910190840161229b565b50858210156122d85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561047a5761047a612176565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a0608083015261233360a0830184611bb5565b979650505050505050565b60006020828403121561235057600080fd5b8151611a3481611a01565b60006001600160a01b03808816835280871660208401525060a0604083015261238760a0830186611f45565b82810360608401526123998186611f45565b905082810360808401526123ad8185611bb5565b98975050505050505050565b6040815260006123cc6040830185611f45565b82810360208401526123de8185611f45565b9594505050505056fea264697066735822122044fe0a9be37bd3d7273a251427f2be2263872a889e55b5902939668ed3a9606264736f6c6343000818003300000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000005000000000000000000000000307b00dd72a29e0828b52947a2adcd9e899167c90000000000000000000000009771bbd992cc58ea13829e6c046298472cfbe04200000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000003f697066733a2f2f516d4e5a57795a55555267565a4e46744443774c47355a6274654e646841525932777544517777793144675071522f7b69647d2e6a736f6e00
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101a25760003560e01c80634e1273f4116100ee57806391ba317a11610097578063bd85b03911610071578063bd85b039146103d6578063e985e9c5146103f6578063f242432a14610432578063f2fde38b1461044557600080fd5b806391ba317a146103a75780639e05a882146103b0578063a22cb465146103c357600080fd5b8063715018a6116100c8578063715018a61461037b5780638329de2f146103835780638da5cb5b1461039657600080fd5b80634e1273f4146102e95780634f558e7914610309578063686dd20b1461032b57600080fd5b806318160ddd116101505780632d744b111161012a5780632d744b11146102985780632eb2c2d6146102c3578063473d0c96146102d657600080fd5b806318160ddd1461024b57806326afbe41146102535780632a55205a1461026657600080fd5b806304634d8d1161018157806304634d8d146102055780630e6602fb146102185780630e89341c1461022b57600080fd5b8062fdd58e146101a757806301ffc9a7146101cd57806302fe5305146101f0575b600080fd5b6101ba6101b53660046119d7565b610458565b6040519081526020015b60405180910390f35b6101e06101db366004611a17565b610480565b60405190151581526020016101c4565b6102036101fe366004611ada565b61048b565b005b610203610213366004611b47565b61049f565b610203610226366004611b7a565b6104b5565b61023e610239366004611b9c565b610753565b6040516101c49190611bfb565b6004546101ba565b610203610261366004611c0e565b6107e7565b610279610274366004611b7a565b61085e565b604080516001600160a01b0390931683526020830191909152016101c4565b600b546102ab906001600160a01b031681565b6040516001600160a01b0390911681526020016101c4565b6102036102d1366004611cdc565b610919565b6102036102e4366004611d96565b61099f565b6102fc6102f7366004611ee1565b610a40565b6040516101c49190611f81565b6101e0610317366004611b9c565b600090815260036020526040902054151590565b61035e610339366004611b9c565b6009602052600090815260409020805460019091015460ff8082169161010090041683565b6040805193845291151560208401521515908201526060016101c4565b610203610b0d565b610203610391366004611b9c565b610b21565b6007546001600160a01b03166102ab565b6101ba600a5481565b6102036103be366004611f94565b610b32565b6102036103d136600461206a565b610c02565b6101ba6103e4366004611b9c565b60009081526003602052604090205490565b6101e0610404366004612094565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6102036104403660046120be565b610c0d565b610203610453366004611c0e565b610c8b565b6000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b600061047a82610cdf565b610493610d1d565b61049c81610d63565b50565b6104a7610d1d565b6104b18282610d6f565b5050565b6104bd610e53565b6000828152600960209081526040918290208251606081018452815480825260019092015460ff8082161515948301949094526101009004909216151592820192909252600a5484921180610519575060408101511515600114155b15610558576040517fbada3012000000000000000000000000000000000000000000000000000000008152600481018390526024015b60405180910390fd5b8280600003610593576040517f2160733900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b546040517efdd58e000000000000000000000000000000000000000000000000000000008152336004820152602481018790526000916001600160a01b03169062fdd58e90604401602060405180830381865afa1580156105fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061e9190612123565b905084811015610658576040516303dee4c560e01b815233600482015260248101829052604481018690526064810187905260840161054f565b600b546040517ff5298aca00000000000000000000000000000000000000000000000000000000815233600482015260248101889052604481018790526001600160a01b039091169063f5298aca90606401600060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b50505060008781526009602090815260409182902082516060810184528154815260019091015460ff8082161580159484019490945261010090910416151592810192909252909150610744576107443382600001518860405180602001604052806000815250610e96565b50505050506104b16001600855565b6060600280546107629061213c565b80601f016020809104026020016040519081016040528092919081815260200182805461078e9061213c565b80156107db5780601f106107b0576101008083540402835291602001916107db565b820191906000526020600020905b8154815290600101906020018083116107be57829003601f168201915b50505050509050919050565b6107ef610d1d565b6001600160a01b03811661082f576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60008281526006602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916108dd5750604080518082019091526005546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090610901906bffffffffffffffffffffffff168761218c565b61090b91906121a3565b915196919550909350505050565b336001600160a01b038616811480159061095957506001600160a01b0380871660009081526001602090815260408083209385168352929052205460ff16155b1561098a5760405163711bec9160e11b81526001600160a01b0380831660048301528716602482015260440161054f565b6109978686868686610ef3565b505050505050565b6109a7610d1d565b8160005b8151811015610a2e57600a548282815181106109c9576109c96121c5565b60200260200101511115610a26578181815181106109e9576109e96121c5565b60200260200101516040517f925d6b1800000000000000000000000000000000000000000000000000000000815260040161054f91815260200190565b6001016109ab565b50610a3a848484610f5a565b50505050565b60608151835114610a715781518351604051635b05999160e01b81526004810192909252602482015260440161054f565b6000835167ffffffffffffffff811115610a8d57610a8d611a3b565b604051908082528060200260200182016040528015610ab6578160200160208202803683370190505b50905060005b8451811015610b0557602080820286010151610ae090602080840287010151610458565b828281518110610af257610af26121c5565b6020908102919091010152600101610abc565b509392505050565b610b15610d1d565b610b1f60006110c6565b565b610b29610d1d565b61049c81600a55565b610b3a610d1d565b8151835114610b695782518251604051635b05999160e01b81526004810192909252602482015260440161054f565b8051825114610b985781518151604051635b05999160e01b81526004810192909252602482015260440161054f565b60005b8351811015610a3a57610bfa838281518110610bb957610bb96121c5565b6020026020010151858381518110610bd357610bd36121c5565b6020026020010151848481518110610bed57610bed6121c5565b6020026020010151611125565b600101610b9b565b6104b1338383611228565b336001600160a01b0386168114801590610c4d57506001600160a01b0380871660009081526001602090815260408083209385168352929052205460ff16155b15610c7e5760405163711bec9160e11b81526001600160a01b0380831660048301528716602482015260440161054f565b61099786868686866112d8565b610c93610d1d565b6001600160a01b038116610cd6576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526000600482015260240161054f565b61049c816110c6565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061047a575061047a82611366565b6007546001600160a01b03163314610b1f576040517f118cdaa700000000000000000000000000000000000000000000000000000000815233600482015260240161054f565b60026104b18282612228565b6127106bffffffffffffffffffffffff8216811015610dd1576040517f6f483d090000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff831660048201526024810182905260440161054f565b6001600160a01b038316610e14576040517fb6d9900a0000000000000000000000000000000000000000000000000000000081526000600482015260240161054f565b50604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217600555565b600260085403610e8f576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600855565b6001600160a01b038416610ec057604051632bfa23e760e11b81526000600482015260240161054f565b60408051600180825260208201869052818301908152606082018590526080820190925290610997600087848487611401565b6001600160a01b038416610f1d57604051632bfa23e760e11b81526000600482015260240161054f565b6001600160a01b038516610f4657604051626a0d4560e21b81526000600482015260240161054f565b610f538585858585611401565b5050505050565b8151835114610f895782518251604051635b05999160e01b81526004810192909252602482015260440161054f565b8051825114610fb85781518151604051635b05999160e01b81526004810192909252602482015260440161054f565b60005b8351811015610a3a57828181518110610fd657610fd66121c5565b602002602001015160096000868481518110610ff457610ff46121c5565b6020026020010151815260200190815260200160002060000181905550818181518110611023576110236121c5565b602002602001015160096000868481518110611041576110416121c5565b6020026020010151815260200190815260200160002060010160006101000a81548160ff021916908315150217905550600160096000868481518110611089576110896121c5565b6020026020010151815260200190815260200160002060010160016101000a81548160ff0219169083151502179055508080600101915050610fbb565b600780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106bffffffffffffffffffffffff821681101561118e576040517fdfd1fc1b000000000000000000000000000000000000000000000000000000008152600481018590526bffffffffffffffffffffffff831660248201526044810182905260640161054f565b6001600160a01b0383166111d8576040517f969f0852000000000000000000000000000000000000000000000000000000008152600481018590526000602482015260440161054f565b506040805180820182526001600160a01b0393841681526bffffffffffffffffffffffff92831660208083019182526000968752600690529190942093519051909116600160a01b029116179055565b6001600160a01b03821661126b576040517fced3e1000000000000000000000000000000000000000000000000000000000081526000600482015260240161054f565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03841661130257604051632bfa23e760e11b81526000600482015260240161054f565b6001600160a01b03851661132b57604051626a0d4560e21b81526000600482015260240161054f565b6040805160018082526020820186905281830190815260608201859052608082019092529061135d8787848487611401565b50505050505050565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806113c957506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061047a57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161461047a565b61140d85858585611454565b6001600160a01b03841615610f535782513390600103611446576020848101519084015161143f83898985858961159a565b5050610997565b6109978187878787876116be565b611460848484846117a7565b6001600160a01b03841661150a576000805b83518110156114f057600083828151811061148f5761148f6121c5565b6020026020010151905080600360008785815181106114b0576114b06121c5565b6020026020010151815260200190815260200160002060008282546114d591906122e8565b909155506114e5905081846122e8565b925050600101611472565b50806004600082825461150391906122e8565b9091555050505b6001600160a01b038316610a3a576000805b8351811015611589576000838281518110611539576115396121c5565b60200260200101519050806003600087858151811061155a5761155a6121c5565b60209081029190910181015182528101919091526040016000208054919091039055919091019060010161151c565b506004805491909103905550505050565b6001600160a01b0384163b156109975760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906115de90899089908890889088906004016122fb565b6020604051808303816000875af1925050508015611619575060408051601f3d908101601f191682019092526116169181019061233e565b60015b611682573d808015611647576040519150601f19603f3d011682016040523d82523d6000602084013e61164c565b606091505b50805160000361167a57604051632bfa23e760e11b81526001600160a01b038616600482015260240161054f565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b1461135d57604051632bfa23e760e11b81526001600160a01b038616600482015260240161054f565b6001600160a01b0384163b156109975760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611702908990899088908890889060040161235b565b6020604051808303816000875af192505050801561173d575060408051601f3d908101601f1916820190925261173a9181019061233e565b60015b61176b573d808015611647576040519150601f19603f3d011682016040523d82523d6000602084013e61164c565b6001600160e01b0319811663bc197c8160e01b1461135d57604051632bfa23e760e11b81526001600160a01b038616600482015260240161054f565b80518251146117d65781518151604051635b05999160e01b81526004810192909252602482015260440161054f565b3360005b83518110156118dc576020818102858101820151908501909101516001600160a01b0388161561188d576000828152602081815260408083206001600160a01b038c16845290915290205481811015611866576040516303dee4c560e01b81526001600160a01b038a16600482015260248101829052604481018390526064810184905260840161054f565b6000838152602081815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b038716156118d2576000828152602081815260408083206001600160a01b038b168452909152812080548392906118cc9084906122e8565b90915550505b50506001016117da565b50825160010361195d5760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62858560405161194e929190918252602082015260400190565b60405180910390a45050610f53565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516119ac9291906123b9565b60405180910390a45050505050565b80356001600160a01b03811681146119d257600080fd5b919050565b600080604083850312156119ea57600080fd5b6119f3836119bb565b946020939093013593505050565b6001600160e01b03198116811461049c57600080fd5b600060208284031215611a2957600080fd5b8135611a3481611a01565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611a7a57611a7a611a3b565b604052919050565b600067ffffffffffffffff831115611a9c57611a9c611a3b565b611aaf601f8401601f1916602001611a51565b9050828152838383011115611ac357600080fd5b828260208301376000602084830101529392505050565b600060208284031215611aec57600080fd5b813567ffffffffffffffff811115611b0357600080fd5b8201601f81018413611b1457600080fd5b611b2384823560208401611a82565b949350505050565b80356bffffffffffffffffffffffff811681146119d257600080fd5b60008060408385031215611b5a57600080fd5b611b63836119bb565b9150611b7160208401611b2b565b90509250929050565b60008060408385031215611b8d57600080fd5b50508035926020909101359150565b600060208284031215611bae57600080fd5b5035919050565b6000815180845260005b81811015611bdb57602081850181015186830182015201611bbf565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000611a346020830184611bb5565b600060208284031215611c2057600080fd5b611a34826119bb565b600067ffffffffffffffff821115611c4357611c43611a3b565b5060051b60200190565b600082601f830112611c5e57600080fd5b81356020611c73611c6e83611c29565b611a51565b8083825260208201915060208460051b870101935086841115611c9557600080fd5b602086015b84811015611cb15780358352918301918301611c9a565b509695505050505050565b600082601f830112611ccd57600080fd5b611a3483833560208501611a82565b600080600080600060a08688031215611cf457600080fd5b611cfd866119bb565b9450611d0b602087016119bb565b9350604086013567ffffffffffffffff80821115611d2857600080fd5b611d3489838a01611c4d565b94506060880135915080821115611d4a57600080fd5b611d5689838a01611c4d565b93506080880135915080821115611d6c57600080fd5b50611d7988828901611cbc565b9150509295509295909350565b803580151581146119d257600080fd5b600080600060608486031215611dab57600080fd5b833567ffffffffffffffff80821115611dc357600080fd5b611dcf87838801611c4d565b9450602091508186013581811115611de657600080fd5b611df288828901611c4d565b945050604086013581811115611e0757600080fd5b86019050601f81018713611e1a57600080fd5b8035611e28611c6e82611c29565b81815260059190911b82018301908381019089831115611e4757600080fd5b928401925b82841015611e6c57611e5d84611d86565b82529284019290840190611e4c565b80955050505050509250925092565b600082601f830112611e8c57600080fd5b81356020611e9c611c6e83611c29565b8083825260208201915060208460051b870101935086841115611ebe57600080fd5b602086015b84811015611cb157611ed4816119bb565b8352918301918301611ec3565b60008060408385031215611ef457600080fd5b823567ffffffffffffffff80821115611f0c57600080fd5b611f1886838701611e7b565b93506020850135915080821115611f2e57600080fd5b50611f3b85828601611c4d565b9150509250929050565b60008151808452602080850194506020840160005b83811015611f7657815187529582019590820190600101611f5a565b509495945050505050565b602081526000611a346020830184611f45565b600080600060608486031215611fa957600080fd5b833567ffffffffffffffff80821115611fc157600080fd5b611fcd87838801611e7b565b9450602091508186013581811115611fe457600080fd5b611ff088828901611c4d565b94505060408601358181111561200557600080fd5b86019050601f8101871361201857600080fd5b8035612026611c6e82611c29565b81815260059190911b8201830190838101908983111561204557600080fd5b928401925b82841015611e6c5761205b84611b2b565b8252928401929084019061204a565b6000806040838503121561207d57600080fd5b612086836119bb565b9150611b7160208401611d86565b600080604083850312156120a757600080fd5b6120b0836119bb565b9150611b71602084016119bb565b600080600080600060a086880312156120d657600080fd5b6120df866119bb565b94506120ed602087016119bb565b93506040860135925060608601359150608086013567ffffffffffffffff81111561211757600080fd5b611d7988828901611cbc565b60006020828403121561213557600080fd5b5051919050565b600181811c9082168061215057607f821691505b60208210810361217057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761047a5761047a612176565b6000826121c057634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f821115612223576000816000526020600020601f850160051c810160208610156122045750805b601f850160051c820191505b8181101561099757828155600101612210565b505050565b815167ffffffffffffffff81111561224257612242611a3b565b61225681612250845461213c565b846121db565b602080601f83116001811461228b57600084156122735750858301515b600019600386901b1c1916600185901b178555610997565b600085815260208120601f198616915b828110156122ba5788860151825594840194600190910190840161229b565b50858210156122d85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561047a5761047a612176565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a0608083015261233360a0830184611bb5565b979650505050505050565b60006020828403121561235057600080fd5b8151611a3481611a01565b60006001600160a01b03808816835280871660208401525060a0604083015261238760a0830186611f45565b82810360608401526123998186611f45565b905082810360808401526123ad8185611bb5565b98975050505050505050565b6040815260006123cc6040830185611f45565b82810360208401526123de8185611f45565b9594505050505056fea264697066735822122044fe0a9be37bd3d7273a251427f2be2263872a889e55b5902939668ed3a9606264736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000005000000000000000000000000307b00dd72a29e0828b52947a2adcd9e899167c90000000000000000000000009771bbd992cc58ea13829e6c046298472cfbe04200000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000003f697066733a2f2f516d4e5a57795a55555267565a4e46744443774c47355a6274654e646841525932777544517777793144675071522f7b69647d2e6a736f6e00
-----Decoded View---------------
Arg [0] : uri_ (string): ipfs://QmNZWyZUURgVZNFtDCwLG5ZbteNdhARY2wuDQwwy1DgPqR/{id}.json
Arg [1] : maxTokenId_ (uint256): 5
Arg [2] : partnerContract_ (address): 0x307b00dd72A29e0828b52947a2AdcD9e899167c9
Arg [3] : royaltyAddress_ (address): 0x9771Bbd992Cc58Ea13829e6C046298472CfBE042
Arg [4] : royaltyFee_ (uint96): 1000
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [2] : 000000000000000000000000307b00dd72a29e0828b52947a2adcd9e899167c9
Arg [3] : 0000000000000000000000009771bbd992cc58ea13829e6c046298472cfbe042
Arg [4] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [5] : 000000000000000000000000000000000000000000000000000000000000003f
Arg [6] : 697066733a2f2f516d4e5a57795a55555267565a4e46744443774c47355a6274
Arg [7] : 654e646841525932777544517777793144675071522f7b69647d2e6a736f6e00
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.