Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- VanguardDailyDrop
- Optimization enabled
- true
- Compiler version
- v0.8.24+commit.e11b9ed9
- Optimization runs
- 100
- EVM Version
- paris
- Verified at
- 2024-06-03T23:23:48.685061Z
contracts/VanguardDailyDrop.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract VanguardDailyDrop is ERC1155, Ownable { string public name = "VanguardDailyDrop"; bool public open = true; uint256 public startDate = 1717434000; // Mon Jun 3 2024 10:00:00 PDT-0700 (Pacific Daylight Time) mapping(uint256 => mapping(address => bool[42])) private _dailyMints; // Day -> Wallet -> Vanguards minted today constructor() ERC1155("ipfs://Qmd5Z2pV3E2NNbp9fpTzgoJ1MjWriVBRHYqHC6q2KReFdx/{id}.json") Ownable(msg.sender) {} function toggleOpenState(bool state) public onlyOwner { open = state; } // for anyone on-chain who wants to mint themselves function mint(uint256 id) public { _mintTo(msg.sender, id); } // used by the remote server to mint to other people's addresses function mintTo(address to, uint256 id) public { _mintTo(to, id); } // used to verify users had minted for a particular day of the drop function receivedMints(address minter, uint256 day) external view returns (bool[42] memory) { return _dailyMints[day][minter]; } function _mintTo(address to, uint256 id) private { require(open, "Mint not open."); require(id >= 0 && id <= 41, "Invalid NFT ID."); // calculate which day, based on time passed since startDate uint256 day = ((block.timestamp - startDate) / 1 days); // check the user hasn't already minted token id today require(!_dailyMints[day][to][id], "This address has already minted this nft today."); // update mapping to track, and mint the vanguard _dailyMints[day][to][id] = true; _mint(to, id, 1, ""); } function getCurrentMintDay() external view returns (uint256) { return ((block.timestamp - startDate) / 1 days); } // standard function form ERC721 for showing NFT metadata on OpenSea... function tokenURI(uint tokenId) external view returns (string memory) { return uri(tokenId); } // prevent transfer function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override { if (from != address(0) && to != address(0)) { revert("Transfers are not allowed"); } super._update(from, to, ids, values); } }
@openzeppelin/contracts/access/Ownable.sol
// 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); } }
@openzeppelin/contracts/interfaces/draft-IERC6093.sol
// 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); }
@openzeppelin/contracts/token/ERC1155/ERC1155.sol
// 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)) } } }
@openzeppelin/contracts/token/ERC1155/IERC1155.sol
// 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; }
@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// 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); }
@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// 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); }
@openzeppelin/contracts/utils/Arrays.sol
// 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))) } } }
@openzeppelin/contracts/utils/Context.sol
// 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; } }
@openzeppelin/contracts/utils/StorageSlot.sol
// 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 } } }
@openzeppelin/contracts/utils/introspection/ERC165.sol
// 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; } }
@openzeppelin/contracts/utils/introspection/IERC165.sol
// 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); }
@openzeppelin/contracts/utils/math/Math.sol
// 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; } }
Compiler Settings
{"viaIR":true,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":100,"enabled":true,"details":{"yulDetails":{"optimizerSteps":"u"}}},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"ERC1155InsufficientBalance","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"needed","internalType":"uint256"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"error","name":"ERC1155InvalidApprover","inputs":[{"type":"address","name":"approver","internalType":"address"}]},{"type":"error","name":"ERC1155InvalidArrayLength","inputs":[{"type":"uint256","name":"idsLength","internalType":"uint256"},{"type":"uint256","name":"valuesLength","internalType":"uint256"}]},{"type":"error","name":"ERC1155InvalidOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"error","name":"ERC1155InvalidReceiver","inputs":[{"type":"address","name":"receiver","internalType":"address"}]},{"type":"error","name":"ERC1155InvalidSender","inputs":[{"type":"address","name":"sender","internalType":"address"}]},{"type":"error","name":"ERC1155MissingApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TransferBatch","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256[]","name":"ids","internalType":"uint256[]","indexed":false},{"type":"uint256[]","name":"values","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"TransferSingle","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"id","internalType":"uint256","indexed":false},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"URI","inputs":[{"type":"string","name":"value","internalType":"string","indexed":false},{"type":"uint256","name":"id","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"balanceOfBatch","inputs":[{"type":"address[]","name":"accounts","internalType":"address[]"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentMintDay","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"uint256","name":"id","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mintTo","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"open","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool[42]","name":"","internalType":"bool[42]"}],"name":"receivedMints","inputs":[{"type":"address","name":"minter","internalType":"address"},{"type":"uint256","name":"day","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeBatchTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"uint256[]","name":"values","internalType":"uint256[]"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startDate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"toggleOpenState","inputs":[{"type":"bool","name":"state","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"uri","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234620000265762000014620002cb565b60405161206a62000592823961206a90f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b038211176200006357604052565b6200002b565b90620000806200007860405190565b928362000041565b565b6001600160401b0381116200006357602090601f01601f19160190565b90620000b5620000af8362000082565b62000069565b918252565b620000c6603f6200009f565b7f697066733a2f2f516d64355a3270563345324e4e6270396670547a676f4a314d60208201527f6a57726956425248597148433671324b52654664782f7b69647d2e6a736f6e00604082015290565b6200011f620000ba565b90565b634e487b7160e01b600052602260045260246000fd5b90600160028304921680156200015b575b60208310146200015557565b62000122565b91607f169162000149565b9160001960089290920291821b911b5b9181191691161790565b6200011f6200011f6200011f9290565b9190620001a56200011f620001ae9362000180565b90835462000166565b9055565b620000809160009162000190565b818110620001cc575050565b80620001dc6000600193620001b2565b01620001c0565b9190601f8111620001f357505050565b620002076200008093600052602060002090565b906020601f8401819004830193106200022b575b6020601f909101040190620001c0565b90915081906200021b565b6200024f601162000248835462000138565b83620001e3565b7f56616e67756172644461696c7944726f700000000000000000000000000000229055565b620000809062000236565b9060ff9062000176565b906200029c6200011f620001ae92151590565b82546200027f565b906000199062000176565b90620002c36200011f620001ae9262000180565b8254620002a4565b620002e0620002d962000115565b3362000353565b620002ec600462000274565b620002fa6001600562000289565b6200008063665df6906006620002af565b6200031b6200011f6200011f9290565b6001600160a01b031690565b6200011f906200030b565b6200033d906200031b565b9052565b60208101929162000080919062000332565b906200035f90620003bd565b6200036b600062000327565b62000376816200031b565b62000381836200031b565b14620003935750620000809062000437565b620003b990620003a260405190565b631e4fbdf760e01b81529182916004830162000341565b0390fd5b620000809062000584565b6200011f906200031b565b6200011f9054620003c8565b906001600160a01b039062000176565b6200011f906200031b906001600160a01b031682565b6200011f90620003ef565b6200011f9062000405565b906200042f6200011f620001ae9262000410565b8254620003df565b620004656200045e6200044b6003620003d3565b620004588460036200041b565b62000410565b9162000410565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06200049160405190565b600090a3565b90620004a1815190565b906001600160401b0382116200006357620004c982620004c2855462000138565b85620001e3565b602090601f83116001146200050857620001ae929160009183620004fc575b5050600019600883021c1916906002021790565b015190503880620004e8565b601f198316916200051e85600052602060002090565b9260005b8181106200055f5750916002939185600196941062000545575b50505002019055565b01516000196008601f8516021c191690553880806200053c565b9193602060018192878701518155019501920162000522565b90620000809162000497565b620000809060026200057856fe6080604052600436101561001257600080fd5b60003560e01c8062fdd58e1461015157806301ffc9a71461014c57806306fdde03146101475780630927d679146101425780630b97bc861461013d5780630e89341c146101385780632d931e0f146101335780632eb2c2d61461012e5780632ebfbe9714610129578063449a52f8146101245780634e1273f41461011f578063715018a61461011a5780638da5cb5b14610115578063a0712d6814610110578063a22cb4651461010b578063c87b56dd14610106578063e985e9c514610101578063f242432a146100fc578063f2fde38b146100f75763fcfff16f0361017557610a48565b610a0a565b6109da565b61097d565b61093f565b610926565b6108eb565b6108c4565b610893565b61086b565b610743565b610728565b61070c565b610567565b610523565b6104f4565b6104aa565b61042c565b610224565b6101c3565b6001600160a01b031690565b90565b61016e81610156565b0361017557565b600080fd5b9050359061018782610165565b565b8061016e565b9050359061018782610189565b9190604083820312610175576101629060206101b8828661017a565b940161018f565b9052565b34610175576101ef6101df6101d936600461019c565b90610ac9565b6040519182918290815260200190565b0390f35b6001600160e01b0319811661016e565b90503590610187826101f3565b906020828203126101755761016291610203565b34610175576101ef61023f61023a366004610210565b610aee565b6040515b91829182901515815260200190565b600091031261017557565b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052602260045260246000fd5b90600160028304921680156102a9575b60208310146102a457565b610273565b91607f1691610299565b805460009392916102d06102c683610289565b8085529360200190565b916001811690811561032257506001146102e957505050565b6102fc9192939450600052602060002090565b916000925b81841061030e5750500190565b805484840152602090930192600101610301565b92949550505060ff1916825215156020020190565b90610162916102b3565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b0382111761037857604052565b610341565b906101876103979261038e60405190565b93848092610337565b0383610357565b906000106103af576101629061037d565b61025d565b6101626000600461039e565b60005b8381106103d35750506000910152565b81810151838201526020016103c3565b61040461040d602093610417936103f8815190565b80835293849260200190565b958691016103c0565b601f01601f191690565b0190565b6020808252610162929101906103e3565b346101755761043c366004610252565b6101ef6104476103b4565b6040519182918261041b565b61046361045f602a9390565b9190565b6000915b8383106104745750505050565b61049061048960019284511515815260200190565b9260200190565b92019190610467565b610540810192916101879190610453565b34610175576101ef6104c66104c036600461019c565b906110c6565b60405191829182610499565b610162916008021c81565b9061016291546104d2565b610162600060066104dd565b3461017557610504366004610252565b6101ef6101df6104e8565b90602082820312610175576101629161018f565b34610175576101ef61044761053936600461050f565b6110ef565b80151561016e565b905035906101878261053e565b906020828203126101755761016291610546565b346101755761057f61057a366004610553565b611140565b604051005b9061018761059160405190565b9283610357565b6001600160401b0381116103785760208091020190565b909291926105c46105bf82610598565b610584565b938185526020808601920283019281841161017557915b8383106105e85750505050565b602080916105f6848661018f565b8152019201916105db565b9080601f8301121561017557816020610162933591016105af565b6001600160401b03811161037857602090601f01601f19160190565b90826000939282370152565b909291926106546105bf8261061c565b938185528183011161017557610187916020850190610638565b9080601f830112156101755781602061016293359101610644565b91909160a081840312610175576106a0838261017a565b926106ae816020840161017a565b9260408301356001600160401b03811161017557826106ce918501610601565b9260608101356001600160401b03811161017557836106ee918301610601565b9260808201356001600160401b03811161017557610162920161066e565b346101755761057f61071f366004610689565b9392909261116b565b3461017557610738366004610252565b6101ef6101df611226565b346101755761057f61075636600461019c565b9061124e565b9092919261076c6105bf82610598565b938185526020808601920283019281841161017557915b8383106107905750505050565b6020809161079e848661017a565b815201920191610783565b9080601f83011215610175578160206101629335910161075c565b9190916040818403126101755780356001600160401b03811161017557836107ed9183016107a9565b9260208201356001600160401b038111610175576101629201610601565b9061082461048961081a845190565b8084529260200190565b9060005b8181106108355750505090565b90919261085261084b6001928651815260200190565b9460200190565b929101610828565b60208082526101629291019061080b565b34610175576101ef6108876108813660046107c4565b906112d9565b6040519182918261085a565b34610175576108a3366004610252565b61057f6113c0565b6101bf90610156565b60208101929161018791906108ab565b34610175576108d4366004610252565b6101ef6108df6113db565b604051918291826108b4565b346101755761057f6108fe36600461050f565b6113e5565b91906040838203126101755761016290602061091f828661017a565b9401610546565b346101755761057f610939366004610903565b906113ef565b34610175576101ef61044761095536600461050f565b6113fa565b919060408382031261017557610162906020610976828661017a565b940161017a565b34610175576101ef61023f61099336600461095a565b9061140d565b91909160a081840312610175576109b0838261017a565b926109be816020840161017a565b926109cc826040850161018f565b926106ee836060830161018f565b346101755761057f6109ed366004610999565b9392909261142d565b90602082820312610175576101629161017a565b346101755761057f610a1d3660046109f6565b6114c9565b610162916008021c5b60ff1690565b906101629154610a22565b61016260006005610a31565b3461017557610a58366004610252565b6101ef61023f610a3c565b6101626101626101629290565b90610a7a90610a63565b600052602052604060002090565b61016290610156906001600160a01b031682565b61016290610a88565b61016290610a9c565b90610a7a90610aa5565b6101629081565b6101629054610ab8565b610ae990610ae461016293610adc600090565b506000610a70565b610aae565b610abf565b636cdb3d1360e11b6001600160e01b0319821614908115610b1e575b8115610b14575090565b61016291506114d2565b6001600160e01b031981166303a24d0760e21b149150610b0a565b6001600160401b0381116103785760200290565b6105bf61016291610b39565b369037565b90610187610b74610b6e84610b4d565b93610b39565b83610b59565b610162602a610b5e565b61016290610a2b565b6101629060081c610a2b565b6101629060101c610a2b565b6101629060181c610a2b565b6101629060201c610a2b565b6101629060281c610a2b565b6101629060301c610a2b565b6101629060381c610a2b565b6101629060401c610a2b565b6101629060481c610a2b565b6101629060501c610a2b565b6101629060581c610a2b565b6101629060601c610a2b565b6101629060681c610a2b565b6101629060701c610a2b565b6101629060781c610a2b565b6101629060801c610a2b565b6101629060881c610a2b565b6101629060901c610a2b565b6101629060981c610a2b565b6101629060a01c610a2b565b6101629060a81c610a2b565b6101629060b01c610a2b565b6101629060b81c610a2b565b6101629060c01c610a2b565b6101629060c81c610a2b565b6101629060d01c610a2b565b6101629060d81c610a2b565b6101629060e01c610a2b565b6101629060e81c610a2b565b6101629060f01c610a2b565b6101629060f81c610a2b565b90600190610d15610d11602a9290565b9390565b90600092610e56575b5054610e38565b15159052565b505050505050565b6001602084610d2b60009596610d2586610bed565b6001602084610d5c839596610d2586610be1565b0193019150610d33565b6001602084610d7a839596610d2586610bd5565b0193019150610d48565b6001602084610d98839596610d2586610bc9565b0193019150610d66565b6001602084610db6839596610d2586610bbd565b0193019150610d84565b6001602084610dd4839596610d2586610bb1565b0193019150610da2565b6001602084610df2839596610d2586610ba5565b0193019150610dc0565b6001602084610e10839596610d2586610b99565b0193019150610dde565b6001602084610e2e839596610d2586610b8d565b0193019150610dfc565b6001602084610e4c839596610d2586610b84565b0193019150610e1a565b601f8301811115610d1e5791909283549080610e7183610b84565b1515905260200180610e8283610b8d565b1515905260200180610e9383610b99565b1515905260200180610ea483610ba5565b1515905260200180610eb583610bb1565b1515905260200180610ec683610bbd565b1515905260200180610ed783610bc9565b1515905260200180610ee883610bd5565b1515905260200180610ef983610be1565b1515905260200180610f0a83610bed565b1515905260200180610f1b83610bf9565b1515905260200180610f2c83610c05565b1515905260200180610f3d83610c11565b1515905260200180610f4e83610c1d565b1515905260200180610f5f83610c29565b1515905260200180610f7083610c35565b1515905260200180610f8183610c41565b1515905260200180610f9283610c4d565b1515905260200180610fa383610c59565b1515905260200180610fb483610c65565b1515905260200180610fc583610c71565b1515905260200180610fd683610c7d565b1515905260200180610fe783610c89565b1515905260200180610ff883610c95565b151590526020018061100983610ca1565b151590526020018061101a83610cad565b151590526020018061102b83610cb9565b151590526020018061103c83610cc5565b151590526020018061104d83610cd1565b151590526020018061105e83610cdd565b151590526020018061106f83610ce9565b151590526020016110808192610cf5565b15159052602001926001019060200191610e56565b906104178161054093610d01565b90610187610397926110b460405190565b93848092611095565b610162906110a3565b6110e190610ae4610162936110d9610b7a565b506007610a70565b6110bd565b6101629061037d565b5061016260026110e6565b610187906111066114f0565b611135565b9060ff905b9181191691161790565b9061112a61016261113192151590565b825461110b565b9055565b61018790600561111a565b610187906110fa565b916020610187929493611164604082019660008301906108ab565b01906108ab565b94939291903361117a81610156565b61118388610156565b1415806111c2575b61119a57506101879495611537565b86906111be6111a860405190565b63711bec9160e11b815292839260048401611149565b0390fd5b506111d46111d0828961140d565b1590565b61118b565b634e487b7160e01b600052601160045260246000fd5b919082039182116111fc57565b6111d9565b634e487b7160e01b600052601260045260246000fd5b8115611221570490565b611201565b61016261123c6112366006610abf565b426111ef565b61124862015180610a63565b90611217565b9061018791611716565b9081526040810192916101879160200152565b0152565b9061127c6105bf83610598565b918252565b906101876112976112918461126f565b93610598565b601f190160208401610b59565b634e487b7160e01b600052603260045260246000fd5b906112c3825190565b8110156112d4576020809102010190565b6112a4565b9081516112ea61045f610162845190565b03611358576112ff6112fa835190565b611281565b9161130a6000610a63565b611315610162835190565b811015611352578061134761133a61133061134d94866117d2565b6101d984886117d2565b61134483886112ba565b52565b60010190565b61130a565b50505090565b519051611365565b915190565b906111be61137260405190565b635b05999160e01b815292839260048401611258565b6113906114f0565b6101876113ae565b6101566101626101629290565b61016290611398565b6101876113bb60006113a5565b61180e565b610187611388565b61016290610156565b61016290546113c8565b61016260036113d1565b6101879033611716565b610187919033611867565b610162906110ef565b6101629054610b84565b61016291610ae461142892611420600090565b506001610aae565b611403565b94939291903361143c81610156565b61144588610156565b14158061145c575b61119a575061018794956118fe565b5061146a6111d0828961140d565b61144d565b6101879061147b6114f0565b61148560006113a5565b61148e81610156565b61149783610156565b146114a657506101879061180e565b6111be906114b360405190565b631e4fbdf760e01b8152918291600483016108b4565b6101879061146f565b6114ec6301ffc9a760e01b5b916001600160e01b03191690565b1490565b6114f86113db565b339061150c61150683610156565b91610156565b036115145750565b6111be9061152160405190565b63118cdaa760e01b8152918291600483016108b4565b949392919061154660006113a5565b9561155087610156565b61155983610156565b146115a25761156787610156565b61157082610156565b146115805761018795965061198b565b6111be8761158d60405190565b626a0d4560e21b8152918291600483016108b4565b6111be876115af60405190565b632bfa23e760e11b8152918291600483016108b4565b156115cc57565b60405162461bcd60e51b815260206004820152600e60248201526d26b4b73a103737ba1037b832b71760911b6044820152606490fd5b1561160957565b60405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21027232a1024a21760891b6044820152606490fd5b909190602a8310156112d457602061165760019290565b8185040193060290565b1561166857565b60405162461bcd60e51b815260206004820152602f60248201527f5468697320616464726573732068617320616c7265616479206d696e7465642060448201526e3a3434b99037333a103a37b230bc9760891b6064820152608490fd5b919060086111109102916116d960ff841b90565b921b90565b91906116ef61016261113193151590565b9083546116c5565b9061127c6105bf8361061c565b61016260006116f7565b610162611704565b6101879161172c6117276005611403565b6115c5565b6117366000610a63565b811015806117ba575b61174890611602565b6117a1600161179b8361178486610ae461176861123c6112366006610abf565b61179461178f6111d06117898861178488610ae4886007610a70565b611640565b90610a31565b611661565b6007610a70565b906116de565b6117ab6001610a63565b906117b461170e565b92611a20565b506117486117c86029610a63565b821115905061173f565b90602080916117df600090565b50029101015190565b906001600160a01b0390611110565b9061180761016261113192610aa5565b82546117e8565b61183461182e61181e60036113d1565b6118298460036117f7565b610aa5565b91610aa5565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061185f60405190565b80805b0390a3565b61187160006113a5565b61187a81610156565b61188384610156565b146118dc57506118626118d26118cc83611829876118c788610ae47f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31996001610aae565b61111a565b93610aa5565b9361024360405190565b6111be906118e960405190565b62ced3e160e81b8152918291600483016108b4565b90919493929461190e60006113a5565b61191781610156565b61192085610156565b1461197e5761192e81610156565b61193784610156565b146119715750610187949561196960405192600184526020840152604083019160018352602083015260408201604052565b92909161198b565b6111be9061158d60405190565b6111be906115af60405190565b9193929061199b82868386611a80565b6119ad6119a860006113a5565b610156565b6119b682610156565b036119c3575b5050505050565b33926119cd865190565b6119da61045f6001610a63565b03611a1057611a00611a06966119fa6119f36000610a63565b80926117d2565b946117d2565b93611cf2565b38808080806119bc565b611a1b959293611ba9565b611a06565b90939291611a2e60006113a5565b94611a3886610156565b611a4184610156565b14611a735761018794959161196960405192600184526020840152604083019160018352602083015260408201604052565b6111be866115af60405190565b929190611a8d60006113a5565b611a9681610156565b611a9f86610156565b14159081611af7575b50611ab65761018793611e16565b60405162461bcd60e51b8152602060048201526019602482015278151c985b9cd9995c9cc8185c99481b9bdd08185b1b1bddd959603a1b6044820152606490fd5b611b019150610156565b611b0a82610156565b141538611aa8565b90505190610187826101f3565b906020828203126101755761016291611b12565b9390611b6e906101629694611b61611b7c95611b5760a08a019460008b01906108ab565b60208901906108ab565b868203604088015261080b565b90848203606086015261080b565b9160808184039101526103e3565b3d15611ba457611b993d6116f7565b903d6000602084013e565b606090565b92919490853b611bbc61045f6000610a63565b11611bc957505050505050565b6000602094611c01611bdd6118298a610aa5565b94611be760405190565b9889978896879563bc197c8160e01b875260048701611b33565b03925af160009181611c78575b50611c5d5750611c24565b388080808080610d2b565b611c2c611b8a565b90611c35825190565b611c4261045f6000610a63565b03611c54576111be906115af60405190565b50805190602001fd5b611c6d63bc197c8160e01b6114de565b0361197e5750611c19565b611c9b91925060203d602011611ca2575b611c938183610357565b810190611b1f565b9038611c0e565b503d611c89565b9193611cde6101629694611cd7611ce59497611ccd60a088019960008901906108ab565b60208701906108ab565b6040850152565b6060830152565b60808184039101526103e3565b92919490853b611d0561045f6000610a63565b11611d1257505050505050565b6000602094611d4a611d266118298a610aa5565b94611d3060405190565b9889978896879563f23a6e6160e01b875260048701611ca9565b03925af160009181611d72575b50611d625750611c24565b611c6d63f23a6e6160e01b6114de565b611d8c91925060203d602011611ca257611c938183610357565b9038611d57565b61126b61018794611dbc606094989795611db5608086019a60008701906108ab565b6020850152565b6040830152565b9060001990611110565b90611ddd61016261113192610a63565b8254611dc3565b919082018092116111fc57565b6040808252610162939192611e089184019061080b565b91602081840391015261080b565b9392909192611e23845190565b611e3161045f610162855190565b03612028573393600091611e4483610a63565b611e4f610162845190565b811015611f5f57611e6081846117d2565b90611e6b81876117d2565b91611e75866113a5565b9288611e8085610156565b611e898d610156565b03611ee9575b611e9b611eb395610156565b611ea482610156565b03611eb8575b50505060010190565b611e44565b611ecc611edb91610ae4611ee1958b610a70565b91611ed683610abf565b611de4565b90611dcd565b388088611eaa565b50909192611efe610ae98c610ae4868b610a70565b828110611f3a57611e9b8392611f328a8f611f2d908f968a611f27611eb39d9c9b610ae4930390565b94610a70565b611dcd565b955050611e8f565b8b6111be8585611f4960405190565b6303dee4c560e01b815294859460048601611d93565b5095929491611f6c825190565b611f7961045f6001610a63565b03611fe057611fbf611fbf6118cc7fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f629594611fb96119f3611fc596610a63565b996117d2565b94610aa5565b94611fdb611fd260405190565b92839283611258565b0390a4565b5093612012611fbf611fbf7f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb94610aa5565b94611fdb61201f60405190565b92839283611df1565b5061136561136084519056fea26469706673582212209be2eec483caf7ad2c5c69af99a5135e406f0787753ee2af072c5fc5e8100f2164736f6c63430008180033
Deployed ByteCode
0x6080604052600436101561001257600080fd5b60003560e01c8062fdd58e1461015157806301ffc9a71461014c57806306fdde03146101475780630927d679146101425780630b97bc861461013d5780630e89341c146101385780632d931e0f146101335780632eb2c2d61461012e5780632ebfbe9714610129578063449a52f8146101245780634e1273f41461011f578063715018a61461011a5780638da5cb5b14610115578063a0712d6814610110578063a22cb4651461010b578063c87b56dd14610106578063e985e9c514610101578063f242432a146100fc578063f2fde38b146100f75763fcfff16f0361017557610a48565b610a0a565b6109da565b61097d565b61093f565b610926565b6108eb565b6108c4565b610893565b61086b565b610743565b610728565b61070c565b610567565b610523565b6104f4565b6104aa565b61042c565b610224565b6101c3565b6001600160a01b031690565b90565b61016e81610156565b0361017557565b600080fd5b9050359061018782610165565b565b8061016e565b9050359061018782610189565b9190604083820312610175576101629060206101b8828661017a565b940161018f565b9052565b34610175576101ef6101df6101d936600461019c565b90610ac9565b6040519182918290815260200190565b0390f35b6001600160e01b0319811661016e565b90503590610187826101f3565b906020828203126101755761016291610203565b34610175576101ef61023f61023a366004610210565b610aee565b6040515b91829182901515815260200190565b600091031261017557565b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052602260045260246000fd5b90600160028304921680156102a9575b60208310146102a457565b610273565b91607f1691610299565b805460009392916102d06102c683610289565b8085529360200190565b916001811690811561032257506001146102e957505050565b6102fc9192939450600052602060002090565b916000925b81841061030e5750500190565b805484840152602090930192600101610301565b92949550505060ff1916825215156020020190565b90610162916102b3565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b0382111761037857604052565b610341565b906101876103979261038e60405190565b93848092610337565b0383610357565b906000106103af576101629061037d565b61025d565b6101626000600461039e565b60005b8381106103d35750506000910152565b81810151838201526020016103c3565b61040461040d602093610417936103f8815190565b80835293849260200190565b958691016103c0565b601f01601f191690565b0190565b6020808252610162929101906103e3565b346101755761043c366004610252565b6101ef6104476103b4565b6040519182918261041b565b61046361045f602a9390565b9190565b6000915b8383106104745750505050565b61049061048960019284511515815260200190565b9260200190565b92019190610467565b610540810192916101879190610453565b34610175576101ef6104c66104c036600461019c565b906110c6565b60405191829182610499565b610162916008021c81565b9061016291546104d2565b610162600060066104dd565b3461017557610504366004610252565b6101ef6101df6104e8565b90602082820312610175576101629161018f565b34610175576101ef61044761053936600461050f565b6110ef565b80151561016e565b905035906101878261053e565b906020828203126101755761016291610546565b346101755761057f61057a366004610553565b611140565b604051005b9061018761059160405190565b9283610357565b6001600160401b0381116103785760208091020190565b909291926105c46105bf82610598565b610584565b938185526020808601920283019281841161017557915b8383106105e85750505050565b602080916105f6848661018f565b8152019201916105db565b9080601f8301121561017557816020610162933591016105af565b6001600160401b03811161037857602090601f01601f19160190565b90826000939282370152565b909291926106546105bf8261061c565b938185528183011161017557610187916020850190610638565b9080601f830112156101755781602061016293359101610644565b91909160a081840312610175576106a0838261017a565b926106ae816020840161017a565b9260408301356001600160401b03811161017557826106ce918501610601565b9260608101356001600160401b03811161017557836106ee918301610601565b9260808201356001600160401b03811161017557610162920161066e565b346101755761057f61071f366004610689565b9392909261116b565b3461017557610738366004610252565b6101ef6101df611226565b346101755761057f61075636600461019c565b9061124e565b9092919261076c6105bf82610598565b938185526020808601920283019281841161017557915b8383106107905750505050565b6020809161079e848661017a565b815201920191610783565b9080601f83011215610175578160206101629335910161075c565b9190916040818403126101755780356001600160401b03811161017557836107ed9183016107a9565b9260208201356001600160401b038111610175576101629201610601565b9061082461048961081a845190565b8084529260200190565b9060005b8181106108355750505090565b90919261085261084b6001928651815260200190565b9460200190565b929101610828565b60208082526101629291019061080b565b34610175576101ef6108876108813660046107c4565b906112d9565b6040519182918261085a565b34610175576108a3366004610252565b61057f6113c0565b6101bf90610156565b60208101929161018791906108ab565b34610175576108d4366004610252565b6101ef6108df6113db565b604051918291826108b4565b346101755761057f6108fe36600461050f565b6113e5565b91906040838203126101755761016290602061091f828661017a565b9401610546565b346101755761057f610939366004610903565b906113ef565b34610175576101ef61044761095536600461050f565b6113fa565b919060408382031261017557610162906020610976828661017a565b940161017a565b34610175576101ef61023f61099336600461095a565b9061140d565b91909160a081840312610175576109b0838261017a565b926109be816020840161017a565b926109cc826040850161018f565b926106ee836060830161018f565b346101755761057f6109ed366004610999565b9392909261142d565b90602082820312610175576101629161017a565b346101755761057f610a1d3660046109f6565b6114c9565b610162916008021c5b60ff1690565b906101629154610a22565b61016260006005610a31565b3461017557610a58366004610252565b6101ef61023f610a3c565b6101626101626101629290565b90610a7a90610a63565b600052602052604060002090565b61016290610156906001600160a01b031682565b61016290610a88565b61016290610a9c565b90610a7a90610aa5565b6101629081565b6101629054610ab8565b610ae990610ae461016293610adc600090565b506000610a70565b610aae565b610abf565b636cdb3d1360e11b6001600160e01b0319821614908115610b1e575b8115610b14575090565b61016291506114d2565b6001600160e01b031981166303a24d0760e21b149150610b0a565b6001600160401b0381116103785760200290565b6105bf61016291610b39565b369037565b90610187610b74610b6e84610b4d565b93610b39565b83610b59565b610162602a610b5e565b61016290610a2b565b6101629060081c610a2b565b6101629060101c610a2b565b6101629060181c610a2b565b6101629060201c610a2b565b6101629060281c610a2b565b6101629060301c610a2b565b6101629060381c610a2b565b6101629060401c610a2b565b6101629060481c610a2b565b6101629060501c610a2b565b6101629060581c610a2b565b6101629060601c610a2b565b6101629060681c610a2b565b6101629060701c610a2b565b6101629060781c610a2b565b6101629060801c610a2b565b6101629060881c610a2b565b6101629060901c610a2b565b6101629060981c610a2b565b6101629060a01c610a2b565b6101629060a81c610a2b565b6101629060b01c610a2b565b6101629060b81c610a2b565b6101629060c01c610a2b565b6101629060c81c610a2b565b6101629060d01c610a2b565b6101629060d81c610a2b565b6101629060e01c610a2b565b6101629060e81c610a2b565b6101629060f01c610a2b565b6101629060f81c610a2b565b90600190610d15610d11602a9290565b9390565b90600092610e56575b5054610e38565b15159052565b505050505050565b6001602084610d2b60009596610d2586610bed565b6001602084610d5c839596610d2586610be1565b0193019150610d33565b6001602084610d7a839596610d2586610bd5565b0193019150610d48565b6001602084610d98839596610d2586610bc9565b0193019150610d66565b6001602084610db6839596610d2586610bbd565b0193019150610d84565b6001602084610dd4839596610d2586610bb1565b0193019150610da2565b6001602084610df2839596610d2586610ba5565b0193019150610dc0565b6001602084610e10839596610d2586610b99565b0193019150610dde565b6001602084610e2e839596610d2586610b8d565b0193019150610dfc565b6001602084610e4c839596610d2586610b84565b0193019150610e1a565b601f8301811115610d1e5791909283549080610e7183610b84565b1515905260200180610e8283610b8d565b1515905260200180610e9383610b99565b1515905260200180610ea483610ba5565b1515905260200180610eb583610bb1565b1515905260200180610ec683610bbd565b1515905260200180610ed783610bc9565b1515905260200180610ee883610bd5565b1515905260200180610ef983610be1565b1515905260200180610f0a83610bed565b1515905260200180610f1b83610bf9565b1515905260200180610f2c83610c05565b1515905260200180610f3d83610c11565b1515905260200180610f4e83610c1d565b1515905260200180610f5f83610c29565b1515905260200180610f7083610c35565b1515905260200180610f8183610c41565b1515905260200180610f9283610c4d565b1515905260200180610fa383610c59565b1515905260200180610fb483610c65565b1515905260200180610fc583610c71565b1515905260200180610fd683610c7d565b1515905260200180610fe783610c89565b1515905260200180610ff883610c95565b151590526020018061100983610ca1565b151590526020018061101a83610cad565b151590526020018061102b83610cb9565b151590526020018061103c83610cc5565b151590526020018061104d83610cd1565b151590526020018061105e83610cdd565b151590526020018061106f83610ce9565b151590526020016110808192610cf5565b15159052602001926001019060200191610e56565b906104178161054093610d01565b90610187610397926110b460405190565b93848092611095565b610162906110a3565b6110e190610ae4610162936110d9610b7a565b506007610a70565b6110bd565b6101629061037d565b5061016260026110e6565b610187906111066114f0565b611135565b9060ff905b9181191691161790565b9061112a61016261113192151590565b825461110b565b9055565b61018790600561111a565b610187906110fa565b916020610187929493611164604082019660008301906108ab565b01906108ab565b94939291903361117a81610156565b61118388610156565b1415806111c2575b61119a57506101879495611537565b86906111be6111a860405190565b63711bec9160e11b815292839260048401611149565b0390fd5b506111d46111d0828961140d565b1590565b61118b565b634e487b7160e01b600052601160045260246000fd5b919082039182116111fc57565b6111d9565b634e487b7160e01b600052601260045260246000fd5b8115611221570490565b611201565b61016261123c6112366006610abf565b426111ef565b61124862015180610a63565b90611217565b9061018791611716565b9081526040810192916101879160200152565b0152565b9061127c6105bf83610598565b918252565b906101876112976112918461126f565b93610598565b601f190160208401610b59565b634e487b7160e01b600052603260045260246000fd5b906112c3825190565b8110156112d4576020809102010190565b6112a4565b9081516112ea61045f610162845190565b03611358576112ff6112fa835190565b611281565b9161130a6000610a63565b611315610162835190565b811015611352578061134761133a61133061134d94866117d2565b6101d984886117d2565b61134483886112ba565b52565b60010190565b61130a565b50505090565b519051611365565b915190565b906111be61137260405190565b635b05999160e01b815292839260048401611258565b6113906114f0565b6101876113ae565b6101566101626101629290565b61016290611398565b6101876113bb60006113a5565b61180e565b610187611388565b61016290610156565b61016290546113c8565b61016260036113d1565b6101879033611716565b610187919033611867565b610162906110ef565b6101629054610b84565b61016291610ae461142892611420600090565b506001610aae565b611403565b94939291903361143c81610156565b61144588610156565b14158061145c575b61119a575061018794956118fe565b5061146a6111d0828961140d565b61144d565b6101879061147b6114f0565b61148560006113a5565b61148e81610156565b61149783610156565b146114a657506101879061180e565b6111be906114b360405190565b631e4fbdf760e01b8152918291600483016108b4565b6101879061146f565b6114ec6301ffc9a760e01b5b916001600160e01b03191690565b1490565b6114f86113db565b339061150c61150683610156565b91610156565b036115145750565b6111be9061152160405190565b63118cdaa760e01b8152918291600483016108b4565b949392919061154660006113a5565b9561155087610156565b61155983610156565b146115a25761156787610156565b61157082610156565b146115805761018795965061198b565b6111be8761158d60405190565b626a0d4560e21b8152918291600483016108b4565b6111be876115af60405190565b632bfa23e760e11b8152918291600483016108b4565b156115cc57565b60405162461bcd60e51b815260206004820152600e60248201526d26b4b73a103737ba1037b832b71760911b6044820152606490fd5b1561160957565b60405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21027232a1024a21760891b6044820152606490fd5b909190602a8310156112d457602061165760019290565b8185040193060290565b1561166857565b60405162461bcd60e51b815260206004820152602f60248201527f5468697320616464726573732068617320616c7265616479206d696e7465642060448201526e3a3434b99037333a103a37b230bc9760891b6064820152608490fd5b919060086111109102916116d960ff841b90565b921b90565b91906116ef61016261113193151590565b9083546116c5565b9061127c6105bf8361061c565b61016260006116f7565b610162611704565b6101879161172c6117276005611403565b6115c5565b6117366000610a63565b811015806117ba575b61174890611602565b6117a1600161179b8361178486610ae461176861123c6112366006610abf565b61179461178f6111d06117898861178488610ae4886007610a70565b611640565b90610a31565b611661565b6007610a70565b906116de565b6117ab6001610a63565b906117b461170e565b92611a20565b506117486117c86029610a63565b821115905061173f565b90602080916117df600090565b50029101015190565b906001600160a01b0390611110565b9061180761016261113192610aa5565b82546117e8565b61183461182e61181e60036113d1565b6118298460036117f7565b610aa5565b91610aa5565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061185f60405190565b80805b0390a3565b61187160006113a5565b61187a81610156565b61188384610156565b146118dc57506118626118d26118cc83611829876118c788610ae47f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31996001610aae565b61111a565b93610aa5565b9361024360405190565b6111be906118e960405190565b62ced3e160e81b8152918291600483016108b4565b90919493929461190e60006113a5565b61191781610156565b61192085610156565b1461197e5761192e81610156565b61193784610156565b146119715750610187949561196960405192600184526020840152604083019160018352602083015260408201604052565b92909161198b565b6111be9061158d60405190565b6111be906115af60405190565b9193929061199b82868386611a80565b6119ad6119a860006113a5565b610156565b6119b682610156565b036119c3575b5050505050565b33926119cd865190565b6119da61045f6001610a63565b03611a1057611a00611a06966119fa6119f36000610a63565b80926117d2565b946117d2565b93611cf2565b38808080806119bc565b611a1b959293611ba9565b611a06565b90939291611a2e60006113a5565b94611a3886610156565b611a4184610156565b14611a735761018794959161196960405192600184526020840152604083019160018352602083015260408201604052565b6111be866115af60405190565b929190611a8d60006113a5565b611a9681610156565b611a9f86610156565b14159081611af7575b50611ab65761018793611e16565b60405162461bcd60e51b8152602060048201526019602482015278151c985b9cd9995c9cc8185c99481b9bdd08185b1b1bddd959603a1b6044820152606490fd5b611b019150610156565b611b0a82610156565b141538611aa8565b90505190610187826101f3565b906020828203126101755761016291611b12565b9390611b6e906101629694611b61611b7c95611b5760a08a019460008b01906108ab565b60208901906108ab565b868203604088015261080b565b90848203606086015261080b565b9160808184039101526103e3565b3d15611ba457611b993d6116f7565b903d6000602084013e565b606090565b92919490853b611bbc61045f6000610a63565b11611bc957505050505050565b6000602094611c01611bdd6118298a610aa5565b94611be760405190565b9889978896879563bc197c8160e01b875260048701611b33565b03925af160009181611c78575b50611c5d5750611c24565b388080808080610d2b565b611c2c611b8a565b90611c35825190565b611c4261045f6000610a63565b03611c54576111be906115af60405190565b50805190602001fd5b611c6d63bc197c8160e01b6114de565b0361197e5750611c19565b611c9b91925060203d602011611ca2575b611c938183610357565b810190611b1f565b9038611c0e565b503d611c89565b9193611cde6101629694611cd7611ce59497611ccd60a088019960008901906108ab565b60208701906108ab565b6040850152565b6060830152565b60808184039101526103e3565b92919490853b611d0561045f6000610a63565b11611d1257505050505050565b6000602094611d4a611d266118298a610aa5565b94611d3060405190565b9889978896879563f23a6e6160e01b875260048701611ca9565b03925af160009181611d72575b50611d625750611c24565b611c6d63f23a6e6160e01b6114de565b611d8c91925060203d602011611ca257611c938183610357565b9038611d57565b61126b61018794611dbc606094989795611db5608086019a60008701906108ab565b6020850152565b6040830152565b9060001990611110565b90611ddd61016261113192610a63565b8254611dc3565b919082018092116111fc57565b6040808252610162939192611e089184019061080b565b91602081840391015261080b565b9392909192611e23845190565b611e3161045f610162855190565b03612028573393600091611e4483610a63565b611e4f610162845190565b811015611f5f57611e6081846117d2565b90611e6b81876117d2565b91611e75866113a5565b9288611e8085610156565b611e898d610156565b03611ee9575b611e9b611eb395610156565b611ea482610156565b03611eb8575b50505060010190565b611e44565b611ecc611edb91610ae4611ee1958b610a70565b91611ed683610abf565b611de4565b90611dcd565b388088611eaa565b50909192611efe610ae98c610ae4868b610a70565b828110611f3a57611e9b8392611f328a8f611f2d908f968a611f27611eb39d9c9b610ae4930390565b94610a70565b611dcd565b955050611e8f565b8b6111be8585611f4960405190565b6303dee4c560e01b815294859460048601611d93565b5095929491611f6c825190565b611f7961045f6001610a63565b03611fe057611fbf611fbf6118cc7fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f629594611fb96119f3611fc596610a63565b996117d2565b94610aa5565b94611fdb611fd260405190565b92839283611258565b0390a4565b5093612012611fbf611fbf7f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb94610aa5565b94611fdb61201f60405190565b92839283611df1565b5061136561136084519056fea26469706673582212209be2eec483caf7ad2c5c69af99a5135e406f0787753ee2af072c5fc5e8100f2164736f6c63430008180033