ERC-1155
Source Code
Overview
Max Total Supply
15,840
Holders
4,975
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
RetroBridgePhases
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./interfaces/IRetroBridgePhases.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol";
contract RetroBridgePhases is Ownable2Step, ERC1155Supply, ERC1155URIStorage, IRetroBridgePhases {
uint8 public constant SUNRISE_NFT_ID = 0;
uint8 public constant MIDDAY_NFT_ID = 1;
uint8 public constant SUNSET_NFT_ID = 2;
uint8 public constant MIDNIGHT_NFT_ID = 3;
/// @dev true - whitelisted, false - not whitelisted
mapping(uint256 nftId => mapping(address account => bool)) public whitelist;
constructor(string memory _baseURI) Ownable(msg.sender) ERC1155("RetroBridge Phases") {
_setBaseURI(_baseURI);
_setURI(0, "0.json");
_setURI(1, "1.json");
_setURI(2, "2.json");
_setURI(3, "3.json");
}
/// @dev sets whitelist
/// @param account address of account in whitelist
/// @param whitelisted true - include in whitelist, false - exclude from whitelist
function setWhitelist(uint256 nftId, address account, bool whitelisted) public onlyOwner {
checkId(nftId);
require(whitelist[nftId][account] != whitelisted, "RetroBridgePhases: not changing whitelist state");
whitelist[nftId][account] = whitelisted;
emit SetWhitelist(msg.sender, nftId, account, whitelisted);
}
function setBaseURI(string memory _baseURI) public onlyOwner() {
_setBaseURI(_baseURI);
emit SetBaseURI(_baseURI);
}
function setDefaultURI(string memory _uri) public onlyOwner() {
_setURI(_uri);
emit SetDefaultURI(_uri);
}
function setURI(uint256 nftId, string memory _uri) public onlyOwner() {
checkId(nftId);
_setURI(nftId, _uri);
emit SetURI(nftId, _uri);
}
function safeTransferFrom(address, address, uint256, uint256, bytes memory) public pure override {
revert("RetroBridgePhases: safeTransferFrom is forbidden");
}
function safeBatchTransferFrom(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public pure override {
revert("RetroBridgePhases: safeBatchTransferFrom is forbidden");
}
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory values
) internal override(ERC1155, ERC1155Supply) {
ERC1155Supply._update(from, to, ids, values);
}
function mint(address to, uint256 nftId, uint256 value) public {
checkId(nftId);
require(whitelist[nftId][msg.sender], "RetroBridgePhases: msg.sender not whitelisted");
_mint(to, nftId, value, "");
emit Mint(msg.sender, to, nftId, value);
}
function mintBatch(address to, uint256[] memory nftIds, uint256[] memory values) public {
for(uint256 i = 0; i < nftIds.length; i++) {
checkId(nftIds[i]);
require(whitelist[nftIds[i]][msg.sender], "RetroBridgePhases: msg.sender not whitelisted");
}
_mintBatch(to, nftIds, values, "");
emit MintBatch(msg.sender, to, nftIds, values);
}
function uri(uint256 nftId) public view override(ERC1155, ERC1155URIStorage, IRetroBridgePhases) returns (string memory) {
return ERC1155URIStorage.uri(nftId);
}
function balanceOf(address account, uint256 nftId) public view override(ERC1155, IRetroBridgePhases) returns (uint256) {
checkId(nftId);
return ERC1155.balanceOf(account, nftId);
}
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view override (ERC1155, IRetroBridgePhases) returns (uint256[] memory) {
return super.balanceOfBatch(accounts, ids);
}
function totalSupply(uint256 nftId) public view override(ERC1155Supply, IRetroBridgePhases) returns (uint256) {
checkId(nftId);
return ERC1155Supply.totalSupply(nftId);
}
function totalSupply() public view override(ERC1155Supply, IRetroBridgePhases) returns (uint256) {
return ERC1155Supply.totalSupply();
}
function exists(uint256 nftId) public view override(ERC1155Supply, IRetroBridgePhases) returns (bool) {
checkId(nftId);
return ERC1155Supply.exists(nftId);
}
function checkId(uint256 nftId) public pure {
require(nftId <= MIDNIGHT_NFT_ID, "RetroBridgePhases: invalid nftId");
}
function owner() public view override(Ownable, IRetroBridgePhases) returns (address) {
return Ownable.owner();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.20;
import {Ownable} from "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is specified at deployment time in the constructor for `Ownable`. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
if (pendingOwner() != sender) {
revert OwnableUnauthorizedAccount(sender);
}
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.20;
import {IERC1155} from "./IERC1155.sol";
import {IERC1155Receiver} from "./IERC1155Receiver.sol";
import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol";
import {Context} from "../../utils/Context.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {Arrays} from "../../utils/Arrays.sol";
import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*/
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
using Arrays for uint256[];
using Arrays for address[];
mapping(uint256 id => mapping(address account => uint256)) private _balances;
mapping(address account => mapping(address operator => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256 /* id */) public view virtual returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*/
function balanceOf(address account, uint256 id) public view virtual returns (uint256) {
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view virtual returns (uint256[] memory) {
if (accounts.length != ids.length) {
revert ERC1155InvalidArrayLength(ids.length, accounts.length);
}
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeTransferFrom(from, to, id, value, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeBatchTransferFrom(from, to, ids, values, data);
}
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
* (or `to`) is the zero address.
*
* Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
* or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
* - `ids` and `values` must have the same length.
*
* NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
*/
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
if (ids.length != values.length) {
revert ERC1155InvalidArrayLength(ids.length, values.length);
}
address operator = _msgSender();
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids.unsafeMemoryAccess(i);
uint256 value = values.unsafeMemoryAccess(i);
if (from != address(0)) {
uint256 fromBalance = _balances[id][from];
if (fromBalance < value) {
revert ERC1155InsufficientBalance(from, fromBalance, value, id);
}
unchecked {
// Overflow not possible: value <= fromBalance
_balances[id][from] = fromBalance - value;
}
}
if (to != address(0)) {
_balances[id][to] += value;
}
}
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
emit TransferSingle(operator, from, to, id, value);
} else {
emit TransferBatch(operator, from, to, ids, values);
}
}
/**
* @dev Version of {_update} that performs the token acceptance check by calling
* {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
* contains code (eg. is a smart contract at the moment of execution).
*
* IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
* update to the contract state after this function would break the check-effect-interaction pattern. Consider
* overriding {_update} instead.
*/
function _updateWithAcceptanceCheck(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal virtual {
_update(from, to, ids, values);
if (to != address(0)) {
address operator = _msgSender();
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
_doSafeTransferAcceptanceCheck(operator, from, to, id, value, data);
} else {
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data);
}
}
}
/**
* @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
* - `ids` and `values` must have the same length.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the values in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev Destroys a `value` amount of tokens of type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
*/
function _burn(address from, uint256 id, uint256 value) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
* - `ids` and `values` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC1155InvalidOperator(address(0));
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address
* if it contains code at the moment of execution.
*/
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 value,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
// Tokens rejected
revert ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-ERC1155Receiver implementer
revert ERC1155InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address
* if it contains code at the moment of execution.
*/
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
// Tokens rejected
revert ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-ERC1155Receiver implementer
revert ERC1155InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @dev Creates an array in memory with only one value for each of the elements provided.
*/
function _asSingletonArrays(
uint256 element1,
uint256 element2
) private pure returns (uint256[] memory array1, uint256[] memory array2) {
/// @solidity memory-safe-assembly
assembly {
// Load the free memory pointer
array1 := mload(0x40)
// Set array length to 1
mstore(array1, 1)
// Store the single element at the next word after the length (where content starts)
mstore(add(array1, 0x20), element1)
// Repeat for next array locating it right after the first array
array2 := add(array1, 0x40)
mstore(array2, 1)
mstore(add(array2, 0x20), element2)
// Update the free memory pointer by pointing after the second array
mstore(0x40, add(array2, 0x40))
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.20;
import {ERC1155} from "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*
* NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens
* that can be minted.
*
* CAUTION: This extension should not be added in an upgrade to an already deployed contract.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 id => uint256) private _totalSupply;
uint256 private _totalSupplyAll;
/**
* @dev Total value of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Total value of tokens.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupplyAll;
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_update}.
*/
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory values
) internal virtual override {
super._update(from, to, ids, values);
if (from == address(0)) {
uint256 totalMintValue = 0;
for (uint256 i = 0; i < ids.length; ++i) {
uint256 value = values[i];
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply[ids[i]] += value;
totalMintValue += value;
}
// Overflow check required: The rest of the code assumes that totalSupplyAll never overflows
_totalSupplyAll += totalMintValue;
}
if (to == address(0)) {
uint256 totalBurnValue = 0;
for (uint256 i = 0; i < ids.length; ++i) {
uint256 value = values[i];
unchecked {
// Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i])
_totalSupply[ids[i]] -= value;
// Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
totalBurnValue += value;
}
}
unchecked {
// Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
_totalSupplyAll -= totalBurnValue;
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)
pragma solidity ^0.8.20;
import {Strings} from "../../../utils/Strings.sol";
import {ERC1155} from "../ERC1155.sol";
/**
* @dev ERC1155 token with storage based token URI management.
* Inspired by the ERC721URIStorage extension
*/
abstract contract ERC1155URIStorage is ERC1155 {
using Strings for uint256;
// Optional base URI
string private _baseURI = "";
// Optional mapping for token URIs
mapping(uint256 tokenId => string) private _tokenURIs;
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the concatenation of the `_baseURI`
* and the token-specific uri if the latter is set
*
* This enables the following behaviors:
*
* - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
* of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
* is empty per default);
*
* - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
* which in most cases will contain `ERC1155._uri`;
*
* - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
* uri value set, then the result is empty.
*/
function uri(uint256 tokenId) public view virtual override returns (string memory) {
string memory tokenURI = _tokenURIs[tokenId];
// If token URI is set, concatenate base URI and tokenURI (via string.concat).
return bytes(tokenURI).length > 0 ? string.concat(_baseURI, tokenURI) : super.uri(tokenId);
}
/**
* @dev Sets `tokenURI` as the tokenURI of `tokenId`.
*/
function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
_tokenURIs[tokenId] = tokenURI;
emit URI(uri(tokenId), tokenId);
}
/**
* @dev Sets `baseURI` as the `_baseURI` for all tokens
*/
function _setBaseURI(string memory baseURI) internal virtual {
_baseURI = baseURI;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.20;
import {IERC1155} from "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using StorageSlot for bytes32;
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* `array` is expected to be sorted in ascending order, and to contain no
* repeated elements.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// 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
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IRetroBridgePhases {
event SetBaseURI(string baseURI);
event SetDefaultURI(string defaultUri);
event SetURI(uint256 nftId, string uri);
event SetWhitelist(address from, uint256 nftId, address account, bool whitelist);
event Mint(address from, address to, uint256 nftId, uint256 value);
event MintBatch(address from, address to, uint256[] nftIds, uint256[] values);
function SUNRISE_NFT_ID() external view returns (uint8);
function MIDDAY_NFT_ID() external view returns (uint8);
function SUNSET_NFT_ID() external view returns (uint8);
function MIDNIGHT_NFT_ID() external view returns (uint8);
function whitelist(uint256 nftId, address account) external view returns (bool);
function uri(uint256 nftId) external view returns (string memory);
function balanceOf(address account, uint256 nftId) external view returns (uint256);
function balanceOfBatch(address[] memory accounts, uint256[] memory ids) external view returns (uint256[] memory);
function totalSupply() external view returns (uint256);
function totalSupply(uint256 nftId) external view returns (uint256);
function exists(uint256 nftId) external view returns (bool);
function checkId(uint256 nftId) external pure;
function mint(address to, uint256 nftId, uint value) external;
function mintBatch(address to, uint256[] memory nftIds, uint256[] memory values) external;
function owner() external view returns (address);
/** ONLY OWNER **/
function setWhitelist(uint256 nftId, address account, bool whitelisted) external;
function setBaseURI(string memory _baseURI) external;
function setDefaultURI(string memory _uri) external;
function setURI(uint256 nftId, string memory _uri) external;
/** END ONLY OWNER **/
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"nftIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"MintBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"SetBaseURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"defaultUri","type":"string"}],"name":"SetDefaultURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"SetURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelist","type":"bool"}],"name":"SetWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"MIDDAY_NFT_ID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIDNIGHT_NFT_ID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SUNRISE_NFT_ID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SUNSET_NFT_ID","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"checkId","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"nftIds","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setDefaultURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a0604052600060809081526007906200001a9082620004bc565b503480156200002857600080fd5b50604051620026ce380380620026ce8339810160408190526200004b91620005ae565b604080518082019091526012815271526574726f4272696467652050686173657360701b602082015233806200009b57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000a68162000189565b50620000b281620001a7565b50620000be81620001b9565b620000ef60006040518060400160405280600681526020016518173539b7b760d11b815250620001c760201b60201c565b6200012060016040518060400160405280600681526020016518973539b7b760d11b815250620001c760201b60201c565b6200015160026040518060400160405280600681526020016519173539b7b760d11b815250620001c760201b60201c565b6200018260036040518060400160405280600681526020016519973539b7b760d11b815250620001c760201b60201c565b506200072c565b600180546001600160a01b0319169055620001a4816200022a565b50565b6004620001b58282620004bc565b5050565b6007620001b58282620004bc565b6000828152600860205260409020620001e18282620004bc565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b6200020f826200027a565b6040516200021e919062000666565b60405180910390a25050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606062000287826200028d565b92915050565b600081815260086020526040812080546060929190620002ad906200042d565b80601f0160208091040260200160405190810160405280929190818152602001828054620002db906200042d565b80156200032c5780601f1062000300576101008083540402835291602001916200032c565b820191906000526020600020905b8154815290600101906020018083116200030e57829003601f168201915b5050505050905060008151116200034e5762000348836200037b565b62000374565b600781604051602001620003649291906200069b565b6040516020818303038152906040525b9392505050565b6060600480546200038c906200042d565b80601f0160208091040260200160405190810160405280929190818152602001828054620003ba906200042d565b80156200040b5780601f10620003df576101008083540402835291602001916200040b565b820191906000526020600020905b815481529060010190602001808311620003ed57829003601f168201915b50505050509050919050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200044257607f821691505b6020821081036200046357634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004b757600081815260208120601f850160051c81016020861015620004925750805b601f850160051c820191505b81811015620004b3578281556001016200049e565b5050505b505050565b81516001600160401b03811115620004d857620004d862000417565b620004f081620004e984546200042d565b8462000469565b602080601f8311600181146200052857600084156200050f5750858301515b600019600386901b1c1916600185901b178555620004b3565b600085815260208120601f198616915b82811015620005595788860151825594840194600190910190840162000538565b5085821015620005785787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60005b83811015620005a55781810151838201526020016200058b565b50506000910152565b600060208284031215620005c157600080fd5b81516001600160401b0380821115620005d957600080fd5b818401915084601f830112620005ee57600080fd5b81518181111562000603576200060362000417565b604051601f8201601f19908116603f011681019083821181831017156200062e576200062e62000417565b816040528281528760208487010111156200064857600080fd5b6200065b83602083016020880162000588565b979650505050505050565b60208152600082518060208401526200068781604085016020870162000588565b601f01601f19169190910160400192915050565b6000808454620006ab816200042d565b60018281168015620006c65760018114620006dc576200070d565b60ff19841687528215158302870194506200070d565b8860005260208060002060005b85811015620007045781548a820152908401908201620006e9565b50505082870194505b5050505083516200072381836020880162000588565b01949350505050565b611f92806200073c6000396000f3fe608060405234801561001057600080fd5b50600436106101c35760003560e01c8063862440e2116100f9578063e30c397811610097578063f242432a11610071578063f242432a146103fe578063f2fde38b14610411578063f429326614610424578063fb8662f31461042c57600080fd5b8063e30c39781461039e578063e985e9c5146103af578063e9afcd40146103eb57600080fd5b8063bd85b039116100d3578063bd85b0391461035d578063c93b86f914610370578063d81d0a1514610378578063da1b9e081461038b57600080fd5b8063862440e2146103125780638da5cb5b14610325578063a22cb4651461034a57600080fd5b80632eb2c2d6116101665780634f558e79116101405780634f558e79146102dc57806355f804b3146102ef578063715018a61461030257806379ba50971461030a57600080fd5b80632eb2c2d61461027b5780634b25bfce1461028e5780634e1273f4146102bc57600080fd5b80630e89341c116101a25780630e89341c1461022b578063156e29f61461024b57806318160ddd14610260578063205a26fb1461026857600080fd5b8062fdd58e146101c857806301ffc9a7146101ee5780630ae2878914610211575b600080fd5b6101db6101d6366004611562565b610434565b6040519081526020015b60405180910390f35b6102016101fc3660046115a2565b61046c565b60405190151581526020016101e5565b610219600281565b60405160ff90911681526020016101e5565b61023e6102393660046115bf565b6104bc565b6040516101e59190611628565b61025e61025936600461163b565b6104c7565b005b6101db610583565b61025e6102763660046115bf565b610593565b61025e6102893660046117b4565b6105e7565b61020161029c36600461185e565b600960209081526000928352604080842090915290825290205460ff1681565b6102cf6102ca36600461188a565b61064d565b6040516101e59190611985565b6102016102ea3660046115bf565b610659565b61025e6102fd366004611998565b61066d565b61025e6106b8565b61025e6106cc565b61025e6103203660046119d5565b61070d565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016101e5565b61025e610358366004611a22565b610765565b6101db61036b3660046115bf565b610774565b610219600381565b61025e610386366004611a4c565b610793565b61025e610399366004611998565b610881565b6001546001600160a01b0316610332565b6102016103bd366004611ac0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b61025e6103f9366004611aea565b6108c1565b61025e61040c366004611b26565b6109dc565b61025e61041f366004611b8b565b610a3d565b610219600181565b610219600081565b600061043f82610593565b60008281526002602090815260408083206001600160a01b03871684529091529020545b90505b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061049d57506001600160e01b031982166303a24d0760e21b145b8061046657506301ffc9a760e01b6001600160e01b0319831614610466565b606061046682610aad565b6104d082610593565b600082815260096020908152604080832033845290915290205460ff166105125760405162461bcd60e51b815260040161050990611ba6565b60405180910390fd5b61052d83838360405180602001604052806000815250610b8d565b604080513381526001600160a01b0385166020820152908101839052606081018290527f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee906080015b60405180910390a1505050565b600061058e60065490565b905090565b60038111156105e45760405162461bcd60e51b815260206004820181905260248201527f526574726f4272696467655068617365733a20696e76616c6964206e667449646044820152606401610509565b50565b60405162461bcd60e51b815260206004820152603560248201527f526574726f4272696467655068617365733a207361666542617463685472616e60448201527439b332b9233937b69034b9903337b93134b23232b760591b6064820152608401610509565b60606104638383610bf2565b600061066482610593565b61046682610cc7565b610675610cda565b61067e81610d07565b7f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa816040516106ad9190611628565b60405180910390a150565b6106c0610cda565b6106ca6000610d13565b565b60015433906001600160a01b031681146107045760405163118cdaa760e01b81526001600160a01b0382166004820152602401610509565b6105e481610d13565b610715610cda565b61071e82610593565b6107288282610d2c565b7fee1bb82f380189104b74a7647d26f2f35679780e816626ffcaec7cafb7288e468282604051610759929190611bf3565b60405180910390a15050565b610770338383610d89565b5050565b600061077f82610593565b600082815260056020526040902054610466565b60005b8251811015610830576107c18382815181106107b4576107b4611c0c565b6020026020010151610593565b600960008483815181106107d7576107d7611c0c565b6020908102919091018101518252818101929092526040908101600090812033825290925290205460ff1661081e5760405162461bcd60e51b815260040161050990611ba6565b8061082881611c38565b915050610796565b5061084c83838360405180602001604052806000815250610e1f565b7f5c5ac6bfb3f54a39f008d2e9be10d575012f29230716d49e92da377d748b1a87338484846040516105769493929190611c51565b610889610cda565b61089281610e5d565b7fb0cb658f6a70918635661157bac90270b4184dff76f6b90dfebdad09e29ce5eb816040516106ad9190611628565b6108c9610cda565b6108d283610593565b60008381526009602090815260408083206001600160a01b038616845290915290205481151560ff9091161515036109645760405162461bcd60e51b815260206004820152602f60248201527f526574726f4272696467655068617365733a206e6f74206368616e67696e672060448201526e77686974656c69737420737461746560881b6064820152608401610509565b60008381526009602090815260408083206001600160a01b03861680855290835292819020805460ff191685151590811790915581513381529283018790529082019290925260608101919091527f36037870726e8fcb5517b403843c7851bcabb9000458e4b91c6bf22ab4676c7e90608001610576565b60405162461bcd60e51b815260206004820152603060248201527f526574726f4272696467655068617365733a20736166655472616e736665724660448201526f3937b69034b9903337b93134b23232b760811b6064820152608401610509565b610a45610cda565b600180546001600160a01b0319166001600160a01b038316908117909155610a756000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600081815260086020526040812080546060929190610acb90611c9a565b80601f0160208091040260200160405190810160405280929190818152602001828054610af790611c9a565b8015610b445780601f10610b1957610100808354040283529160200191610b44565b820191906000526020600020905b815481529060010190602001808311610b2757829003601f168201915b505050505090506000815111610b6257610b5d83610e69565b610b86565b600781604051602001610b76929190611cd4565b6040516020818303038152906040525b9392505050565b6001600160a01b038416610bb757604051632bfa23e760e11b815260006004820152602401610509565b60408051600180825260208201869052818301908152606082018590526080820190925290610bea600087848487610efd565b505050505050565b60608151835114610c235781518351604051635b05999160e01b815260048101929092526024820152604401610509565b6000835167ffffffffffffffff811115610c3f57610c3f61166e565b604051908082528060200260200182016040528015610c68578160200160208202803683370190505b50905060005b8451811015610cbf57602080820286010151610c9290602080840287010151610434565b828281518110610ca457610ca4611c0c565b6020908102919091010152610cb881611c38565b9050610c6e565b509392505050565b600080610cd383610774565b1192915050565b6000546001600160a01b031633146106ca5760405163118cdaa760e01b8152336004820152602401610509565b60076107708282611da6565b600180546001600160a01b03191690556105e481610f57565b6000828152600860205260409020610d448282611da6565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b610d70846104bc565b604051610d7d9190611628565b60405180910390a25050565b6001600160a01b038216610db25760405162ced3e160e81b815260006004820152602401610509565b6001600160a01b03838116600081815260036020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416610e4957604051632bfa23e760e11b815260006004820152602401610509565b610e57600085858585610efd565b50505050565b60046107708282611da6565b606060048054610e7890611c9a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ea490611c9a565b8015610ef15780601f10610ec657610100808354040283529160200191610ef1565b820191906000526020600020905b815481529060010190602001808311610ed457829003601f168201915b50505050509050919050565b610f0985858585610fa7565b6001600160a01b03841615610f505782513390600103610f425760208481015190840151610f3b838989858589610fb3565b5050610bea565b610bea8187878787876110e0565b5050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e57848484846111c9565b6001600160a01b0384163b15610bea5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190610ff79089908990889088908890600401611e66565b6020604051808303816000875af1925050508015611032575060408051601f3d908101601f1916820190925261102f91810190611ea0565b60015b61109b573d808015611060576040519150601f19603f3d011682016040523d82523d6000602084013e611065565b606091505b50805160000361109357604051632bfa23e760e11b81526001600160a01b0386166004820152602401610509565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b146110d757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610509565b50505050505050565b6001600160a01b0384163b15610bea5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906111249089908990889088908890600401611ebd565b6020604051808303816000875af192505050801561115f575060408051601f3d908101601f1916820190925261115c91810190611ea0565b60015b61118d573d808015611060576040519150601f19603f3d011682016040523d82523d6000602084013e611065565b6001600160e01b0319811663bc197c8160e01b146110d757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610509565b6111d584848484611323565b6001600160a01b038416611288576000805b835181101561126e57600083828151811061120457611204611c0c565b60200260200101519050806005600087858151811061122557611225611c0c565b60200260200101518152602001908152602001600020600082825461124a9190611f1b565b9091555061125a90508184611f1b565b9250508061126790611c38565b90506111e7565b5080600660008282546112819190611f1b565b9091555050505b6001600160a01b038316610e57576000805b83518110156113125760008382815181106112b7576112b7611c0c565b6020026020010151905080600560008785815181106112d8576112d8611c0c565b60200260200101518152602001908152602001600020600082825403925050819055508083019250508061130b90611c38565b905061129a565b506006805491909103905550505050565b80518251146113525781518151604051635b05999160e01b815260048101929092526024820152604401610509565b3360005b8351811015611467576020818102858101820151908501909101516001600160a01b0388161561140d5760008281526002602090815260408083206001600160a01b038c168452909152902054818110156113e4576040516303dee4c560e01b81526001600160a01b038a166004820152602481018290526044810183905260648101849052608401610509565b60008381526002602090815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b038716156114545760008281526002602090815260408083206001600160a01b038b1684529091528120805483929061144e908490611f1b565b90915550505b50508061146090611c38565b9050611356565b5082516001036114e85760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516114d9929190918252602082015260400190565b60405180910390a45050610f50565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611537929190611f2e565b60405180910390a45050505050565b80356001600160a01b038116811461155d57600080fd5b919050565b6000806040838503121561157557600080fd5b61157e83611546565b946020939093013593505050565b6001600160e01b0319811681146105e457600080fd5b6000602082840312156115b457600080fd5b8135610b868161158c565b6000602082840312156115d157600080fd5b5035919050565b60005b838110156115f35781810151838201526020016115db565b50506000910152565b600081518084526116148160208601602086016115d8565b601f01601f19169290920160200192915050565b60208152600061046360208301846115fc565b60008060006060848603121561165057600080fd5b61165984611546565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156116ad576116ad61166e565b604052919050565b600067ffffffffffffffff8211156116cf576116cf61166e565b5060051b60200190565b600082601f8301126116ea57600080fd5b813560206116ff6116fa836116b5565b611684565b82815260059290921b8401810191818101908684111561171e57600080fd5b8286015b848110156117395780358352918301918301611722565b509695505050505050565b600082601f83011261175557600080fd5b813567ffffffffffffffff81111561176f5761176f61166e565b611782601f8201601f1916602001611684565b81815284602083860101111561179757600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156117cc57600080fd5b6117d586611546565b94506117e360208701611546565b9350604086013567ffffffffffffffff8082111561180057600080fd5b61180c89838a016116d9565b9450606088013591508082111561182257600080fd5b61182e89838a016116d9565b9350608088013591508082111561184457600080fd5b5061185188828901611744565b9150509295509295909350565b6000806040838503121561187157600080fd5b8235915061188160208401611546565b90509250929050565b6000806040838503121561189d57600080fd5b823567ffffffffffffffff808211156118b557600080fd5b818501915085601f8301126118c957600080fd5b813560206118d96116fa836116b5565b82815260059290921b840181019181810190898411156118f857600080fd5b948201945b8386101561191d5761190e86611546565b825294820194908201906118fd565b9650508601359250508082111561193357600080fd5b50611940858286016116d9565b9150509250929050565b600081518084526020808501945080840160005b8381101561197a5781518752958201959082019060010161195e565b509495945050505050565b602081526000610463602083018461194a565b6000602082840312156119aa57600080fd5b813567ffffffffffffffff8111156119c157600080fd5b6119cd84828501611744565b949350505050565b600080604083850312156119e857600080fd5b82359150602083013567ffffffffffffffff811115611a0657600080fd5b61194085828601611744565b8035801515811461155d57600080fd5b60008060408385031215611a3557600080fd5b611a3e83611546565b915061188160208401611a12565b600080600060608486031215611a6157600080fd5b611a6a84611546565b9250602084013567ffffffffffffffff80821115611a8757600080fd5b611a93878388016116d9565b93506040860135915080821115611aa957600080fd5b50611ab6868287016116d9565b9150509250925092565b60008060408385031215611ad357600080fd5b611adc83611546565b915061188160208401611546565b600080600060608486031215611aff57600080fd5b83359250611b0f60208501611546565b9150611b1d60408501611a12565b90509250925092565b600080600080600060a08688031215611b3e57600080fd5b611b4786611546565b9450611b5560208701611546565b93506040860135925060608601359150608086013567ffffffffffffffff811115611b7f57600080fd5b61185188828901611744565b600060208284031215611b9d57600080fd5b61046382611546565b6020808252602d908201527f526574726f4272696467655068617365733a206d73672e73656e646572206e6f60408201526c1d081dda1a5d195b1a5cdd1959609a1b606082015260800190565b8281526040602082015260006119cd60408301846115fc565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c4a57611c4a611c22565b5060010190565b6001600160a01b03858116825284166020820152608060408201819052600090611c7d9083018561194a565b8281036060840152611c8f818561194a565b979650505050505050565b600181811c90821680611cae57607f821691505b602082108103611cce57634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454611ce281611c9a565b60018281168015611cfa5760018114611d0f57611d3e565b60ff1984168752821515830287019450611d3e565b8860005260208060002060005b85811015611d355781548a820152908401908201611d1c565b50505082870194505b505050508351611d528183602088016115d8565b01949350505050565b601f821115611da157600081815260208120601f850160051c81016020861015611d825750805b601f850160051c820191505b81811015610bea57828155600101611d8e565b505050565b815167ffffffffffffffff811115611dc057611dc061166e565b611dd481611dce8454611c9a565b84611d5b565b602080601f831160018114611e095760008415611df15750858301515b600019600386901b1c1916600185901b178555610bea565b600085815260208120601f198616915b82811015611e3857888601518255948401946001909101908401611e19565b5085821015611e565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611c8f908301846115fc565b600060208284031215611eb257600080fd5b8151610b868161158c565b6001600160a01b0386811682528516602082015260a060408201819052600090611ee99083018661194a565b8281036060840152611efb818661194a565b90508281036080840152611f0f81856115fc565b98975050505050505050565b8082018082111561046657610466611c22565b604081526000611f41604083018561194a565b8281036020840152611f53818561194a565b9594505050505056fea2646970667358221220bd174ae33cda336f394be2d297375745782b6dab3d42b59f4bf0d3fc18a71e9a64736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d634e48627076517461555178516f62475a5744696433314d4d6d69326d6131774a67457a75486447786533612f00000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101c35760003560e01c8063862440e2116100f9578063e30c397811610097578063f242432a11610071578063f242432a146103fe578063f2fde38b14610411578063f429326614610424578063fb8662f31461042c57600080fd5b8063e30c39781461039e578063e985e9c5146103af578063e9afcd40146103eb57600080fd5b8063bd85b039116100d3578063bd85b0391461035d578063c93b86f914610370578063d81d0a1514610378578063da1b9e081461038b57600080fd5b8063862440e2146103125780638da5cb5b14610325578063a22cb4651461034a57600080fd5b80632eb2c2d6116101665780634f558e79116101405780634f558e79146102dc57806355f804b3146102ef578063715018a61461030257806379ba50971461030a57600080fd5b80632eb2c2d61461027b5780634b25bfce1461028e5780634e1273f4146102bc57600080fd5b80630e89341c116101a25780630e89341c1461022b578063156e29f61461024b57806318160ddd14610260578063205a26fb1461026857600080fd5b8062fdd58e146101c857806301ffc9a7146101ee5780630ae2878914610211575b600080fd5b6101db6101d6366004611562565b610434565b6040519081526020015b60405180910390f35b6102016101fc3660046115a2565b61046c565b60405190151581526020016101e5565b610219600281565b60405160ff90911681526020016101e5565b61023e6102393660046115bf565b6104bc565b6040516101e59190611628565b61025e61025936600461163b565b6104c7565b005b6101db610583565b61025e6102763660046115bf565b610593565b61025e6102893660046117b4565b6105e7565b61020161029c36600461185e565b600960209081526000928352604080842090915290825290205460ff1681565b6102cf6102ca36600461188a565b61064d565b6040516101e59190611985565b6102016102ea3660046115bf565b610659565b61025e6102fd366004611998565b61066d565b61025e6106b8565b61025e6106cc565b61025e6103203660046119d5565b61070d565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016101e5565b61025e610358366004611a22565b610765565b6101db61036b3660046115bf565b610774565b610219600381565b61025e610386366004611a4c565b610793565b61025e610399366004611998565b610881565b6001546001600160a01b0316610332565b6102016103bd366004611ac0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b61025e6103f9366004611aea565b6108c1565b61025e61040c366004611b26565b6109dc565b61025e61041f366004611b8b565b610a3d565b610219600181565b610219600081565b600061043f82610593565b60008281526002602090815260408083206001600160a01b03871684529091529020545b90505b92915050565b60006001600160e01b03198216636cdb3d1360e11b148061049d57506001600160e01b031982166303a24d0760e21b145b8061046657506301ffc9a760e01b6001600160e01b0319831614610466565b606061046682610aad565b6104d082610593565b600082815260096020908152604080832033845290915290205460ff166105125760405162461bcd60e51b815260040161050990611ba6565b60405180910390fd5b61052d83838360405180602001604052806000815250610b8d565b604080513381526001600160a01b0385166020820152908101839052606081018290527f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee906080015b60405180910390a1505050565b600061058e60065490565b905090565b60038111156105e45760405162461bcd60e51b815260206004820181905260248201527f526574726f4272696467655068617365733a20696e76616c6964206e667449646044820152606401610509565b50565b60405162461bcd60e51b815260206004820152603560248201527f526574726f4272696467655068617365733a207361666542617463685472616e60448201527439b332b9233937b69034b9903337b93134b23232b760591b6064820152608401610509565b60606104638383610bf2565b600061066482610593565b61046682610cc7565b610675610cda565b61067e81610d07565b7f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa816040516106ad9190611628565b60405180910390a150565b6106c0610cda565b6106ca6000610d13565b565b60015433906001600160a01b031681146107045760405163118cdaa760e01b81526001600160a01b0382166004820152602401610509565b6105e481610d13565b610715610cda565b61071e82610593565b6107288282610d2c565b7fee1bb82f380189104b74a7647d26f2f35679780e816626ffcaec7cafb7288e468282604051610759929190611bf3565b60405180910390a15050565b610770338383610d89565b5050565b600061077f82610593565b600082815260056020526040902054610466565b60005b8251811015610830576107c18382815181106107b4576107b4611c0c565b6020026020010151610593565b600960008483815181106107d7576107d7611c0c565b6020908102919091018101518252818101929092526040908101600090812033825290925290205460ff1661081e5760405162461bcd60e51b815260040161050990611ba6565b8061082881611c38565b915050610796565b5061084c83838360405180602001604052806000815250610e1f565b7f5c5ac6bfb3f54a39f008d2e9be10d575012f29230716d49e92da377d748b1a87338484846040516105769493929190611c51565b610889610cda565b61089281610e5d565b7fb0cb658f6a70918635661157bac90270b4184dff76f6b90dfebdad09e29ce5eb816040516106ad9190611628565b6108c9610cda565b6108d283610593565b60008381526009602090815260408083206001600160a01b038616845290915290205481151560ff9091161515036109645760405162461bcd60e51b815260206004820152602f60248201527f526574726f4272696467655068617365733a206e6f74206368616e67696e672060448201526e77686974656c69737420737461746560881b6064820152608401610509565b60008381526009602090815260408083206001600160a01b03861680855290835292819020805460ff191685151590811790915581513381529283018790529082019290925260608101919091527f36037870726e8fcb5517b403843c7851bcabb9000458e4b91c6bf22ab4676c7e90608001610576565b60405162461bcd60e51b815260206004820152603060248201527f526574726f4272696467655068617365733a20736166655472616e736665724660448201526f3937b69034b9903337b93134b23232b760811b6064820152608401610509565b610a45610cda565b600180546001600160a01b0319166001600160a01b038316908117909155610a756000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600081815260086020526040812080546060929190610acb90611c9a565b80601f0160208091040260200160405190810160405280929190818152602001828054610af790611c9a565b8015610b445780601f10610b1957610100808354040283529160200191610b44565b820191906000526020600020905b815481529060010190602001808311610b2757829003601f168201915b505050505090506000815111610b6257610b5d83610e69565b610b86565b600781604051602001610b76929190611cd4565b6040516020818303038152906040525b9392505050565b6001600160a01b038416610bb757604051632bfa23e760e11b815260006004820152602401610509565b60408051600180825260208201869052818301908152606082018590526080820190925290610bea600087848487610efd565b505050505050565b60608151835114610c235781518351604051635b05999160e01b815260048101929092526024820152604401610509565b6000835167ffffffffffffffff811115610c3f57610c3f61166e565b604051908082528060200260200182016040528015610c68578160200160208202803683370190505b50905060005b8451811015610cbf57602080820286010151610c9290602080840287010151610434565b828281518110610ca457610ca4611c0c565b6020908102919091010152610cb881611c38565b9050610c6e565b509392505050565b600080610cd383610774565b1192915050565b6000546001600160a01b031633146106ca5760405163118cdaa760e01b8152336004820152602401610509565b60076107708282611da6565b600180546001600160a01b03191690556105e481610f57565b6000828152600860205260409020610d448282611da6565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b610d70846104bc565b604051610d7d9190611628565b60405180910390a25050565b6001600160a01b038216610db25760405162ced3e160e81b815260006004820152602401610509565b6001600160a01b03838116600081815260036020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416610e4957604051632bfa23e760e11b815260006004820152602401610509565b610e57600085858585610efd565b50505050565b60046107708282611da6565b606060048054610e7890611c9a565b80601f0160208091040260200160405190810160405280929190818152602001828054610ea490611c9a565b8015610ef15780601f10610ec657610100808354040283529160200191610ef1565b820191906000526020600020905b815481529060010190602001808311610ed457829003601f168201915b50505050509050919050565b610f0985858585610fa7565b6001600160a01b03841615610f505782513390600103610f425760208481015190840151610f3b838989858589610fb3565b5050610bea565b610bea8187878787876110e0565b5050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e57848484846111c9565b6001600160a01b0384163b15610bea5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190610ff79089908990889088908890600401611e66565b6020604051808303816000875af1925050508015611032575060408051601f3d908101601f1916820190925261102f91810190611ea0565b60015b61109b573d808015611060576040519150601f19603f3d011682016040523d82523d6000602084013e611065565b606091505b50805160000361109357604051632bfa23e760e11b81526001600160a01b0386166004820152602401610509565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b146110d757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610509565b50505050505050565b6001600160a01b0384163b15610bea5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906111249089908990889088908890600401611ebd565b6020604051808303816000875af192505050801561115f575060408051601f3d908101601f1916820190925261115c91810190611ea0565b60015b61118d573d808015611060576040519150601f19603f3d011682016040523d82523d6000602084013e611065565b6001600160e01b0319811663bc197c8160e01b146110d757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610509565b6111d584848484611323565b6001600160a01b038416611288576000805b835181101561126e57600083828151811061120457611204611c0c565b60200260200101519050806005600087858151811061122557611225611c0c565b60200260200101518152602001908152602001600020600082825461124a9190611f1b565b9091555061125a90508184611f1b565b9250508061126790611c38565b90506111e7565b5080600660008282546112819190611f1b565b9091555050505b6001600160a01b038316610e57576000805b83518110156113125760008382815181106112b7576112b7611c0c565b6020026020010151905080600560008785815181106112d8576112d8611c0c565b60200260200101518152602001908152602001600020600082825403925050819055508083019250508061130b90611c38565b905061129a565b506006805491909103905550505050565b80518251146113525781518151604051635b05999160e01b815260048101929092526024820152604401610509565b3360005b8351811015611467576020818102858101820151908501909101516001600160a01b0388161561140d5760008281526002602090815260408083206001600160a01b038c168452909152902054818110156113e4576040516303dee4c560e01b81526001600160a01b038a166004820152602481018290526044810183905260648101849052608401610509565b60008381526002602090815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b038716156114545760008281526002602090815260408083206001600160a01b038b1684529091528120805483929061144e908490611f1b565b90915550505b50508061146090611c38565b9050611356565b5082516001036114e85760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516114d9929190918252602082015260400190565b60405180910390a45050610f50565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611537929190611f2e565b60405180910390a45050505050565b80356001600160a01b038116811461155d57600080fd5b919050565b6000806040838503121561157557600080fd5b61157e83611546565b946020939093013593505050565b6001600160e01b0319811681146105e457600080fd5b6000602082840312156115b457600080fd5b8135610b868161158c565b6000602082840312156115d157600080fd5b5035919050565b60005b838110156115f35781810151838201526020016115db565b50506000910152565b600081518084526116148160208601602086016115d8565b601f01601f19169290920160200192915050565b60208152600061046360208301846115fc565b60008060006060848603121561165057600080fd5b61165984611546565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156116ad576116ad61166e565b604052919050565b600067ffffffffffffffff8211156116cf576116cf61166e565b5060051b60200190565b600082601f8301126116ea57600080fd5b813560206116ff6116fa836116b5565b611684565b82815260059290921b8401810191818101908684111561171e57600080fd5b8286015b848110156117395780358352918301918301611722565b509695505050505050565b600082601f83011261175557600080fd5b813567ffffffffffffffff81111561176f5761176f61166e565b611782601f8201601f1916602001611684565b81815284602083860101111561179757600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156117cc57600080fd5b6117d586611546565b94506117e360208701611546565b9350604086013567ffffffffffffffff8082111561180057600080fd5b61180c89838a016116d9565b9450606088013591508082111561182257600080fd5b61182e89838a016116d9565b9350608088013591508082111561184457600080fd5b5061185188828901611744565b9150509295509295909350565b6000806040838503121561187157600080fd5b8235915061188160208401611546565b90509250929050565b6000806040838503121561189d57600080fd5b823567ffffffffffffffff808211156118b557600080fd5b818501915085601f8301126118c957600080fd5b813560206118d96116fa836116b5565b82815260059290921b840181019181810190898411156118f857600080fd5b948201945b8386101561191d5761190e86611546565b825294820194908201906118fd565b9650508601359250508082111561193357600080fd5b50611940858286016116d9565b9150509250929050565b600081518084526020808501945080840160005b8381101561197a5781518752958201959082019060010161195e565b509495945050505050565b602081526000610463602083018461194a565b6000602082840312156119aa57600080fd5b813567ffffffffffffffff8111156119c157600080fd5b6119cd84828501611744565b949350505050565b600080604083850312156119e857600080fd5b82359150602083013567ffffffffffffffff811115611a0657600080fd5b61194085828601611744565b8035801515811461155d57600080fd5b60008060408385031215611a3557600080fd5b611a3e83611546565b915061188160208401611a12565b600080600060608486031215611a6157600080fd5b611a6a84611546565b9250602084013567ffffffffffffffff80821115611a8757600080fd5b611a93878388016116d9565b93506040860135915080821115611aa957600080fd5b50611ab6868287016116d9565b9150509250925092565b60008060408385031215611ad357600080fd5b611adc83611546565b915061188160208401611546565b600080600060608486031215611aff57600080fd5b83359250611b0f60208501611546565b9150611b1d60408501611a12565b90509250925092565b600080600080600060a08688031215611b3e57600080fd5b611b4786611546565b9450611b5560208701611546565b93506040860135925060608601359150608086013567ffffffffffffffff811115611b7f57600080fd5b61185188828901611744565b600060208284031215611b9d57600080fd5b61046382611546565b6020808252602d908201527f526574726f4272696467655068617365733a206d73672e73656e646572206e6f60408201526c1d081dda1a5d195b1a5cdd1959609a1b606082015260800190565b8281526040602082015260006119cd60408301846115fc565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c4a57611c4a611c22565b5060010190565b6001600160a01b03858116825284166020820152608060408201819052600090611c7d9083018561194a565b8281036060840152611c8f818561194a565b979650505050505050565b600181811c90821680611cae57607f821691505b602082108103611cce57634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454611ce281611c9a565b60018281168015611cfa5760018114611d0f57611d3e565b60ff1984168752821515830287019450611d3e565b8860005260208060002060005b85811015611d355781548a820152908401908201611d1c565b50505082870194505b505050508351611d528183602088016115d8565b01949350505050565b601f821115611da157600081815260208120601f850160051c81016020861015611d825750805b601f850160051c820191505b81811015610bea57828155600101611d8e565b505050565b815167ffffffffffffffff811115611dc057611dc061166e565b611dd481611dce8454611c9a565b84611d5b565b602080601f831160018114611e095760008415611df15750858301515b600019600386901b1c1916600185901b178555610bea565b600085815260208120601f198616915b82811015611e3857888601518255948401946001909101908401611e19565b5085821015611e565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611c8f908301846115fc565b600060208284031215611eb257600080fd5b8151610b868161158c565b6001600160a01b0386811682528516602082015260a060408201819052600090611ee99083018661194a565b8281036060840152611efb818661194a565b90508281036080840152611f0f81856115fc565b98975050505050505050565b8082018082111561046657610466611c22565b604081526000611f41604083018561194a565b8281036020840152611f53818561194a565b9594505050505056fea2646970667358221220bd174ae33cda336f394be2d297375745782b6dab3d42b59f4bf0d3fc18a71e9a64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000036697066733a2f2f516d634e48627076517461555178516f62475a5744696433314d4d6d69326d6131774a67457a75486447786533612f00000000000000000000
-----Decoded View---------------
Arg [0] : _baseURI (string): ipfs://QmcNHbpvQtaUQxQobGZWDid31MMmi2ma1wJgEzuHdGxe3a/
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000036
Arg [2] : 697066733a2f2f516d634e48627076517461555178516f62475a574469643331
Arg [3] : 4d4d6d69326d6131774a67457a75486447786533612f00000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.