Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 645 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Safe Transfer Fr... | 36849154 | 146 days ago | IN | 0 ETH | 0.00000025 | ||||
| Safe Transfer Fr... | 36848362 | 146 days ago | IN | 0 ETH | 0.00000018 | ||||
| Safe Transfer Fr... | 35467205 | 178 days ago | IN | 0 ETH | 0.00000022 | ||||
| Safe Transfer Fr... | 35467165 | 178 days ago | IN | 0 ETH | 0.0000002 | ||||
| Set Approval For... | 35241996 | 184 days ago | IN | 0 ETH | 0.00000003 | ||||
| Set Approval For... | 35241992 | 184 days ago | IN | 0 ETH | 0.00000008 | ||||
| Set Approval For... | 32918868 | 237 days ago | IN | 0 ETH | 0.00000068 | ||||
| Set Approval For... | 32918865 | 237 days ago | IN | 0 ETH | 0.00000073 | ||||
| Set Approval For... | 30868055 | 285 days ago | IN | 0 ETH | 0.00000077 | ||||
| Safe Transfer Fr... | 30007097 | 305 days ago | IN | 0 ETH | 0.00000032 | ||||
| Safe Transfer Fr... | 30007087 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007078 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007069 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007060 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007051 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007041 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007032 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007022 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30007012 | 305 days ago | IN | 0 ETH | 0.00000034 | ||||
| Safe Transfer Fr... | 30007001 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30006991 | 305 days ago | IN | 0 ETH | 0.00000038 | ||||
| Safe Transfer Fr... | 30006981 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30006971 | 305 days ago | IN | 0 ETH | 0.00000034 | ||||
| Safe Transfer Fr... | 30006960 | 305 days ago | IN | 0 ETH | 0.00000035 | ||||
| Safe Transfer Fr... | 30006938 | 305 days ago | IN | 0 ETH | 0.00000035 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
NFTContract
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 {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {ERC721A, IERC721A} from "@erc721a/contracts/ERC721A.sol";
import {ERC721ABurnable} from "@erc721a/contracts/extensions/ERC721ABurnable.sol";
/// @title NFTContract NFTs
/// @author Nadina Oates
/// @notice Contract implementing ERC721A standard using ERC20 token and ETH for minting
/// @dev Inherits from ERC721A and ERC721ABurnable and openzeppelin Ownable
contract NFTContract is ERC721A, ERC2981, ERC721ABurnable, Ownable {
/**
* TYPES
*/
struct ConstructorArguments {
string name;
string symbol;
address owner;
address feeAddress;
address tokenAddress;
uint256 tokenFee;
uint256 ethFee;
string baseURI;
string contractURI;
uint256 maxSupply;
uint96 royaltyNumerator;
}
enum Trait {
None,
Green,
Blue,
Yellow,
Red,
Purple
}
/**
* Storage Variables
*/
uint256 private immutable i_maxSupply;
uint256 private immutable i_numTraits;
IERC20 private immutable i_feeToken;
address private s_feeAddress;
uint256 private s_tokenFee;
uint256 private s_ethFee;
uint256 private s_batchLimit = 50;
string private s_baseURI;
string private s_contractURI;
bool private s_paused;
mapping(Trait trait => uint256) private s_limits;
mapping(uint256 tokenId => Trait) private s_traits;
mapping(uint256 tokenId => uint256) private s_tokenURINumber;
uint256[] private s_ids;
uint256 private s_nonce;
/**
* Events
*/
event Paused(address indexed sender, bool isPaused);
event TokenFeeSet(address indexed sender, uint256 indexed fee);
event EthFeeSet(address indexed sender, uint256 indexed fee);
event FeeAddressSet(address indexed sender, address feeAddress);
event BatchLimitSet(address indexed sender, uint256 batchLimit);
event BaseURIUpdated(address indexed sender, string indexed baseUri);
event ContractURIUpdated(address indexed sender, string indexed contractUri);
event RoyaltyUpdated(address indexed feeAddress, uint96 indexed royaltyNumerator);
event MetadataUpdated(uint256 indexed tokenId);
/**
* Errors
*/
error NFTContract_InsufficientMintQuantity();
error NFTContract_ExceedsMaxSupply();
error NFTContract_ExceedsMaxPerWallet();
error NFTContract_ExceedsBatchLimit();
error NFTContract_FeeAddressIsZeroAddress();
error NFTContract_InsufficientEthFee(uint256 value, uint256 fee);
error NFTContract_TokenTransferFailed();
error NFTContract_EthTransferFailed();
error NFTContract_BatchLimitTooHigh();
error NFTContract_NonexistentToken(uint256);
error NFTContract_TokenUriError();
error NFTContract_NoBaseURI();
error NFTContract_ContractIsPaused();
/// @notice Constructor
/// @param args constructor arguments:
/// name: collection name
/// symbol: nft symbol
/// owner: contract owner
/// ethFee: minting fee in native coin
/// token: minting fee in erc20
/// tokenAddress: erc20 token address used for fees
/// feeAddress: address for fees
/// baseURI: base uri
/// contractURI: contract uri
/// maxSupply: maximum nfts mintable
/// royaltyNumerator: basis points for royalty fees
constructor(ConstructorArguments memory args) ERC721A(args.name, args.symbol) Ownable(msg.sender) {
if (args.feeAddress == address(0)) {
revert NFTContract_FeeAddressIsZeroAddress();
}
if (bytes(args.baseURI).length == 0) revert NFTContract_NoBaseURI();
s_tokenFee = args.tokenFee;
s_ethFee = args.ethFee;
s_feeAddress = args.feeAddress;
i_feeToken = IERC20(args.tokenAddress);
i_maxSupply = args.maxSupply;
s_paused = true;
// setup trait
i_numTraits = 5;
s_limits[Trait.Green] = 790;
s_limits[Trait.Blue] = 890;
s_limits[Trait.Yellow] = 970;
s_limits[Trait.Red] = 990;
s_limits[Trait.Purple] = args.maxSupply;
// initialize randomization
s_ids = new uint256[](args.maxSupply);
// initialize metadata
_setBaseURI(args.baseURI);
_setContractURI(args.contractURI);
_setDefaultRoyalty(args.feeAddress, args.royaltyNumerator);
// set ownership
if (args.owner != msg.sender) _transferOwnership(args.owner);
}
receive() external payable {}
/// @notice Mints NFT for a eth and a token fee
/// @param quantity number of NFTs to mint
function mint(uint256 quantity) external payable {
if (s_paused) revert NFTContract_ContractIsPaused();
if (quantity == 0) revert NFTContract_InsufficientMintQuantity();
if (quantity > s_batchLimit) revert NFTContract_ExceedsBatchLimit();
if (totalSupply() + quantity > i_maxSupply) {
revert NFTContract_ExceedsMaxSupply();
}
// mint nfts
uint256 tokenId = _nextTokenId();
for (uint256 i = 0; i < quantity; i++) {
_setTokenURI(tokenId);
unchecked {
tokenId++;
}
}
_mint(msg.sender, quantity);
// pay mint fee in tokens
uint256 tokenFee = s_tokenFee;
if (tokenFee > 0) {
uint256 totalTokenFee = tokenFee * quantity;
bool success = i_feeToken.transferFrom(msg.sender, s_feeAddress, totalTokenFee);
if (!success) revert NFTContract_TokenTransferFailed();
}
// pay mint fee in ETH
uint256 ethFee = s_ethFee;
if (ethFee > 0) {
uint256 totalEthFee = ethFee * quantity;
if (msg.value < totalEthFee) {
revert NFTContract_InsufficientEthFee(msg.value, totalEthFee);
}
(bool success,) = payable(s_feeAddress).call{value: totalEthFee}("");
if (!success) revert NFTContract_EthTransferFailed();
}
}
/// @notice Sets minting fee in ETH (only owner)
/// @param fee New fee in ETH
function setEthFee(uint256 fee) external onlyOwner {
s_ethFee = fee;
emit EthFeeSet(msg.sender, fee);
}
/// @notice Sets minting fee in ERC20 (only owner)
/// @param fee New fee in ERC20
function setTokenFee(uint256 fee) external onlyOwner {
s_tokenFee = fee;
emit TokenFeeSet(msg.sender, fee);
}
/// @notice Sets the receiver address for the token/ETH fee (only owner)
/// @param feeAddress New receiver address for tokens and ETH received through minting
function setFeeAddress(address feeAddress) external onlyOwner {
if (feeAddress == address(0)) {
revert NFTContract_FeeAddressIsZeroAddress();
}
s_feeAddress = feeAddress;
emit FeeAddressSet(msg.sender, feeAddress);
}
/// @notice Sets batch limit - maximum number of nfts that can be minted at once (only owner)
/// @param batchLimit Maximum number of nfts that can be minted at once
function setBatchLimit(uint256 batchLimit) external onlyOwner {
if (batchLimit > 100) revert NFTContract_BatchLimitTooHigh();
s_batchLimit = batchLimit;
emit BatchLimitSet(msg.sender, batchLimit);
}
/// @notice Withdraw tokens from contract (only owner)
/// @param tokenAddress Contract address of token to be withdrawn
/// @param receiverAddress Tokens are withdrawn to this address
/// @return success of withdrawal
function withdrawTokens(address tokenAddress, address receiverAddress) external onlyOwner returns (bool success) {
IERC20 tokenContract = IERC20(tokenAddress);
uint256 amount = tokenContract.balanceOf(address(this));
success = tokenContract.transfer(receiverAddress, amount);
if (!success) revert NFTContract_TokenTransferFailed();
}
/// @notice Withdraw ETH from contract (only owner)
/// @param receiverAddress ETH withdrawn to this address
/// @return success of withdrawal
function withdrawETH(address receiverAddress) external onlyOwner returns (bool success) {
uint256 amount = address(this).balance;
(success,) = payable(receiverAddress).call{value: amount}("");
if (!success) revert NFTContract_EthTransferFailed();
}
/// @notice Sets base Uri
/// @param baseURI base uri
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
/// @notice Sets contract uri
/// @param _contractURI contract uri for contract metadata
function setContractURI(string memory _contractURI) external onlyOwner {
_setContractURI(_contractURI);
}
/// @notice Sets royalty
/// @param feeAddress address receiving royalties
/// @param royaltyNumerator numerator to calculate fees (denominator is 10000)
function setRoyalty(address feeAddress, uint96 royaltyNumerator) external onlyOwner {
_setDefaultRoyalty(feeAddress, royaltyNumerator);
emit RoyaltyUpdated(feeAddress, royaltyNumerator);
}
/// @notice Pauses minting
/// @param _isPaused boolean to set minting to be paused (true) or unpaused (false)
function pause(bool _isPaused) external onlyOwner {
s_paused = _isPaused;
emit Paused(msg.sender, _isPaused);
}
/**
* Getter Functions
*/
/// @notice Returns maximum supply
function getMaxSupply() external view returns (uint256) {
return i_maxSupply;
}
/// @notice Returns minting fee in ETH
function getEthFee() external view returns (uint256) {
return s_ethFee;
}
/// @notice Returns minting fee in ERC20
function getTokenFee() external view returns (uint256) {
return s_tokenFee;
}
/// @notice Returns fee token address
function getFeeToken() external view returns (address) {
return address(i_feeToken);
}
/// @notice Returns trait limit
function getTraitLimit(uint256 trait) external view returns (uint256) {
return s_limits[Trait(trait)];
}
/// @notice Returns trait
function getTrait(uint256 tokenId) external view returns (Trait) {
return s_traits[tokenId];
}
/// @notice Returns address that receives minting fees
function getFeeAddress() external view returns (address) {
return s_feeAddress;
}
/// @notice Returns number of nfts allowed minted at once
function getBatchLimit() external view returns (uint256) {
return s_batchLimit;
}
/// @notice Returns base uri
function getBaseURI() external view returns (string memory) {
return _baseURI();
}
/// @notice Returns contract uri
function getContractURI() external view returns (string memory) {
return s_contractURI;
}
/// @notice Returns whether contract is paused
function isPaused() external view returns (bool) {
return s_paused;
}
/**
* Public Functions
*/
/// @notice retrieves contractURI
function contractURI() public view returns (string memory) {
return s_contractURI;
}
/// @notice retrieves tokenURI
/// @dev adapted from openzeppelin ERC721URIStorage contract
/// @param tokenId tokenID of NFT
function tokenURI(uint256 tokenId) public view override(ERC721A, IERC721A) returns (string memory) {
_requireOwned(tokenId);
string memory _tokenURI = Strings.toString(s_tokenURINumber[tokenId]);
string memory base = _baseURI();
// If both are set, concatenate the baseURI and tokenURI (via string.concat).
if (bytes(_tokenURI).length > 0) {
return string.concat(base, _tokenURI);
}
return super.tokenURI(tokenId);
}
/// @notice checks for supported interface
/// @dev function override required by ERC721
/// @param interfaceId interfaceId to be checked
function supportsInterface(bytes4 interfaceId) public view override(ERC721A, IERC721A, ERC2981) returns (bool) {
return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
}
/**
* Internal/Private Functions
*/
/// @notice Checks if token owner exists
/// @dev adapted code from openzeppelin ERC721
/// @param tokenId token id of NFT
function _requireOwned(uint256 tokenId) internal view {
ownerOf(tokenId);
}
/// @notice sets first tokenId to 1
function _startTokenId() internal view virtual override(ERC721A) returns (uint256) {
return 1;
}
/// @notice Checks if token owner exists
/// @dev adapted code from openzeppelin ERC721URIStorage
/// @param tokenId tokenId of nft
function _setTokenURI(uint256 tokenId) private {
uint256 tokenUri = _randomTokenURI();
s_tokenURINumber[tokenId] = tokenUri;
for (uint256 i = 1; i <= i_numTraits; i++) {
if (tokenUri < s_limits[Trait(i)]) {
s_traits[tokenId] = Trait(i);
emit MetadataUpdated(tokenId);
return;
}
}
}
/// @notice Retrieves base uri
function _baseURI() internal view override returns (string memory) {
return s_baseURI;
}
/// @notice Sets base uri
/// @param baseURI base uri for NFT metadata
function _setBaseURI(string memory baseURI) private {
s_baseURI = baseURI;
emit BaseURIUpdated(msg.sender, baseURI);
}
/// @notice Sets contract uri
/// @param _contractURI contract uri for contract metadata
function _setContractURI(string memory _contractURI) private {
s_contractURI = _contractURI;
emit ContractURIUpdated(msg.sender, _contractURI);
}
/// @notice generates a random tokenURI
function _randomTokenURI() private returns (uint256 randomTokenURI) {
uint256 numAvailableURIs = s_ids.length;
uint256 randIdx = uint256(keccak256(abi.encodePacked(block.prevrandao, s_nonce))) % numAvailableURIs;
// get new and nonexisting random id
randomTokenURI = (s_ids[randIdx] != 0) ? s_ids[randIdx] : randIdx;
// update helper array
s_ids[randIdx] = (s_ids[numAvailableURIs - 1] == 0) ? numAvailableURIs - 1 : s_ids[numAvailableURIs - 1];
s_ids.pop();
unchecked {
s_nonce++;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// 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) (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
// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.20;
import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);
/**
* @dev The default royalty receiver is invalid.
*/
error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);
/**
* @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);
/**
* @dev The royalty receiver for `tokenId` is invalid.
*/
error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
}
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
}
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* The `_sequentialUpTo()` function can be overriden to enable spot mints
* (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// The amount of tokens minted above `_sequentialUpTo()`.
// We call these spot mints (i.e. non-sequential mints).
uint256 private _spotMinted;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector);
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID for sequential mints.
*
* Override this function to change the starting token ID for sequential mints.
*
* Note: The value returned must never change after any tokens have been minted.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the maximum token ID (inclusive) for sequential mints.
*
* Override this function to return a value less than 2**256 - 1,
* but greater than `_startTokenId()`, to enable spot (non-sequential) mints.
*
* Note: The value returned must never change after any tokens have been minted.
*/
function _sequentialUpTo() internal view virtual returns (uint256) {
return type(uint256).max;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256 result) {
// Counter underflow is impossible as `_burnCounter` cannot be incremented
// more than `_currentIndex + _spotMinted - _startTokenId()` times.
unchecked {
// With spot minting, the intermediate `result` can be temporarily negative,
// and the computation must be unchecked.
result = _currentIndex - _burnCounter - _startTokenId();
if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256 result) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
result = _currentIndex - _startTokenId();
if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
/**
* @dev Returns the total number of tokens that are spot-minted.
*/
function _totalSpotMinted() internal view virtual returns (uint256) {
return _spotMinted;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Returns whether the ownership slot at `index` is initialized.
* An uninitialized slot does not necessarily mean that the slot has no owner.
*/
function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {
return _packedOwnerships[index] != 0;
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* @dev Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
if (_startTokenId() <= tokenId) {
packed = _packedOwnerships[tokenId];
if (tokenId > _sequentialUpTo()) {
if (_packedOwnershipExists(packed)) return packed;
_revert(OwnerQueryForNonexistentToken.selector);
}
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) {
if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `tokenId` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
for (;;) {
unchecked {
packed = _packedOwnerships[--tokenId];
}
if (packed == 0) continue;
if (packed & _BITMASK_BURNED == 0) return packed;
// Otherwise, the token is burned, and we must revert.
// This handles the case of batch burned tokens, where only the burned bit
// of the starting slot is set, and remaining slots are left uninitialized.
_revert(OwnerQueryForNonexistentToken.selector);
}
}
// Otherwise, the data exists and we can skip the scan.
// This is possible because we have already achieved the target condition.
// This saves 2143 gas on transfers of initialized tokens.
// If the token is not burned, return `packed`. Otherwise, revert.
if (packed & _BITMASK_BURNED == 0) return packed;
}
_revert(OwnerQueryForNonexistentToken.selector);
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
_approve(to, tokenId, true);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector);
return _tokenApprovals[tokenId].value;
}
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool result) {
if (_startTokenId() <= tokenId) {
if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]);
if (tokenId < _currentIndex) {
uint256 packed;
while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId;
result = packed & _BITMASK_BURNED == 0;
}
}
}
/**
* @dev Returns whether `packed` represents a token that exists.
*/
function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {
assembly {
// The following is equivalent to `owner != address(0) && burned == false`.
// Symbolically tested.
result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED))
}
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
// Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));
if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
from, // `from`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
if (toMasked == 0) _revert(TransferToZeroAddress.selector);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
}
/**
* @dev Hook that is called before a set of serially-ordered token IDs
* are about to be transferred. This includes minting.
* And also called before burning one token.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
assembly {
revert(add(32, reason), mload(reason))
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) _revert(MintZeroQuantity.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
uint256 end = startTokenId + quantity;
uint256 tokenId = startTokenId;
if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);
do {
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
// The `!=` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
} while (++tokenId != end);
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) _revert(MintToZeroAddress.selector);
if (quantity == 0) _revert(MintZeroQuantity.selector);
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
} while (index < end);
// This prevents reentrancy to `_safeMint`.
// It does not prevent reentrancy to `_safeMintSpot`.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
/**
* @dev Mints a single token at `tokenId`.
*
* Note: A spot-minted `tokenId` that has been burned can be re-minted again.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` must be greater than `_sequentialUpTo()`.
* - `tokenId` must not exist.
*
* Emits a {Transfer} event for each mint.
*/
function _mintSpot(address to, uint256 tokenId) internal virtual {
if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector);
uint256 prevOwnershipPacked = _packedOwnerships[tokenId];
if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector);
_beforeTokenTransfers(address(0), to, tokenId, 1);
// Overflows are incredibly unrealistic.
// The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1.
// `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1.
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `true` (as `quantity == 1`).
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked)
);
// Updates:
// - `balance += 1`.
// - `numberMinted += 1`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1;
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
++_spotMinted;
}
_afterTokenTransfers(address(0), to, tokenId, 1);
}
/**
* @dev Safely mints a single token at `tokenId`.
*
* Note: A spot-minted `tokenId` that has been burned can be re-minted again.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}.
* - `tokenId` must be greater than `_sequentialUpTo()`.
* - `tokenId` must not exist.
*
* See {_mintSpot}.
*
* Emits a {Transfer} event.
*/
function _safeMintSpot(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mintSpot(to, tokenId);
unchecked {
if (to.code.length != 0) {
uint256 currentSpotMinted = _spotMinted;
if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
// This prevents reentrancy to `_safeMintSpot`.
// It does not prevent reentrancy to `_safeMint`.
if (_spotMinted != currentSpotMinted) revert();
}
}
}
/**
* @dev Equivalent to `_safeMintSpot(to, tokenId, '')`.
*/
function _safeMintSpot(address to, uint256 tokenId) internal virtual {
_safeMintSpot(to, tokenId, '');
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_approve(to, tokenId, false)`.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_approve(to, tokenId, false);
}
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck && _msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
_revert(ApprovalCallerNotOwnerNorApproved.selector);
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
/**
* @dev For more efficient reverts.
*/
function _revert(bytes4 errorSelector) internal pure {
assembly {
mstore(0x00, errorSelector)
revert(0x00, 0x04)
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721ABurnable.sol';
import '../ERC721A.sol';
/**
* @title ERC721ABurnable.
*
* @dev ERC721A token that can be irreversibly burned (destroyed).
*/
abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable {
/**
* @dev Burns `tokenId`. See {ERC721A-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual override {
_burn(tokenId, true);
}
}// 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/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) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (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
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
/**
* `_sequentialUpTo()` must be greater than `_startTokenId()`.
*/
error SequentialUpToTooSmall();
/**
* The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`.
*/
error SequentialMintExceedsLimit();
/**
* Spot minting requires a `tokenId` greater than `_sequentialUpTo()`.
*/
error SpotMintTokenIdTooSmall();
/**
* Cannot mint over a token that already exists.
*/
error TokenAlreadyExists();
/**
* The feature is not compatible with spot mints.
*/
error NotCompatibleWithSpotMints();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables
* (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`,
* checking first that contract recipients are aware of the ERC721 protocol
* to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move
* this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external payable;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '../IERC721A.sol';
/**
* @dev Interface of ERC721ABurnable.
*/
interface IERC721ABurnable is IERC721A {
/**
* @dev Burns `tokenId`. See {ERC721A-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) external;
}// 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);
}{
"remappings": [
"@erc721a/contracts/=lib/ERC721A/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"foundry-devops/=lib/foundry-devops/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ERC721A/=lib/ERC721A/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"feeAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenFee","type":"uint256"},{"internalType":"uint256","name":"ethFee","type":"uint256"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint96","name":"royaltyNumerator","type":"uint96"}],"internalType":"struct NFTContract.ConstructorArguments","name":"args","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NFTContract_BatchLimitTooHigh","type":"error"},{"inputs":[],"name":"NFTContract_ContractIsPaused","type":"error"},{"inputs":[],"name":"NFTContract_EthTransferFailed","type":"error"},{"inputs":[],"name":"NFTContract_ExceedsBatchLimit","type":"error"},{"inputs":[],"name":"NFTContract_ExceedsMaxPerWallet","type":"error"},{"inputs":[],"name":"NFTContract_ExceedsMaxSupply","type":"error"},{"inputs":[],"name":"NFTContract_FeeAddressIsZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"NFTContract_InsufficientEthFee","type":"error"},{"inputs":[],"name":"NFTContract_InsufficientMintQuantity","type":"error"},{"inputs":[],"name":"NFTContract_NoBaseURI","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"NFTContract_NonexistentToken","type":"error"},{"inputs":[],"name":"NFTContract_TokenTransferFailed","type":"error"},{"inputs":[],"name":"NFTContract_TokenUriError","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"string","name":"baseUri","type":"string"}],"name":"BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"batchLimit","type":"uint256"}],"name":"BatchLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"string","name":"contractUri","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"EthFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"feeAddress","type":"address"}],"name":"FeeAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"MetadataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeAddress","type":"address"},{"indexed":true,"internalType":"uint96","name":"royaltyNumerator","type":"uint96"}],"name":"RoyaltyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"TokenFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBatchLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEthFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTrait","outputs":[{"internalType":"enum NFTContract.Trait","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"trait","type":"uint256"}],"name":"getTraitLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_isPaused","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","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":"uint256","name":"batchLimit","type":"uint256"}],"name":"setBatchLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_contractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setEthFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeAddress","type":"address"},{"internalType":"uint96","name":"royaltyNumerator","type":"uint96"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setTokenFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiverAddress","type":"address"}],"name":"withdrawETH","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"receiverAddress","type":"address"}],"name":"withdrawTokens","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60e06040526032600f553480156200001657600080fd5b5060405162002f1238038062002f12833981016040819052620000399162000618565b80516020820151339190600262000051838262000805565b50600362000060828262000805565b50600160005550506001600160a01b0381166200009857604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000a381620002e2565b5060608101516001600160a01b0316620000d057604051638eda511f60e01b815260040160405180910390fd5b8060e0015151600003620000f75760405163285748b960e21b815260040160405180910390fd5b60a081810151600d5560c080830151600e556060830151600c80546001600160a01b0319166001600160a01b03928316179055608080850151909116909152610120830180519091526012805460ff1916600117905560059182905260136020526103167f4155c2f711f2cdd34f8262ab8fb9b7020a700fe7b6948222152f7670d1fdf34d5561037a7f0b9d2c0c271bb30544eb78c59bdaebdae2728e5f65814c07768a0abe90ed1923556103ca7f0d2a6872ef858a7f8ead18dc4f3f2e8d35c853d47e2816cbb9cdd49202554e0c55600460009081526103de7f01413ff7a3b1d5b6c016c061d48e2c7014700c777a29fcd068fff04265813d5d5581519290527ff4b2859895858d6aa26d656e4999d552f6a869b74c43bba7d2a941c4d22c355991909155516001600160401b03811115620002385762000238620004ea565b60405190808252806020026020018201604052801562000262578160200160208202803683370190505b508051620002799160169160209091019062000483565b5060e08101516200028a9062000334565b6101008101516200029b9062000388565b620002b68160600151826101400151620003dc60201b60201c565b60408101516001600160a01b03163314620002db576040810151620002db90620002e2565b50620008ef565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b601062000342828262000805565b5080604051620003539190620008d1565b6040519081900381209033907ff765b68b6ff897de964353a0eb194e46ecea8772879eb880b4b0fd277124922c90600090a350565b601162000396828262000805565b5080604051620003a79190620008d1565b6040519081900381209033907f1ca91f64ead03abb06ea28975dfbf18044ac06f9fa1cb62a54ccc905df1028ed90600090a350565b6127106001600160601b0382168110156200041d57604051636f483d0960e01b81526001600160601b0383166004820152602481018290526044016200008f565b6001600160a01b0383166200044957604051635b6cc80560e11b8152600060048201526024016200008f565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b828054828255906000526020600020908101928215620004c1579160200282015b82811115620004c1578251825591602001919060010190620004a4565b50620004cf929150620004d3565b5090565b5b80821115620004cf5760008155600101620004d4565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b0381118282101715620005265762000526620004ea565b60405290565b60005b83811015620005495781810151838201526020016200052f565b50506000910152565b600082601f8301126200056457600080fd5b81516001600160401b0380821115620005815762000581620004ea565b604051601f8301601f19908116603f01168101908282118183101715620005ac57620005ac620004ea565b81604052838152866020858801011115620005c657600080fd5b620005d98460208301602089016200052c565b9695505050505050565b80516001600160a01b0381168114620005fb57600080fd5b919050565b80516001600160601b0381168114620005fb57600080fd5b6000602082840312156200062b57600080fd5b81516001600160401b03808211156200064357600080fd5b9083019061016082860312156200065957600080fd5b6200066362000500565b8251828111156200067357600080fd5b620006818782860162000552565b8252506020830151828111156200069757600080fd5b620006a58782860162000552565b602083015250620006b960408401620005e3565b6040820152620006cc60608401620005e3565b6060820152620006df60808401620005e3565b608082015260a083015160a082015260c083015160c082015260e0830151828111156200070b57600080fd5b620007198782860162000552565b60e08301525061010080840151838111156200073457600080fd5b620007428882870162000552565b8284015250506101209150818301518282015261014091506200076782840162000600565b91810191909152949350505050565b600181811c908216806200078b57607f821691505b602082108103620007ac57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200080057600081815260208120601f850160051c81016020861015620007db5750805b601f850160051c820191505b81811015620007fc57828155600101620007e7565b5050505b505050565b81516001600160401b03811115620008215762000821620004ea565b620008398162000832845462000776565b84620007b2565b602080601f831160018114620008715760008415620008585750858301515b600019600386901b1c1916600185901b178555620007fc565b600085815260208120601f198616915b82811015620008a25788860151825594840194600190910190840162000881565b5085821015620008c15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251620008e58184602087016200052c565b9190910192915050565b60805160a05160c0516125e56200092d600039600081816106cd0152610eec015260006118d00152600081816104640152610e0e01526125e56000f3fe6080604052600436106102555760003560e01c8063714c539811610139578063acb586df116100b6578063cbafcf361161007a578063cbafcf36146106f1578063d116f9d814610706578063e8a3d485146103d8578063e985e9c514610726578063f2600b5614610746578063f2fde38b1461076657600080fd5b8063acb586df14610636578063b187bd2614610673578063b88d4fde1461068b578063c87b56dd1461069e578063ca709a25146106be57600080fd5b8063938e3d7b116100fd578063938e3d7b146105ae57806395d89b41146105ce578063a0712d68146105e3578063a22cb465146105f6578063a522ad251461061657600080fd5b8063714c539814610526578063715018a61461053b5780638705fcd4146105505780638da5cb5b146105705780638f2fc60b1461058e57600080fd5b806337929eb4116101d25780634c0f38c2116101965780634c0f38c2146104555780634e7ceacb1461048857806355f804b3146104a65780636352211e146104c6578063690d8320146104e657806370a082311461050657600080fd5b806337929eb4146103d85780633f6738a9146103ed57806342842e0e1461040d57806342966c6814610420578063435d0e141461044057600080fd5b806318160ddd1161021957806318160ddd1461032557806323b872dd146103515780632a55205a1461036457806331b31b88146103a357806335546850146103c357600080fd5b806301ffc9a71461026157806302329a291461029657806306fdde03146102b8578063081812fc146102da578063095ea7b31461031257600080fd5b3661025c57005b600080fd5b34801561026d57600080fd5b5061028161027c366004611efe565b610786565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102b66102b1366004611f29565b6107a6565b005b3480156102c457600080fd5b506102cd6107f8565b60405161028d9190611f96565b3480156102e657600080fd5b506102fa6102f5366004611fa9565b61088a565b6040516001600160a01b03909116815260200161028d565b6102b6610320366004611fd9565b6108c5565b34801561033157600080fd5b50610343600154600054036000190190565b60405190815260200161028d565b6102b661035f366004612003565b6108d5565b34801561037057600080fd5b5061038461037f36600461203f565b610a44565b604080516001600160a01b03909316835260208301919091520161028d565b3480156103af57600080fd5b506102b66103be366004611fa9565b610af0565b3480156103cf57600080fd5b50600d54610343565b3480156103e457600080fd5b506102cd610b2d565b3480156103f957600080fd5b506102b6610408366004611fa9565b610b3c565b6102b661041b366004612003565b610b79565b34801561042c57600080fd5b506102b661043b366004611fa9565b610b99565b34801561044c57600080fd5b50600e54610343565b34801561046157600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610343565b34801561049457600080fd5b50600c546001600160a01b03166102fa565b3480156104b257600080fd5b506102b66104c13660046120ed565b610ba7565b3480156104d257600080fd5b506102fa6104e1366004611fa9565b610bb8565b3480156104f257600080fd5b50610281610501366004612136565b610bc3565b34801561051257600080fd5b50610343610521366004612136565b610c47565b34801561053257600080fd5b506102cd610c8d565b34801561054757600080fd5b506102b6610c9c565b34801561055c57600080fd5b506102b661056b366004612136565b610cb0565b34801561057c57600080fd5b50600b546001600160a01b03166102fa565b34801561059a57600080fd5b506102b66105a9366004612151565b610d2f565b3480156105ba57600080fd5b506102b66105c93660046120ed565b610d84565b3480156105da57600080fd5b506102cd610d95565b6102b66105f1366004611fa9565b610da4565b34801561060257600080fd5b506102b6610611366004612194565b611041565b34801561062257600080fd5b506102816106313660046121c0565b6110ad565b34801561064257600080fd5b50610666610651366004611fa9565b60009081526014602052604090205460ff1690565b60405161028d9190612209565b34801561067f57600080fd5b5060125460ff16610281565b6102b6610699366004612231565b6111c3565b3480156106aa57600080fd5b506102cd6106b9366004611fa9565b6111fe565b3480156106ca57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006102fa565b3480156106fd57600080fd5b50600f54610343565b34801561071257600080fd5b50610343610721366004611fa9565b611273565b34801561073257600080fd5b506102816107413660046121c0565b6112c3565b34801561075257600080fd5b506102b6610761366004611fa9565b6112f1565b34801561077257600080fd5b506102b6610781366004612136565b611352565b60006107918261138d565b806107a057506107a0826113db565b92915050565b6107ae611400565b6012805460ff191682151590811790915560405190815233907fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d906020015b60405180910390a250565b606060028054610807906122ad565b80601f0160208091040260200160405190810160405280929190818152602001828054610833906122ad565b80156108805780601f1061085557610100808354040283529160200191610880565b820191906000526020600020905b81548152906001019060200180831161086357829003601f168201915b5050505050905090565b60006108958261142d565b6108a9576108a96333d1c03960e21b61147b565b506000908152600660205260409020546001600160a01b031690565b6108d182826001611485565b5050565b60006108e082611528565b6001600160a01b0394851694909150811684146109065761090662a1148160e81b61147b565b600082815260066020526040902080546109328187335b6001600160a01b039081169116811491141790565b6109545761094086336112c3565b61095457610954632ce44b5f60e11b61147b565b801561095f57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036109f1576001840160008181526004602052604081205490036109ef5760005481146109ef5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a480600003610a3b57610a3b633a954ecd60e21b61147b565b50505050505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610ab95750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610ad8906001600160601b0316876122f7565b610ae29190612324565b915196919550909350505050565b610af8611400565b600d819055604051819033907f3a7d6a487d59f1f47f0273e978deb2b5b5d30f3db7cdca892c252ad01a63664d90600090a350565b606060118054610807906122ad565b610b44611400565b600e819055604051819033907f7bc1e4c3e1ebfbcf0368c175c55cbc5cd50c142d50f4a1163d904fba1713dd7290600090a350565b610b94838383604051806020016040528060008152506111c3565b505050565b610ba48160016115c9565b50565b610baf611400565b610ba48161170a565b60006107a082611528565b6000610bcd611400565b60405147906001600160a01b038416908290600081818185875af1925050503d8060008114610c18576040519150601f19603f3d011682016040523d82523d6000602084013e610c1d565b606091505b50508092505081610c4157604051633c5db26160e21b815260040160405180910390fd5b50919050565b60006001600160a01b038216610c6757610c676323d3ad8160e21b61147b565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6060610c9761175a565b905090565b610ca4611400565b610cae6000611769565b565b610cb8611400565b6001600160a01b038116610cdf57604051638eda511f60e01b815260040160405180910390fd5b600c80546001600160a01b0319166001600160a01b03831690811790915560405190815233907f32c7f8c60f86ae20e5414c27c3d06e25fa775321683e23c95456c83d0ce0a652906020016107ed565b610d37611400565b610d4182826117bb565b6040516001600160601b038216906001600160a01b038416907f8039bd6e4e7dba001c8840eb2e118d9d131246faa7d0d04335f7305127ec0b1090600090a35050565b610d8c611400565b610ba48161185e565b606060038054610807906122ad565b60125460ff1615610dc85760405163ec863e7f60e01b815260040160405180910390fd5b80600003610de957604051637009066560e01b815260040160405180910390fd5b600f54811115610e0c5760405163e741329560e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081610e3f600154600054036000190190565b610e499190612338565b1115610e685760405163cec9834f60e01b815260040160405180910390fd5b60008054905b82811015610e9757610e7f826118ae565b60019091019080610e8f8161234b565b915050610e6e565b50610ea233836119c4565b600d548015610f7e576000610eb784836122f7565b600c546040516323b872dd60e01b81523360048201526001600160a01b039182166024820152604481018390529192506000917f0000000000000000000000000000000000000000000000000000000000000000909116906323b872dd906064016020604051808303816000875af1158015610f37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5b9190612364565b905080610f7b57604051636d7d034960e01b815260040160405180910390fd5b50505b600e54801561103b576000610f9385836122f7565b905080341015610fc45760405163d4a0549360e01b8152346004820152602481018290526044015b60405180910390fd5b600c546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611011576040519150601f19603f3d011682016040523d82523d6000602084013e611016565b606091505b505090508061103857604051633c5db26160e21b815260040160405180910390fd5b50505b50505050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006110b7611400565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111249190612381565b60405163a9059cbb60e01b81526001600160a01b038681166004830152602482018390529192509083169063a9059cbb906044016020604051808303816000875af1158015611177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119b9190612364565b9250826111bb57604051636d7d034960e01b815260040160405180910390fd5b505092915050565b6111ce8484846108d5565b6001600160a01b0383163b1561103b576111ea84848484611a83565b61103b5761103b6368d2bf6b60e11b61147b565b606061120982611b65565b60008281526015602052604081205461122190611b6e565b9050600061122d61175a565b82519091501561126257808260405160200161124a92919061239a565b60405160208183030381529060405292505050919050565b61126b84611c01565b949350505050565b60006013600083600581111561128b5761128b6121f3565b600581111561129c5761129c6121f3565b60058111156112ad576112ad6121f3565b8152602001908152602001600020549050919050565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6112f9611400565b606481111561131b57604051631947bed760e21b815260040160405180910390fd5b600f81905560405181815233907fda87f1fabff66db5220295bbdbd1905d8399c8c4e1afeddbc6b8fc2b2cb0466d906020016107ed565b61135a611400565b6001600160a01b03811661138457604051631e4fbdf760e01b815260006004820152602401610fbb565b610ba481611769565b60006301ffc9a760e01b6001600160e01b0319831614806113be57506380ac58cd60e01b6001600160e01b03198316145b806107a05750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b14806107a057506107a08261138d565b600b546001600160a01b03163314610cae5760405163118cdaa760e01b8152336004820152602401610fbb565b600081600111611476576000548210156114765760005b506000828152600460205260408120549081900361146c57611465836123c9565b9250611444565b600160e01b161590505b919050565b8060005260046000fd5b600061149083610bb8565b90508180156114a85750336001600160a01b03821614155b156114cb576114b781336112c3565b6114cb576114cb6367d9dca160e11b61147b565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b6000816001116115b95750600081815260046020526040902054806000036115a657600054821061156357611563636f96cda160e11b61147b565b5b5060001901600081815260046020526040902054801561156457600160e01b811660000361159157919050565b6115a1636f96cda160e11b61147b565b611564565b600160e01b81166000036115b957919050565b611476636f96cda160e11b61147b565b60006115d483611528565b9050806000806115f286600090815260066020526040902080549091565b9150915084156116295761160781843361091d565b6116295761161583336112c3565b61162957611629632ce44b5f60e11b61147b565b801561163457600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036116c2576001860160008181526004602052604081205490036116c05760005481146116c05760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b60106117168282612426565b508060405161172591906124e6565b6040519081900381209033907ff765b68b6ff897de964353a0eb194e46ecea8772879eb880b4b0fd277124922c90600090a350565b606060108054610807906122ad565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382168110156117fa57604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610fbb565b6001600160a01b03831661182457604051635b6cc80560e11b815260006004820152602401610fbb565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b601161186a8282612426565b508060405161187991906124e6565b6040519081900381209033907f1ca91f64ead03abb06ea28975dfbf18044ac06f9fa1cb62a54ccc905df1028ed90600090a350565b60006118b8611c7c565b6000838152601560205260409020819055905060015b7f00000000000000000000000000000000000000000000000000000000000000008111610b94576013600082600581111561190b5761190b6121f3565b600581111561191c5761191c6121f3565b600581111561192d5761192d6121f3565b8152602001908152602001600020548210156119b257806005811115611955576119556121f3565b6000848152601460205260409020805460ff1916600183600581111561197d5761197d6121f3565b021790555060405183907f9428dcbe773ffde983d366e27dc72d5f9be6e309154036dd48f60fbc0784be6890600090a2505050565b806119bc8161234b565b9150506118ce565b60008054908290036119e0576119e063b562e8dd60e01b61147b565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b17811790915580845260059092528220805468010000000000000001860201905590819003611a3e57611a3e622e076360e81b61147b565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103611a43575060005550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611ab8903390899088908890600401612502565b6020604051808303816000875af1925050508015611af3575060408051601f3d908101601f19168201909252611af09181019061253f565b60015b611b48573d808015611b21576040519150601f19603f3d011682016040523d82523d6000602084013e611b26565b606091505b508051600003611b4057611b406368d2bf6b60e11b61147b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6108d181610bb8565b60606000611b7b83611dcc565b600101905060008167ffffffffffffffff811115611b9b57611b9b612061565b6040519080825280601f01601f191660200182016040528015611bc5576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611bcf57509392505050565b6060611c0c8261142d565b611c2057611c20630a14c4b560e41b61147b565b6000611c2a61175a565b90508051600003611c4a5760405180602001604052806000815250611c75565b80611c5484611ea4565b604051602001611c6592919061239a565b6040516020818303038152906040525b9392505050565b601654601754604080514460208201529081019190915260009190829082906060016040516020818303038152906040528051906020012060001c611cc1919061255c565b905060168181548110611cd657611cd6612570565b9060005260206000200154600003611cee5780611d0d565b60168181548110611d0157611d01612570565b90600052602060002001545b92506016611d1c600184612586565b81548110611d2c57611d2c612570565b9060005260206000200154600014611d6b576016611d4b600184612586565b81548110611d5b57611d5b612570565b9060005260206000200154611d76565b611d76600183612586565b60168281548110611d8957611d89612570565b6000918252602090912001556016805480611da657611da6612599565b600082815260208120820160001990810191909155019055505060178054600101905590565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611e0b5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611e37576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611e5557662386f26fc10000830492506010015b6305f5e1008310611e6d576305f5e100830492506008015b6127108310611e8157612710830492506004015b60648310611e93576064830492506002015b600a83106107a05760010192915050565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611ebe5750819003601f19909101908152919050565b6001600160e01b031981168114610ba457600080fd5b600060208284031215611f1057600080fd5b8135611c7581611ee8565b8015158114610ba457600080fd5b600060208284031215611f3b57600080fd5b8135611c7581611f1b565b60005b83811015611f61578181015183820152602001611f49565b50506000910152565b60008151808452611f82816020860160208601611f46565b601f01601f19169290920160200192915050565b602081526000611c756020830184611f6a565b600060208284031215611fbb57600080fd5b5035919050565b80356001600160a01b038116811461147657600080fd5b60008060408385031215611fec57600080fd5b611ff583611fc2565b946020939093013593505050565b60008060006060848603121561201857600080fd5b61202184611fc2565b925061202f60208501611fc2565b9150604084013590509250925092565b6000806040838503121561205257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561209257612092612061565b604051601f8501601f19908116603f011681019082821181831017156120ba576120ba612061565b816040528093508581528686860111156120d357600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156120ff57600080fd5b813567ffffffffffffffff81111561211657600080fd5b8201601f8101841361212757600080fd5b61126b84823560208401612077565b60006020828403121561214857600080fd5b611c7582611fc2565b6000806040838503121561216457600080fd5b61216d83611fc2565b915060208301356001600160601b038116811461218957600080fd5b809150509250929050565b600080604083850312156121a757600080fd5b6121b083611fc2565b9150602083013561218981611f1b565b600080604083850312156121d357600080fd5b6121dc83611fc2565b91506121ea60208401611fc2565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b602081016006831061222b57634e487b7160e01b600052602160045260246000fd5b91905290565b6000806000806080858703121561224757600080fd5b61225085611fc2565b935061225e60208601611fc2565b925060408501359150606085013567ffffffffffffffff81111561228157600080fd5b8501601f8101871361229257600080fd5b6122a187823560208401612077565b91505092959194509250565b600181811c908216806122c157607f821691505b602082108103610c4157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176107a0576107a06122e1565b634e487b7160e01b600052601260045260246000fd5b6000826123335761233361230e565b500490565b808201808211156107a0576107a06122e1565b60006001820161235d5761235d6122e1565b5060010190565b60006020828403121561237657600080fd5b8151611c7581611f1b565b60006020828403121561239357600080fd5b5051919050565b600083516123ac818460208801611f46565b8351908301906123c0818360208801611f46565b01949350505050565b6000816123d8576123d86122e1565b506000190190565b601f821115610b9457600081815260208120601f850160051c810160208610156124075750805b601f850160051c820191505b8181101561103857828155600101612413565b815167ffffffffffffffff81111561244057612440612061565b6124548161244e84546122ad565b846123e0565b602080601f83116001811461248957600084156124715750858301515b600019600386901b1c1916600185901b178555611038565b600085815260208120601f198616915b828110156124b857888601518255948401946001909101908401612499565b50858210156124d65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082516124f8818460208701611f46565b9190910192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061253590830184611f6a565b9695505050505050565b60006020828403121561255157600080fd5b8151611c7581611ee8565b60008261256b5761256b61230e565b500690565b634e487b7160e01b600052603260045260246000fd5b818103818111156107a0576107a06122e1565b634e487b7160e01b600052603160045260246000fdfea26469706673582212203e35532a289725080baf955b52079734eb01262f0963fbe5470b840aab4c871764736f6c634300081400330000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000a25c35fb88b40a8ffa1ded934d494fc79339cb1f000000000000000000000000a839967c96197521c19b6926aeb731a59cae6e2b000000000000000000000000bb4f69a0fca3f63477b6b3b2a3e8491e5425a356000000000000000000000000000000000000000000002a5a058fc295ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000c546f756368204772617373790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000647524153535900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656964756e6f6134683365356b766464696236676935336e686d626d33326c7a7663617871636364666f7273696968326d7775626b792f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569657a34746b6c627863763565343573357a6564356c32783261746d66376432366c66756f343278626264646e6c70706e7a6e676d000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102555760003560e01c8063714c539811610139578063acb586df116100b6578063cbafcf361161007a578063cbafcf36146106f1578063d116f9d814610706578063e8a3d485146103d8578063e985e9c514610726578063f2600b5614610746578063f2fde38b1461076657600080fd5b8063acb586df14610636578063b187bd2614610673578063b88d4fde1461068b578063c87b56dd1461069e578063ca709a25146106be57600080fd5b8063938e3d7b116100fd578063938e3d7b146105ae57806395d89b41146105ce578063a0712d68146105e3578063a22cb465146105f6578063a522ad251461061657600080fd5b8063714c539814610526578063715018a61461053b5780638705fcd4146105505780638da5cb5b146105705780638f2fc60b1461058e57600080fd5b806337929eb4116101d25780634c0f38c2116101965780634c0f38c2146104555780634e7ceacb1461048857806355f804b3146104a65780636352211e146104c6578063690d8320146104e657806370a082311461050657600080fd5b806337929eb4146103d85780633f6738a9146103ed57806342842e0e1461040d57806342966c6814610420578063435d0e141461044057600080fd5b806318160ddd1161021957806318160ddd1461032557806323b872dd146103515780632a55205a1461036457806331b31b88146103a357806335546850146103c357600080fd5b806301ffc9a71461026157806302329a291461029657806306fdde03146102b8578063081812fc146102da578063095ea7b31461031257600080fd5b3661025c57005b600080fd5b34801561026d57600080fd5b5061028161027c366004611efe565b610786565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102b66102b1366004611f29565b6107a6565b005b3480156102c457600080fd5b506102cd6107f8565b60405161028d9190611f96565b3480156102e657600080fd5b506102fa6102f5366004611fa9565b61088a565b6040516001600160a01b03909116815260200161028d565b6102b6610320366004611fd9565b6108c5565b34801561033157600080fd5b50610343600154600054036000190190565b60405190815260200161028d565b6102b661035f366004612003565b6108d5565b34801561037057600080fd5b5061038461037f36600461203f565b610a44565b604080516001600160a01b03909316835260208301919091520161028d565b3480156103af57600080fd5b506102b66103be366004611fa9565b610af0565b3480156103cf57600080fd5b50600d54610343565b3480156103e457600080fd5b506102cd610b2d565b3480156103f957600080fd5b506102b6610408366004611fa9565b610b3c565b6102b661041b366004612003565b610b79565b34801561042c57600080fd5b506102b661043b366004611fa9565b610b99565b34801561044c57600080fd5b50600e54610343565b34801561046157600080fd5b507f00000000000000000000000000000000000000000000000000000000000003e8610343565b34801561049457600080fd5b50600c546001600160a01b03166102fa565b3480156104b257600080fd5b506102b66104c13660046120ed565b610ba7565b3480156104d257600080fd5b506102fa6104e1366004611fa9565b610bb8565b3480156104f257600080fd5b50610281610501366004612136565b610bc3565b34801561051257600080fd5b50610343610521366004612136565b610c47565b34801561053257600080fd5b506102cd610c8d565b34801561054757600080fd5b506102b6610c9c565b34801561055c57600080fd5b506102b661056b366004612136565b610cb0565b34801561057c57600080fd5b50600b546001600160a01b03166102fa565b34801561059a57600080fd5b506102b66105a9366004612151565b610d2f565b3480156105ba57600080fd5b506102b66105c93660046120ed565b610d84565b3480156105da57600080fd5b506102cd610d95565b6102b66105f1366004611fa9565b610da4565b34801561060257600080fd5b506102b6610611366004612194565b611041565b34801561062257600080fd5b506102816106313660046121c0565b6110ad565b34801561064257600080fd5b50610666610651366004611fa9565b60009081526014602052604090205460ff1690565b60405161028d9190612209565b34801561067f57600080fd5b5060125460ff16610281565b6102b6610699366004612231565b6111c3565b3480156106aa57600080fd5b506102cd6106b9366004611fa9565b6111fe565b3480156106ca57600080fd5b507f000000000000000000000000bb4f69a0fca3f63477b6b3b2a3e8491e5425a3566102fa565b3480156106fd57600080fd5b50600f54610343565b34801561071257600080fd5b50610343610721366004611fa9565b611273565b34801561073257600080fd5b506102816107413660046121c0565b6112c3565b34801561075257600080fd5b506102b6610761366004611fa9565b6112f1565b34801561077257600080fd5b506102b6610781366004612136565b611352565b60006107918261138d565b806107a057506107a0826113db565b92915050565b6107ae611400565b6012805460ff191682151590811790915560405190815233907fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d906020015b60405180910390a250565b606060028054610807906122ad565b80601f0160208091040260200160405190810160405280929190818152602001828054610833906122ad565b80156108805780601f1061085557610100808354040283529160200191610880565b820191906000526020600020905b81548152906001019060200180831161086357829003601f168201915b5050505050905090565b60006108958261142d565b6108a9576108a96333d1c03960e21b61147b565b506000908152600660205260409020546001600160a01b031690565b6108d182826001611485565b5050565b60006108e082611528565b6001600160a01b0394851694909150811684146109065761090662a1148160e81b61147b565b600082815260066020526040902080546109328187335b6001600160a01b039081169116811491141790565b6109545761094086336112c3565b61095457610954632ce44b5f60e11b61147b565b801561095f57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036109f1576001840160008181526004602052604081205490036109ef5760005481146109ef5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a480600003610a3b57610a3b633a954ecd60e21b61147b565b50505050505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610ab95750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610ad8906001600160601b0316876122f7565b610ae29190612324565b915196919550909350505050565b610af8611400565b600d819055604051819033907f3a7d6a487d59f1f47f0273e978deb2b5b5d30f3db7cdca892c252ad01a63664d90600090a350565b606060118054610807906122ad565b610b44611400565b600e819055604051819033907f7bc1e4c3e1ebfbcf0368c175c55cbc5cd50c142d50f4a1163d904fba1713dd7290600090a350565b610b94838383604051806020016040528060008152506111c3565b505050565b610ba48160016115c9565b50565b610baf611400565b610ba48161170a565b60006107a082611528565b6000610bcd611400565b60405147906001600160a01b038416908290600081818185875af1925050503d8060008114610c18576040519150601f19603f3d011682016040523d82523d6000602084013e610c1d565b606091505b50508092505081610c4157604051633c5db26160e21b815260040160405180910390fd5b50919050565b60006001600160a01b038216610c6757610c676323d3ad8160e21b61147b565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6060610c9761175a565b905090565b610ca4611400565b610cae6000611769565b565b610cb8611400565b6001600160a01b038116610cdf57604051638eda511f60e01b815260040160405180910390fd5b600c80546001600160a01b0319166001600160a01b03831690811790915560405190815233907f32c7f8c60f86ae20e5414c27c3d06e25fa775321683e23c95456c83d0ce0a652906020016107ed565b610d37611400565b610d4182826117bb565b6040516001600160601b038216906001600160a01b038416907f8039bd6e4e7dba001c8840eb2e118d9d131246faa7d0d04335f7305127ec0b1090600090a35050565b610d8c611400565b610ba48161185e565b606060038054610807906122ad565b60125460ff1615610dc85760405163ec863e7f60e01b815260040160405180910390fd5b80600003610de957604051637009066560e01b815260040160405180910390fd5b600f54811115610e0c5760405163e741329560e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000003e881610e3f600154600054036000190190565b610e499190612338565b1115610e685760405163cec9834f60e01b815260040160405180910390fd5b60008054905b82811015610e9757610e7f826118ae565b60019091019080610e8f8161234b565b915050610e6e565b50610ea233836119c4565b600d548015610f7e576000610eb784836122f7565b600c546040516323b872dd60e01b81523360048201526001600160a01b039182166024820152604481018390529192506000917f000000000000000000000000bb4f69a0fca3f63477b6b3b2a3e8491e5425a356909116906323b872dd906064016020604051808303816000875af1158015610f37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5b9190612364565b905080610f7b57604051636d7d034960e01b815260040160405180910390fd5b50505b600e54801561103b576000610f9385836122f7565b905080341015610fc45760405163d4a0549360e01b8152346004820152602481018290526044015b60405180910390fd5b600c546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611011576040519150601f19603f3d011682016040523d82523d6000602084013e611016565b606091505b505090508061103857604051633c5db26160e21b815260040160405180910390fd5b50505b50505050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006110b7611400565b6040516370a0823160e01b815230600482015283906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111249190612381565b60405163a9059cbb60e01b81526001600160a01b038681166004830152602482018390529192509083169063a9059cbb906044016020604051808303816000875af1158015611177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119b9190612364565b9250826111bb57604051636d7d034960e01b815260040160405180910390fd5b505092915050565b6111ce8484846108d5565b6001600160a01b0383163b1561103b576111ea84848484611a83565b61103b5761103b6368d2bf6b60e11b61147b565b606061120982611b65565b60008281526015602052604081205461122190611b6e565b9050600061122d61175a565b82519091501561126257808260405160200161124a92919061239a565b60405160208183030381529060405292505050919050565b61126b84611c01565b949350505050565b60006013600083600581111561128b5761128b6121f3565b600581111561129c5761129c6121f3565b60058111156112ad576112ad6121f3565b8152602001908152602001600020549050919050565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6112f9611400565b606481111561131b57604051631947bed760e21b815260040160405180910390fd5b600f81905560405181815233907fda87f1fabff66db5220295bbdbd1905d8399c8c4e1afeddbc6b8fc2b2cb0466d906020016107ed565b61135a611400565b6001600160a01b03811661138457604051631e4fbdf760e01b815260006004820152602401610fbb565b610ba481611769565b60006301ffc9a760e01b6001600160e01b0319831614806113be57506380ac58cd60e01b6001600160e01b03198316145b806107a05750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b14806107a057506107a08261138d565b600b546001600160a01b03163314610cae5760405163118cdaa760e01b8152336004820152602401610fbb565b600081600111611476576000548210156114765760005b506000828152600460205260408120549081900361146c57611465836123c9565b9250611444565b600160e01b161590505b919050565b8060005260046000fd5b600061149083610bb8565b90508180156114a85750336001600160a01b03821614155b156114cb576114b781336112c3565b6114cb576114cb6367d9dca160e11b61147b565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b6000816001116115b95750600081815260046020526040902054806000036115a657600054821061156357611563636f96cda160e11b61147b565b5b5060001901600081815260046020526040902054801561156457600160e01b811660000361159157919050565b6115a1636f96cda160e11b61147b565b611564565b600160e01b81166000036115b957919050565b611476636f96cda160e11b61147b565b60006115d483611528565b9050806000806115f286600090815260066020526040902080549091565b9150915084156116295761160781843361091d565b6116295761161583336112c3565b61162957611629632ce44b5f60e11b61147b565b801561163457600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036116c2576001860160008181526004602052604081205490036116c05760005481146116c05760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b60106117168282612426565b508060405161172591906124e6565b6040519081900381209033907ff765b68b6ff897de964353a0eb194e46ecea8772879eb880b4b0fd277124922c90600090a350565b606060108054610807906122ad565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382168110156117fa57604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610fbb565b6001600160a01b03831661182457604051635b6cc80560e11b815260006004820152602401610fbb565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b601161186a8282612426565b508060405161187991906124e6565b6040519081900381209033907f1ca91f64ead03abb06ea28975dfbf18044ac06f9fa1cb62a54ccc905df1028ed90600090a350565b60006118b8611c7c565b6000838152601560205260409020819055905060015b7f00000000000000000000000000000000000000000000000000000000000000058111610b94576013600082600581111561190b5761190b6121f3565b600581111561191c5761191c6121f3565b600581111561192d5761192d6121f3565b8152602001908152602001600020548210156119b257806005811115611955576119556121f3565b6000848152601460205260409020805460ff1916600183600581111561197d5761197d6121f3565b021790555060405183907f9428dcbe773ffde983d366e27dc72d5f9be6e309154036dd48f60fbc0784be6890600090a2505050565b806119bc8161234b565b9150506118ce565b60008054908290036119e0576119e063b562e8dd60e01b61147b565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b17811790915580845260059092528220805468010000000000000001860201905590819003611a3e57611a3e622e076360e81b61147b565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103611a43575060005550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611ab8903390899088908890600401612502565b6020604051808303816000875af1925050508015611af3575060408051601f3d908101601f19168201909252611af09181019061253f565b60015b611b48573d808015611b21576040519150601f19603f3d011682016040523d82523d6000602084013e611b26565b606091505b508051600003611b4057611b406368d2bf6b60e11b61147b565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6108d181610bb8565b60606000611b7b83611dcc565b600101905060008167ffffffffffffffff811115611b9b57611b9b612061565b6040519080825280601f01601f191660200182016040528015611bc5576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611bcf57509392505050565b6060611c0c8261142d565b611c2057611c20630a14c4b560e41b61147b565b6000611c2a61175a565b90508051600003611c4a5760405180602001604052806000815250611c75565b80611c5484611ea4565b604051602001611c6592919061239a565b6040516020818303038152906040525b9392505050565b601654601754604080514460208201529081019190915260009190829082906060016040516020818303038152906040528051906020012060001c611cc1919061255c565b905060168181548110611cd657611cd6612570565b9060005260206000200154600003611cee5780611d0d565b60168181548110611d0157611d01612570565b90600052602060002001545b92506016611d1c600184612586565b81548110611d2c57611d2c612570565b9060005260206000200154600014611d6b576016611d4b600184612586565b81548110611d5b57611d5b612570565b9060005260206000200154611d76565b611d76600183612586565b60168281548110611d8957611d89612570565b6000918252602090912001556016805480611da657611da6612599565b600082815260208120820160001990810191909155019055505060178054600101905590565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611e0b5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611e37576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611e5557662386f26fc10000830492506010015b6305f5e1008310611e6d576305f5e100830492506008015b6127108310611e8157612710830492506004015b60648310611e93576064830492506002015b600a83106107a05760010192915050565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611ebe5750819003601f19909101908152919050565b6001600160e01b031981168114610ba457600080fd5b600060208284031215611f1057600080fd5b8135611c7581611ee8565b8015158114610ba457600080fd5b600060208284031215611f3b57600080fd5b8135611c7581611f1b565b60005b83811015611f61578181015183820152602001611f49565b50506000910152565b60008151808452611f82816020860160208601611f46565b601f01601f19169290920160200192915050565b602081526000611c756020830184611f6a565b600060208284031215611fbb57600080fd5b5035919050565b80356001600160a01b038116811461147657600080fd5b60008060408385031215611fec57600080fd5b611ff583611fc2565b946020939093013593505050565b60008060006060848603121561201857600080fd5b61202184611fc2565b925061202f60208501611fc2565b9150604084013590509250925092565b6000806040838503121561205257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561209257612092612061565b604051601f8501601f19908116603f011681019082821181831017156120ba576120ba612061565b816040528093508581528686860111156120d357600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156120ff57600080fd5b813567ffffffffffffffff81111561211657600080fd5b8201601f8101841361212757600080fd5b61126b84823560208401612077565b60006020828403121561214857600080fd5b611c7582611fc2565b6000806040838503121561216457600080fd5b61216d83611fc2565b915060208301356001600160601b038116811461218957600080fd5b809150509250929050565b600080604083850312156121a757600080fd5b6121b083611fc2565b9150602083013561218981611f1b565b600080604083850312156121d357600080fd5b6121dc83611fc2565b91506121ea60208401611fc2565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b602081016006831061222b57634e487b7160e01b600052602160045260246000fd5b91905290565b6000806000806080858703121561224757600080fd5b61225085611fc2565b935061225e60208601611fc2565b925060408501359150606085013567ffffffffffffffff81111561228157600080fd5b8501601f8101871361229257600080fd5b6122a187823560208401612077565b91505092959194509250565b600181811c908216806122c157607f821691505b602082108103610c4157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176107a0576107a06122e1565b634e487b7160e01b600052601260045260246000fd5b6000826123335761233361230e565b500490565b808201808211156107a0576107a06122e1565b60006001820161235d5761235d6122e1565b5060010190565b60006020828403121561237657600080fd5b8151611c7581611f1b565b60006020828403121561239357600080fd5b5051919050565b600083516123ac818460208801611f46565b8351908301906123c0818360208801611f46565b01949350505050565b6000816123d8576123d86122e1565b506000190190565b601f821115610b9457600081815260208120601f850160051c810160208610156124075750805b601f850160051c820191505b8181101561103857828155600101612413565b815167ffffffffffffffff81111561244057612440612061565b6124548161244e84546122ad565b846123e0565b602080601f83116001811461248957600084156124715750858301515b600019600386901b1c1916600185901b178555611038565b600085815260208120601f198616915b828110156124b857888601518255948401946001909101908401612499565b50858210156124d65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082516124f8818460208701611f46565b9190910192915050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061253590830184611f6a565b9695505050505050565b60006020828403121561255157600080fd5b8151611c7581611ee8565b60008261256b5761256b61230e565b500690565b634e487b7160e01b600052603260045260246000fd5b818103818111156107a0576107a06122e1565b634e487b7160e01b600052603160045260246000fdfea26469706673582212203e35532a289725080baf955b52079734eb01262f0963fbe5470b840aab4c871764736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000a25c35fb88b40a8ffa1ded934d494fc79339cb1f000000000000000000000000a839967c96197521c19b6926aeb731a59cae6e2b000000000000000000000000bb4f69a0fca3f63477b6b3b2a3e8491e5425a356000000000000000000000000000000000000000000002a5a058fc295ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000c546f756368204772617373790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000647524153535900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656964756e6f6134683365356b766464696236676935336e686d626d33326c7a7663617871636364666f7273696968326d7775626b792f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569657a34746b6c627863763565343573357a6564356c32783261746d66376432366c66756f343278626264646e6c70706e7a6e676d000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : args (tuple):
Arg [1] : name (string): Touch Grassy
Arg [2] : symbol (string): GRASSY
Arg [3] : owner (address): 0xa25c35fb88b40A8fFA1DeD934d494fc79339Cb1f
Arg [4] : feeAddress (address): 0xa839967C96197521C19b6926aeB731A59CaE6E2B
Arg [5] : tokenAddress (address): 0xBb4f69A0FCa3f63477B6B3b2A3E8491E5425A356
Arg [6] : tokenFee (uint256): 200000000000000000000000
Arg [7] : ethFee (uint256): 0
Arg [8] : baseURI (string): ipfs://bafybeidunoa4h3e5kvddib6gi53nhmbm32lzvcaxqccdforsiih2mwubky/
Arg [9] : contractURI (string): ipfs://bafkreiez4tklbxcv5e45s5zed5l2x2atmf7d26lfuo42xbbddnlppnzngm
Arg [10] : maxSupply (uint256): 1000
Arg [11] : royaltyNumerator (uint96): 500
-----Encoded View---------------
24 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [3] : 000000000000000000000000a25c35fb88b40a8ffa1ded934d494fc79339cb1f
Arg [4] : 000000000000000000000000a839967c96197521c19b6926aeb731a59cae6e2b
Arg [5] : 000000000000000000000000bb4f69a0fca3f63477b6b3b2a3e8491e5425a356
Arg [6] : 000000000000000000000000000000000000000000002a5a058fc295ed000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [10] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [11] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [12] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [13] : 546f756368204772617373790000000000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [15] : 4752415353590000000000000000000000000000000000000000000000000000
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [17] : 697066733a2f2f6261667962656964756e6f6134683365356b76646469623667
Arg [18] : 6935336e686d626d33326c7a7663617871636364666f7273696968326d777562
Arg [19] : 6b792f0000000000000000000000000000000000000000000000000000000000
Arg [20] : 0000000000000000000000000000000000000000000000000000000000000042
Arg [21] : 697066733a2f2f6261666b726569657a34746b6c627863763565343573357a65
Arg [22] : 64356c32783261746d66376432366c66756f343278626264646e6c70706e7a6e
Arg [23] : 676d000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.