Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 1,070 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Approval For... | 24469767 | 7 days ago | IN | 0 ETH | 0.00000523 | ||||
| Set Approval For... | 24465073 | 8 days ago | IN | 0 ETH | 0.00000204 | ||||
| Set Approval For... | 24355818 | 23 days ago | IN | 0 ETH | 0.00002578 | ||||
| Set Approval For... | 24332866 | 26 days ago | IN | 0 ETH | 0.000007 | ||||
| Transfer From | 24188757 | 46 days ago | IN | 0 ETH | 0.0001347 | ||||
| Set Approval For... | 24186447 | 47 days ago | IN | 0 ETH | 0.00009121 | ||||
| Set Approval For... | 24152791 | 51 days ago | IN | 0 ETH | 0.00000236 | ||||
| Safe Transfer Fr... | 24107211 | 58 days ago | IN | 0 ETH | 0.00000255 | ||||
| Set Approval For... | 24107143 | 58 days ago | IN | 0 ETH | 0.00000097 | ||||
| Set Approval For... | 24054360 | 65 days ago | IN | 0 ETH | 0.00000121 | ||||
| Set Approval For... | 24053836 | 65 days ago | IN | 0 ETH | 0.0000019 | ||||
| Set Approval For... | 24053683 | 65 days ago | IN | 0 ETH | 0.00000138 | ||||
| Set Approval For... | 24039415 | 67 days ago | IN | 0 ETH | 0.00004919 | ||||
| Set Approval For... | 24026560 | 69 days ago | IN | 0 ETH | 0.00002522 | ||||
| Set Approval For... | 24025364 | 69 days ago | IN | 0 ETH | 0.00009405 | ||||
| Set Approval For... | 23992043 | 74 days ago | IN | 0 ETH | 0.0000098 | ||||
| Set Approval For... | 23964459 | 78 days ago | IN | 0 ETH | 0.00000944 | ||||
| Safe Transfer Fr... | 23964367 | 78 days ago | IN | 0 ETH | 0.00003007 | ||||
| Set Approval For... | 23950168 | 80 days ago | IN | 0 ETH | 0.00002418 | ||||
| Safe Transfer Fr... | 23944613 | 80 days ago | IN | 0 ETH | 0.00015178 | ||||
| Transfer From | 23940157 | 81 days ago | IN | 0 ETH | 0.00011575 | ||||
| Transfer From | 23940096 | 81 days ago | IN | 0 ETH | 0.0001938 | ||||
| Set Approval For... | 23932334 | 82 days ago | IN | 0 ETH | 0.0000246 | ||||
| Set Approval For... | 23921558 | 84 days ago | IN | 0 ETH | 0.00000216 | ||||
| Set Approval For... | 23875096 | 90 days ago | IN | 0 ETH | 0.00005066 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 22827171 | 237 days ago | 1.188 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Kaze
Compiler Version
v0.8.28+commit.7893614a
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.4;
import "./ERC721ACQueryable.sol";
import "@limitbreak/creator-token-standards/src/access/OwnableBasic.sol";
import "@limitbreak/creator-token-standards/src/programmable-royalties/BasicRoyalties.sol";
import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol";
/**
* @title Kaze
* @author dylie.eth
*/
contract Kaze is ERC721ACQueryable, OwnableBasic, BasicRoyalties {
/*//////////////////////////////////////////////////////////////
CUSTOM ERRORS
//////////////////////////////////////////////////////////////*/
/// @dev The user has no claim allocation or has already claimed
error NoClaim();
/// @dev The user has exceeded the maximum public mint limit
error PublicMintLimitExceeded();
/// @dev The total supply has reached the maximum supply
error MaxSupplyReached();
/// @dev The sent ETH value is incorrect
error IncorrectValue();
/// @dev The public mint phase is not active
error PublicMintNotActive();
/// @dev The claim phase is not active
error ClaimNotActive();
/// @dev Trading is not enabled
error TradingNotEnabled();
/// @dev Invalid phase timestamps
error InvalidTimestamps();
/// @dev Cannot reclaim before public mint phase ends
error ReclaimNotAllowed();
/// @dev Zero address provided
error ZeroAddress();
/*//////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/
/// @dev Maximum supply of tokens
uint256 public constant MAX_SUPPLY = 3400;
/// @dev Maximum tokens per wallet in public mint
uint256 public constant MAX_PUBLIC_MINT_PER_WALLET = 3;
/// @dev Public mint price in wei
uint256 public constant PUBLIC_MINT_PRICE = 0.054 ether;
/*//////////////////////////////////////////////////////////////
STORAGE
//////////////////////////////////////////////////////////////*/
/// @dev Packed phase timestamps (160 bits total)
/// Bits 0-39: publicMintStartTime
/// Bits 40-79: publicMintEndTime
/// Bits 80-119: claimStartTime
/// Bits 120-159: claimEndTime
uint256 private _packedTimestamps;
/// @dev Trading enabled flag
bool private _tradingEnabled;
/// @dev Immutable treasury address
address public immutable treasury;
/// @dev Base URI for token metadata
string private _baseTokenURI;
/// @dev Mapping from address to claim allocation
mapping(address => uint256) public claimAllocations;
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event ClaimAllocationSet(address indexed user, uint256 allocation);
event ClaimAllocationsBatchSet(uint256 totalAllocations);
event TradingEnabled();
event TimestampsUpdated(
uint256 publicStart,
uint256 publicEnd,
uint256 claimStart,
uint256 claimEnd
);
event ReclaimToAddress(address indexed to, uint256 quantity);
/*//////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////*/
/// @dev Ensures the provided address is not zero
modifier notZeroAddress(address addr) {
if (addr == address(0)) revert ZeroAddress();
_;
}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory name_,
string memory symbol_,
address owner_,
address royaltyReceiver_,
uint96 royaltyFeeNumerator_,
address treasury_,
string memory baseURI_,
uint256 publicMintStartTime_,
uint256 publicMintEndTime_,
uint256 claimStartTime_,
uint256 claimEndTime_
)
ERC721ACQueryable(name_, symbol_)
BasicRoyalties(royaltyReceiver_, royaltyFeeNumerator_)
notZeroAddress(owner_)
notZeroAddress(treasury_)
{
treasury = treasury_;
_baseTokenURI = baseURI_;
_updateTimestamps(
publicMintStartTime_,
publicMintEndTime_,
claimStartTime_,
claimEndTime_
);
// Mint Top 50 + Team + Treasury
_safeMint(treasury, 200);
}
/*//////////////////////////////////////////////////////////////
MINTING FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @dev Public mint function - users pay for each NFT (max 3 per wallet)
function publicMint(uint64 quantity) external payable {
uint256 currentTime = block.timestamp;
(uint256 publicStart, uint256 publicEnd, , ) = getTimestamps();
// Check if public mint is active
if (currentTime < publicStart || currentTime > publicEnd) {
revert PublicMintNotActive();
}
// Check quantity bounds
if (quantity == 0 || quantity > MAX_PUBLIC_MINT_PER_WALLET) {
revert PublicMintLimitExceeded();
}
// Check payment
uint256 totalCost = PUBLIC_MINT_PRICE * quantity;
if (msg.value != totalCost) {
revert IncorrectValue();
}
// Check supply limit
if (_remainingSupply() < quantity) {
revert MaxSupplyReached();
}
uint64 aux = _getAux(msg.sender);
uint256 currentMintCount = aux & 0xF;
if (currentMintCount + quantity > MAX_PUBLIC_MINT_PER_WALLET) {
revert PublicMintLimitExceeded();
}
_setAux(msg.sender, aux + quantity);
_safeMint(msg.sender, quantity);
}
/// @dev Claim function - users claim their full allocation in one transaction
function claim() external {
uint256 currentTime = block.timestamp;
(, , uint256 claimStart, uint256 claimEnd) = getTimestamps();
// Check if claim is active
if (currentTime < claimStart || currentTime > claimEnd) {
revert ClaimNotActive();
}
uint256 allocation = claimAllocations[msg.sender];
if (allocation == 0) {
revert NoClaim();
}
// Check supply limit
if (_remainingSupply() < allocation) {
revert MaxSupplyReached();
}
claimAllocations[msg.sender] = 0;
_safeMint(msg.sender, allocation);
}
/*//////////////////////////////////////////////////////////////
ADMIN FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @dev Airdrop tokens to a single address
function airdrop(address to, uint256 quantity) external {
_requireCallerIsContractOwner();
if (_remainingSupply() < quantity) {
revert MaxSupplyReached();
}
_safeMint(to, quantity);
}
/// @dev Set claim allocation for a single address
function setClaimAllocation(address user, uint256 allocation) external {
_requireCallerIsContractOwner();
claimAllocations[user] = allocation;
emit ClaimAllocationSet(user, allocation);
}
/// @dev Set claim allocations for multiple addresses (gas-optimized batch operation)
function setClaimAllocationsBatch(
address[] calldata users,
uint256[] calldata allocations
) external {
_requireCallerIsContractOwner();
uint256 length = users.length;
if (length != allocations.length) revert();
uint256 totalAllocations = 0;
for (uint256 i = 0; i < length; ) {
claimAllocations[users[i]] = allocations[i];
totalAllocations += allocations[i];
unchecked {
++i;
}
}
emit ClaimAllocationsBatchSet(totalAllocations);
}
/// @dev Enable trading (irreversible)
function enableTrading() external {
_requireCallerIsContractOwner();
_tradingEnabled = true;
emit TradingEnabled();
}
/// @dev Update phase timestamps
function updateTimestamps(
uint256 publicMintStartTime_,
uint256 publicMintEndTime_,
uint256 claimStartTime_,
uint256 claimEndTime_
) external {
_requireCallerIsContractOwner();
_updateTimestamps(
publicMintStartTime_,
publicMintEndTime_,
claimStartTime_,
claimEndTime_
);
}
/// @dev Reclaim remaining supply to specified address after public mint phase
function reclaimToAddress(address to) external notZeroAddress(to) {
_requireCallerIsContractOwner();
uint256 currentTime = block.timestamp;
(, uint256 publicEnd, , ) = getTimestamps();
// Can only reclaim after public mint phase ends
if (currentTime <= publicEnd) {
revert ReclaimNotAllowed();
}
uint256 quantity = _remainingSupply();
if (quantity > 0) {
_safeMint(to, quantity);
emit ReclaimToAddress(to, quantity);
}
}
/// @dev Withdraw all ETH from contract to specified address
function withdrawETH(address to) external notZeroAddress(to) {
_requireCallerIsContractOwner();
SafeTransferLib.safeTransferAllETH(to);
}
/// @dev Withdraw all ETH from contract to treasury
function withdrawETHToTreasury() external {
_requireCallerIsContractOwner();
SafeTransferLib.safeTransferAllETH(treasury);
}
/// @dev Set base URI for token metadata
function setBaseURI(string calldata baseURI_) external {
_requireCallerIsContractOwner();
_baseTokenURI = baseURI_;
}
/// @dev Set default royalty information
function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {
_requireCallerIsContractOwner();
_setDefaultRoyalty(receiver, feeNumerator);
}
/*//////////////////////////////////////////////////////////////
VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @dev Get current phase timestamps
function getTimestamps()
public
view
returns (
uint256 publicStart,
uint256 publicEnd,
uint256 claimStart,
uint256 claimEnd
)
{
uint256 packed = _packedTimestamps;
publicStart = packed & 0xFFFFFFFFFF;
publicEnd = (packed >> 40) & 0xFFFFFFFFFF;
claimStart = (packed >> 80) & 0xFFFFFFFFFF;
claimEnd = (packed >> 120) & 0xFFFFFFFFFF;
}
/// @dev Check if trading is enabled
function tradingEnabled() public view returns (bool) {
return _tradingEnabled;
}
/// @dev Check if public mint is currently active
function isPublicMintActive() external view returns (bool) {
uint256 currentTime = block.timestamp;
(uint256 publicStart, uint256 publicEnd, , ) = getTimestamps();
return currentTime >= publicStart && currentTime <= publicEnd;
}
/// @dev Check if claim is currently active
function isClaimActive() external view returns (bool) {
uint256 currentTime = block.timestamp;
(, , uint256 claimStart, uint256 claimEnd) = getTimestamps();
return currentTime >= claimStart && currentTime <= claimEnd;
}
/// @dev Get remaining supply
function remainingSupply() external view returns (uint256) {
return _remainingSupply();
}
/// @dev Get public mint count for a user
function getPublicMintCount(address user) external view returns (uint256) {
return _getAux(user) & 0xF;
}
/// @dev Get claim allocation for a user
function getClaimAllocation(address user) external view returns (uint256) {
return claimAllocations[user];
}
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @dev Get remaining supply
function _remainingSupply() internal view returns (uint256) {
return MAX_SUPPLY - _totalMinted();
}
/// @dev Override _baseURI to return stored base URI
function _baseURI() internal view override returns (string memory) {
return _baseTokenURI;
}
/// @dev Override _startTokenId to start from 1
function _startTokenId() internal pure override returns (uint256) {
return 1;
}
/// @dev Check if trading is enabled
function _checkTradingEnabled(address from) internal view {
// Allow minting
if (from != address(0) && !_tradingEnabled) {
revert TradingNotEnabled();
}
}
/// @dev Override transfer validation to enforce trading restrictions
function _validateBeforeTransfer(
address from,
address to,
uint256 tokenId
) internal override {
_checkTradingEnabled(from);
super._validateBeforeTransfer(from, to, tokenId);
}
/// @dev Internal function to update timestamps with validation
function _updateTimestamps(
uint256 publicMintStartTime_,
uint256 publicMintEndTime_,
uint256 claimStartTime_,
uint256 claimEndTime_
) internal {
if (
publicMintStartTime_ >= publicMintEndTime_ ||
claimStartTime_ >= claimEndTime_ ||
publicMintStartTime_ > claimStartTime_
) {
revert InvalidTimestamps();
}
_packedTimestamps =
publicMintStartTime_ |
(publicMintEndTime_ << 40) |
(claimStartTime_ << 80) |
(claimEndTime_ << 120);
emit TimestampsUpdated(
publicMintStartTime_,
publicMintEndTime_,
claimStartTime_,
claimEndTime_
);
}
/*//////////////////////////////////////////////////////////////
INTERFACE SUPPORT
//////////////////////////////////////////////////////////////*/
/// @dev Override supportsInterface to include all implemented interfaces
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721ACQueryable, ERC2981) returns (bool) {
return
ERC721ACQueryable.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./OwnablePermissions.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
abstract contract OwnableBasic is OwnablePermissions, Ownable {
function _requireCallerIsContractOwner() internal view virtual override {
_checkOwner();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Context.sol";
abstract contract OwnablePermissions is Context {
function _requireCallerIsContractOwner() internal view virtual;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ICreatorToken {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function setTransferValidator(address validator) external;
function getTransferValidationFunction() external view returns (bytes4 functionSignature, bool isViewFunction);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ICreatorTokenLegacy {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function setTransferValidator(address validator) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ITransferValidator {
function applyCollectionTransferPolicy(address caller, address from, address to) external view;
function validateTransfer(address caller, address from, address to) external view;
function validateTransfer(address caller, address from, address to, uint256 tokenId) external view;
function validateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount) external;
function beforeAuthorizedTransfer(address operator, address token, uint256 tokenId) external;
function afterAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransfer(address operator, address token) external;
function afterAuthorizedTransfer(address token) external;
function beforeAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransferWithAmount(address token, uint256 tokenId, uint256 amount) external;
function afterAuthorizedTransferWithAmount(address token, uint256 tokenId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface ITransferValidatorSetTokenType {
function setTokenTypeOfCollection(address collection, uint16 tokenType) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/common/ERC2981.sol";
/**
* @title BasicRoyaltiesBase
* @author Limit Break, Inc.
* @dev Base functionality of an NFT mix-in contract implementing the most basic form of programmable royalties.
*/
abstract contract BasicRoyaltiesBase is ERC2981 {
event DefaultRoyaltySet(address indexed receiver, uint96 feeNumerator);
event TokenRoyaltySet(uint256 indexed tokenId, address indexed receiver, uint96 feeNumerator);
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual override {
super._setDefaultRoyalty(receiver, feeNumerator);
emit DefaultRoyaltySet(receiver, feeNumerator);
}
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual override {
super._setTokenRoyalty(tokenId, receiver, feeNumerator);
emit TokenRoyaltySet(tokenId, receiver, feeNumerator);
}
}
/**
* @title BasicRoyalties
* @author Limit Break, Inc.
* @notice Constructable BasicRoyalties Contract implementation.
*/
abstract contract BasicRoyalties is BasicRoyaltiesBase {
constructor(address receiver, uint96 feeNumerator) {
_setDefaultRoyalty(receiver, feeNumerator);
}
}
/**
* @title BasicRoyaltiesInitializable
* @author Limit Break, Inc.
* @notice Initializable BasicRoyalties Contract implementation to allow for EIP-1167 clones.
*/
abstract contract BasicRoyaltiesInitializable is BasicRoyaltiesBase {}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../access/OwnablePermissions.sol";
/**
* @title AutomaticValidatorTransferApproval
* @author Limit Break, Inc.
* @notice Base contract mix-in that provides boilerplate code giving the contract owner the
* option to automatically approve a 721-C transfer validator implementation for transfers.
*/
abstract contract AutomaticValidatorTransferApproval is OwnablePermissions {
/// @dev Emitted when the automatic approval flag is modified by the creator.
event AutomaticApprovalOfTransferValidatorSet(bool autoApproved);
/// @dev If true, the collection's transfer validator is automatically approved to transfer holder's tokens.
bool public autoApproveTransfersFromValidator;
/**
* @notice Sets if the transfer validator is automatically approved as an operator for all token owners.
*
* @dev Throws when the caller is not the contract owner.
*
* @param autoApprove If true, the collection's transfer validator will be automatically approved to
* transfer holder's tokens.
*/
function setAutomaticApprovalOfTransfersFromValidator(bool autoApprove) external {
_requireCallerIsContractOwner();
autoApproveTransfersFromValidator = autoApprove;
emit AutomaticApprovalOfTransferValidatorSet(autoApprove);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../access/OwnablePermissions.sol";
import "../interfaces/ICreatorToken.sol";
import "../interfaces/ICreatorTokenLegacy.sol";
import "../interfaces/ITransferValidator.sol";
import "./TransferValidation.sol";
import "../interfaces/ITransferValidatorSetTokenType.sol";
/**
* @title CreatorTokenBase
* @author Limit Break, Inc.
* @notice CreatorTokenBaseV3 is an abstract contract that provides basic functionality for managing token
* transfer policies through an implementation of ICreatorTokenTransferValidator/ICreatorTokenTransferValidatorV2/ICreatorTokenTransferValidatorV3.
* This contract is intended to be used as a base for creator-specific token contracts, enabling customizable transfer
* restrictions and security policies.
*
* <h4>Features:</h4>
* <ul>Ownable: This contract can have an owner who can set and update the transfer validator.</ul>
* <ul>TransferValidation: Implements the basic token transfer validation interface.</ul>
*
* <h4>Benefits:</h4>
* <ul>Provides a flexible and modular way to implement custom token transfer restrictions and security policies.</ul>
* <ul>Allows creators to enforce policies such as account and codehash blacklists, whitelists, and graylists.</ul>
* <ul>Can be easily integrated into other token contracts as a base contract.</ul>
*
* <h4>Intended Usage:</h4>
* <ul>Use as a base contract for creator token implementations that require advanced transfer restrictions and
* security policies.</ul>
* <ul>Set and update the ICreatorTokenTransferValidator implementation contract to enforce desired policies for the
* creator token.</ul>
*
* <h4>Compatibility:</h4>
* <ul>Backward and Forward Compatible - V1/V2/V3 Creator Token Base will work with V1/V2/V3 Transfer Validators.</ul>
*/
abstract contract CreatorTokenBase is OwnablePermissions, TransferValidation, ICreatorToken {
/// @dev Thrown when setting a transfer validator address that has no deployed code.
error CreatorTokenBase__InvalidTransferValidatorContract();
/// @dev The default transfer validator that will be used if no transfer validator has been set by the creator.
address public constant DEFAULT_TRANSFER_VALIDATOR = address(0x721C008fdff27BF06E7E123956E2Fe03B63342e3);
/// @dev Used to determine if the default transfer validator is applied.
/// @dev Set to true when the creator sets a transfer validator address.
bool private isValidatorInitialized;
/// @dev Address of the transfer validator to apply to transactions.
address private transferValidator;
constructor() {
_emitDefaultTransferValidator();
_registerTokenType(DEFAULT_TRANSFER_VALIDATOR);
}
/**
* @notice Sets the transfer validator for the token contract.
*
* @dev Throws when provided validator contract is not the zero address and does not have code.
* @dev Throws when the caller is not the contract owner.
*
* @dev <h4>Postconditions:</h4>
* 1. The transferValidator address is updated.
* 2. The `TransferValidatorUpdated` event is emitted.
*
* @param transferValidator_ The address of the transfer validator contract.
*/
function setTransferValidator(address transferValidator_) public {
_requireCallerIsContractOwner();
bool isValidTransferValidator = transferValidator_.code.length > 0;
if(transferValidator_ != address(0) && !isValidTransferValidator) {
revert CreatorTokenBase__InvalidTransferValidatorContract();
}
emit TransferValidatorUpdated(address(getTransferValidator()), transferValidator_);
isValidatorInitialized = true;
transferValidator = transferValidator_;
_registerTokenType(transferValidator_);
}
/**
* @notice Returns the transfer validator contract address for this token contract.
*/
function getTransferValidator() public view override returns (address validator) {
validator = transferValidator;
if (validator == address(0)) {
if (!isValidatorInitialized) {
validator = DEFAULT_TRANSFER_VALIDATOR;
}
}
}
/**
* @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
* Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
* and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
*
* @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the
* transfer validator is expected to pre-validate the transfer.
*
* @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
* set to a non-zero address.
*
* @param caller The address of the caller.
* @param from The address of the sender.
* @param to The address of the receiver.
* @param tokenId The token id being transferred.
*/
function _preValidateTransfer(
address caller,
address from,
address to,
uint256 tokenId,
uint256 /*value*/) internal virtual override {
address validator = getTransferValidator();
if (validator != address(0)) {
if (msg.sender == validator) {
return;
}
ITransferValidator(validator).validateTransfer(caller, from, to, tokenId);
}
}
/**
* @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
* Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
* and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
*
* @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the
* transfer validator is expected to pre-validate the transfer.
*
* @dev Used for ERC20 and ERC1155 token transfers which have an amount value to validate in the transfer validator.
* @dev The `tokenId` for ERC20 tokens should be set to `0`.
*
* @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
* set to a non-zero address.
*
* @param caller The address of the caller.
* @param from The address of the sender.
* @param to The address of the receiver.
* @param tokenId The token id being transferred.
* @param amount The amount of token being transferred.
*/
function _preValidateTransfer(
address caller,
address from,
address to,
uint256 tokenId,
uint256 amount,
uint256 /*value*/) internal virtual override {
address validator = getTransferValidator();
if (validator != address(0)) {
if (msg.sender == validator) {
return;
}
ITransferValidator(validator).validateTransfer(caller, from, to, tokenId, amount);
}
}
function _tokenType() internal virtual pure returns(uint16);
function _registerTokenType(address validator) internal {
if (validator != address(0)) {
uint256 validatorCodeSize;
assembly {
validatorCodeSize := extcodesize(validator)
}
if(validatorCodeSize > 0) {
try ITransferValidatorSetTokenType(validator).setTokenTypeOfCollection(address(this), _tokenType()) {
} catch { }
}
}
}
/**
* @dev Used during contract deployment for constructable and cloneable creator tokens
* @dev to emit the `TransferValidatorUpdated` event signaling the validator for the contract
* @dev is the default transfer validator.
*/
function _emitDefaultTransferValidator() internal {
emit TransferValidatorUpdated(address(0), DEFAULT_TRANSFER_VALIDATOR);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @title TransferValidation
* @author Limit Break, Inc.
* @notice A mix-in that can be combined with ERC-721 contracts to provide more granular hooks.
* Openzeppelin's ERC721 contract only provides hooks for before and after transfer. This allows
* developers to validate or customize transfers within the context of a mint, a burn, or a transfer.
*/
abstract contract TransferValidation is Context {
/// @dev Thrown when the from and to address are both the zero address.
error ShouldNotMintToBurnAddress();
/*************************************************************************/
/* Transfers Without Amounts */
/*************************************************************************/
/// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
function _validateBeforeTransfer(address from, address to, uint256 tokenId) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_preValidateMint(_msgSender(), to, tokenId, msg.value);
} else if(toZeroAddress) {
_preValidateBurn(_msgSender(), from, tokenId, msg.value);
} else {
_preValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
}
}
/// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
function _validateAfterTransfer(address from, address to, uint256 tokenId) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_postValidateMint(_msgSender(), to, tokenId, msg.value);
} else if(toZeroAddress) {
_postValidateBurn(_msgSender(), from, tokenId, msg.value);
} else {
_postValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
}
}
/// @dev Optional validation hook that fires before a mint
function _preValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a mint
function _postValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a burn
function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a burn
function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a transfer
function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a transfer
function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}
/*************************************************************************/
/* Transfers With Amounts */
/*************************************************************************/
/// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
function _validateBeforeTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_preValidateMint(_msgSender(), to, tokenId, amount, msg.value);
} else if(toZeroAddress) {
_preValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
} else {
_preValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
}
}
/// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
function _validateAfterTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
bool fromZeroAddress = from == address(0);
bool toZeroAddress = to == address(0);
if(fromZeroAddress && toZeroAddress) {
revert ShouldNotMintToBurnAddress();
} else if(fromZeroAddress) {
_postValidateMint(_msgSender(), to, tokenId, amount, msg.value);
} else if(toZeroAddress) {
_postValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
} else {
_postValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
}
}
/// @dev Optional validation hook that fires before a mint
function _preValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a mint
function _postValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a burn
function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a burn
function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires before a transfer
function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
/// @dev Optional validation hook that fires after a transfer
function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @dev Constant bytes32 value of 0x000...000
bytes32 constant ZERO_BYTES32 = bytes32(0);
/// @dev Constant value of 0
uint256 constant ZERO = 0;
/// @dev Constant value of 1
uint256 constant ONE = 1;
/// @dev Constant value representing an open order in storage
uint8 constant ORDER_STATE_OPEN = 0;
/// @dev Constant value representing a filled order in storage
uint8 constant ORDER_STATE_FILLED = 1;
/// @dev Constant value representing a cancelled order in storage
uint8 constant ORDER_STATE_CANCELLED = 2;
/// @dev Constant value representing the ERC721 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC721 = 721;
/// @dev Constant value representing the ERC1155 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC1155 = 1155;
/// @dev Constant value representing the ERC20 token type for signatures and transfer hooks
uint256 constant TOKEN_TYPE_ERC20 = 20;
/// @dev Constant value to mask the upper bits of a signature that uses a packed `vs` value to extract `s`
bytes32 constant UPPER_BIT_MASK = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
/// @dev EIP-712 typehash used for validating signature based stored approvals
bytes32 constant UPDATE_APPROVAL_TYPEHASH =
keccak256("UpdateApprovalBySignature(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 approvalExpiration,uint256 sigDeadline,uint256 masterNonce)");
/// @dev EIP-712 typehash used for validating a single use permit without additional data
bytes32 constant SINGLE_USE_PERMIT_TYPEHASH =
keccak256("PermitTransferFrom(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 expiration,uint256 masterNonce)");
/// @dev EIP-712 typehash used for validating a single use permit with additional data
string constant SINGLE_USE_PERMIT_TRANSFER_ADVANCED_TYPEHASH_STUB =
"PermitTransferFromWithAdditionalData(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 expiration,uint256 masterNonce,";
/// @dev EIP-712 typehash used for validating an order permit that updates storage as it fills
string constant PERMIT_ORDER_ADVANCED_TYPEHASH_STUB =
"PermitOrderWithAdditionalData(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 salt,address operator,uint256 expiration,uint256 masterNonce,";
/// @dev Pausable flag for stored approval transfers of ERC721 assets
uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC721 = 1 << 0;
/// @dev Pausable flag for stored approval transfers of ERC1155 assets
uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC1155 = 1 << 1;
/// @dev Pausable flag for stored approval transfers of ERC20 assets
uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC20 = 1 << 2;
/// @dev Pausable flag for single use permit transfers of ERC721 assets
uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC721 = 1 << 3;
/// @dev Pausable flag for single use permit transfers of ERC1155 assets
uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC1155 = 1 << 4;
/// @dev Pausable flag for single use permit transfers of ERC20 assets
uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC20 = 1 << 5;
/// @dev Pausable flag for order fill transfers of ERC1155 assets
uint256 constant PAUSABLE_ORDER_TRANSFER_FROM_ERC1155 = 1 << 6;
/// @dev Pausable flag for order fill transfers of ERC20 assets
uint256 constant PAUSABLE_ORDER_TRANSFER_FROM_ERC20 = 1 << 7;// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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 {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_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 v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../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.
*
* _Available since v4.5._
*/
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 v4.7.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../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.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @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 override 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 {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_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 {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./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);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@limitbreak/creator-token-standards/src/utils/AutomaticValidatorTransferApproval.sol";
import "@limitbreak/creator-token-standards/src/utils/CreatorTokenBase.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import {TOKEN_TYPE_ERC721} from "@limitbreak/permit-c/src/Constants.sol";
/**
* @title ERC721ACQueryable
* @author Limit Break, Inc.
* @notice Extends Azuki's ERC721AQueryable implementation with Creator Token functionality, which
* allows the contract owner to update the transfer validation logic by managing a security policy in
* an external transfer validation security policy registry. See {CreatorTokenTransferValidator}.
*/
abstract contract ERC721ACQueryable is
ERC721AQueryable,
CreatorTokenBase,
AutomaticValidatorTransferApproval
{
constructor(
string memory name_,
string memory symbol_
) CreatorTokenBase() ERC721A(name_, symbol_) {}
/**
* @notice Overrides behavior of isApprovedFor all such that if an operator is not explicitly approved
* for all, the contract owner can optionally auto-approve the 721-C transfer validator for transfers.
*/
function isApprovedForAll(
address owner,
address operator
)
public
view
virtual
override(ERC721A, IERC721A)
returns (bool isApproved)
{
isApproved = super.isApprovedForAll(owner, operator);
if (!isApproved) {
if (autoApproveTransfersFromValidator) {
isApproved = operator == address(getTransferValidator());
}
}
}
/**
* @notice Indicates whether the contract implements the specified interface.
* @dev Overrides supportsInterface in ERC165.
* @param interfaceId The interface id
* @return true if the contract implements the specified interface, false otherwise
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721A, IERC721A) returns (bool) {
return
interfaceId == type(ICreatorToken).interfaceId ||
interfaceId == type(ICreatorTokenLegacy).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @notice Returns the function selector for the transfer validator's validation function to be called
* @notice for transaction simulation.
*/
function getTransferValidationFunction()
external
pure
returns (bytes4 functionSignature, bool isViewFunction)
{
functionSignature = bytes4(
keccak256("validateTransfer(address,address,address,uint256)")
);
isViewFunction = true;
}
/// @dev Ties the erc721a _beforeTokenTransfers hook to more granular transfer validation logic
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override {
for (uint256 i = 0; i < quantity; ) {
_validateBeforeTransfer(from, to, startTokenId + i);
unchecked {
++i;
}
}
}
/// @dev Ties the erc721a _afterTokenTransfer hook to more granular transfer validation logic
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override {
for (uint256 i = 0; i < quantity; ) {
_validateAfterTransfer(from, to, startTokenId + i);
unchecked {
++i;
}
}
}
function _msgSenderERC721A()
internal
view
virtual
override
returns (address)
{
return _msgSender();
}
function _tokenType() internal pure override returns (uint16) {
return uint16(TOKEN_TYPE_ERC721);
}
}// 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 "./IERC721AQueryable.sol";
import "../ERC721A.sol";
/**
* @title ERC721AQueryable.
*
* @dev ERC721A subclass with convenience query functions.
*/
abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(
uint256 tokenId
) public view virtual override returns (TokenOwnership memory ownership) {
unchecked {
if (tokenId >= _startTokenId()) {
if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId);
if (tokenId < _nextTokenId()) {
// If the `tokenId` is within bounds,
// scan backwards for the initialized ownership slot.
while (!_ownershipIsInitialized(tokenId)) --tokenId;
return _ownershipAt(tokenId);
}
}
}
}
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(
uint256[] calldata tokenIds
) external view virtual override returns (TokenOwnership[] memory) {
TokenOwnership[] memory ownerships;
uint256 i = tokenIds.length;
assembly {
// Grab the free memory pointer.
ownerships := mload(0x40)
// Store the length.
mstore(ownerships, i)
// Allocate one word for the length,
// `tokenIds.length` words for the pointers.
i := shl(5, i) // Multiply `i` by 32.
mstore(0x40, add(add(ownerships, 0x20), i))
}
while (i != 0) {
uint256 tokenId;
assembly {
i := sub(i, 0x20)
tokenId := calldataload(add(tokenIds.offset, i))
}
TokenOwnership memory ownership = explicitOwnershipOf(tokenId);
assembly {
// Store the pointer of `ownership` in the `ownerships` array.
mstore(add(add(ownerships, 0x20), i), ownership)
}
}
return ownerships;
}
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view virtual override returns (uint256[] memory) {
return _tokensOfOwnerIn(owner, start, stop);
}
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(
address owner
) external view virtual override returns (uint256[] memory) {
// If spot mints are enabled, full-range scan is disabled.
if (_sequentialUpTo() != type(uint256).max)
_revert(NotCompatibleWithSpotMints.selector);
uint256 start = _startTokenId();
uint256 stop = _nextTokenId();
uint256[] memory tokenIds;
if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop);
return tokenIds;
}
/**
* @dev Helper function for returning an array of token IDs owned by `owner`.
*
* Note that this function is optimized for smaller bytecode size over runtime gas,
* since it is meant to be called off-chain.
*/
function _tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) private view returns (uint256[] memory tokenIds) {
unchecked {
if (start >= stop) _revert(InvalidQueryRange.selector);
// Set `start = max(start, _startTokenId())`.
if (start < _startTokenId()) start = _startTokenId();
uint256 nextTokenId = _nextTokenId();
// If spot mints are enabled, scan all the way until the specified `stop`.
uint256 stopLimit = _sequentialUpTo() != type(uint256).max
? stop
: nextTokenId;
// Set `stop = min(stop, stopLimit)`.
if (stop >= stopLimit) stop = stopLimit;
// Number of tokens to scan.
uint256 tokenIdsMaxLength = balanceOf(owner);
// Set `tokenIdsMaxLength` to zero if the range contains no tokens.
if (start >= stop) tokenIdsMaxLength = 0;
// If there are one or more tokens to scan.
if (tokenIdsMaxLength != 0) {
// Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`.
if (stop - start <= tokenIdsMaxLength)
tokenIdsMaxLength = stop - start;
uint256 m; // Start of available memory.
assembly {
// Grab the free memory pointer.
tokenIds := mload(0x40)
// Allocate one word for the length, and `tokenIdsMaxLength` words
// for the data. `shl(5, x)` is equivalent to `mul(32, x)`.
m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1)))
mstore(0x40, m)
}
// We need to call `explicitOwnershipOf(start)`,
// because the slot at `start` may not be initialized.
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
// If the starting slot exists (i.e. not burned),
// initialize `currOwnershipAddr`.
// `ownership.address` will not be zero,
// as `start` is clamped to the valid token ID range.
if (!ownership.burned) currOwnershipAddr = ownership.addr;
uint256 tokenIdsIdx;
// Use a do-while, which is slightly more efficient for this case,
// as the array will at least contain one element.
do {
if (_sequentialUpTo() != type(uint256).max) {
// Skip the remaining unused sequential slots.
if (start == nextTokenId) start = _sequentialUpTo() + 1;
// Reset `currOwnershipAddr`, as each spot-minted token is a batch of one.
if (start > _sequentialUpTo())
currOwnershipAddr = address(0);
}
ownership = _ownershipAt(start); // This implicitly allocates memory.
assembly {
switch mload(add(ownership, 0x40))
// if `ownership.burned == false`.
case 0 {
// if `ownership.addr != address(0)`.
// The `addr` already has it's upper 96 bits clearned,
// since it is written to memory with regular Solidity.
if mload(ownership) {
currOwnershipAddr := mload(ownership)
}
// if `currOwnershipAddr == owner`.
// The `shl(96, x)` is to make the comparison agnostic to any
// dirty upper 96 bits in `owner`.
if iszero(shl(96, xor(currOwnershipAddr, owner))) {
tokenIdsIdx := add(tokenIdsIdx, 1)
mstore(
add(tokenIds, shl(5, tokenIdsIdx)),
start
)
}
}
// Otherwise, reset `currOwnershipAddr`.
// This handles the case of batch burned tokens
// (burned bit of first slot set, remaining slots left uninitialized).
default {
currOwnershipAddr := 0
}
start := add(start, 1)
// Free temporary memory implicitly allocated for ownership
// to avoid quadratic memory expansion costs.
mstore(0x40, m)
}
} while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength));
// Store the length of the array.
assembly {
mstore(tokenIds, tokenIdsIdx)
}
}
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '../IERC721A.sol';
/**
* @dev Interface of ERC721AQueryable.
*/
interface IERC721AQueryable is IERC721A {
/**
* Invalid query range (`start` >= `stop`).
*/
error InvalidQueryRange();
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory);
}// 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
pragma solidity ^0.8.4;
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
library SafeTransferLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev The ERC20 `transferFrom` has failed.
error TransferFromFailed();
/// @dev The ERC20 `transfer` has failed.
error TransferFailed();
/// @dev The ERC20 `approve` has failed.
error ApproveFailed();
/// @dev The ERC20 `totalSupply` query has failed.
error TotalSupplyQueryFailed();
/// @dev The Permit2 operation has failed.
error Permit2Failed();
/// @dev The Permit2 amount must be less than `2**160 - 1`.
error Permit2AmountOverflow();
/// @dev The Permit2 approve operation has failed.
error Permit2ApproveFailed();
/// @dev The Permit2 lockdown operation has failed.
error Permit2LockdownFailed();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;
/// @dev Suggested gas stipend for contract receiving ETH to perform a few
/// storage reads and writes, but low enough to prevent griefing.
uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;
/// @dev The unique EIP-712 domain separator for the DAI token contract.
bytes32 internal constant DAI_DOMAIN_SEPARATOR =
0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;
/// @dev The address for the WETH9 contract on Ethereum mainnet.
address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
/// @dev The canonical Permit2 address.
/// [Github](https://github.com/Uniswap/permit2)
/// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ETH OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
//
// The regular variants:
// - Forwards all remaining gas to the target.
// - Reverts if the target reverts.
// - Reverts if the current contract has insufficient balance.
//
// The force variants:
// - Forwards with an optional gas stipend
// (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
// - If the target reverts, or if the gas stipend is exhausted,
// creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
// Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
// - Reverts if the current contract has insufficient balance.
//
// The try variants:
// - Forwards with a mandatory gas stipend.
// - Instead of reverting, returns whether the transfer succeeded.
/// @dev Sends `amount` (in wei) ETH to `to`.
function safeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Sends all the ETH in the current contract to `to`.
function safeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// Transfer all the ETH and check if it succeeded or not.
if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// forgefmt: disable-next-item
if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
}
}
/// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
function trySafeTransferAllETH(address to, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ERC20 OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for
/// the current contract to manage.
function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function trySafeTransferFrom(address token, address from, address to, uint256 amount)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
success := lt(or(iszero(extcodesize(token)), returndatasize()), success)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends all of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have their entire balance approved for the current contract to manage.
function safeTransferAllFrom(address token, address from, address to)
internal
returns (uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
// Perform the transfer, reverting upon failure.
let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransfer(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sends all of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransferAll(address token, address to) internal returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
mstore(0x20, address()) // Store the address of the current contract.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x14, to) // Store the `to` argument.
amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// Reverts upon failure.
function safeApprove(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
/// then retries the approval again (some tokens, e.g. USDT, requires this).
/// Reverts upon failure.
function safeApproveWithRetry(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, retrying upon failure.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x34, 0) // Store 0 for the `amount`.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
mstore(0x34, amount) // Store back the original `amount`.
// Retry the approval, reverting upon failure.
success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
// Check the `extcodesize` again just in case the token selfdestructs lol.
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Returns the amount of ERC20 `token` owned by `account`.
/// Returns zero if the `token` does not exist.
function balanceOf(address token, address account) internal view returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
amount :=
mul( // The arguments of `mul` are evaluated from right to left.
mload(0x20),
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
)
}
}
/// @dev Performs a `token.balanceOf(account)` check.
/// `implemented` denotes whether the `token` does not implement `balanceOf`.
/// `amount` is zero if the `token` does not implement `balanceOf`.
function checkBalanceOf(address token, address account)
internal
view
returns (bool implemented, uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
implemented :=
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
amount := mul(mload(0x20), implemented)
}
}
/// @dev Returns the total supply of the `token`.
/// Reverts if the token does not exist or does not implement `totalSupply()`.
function totalSupply(address token) internal view returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x18160ddd) // `totalSupply()`.
if iszero(
and(gt(returndatasize(), 0x1f), staticcall(gas(), token, 0x1c, 0x04, 0x00, 0x20))
) {
mstore(0x00, 0x54cd9435) // `TotalSupplyQueryFailed()`.
revert(0x1c, 0x04)
}
result := mload(0x00)
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// If the initial attempt fails, try to use Permit2 to transfer the token.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
if (!trySafeTransferFrom(token, from, to, amount)) {
permit2TransferFrom(token, from, to, amount);
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
/// Reverts upon failure.
function permit2TransferFrom(address token, address from, address to, uint256 amount)
internal
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(add(m, 0x74), shr(96, shl(96, token)))
mstore(add(m, 0x54), amount)
mstore(add(m, 0x34), to)
mstore(add(m, 0x20), shl(96, from))
// `transferFrom(address,address,uint160,address)`.
mstore(m, 0x36c78516000000000000000000000000)
let p := PERMIT2
let exists := eq(chainid(), 1)
if iszero(exists) { exists := iszero(iszero(extcodesize(p))) }
if iszero(
and(
call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00),
lt(iszero(extcodesize(token)), exists) // Token has code and Permit2 exists.
)
) {
mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04)
}
}
}
/// @dev Permit a user to spend a given amount of
/// another user's tokens via native EIP-2612 permit if possible, falling
/// back to Permit2 if native permit fails or is not implemented on the token.
function permit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
for {} shl(96, xor(token, WETH9)) {} {
mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
// Gas stipend to limit gas burn for tokens that don't refund gas when
// an non-existing function is called. 5K should be enough for a SLOAD.
staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
)
) { break }
// After here, we can be sure that token is a contract.
let m := mload(0x40)
mstore(add(m, 0x34), spender)
mstore(add(m, 0x20), shl(96, owner))
mstore(add(m, 0x74), deadline)
if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
mstore(0x14, owner)
mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
mstore(
add(m, 0x94),
lt(iszero(amount), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
)
mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
// `nonces` is already at `add(m, 0x54)`.
// `amount != 0` is already stored at `add(m, 0x94)`.
mstore(add(m, 0xb4), and(0xff, v))
mstore(add(m, 0xd4), r)
mstore(add(m, 0xf4), s)
success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
break
}
mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
mstore(add(m, 0x54), amount)
mstore(add(m, 0x94), and(0xff, v))
mstore(add(m, 0xb4), r)
mstore(add(m, 0xd4), s)
success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
break
}
}
if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
}
/// @dev Simple permit on the Permit2 contract.
function simplePermit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, 0x927da105) // `allowance(address,address,address)`.
{
let addressMask := shr(96, not(0))
mstore(add(m, 0x20), and(addressMask, owner))
mstore(add(m, 0x40), and(addressMask, token))
mstore(add(m, 0x60), and(addressMask, spender))
mstore(add(m, 0xc0), and(addressMask, spender))
}
let p := mul(PERMIT2, iszero(shr(160, amount)))
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
)
) {
mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(p))), 0x04)
}
mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
// `owner` is already `add(m, 0x20)`.
// `token` is already at `add(m, 0x40)`.
mstore(add(m, 0x60), amount)
mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
// `nonce` is already at `add(m, 0xa0)`.
// `spender` is already at `add(m, 0xc0)`.
mstore(add(m, 0xe0), deadline)
mstore(add(m, 0x100), 0x100) // `signature` offset.
mstore(add(m, 0x120), 0x41) // `signature` length.
mstore(add(m, 0x140), r)
mstore(add(m, 0x160), s)
mstore(add(m, 0x180), shl(248, v))
if iszero( // Revert if token does not have code, or if the call fails.
mul(extcodesize(token), call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00))) {
mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Approves `spender` to spend `amount` of `token` for `address(this)`.
function permit2Approve(address token, address spender, uint160 amount, uint48 expiration)
internal
{
/// @solidity memory-safe-assembly
assembly {
let addressMask := shr(96, not(0))
let m := mload(0x40)
mstore(m, 0x87517c45) // `approve(address,address,uint160,uint48)`.
mstore(add(m, 0x20), and(addressMask, token))
mstore(add(m, 0x40), and(addressMask, spender))
mstore(add(m, 0x60), and(addressMask, amount))
mstore(add(m, 0x80), and(0xffffffffffff, expiration))
if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) {
mstore(0x00, 0x324f14ae) // `Permit2ApproveFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Revokes an approval for `token` and `spender` for `address(this)`.
function permit2Lockdown(address token, address spender) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, 0xcc53287f) // `Permit2.lockdown`.
mstore(add(m, 0x20), 0x20) // Offset of the `approvals`.
mstore(add(m, 0x40), 1) // `approvals.length`.
mstore(add(m, 0x60), shr(96, shl(96, token)))
mstore(add(m, 0x80), shr(96, shl(96, spender)))
if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) {
mstore(0x00, 0x96b3de23) // `Permit2LockdownFailed()`.
revert(0x1c, 0x04)
}
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"royaltyReceiver_","type":"address"},{"internalType":"uint96","name":"royaltyFeeNumerator_","type":"uint96"},{"internalType":"address","name":"treasury_","type":"address"},{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"uint256","name":"publicMintStartTime_","type":"uint256"},{"internalType":"uint256","name":"publicMintEndTime_","type":"uint256"},{"internalType":"uint256","name":"claimStartTime_","type":"uint256"},{"internalType":"uint256","name":"claimEndTime_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"ClaimNotActive","type":"error"},{"inputs":[],"name":"CreatorTokenBase__InvalidTransferValidatorContract","type":"error"},{"inputs":[],"name":"IncorrectValue","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"InvalidTimestamps","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NoClaim","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PublicMintLimitExceeded","type":"error"},{"inputs":[],"name":"PublicMintNotActive","type":"error"},{"inputs":[],"name":"ReclaimNotAllowed","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"ShouldNotMintToBurnAddress","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TradingNotEnabled","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"},{"inputs":[],"name":"ZeroAddress","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":false,"internalType":"bool","name":"autoApproved","type":"bool"}],"name":"AutomaticApprovalOfTransferValidatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"ClaimAllocationSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalAllocations","type":"uint256"}],"name":"ClaimAllocationsBatchSet","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":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"DefaultRoyaltySet","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":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ReclaimToAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"publicStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"publicEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimEnd","type":"uint256"}],"name":"TimestampsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"TokenRoyaltySet","type":"event"},{"anonymous":false,"inputs":[],"name":"TradingEnabled","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"TransferValidatorUpdated","type":"event"},{"inputs":[],"name":"DEFAULT_TRANSFER_VALIDATOR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PUBLIC_MINT_PER_WALLET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PUBLIC_MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"autoApproveTransfersFromValidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimAllocations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"ownership","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getClaimAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getPublicMintCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimestamps","outputs":[{"internalType":"uint256","name":"publicStart","type":"uint256"},{"internalType":"uint256","name":"publicEnd","type":"uint256"},{"internalType":"uint256","name":"claimStart","type":"uint256"},{"internalType":"uint256","name":"claimEnd","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransferValidationFunction","outputs":[{"internalType":"bytes4","name":"functionSignature","type":"bytes4"},{"internalType":"bool","name":"isViewFunction","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransferValidator","outputs":[{"internalType":"address","name":"validator","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isApproved","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isClaimActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"quantity","type":"uint64"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"reclaimToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"bool","name":"autoApprove","type":"bool"}],"name":"setAutomaticApprovalOfTransfersFromValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"setClaimAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"}],"name":"setClaimAllocationsBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transferValidator_","type":"address"}],"name":"setTransferValidator","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"publicMintStartTime_","type":"uint256"},{"internalType":"uint256","name":"publicMintEndTime_","type":"uint256"},{"internalType":"uint256","name":"claimStartTime_","type":"uint256"},{"internalType":"uint256","name":"claimEndTime_","type":"uint256"}],"name":"updateTimestamps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawETHToTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a060405234801561001057600080fd5b5060405161390438038061390483398101604081905261002f91610987565b87878c8c818160026100418382610b21565b50600361004e8282610b21565b505060016000555061005e610134565b61007b73721c008fdff27bf06e7e123956e2fe03b63342e3610183565b50610087905033610201565b6100918282610253565b508990506001600160a01b0381166100bc5760405163d92e233d60e01b815260040160405180910390fd5b866001600160a01b0381166100e45760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b038816608052600f6100fd8882610b21565b5061010a868686866102a8565b6080516101189060c8610343565b50505050505050505050505050610c8f565b8060005260046000fd5b604080516000815273721c008fdff27bf06e7e123956e2fe03b63342e360208201527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a1565b6001600160a01b038116156101fe57803b80156101fc576040805163fb2de5d760e01b81523060048201526102d1602482015290516001600160a01b0384169163fb2de5d791604480830192600092919082900301818387803b1580156101e957600080fd5b505af19250505080156101fa575060015b505b505b50565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61025d8282610363565b6040516001600160601b03821681526001600160a01b038316907f8a8bae378cb731c5c40b632330c6836c2f916f48edb967699c86736f9a6a76ef9060200160405180910390a25050565b82841015806102b75750808210155b806102c157508184115b156102df5760405163d22806e360e01b815260040160405180910390fd5b607881901b605083901b602885901b86171717600d556040805185815260208101859052908101839052606081018290527fb4f7501f0db5825b71c48e8f363f9224a687d32f4c104130a997d35e9a909c159060800160405180910390a150505050565b6101fc82826040518060200160405280600081525061046560201b60201c565b6127106001600160601b03821611156103d65760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b03821661042c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016103cd565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600b55565b61046f83836104ca565b6001600160a01b0383163b156101fa576000548281035b600181019061049a9060009087908661059f565b6104ae576104ae6368d2bf6b60e11b61012a565b8181106104865781600054146104c357600080fd5b5050505050565b60008054908290036104e6576104e663b562e8dd60e01b61012a565b6104f36000848385610682565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b1781179091558084526005909252822080546801000000000000000186020190559081900361055157610551622e076360e81b61012a565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103610556575060009081556101fa91508483856106a9565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906105d4903390899088908890600401610bdf565b6020604051808303816000875af192505050801561060f575060408051601f3d908101601f1916820190925261060c91810190610c37565b60015b610664573d80801561063d576040519150601f19603f3d011682016040523d82523d6000602084013e610642565b606091505b50805160000361065c5761065c6368d2bf6b60e11b61012a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60005b818110156104c3576106a1858561069c8487610c68565b6106d0565b600101610685565b60005b818110156104c3576106c885856106c38487610c68565b6106e4565b6001016106ac565b6106d983610732565b6101fa83838361076b565b6001600160a01b0383811615908316158180156106fe5750805b1561071c57604051635cbd944160e01b815260040160405180910390fd5b8115610728575b6104c3565b80610723576104c3565b6001600160a01b0381161580159061074d5750600e5460ff16155b156101fe576040516312f1f92360e01b815260040160405180910390fd5b6001600160a01b0383811615908316158180156107855750805b156107a357604051635cbd944160e01b815260040160405180910390fd5b816107235780610723576104c3338686863460006107bf61085f565b90506001600160a01b03811615610857576001600160a01b03811633036107e657506104c3565b60405163657711f560e11b81526001600160a01b038781166004830152868116602483015285811660448301526064820185905282169063caee23ea9060840160006040518083038186803b15801561083e57600080fd5b505afa158015610852573d6000803e3d6000fd5b505050505b505050505050565b60095461010090046001600160a01b0316806108965760095460ff16610896575073721c008fdff27bf06e7e123956e2fe03b63342e35b90565b634e487b7160e01b600052604160045260246000fd5b60005b838110156108ca5781810151838201526020016108b2565b50506000910152565b600082601f8301126108e457600080fd5b81516001600160401b038111156108fd576108fd610899565b604051601f8201601f19908116603f011681016001600160401b038111828210171561092b5761092b610899565b60405281815283820160200185101561094357600080fd5b61067a8260208301602087016108af565b80516001600160a01b038116811461096b57600080fd5b919050565b80516001600160601b038116811461096b57600080fd5b60008060008060008060008060008060006101608c8e0312156109a957600080fd5b8b516001600160401b038111156109bf57600080fd5b6109cb8e828f016108d3565b60208e0151909c5090506001600160401b038111156109e957600080fd5b6109f58e828f016108d3565b9a5050610a0460408d01610954565b9850610a1260608d01610954565b9750610a2060808d01610970565b9650610a2e60a08d01610954565b60c08d01519096506001600160401b03811115610a4a57600080fd5b610a568e828f016108d3565b955050600060e08d015190508094505060006101008d015190508093505060006101208d015190508092505060006101408d01519050809150509295989b509295989b9093969950565b600181811c90821680610ab457607f821691505b602082108103610ad457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101fa57806000526020600020601f840160051c81016020851015610b015750805b601f840160051c820191505b818110156104c35760008155600101610b0d565b81516001600160401b03811115610b3a57610b3a610899565b610b4e81610b488454610aa0565b84610ada565b6020601f821160018114610b825760008315610b6a5750848201515b600019600385901b1c1916600184901b1784556104c3565b600084815260208120601f198516915b82811015610bb25787850151825560209485019460019092019101610b92565b5084821015610bd05786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b60018060a01b038516815260018060a01b03841660208201528260408201526080606082015260008251806080840152610c208160a08501602087016108af565b601f01601f19169190910160a00195945050505050565b600060208284031215610c4957600080fd5b81516001600160e01b031981168114610c6157600080fd5b9392505050565b80820180821115610c8957634e487b7160e01b600052601160045260246000fd5b92915050565b608051612c53610cb16000396000818161062f015261123d0152612c536000f3fe6080604052600436106102ff5760003560e01c80636afcb7b0116101905780639e05d240116100dc578063c87b56dd11610095578063df9cbf381161006f578063df9cbf3814610947578063e985e9c514610967578063ee7f174814610987578063f2fde38b146109a757600080fd5b8063c87b56dd146108fd578063c8d5ed681461091d578063da0239a61461093257600080fd5b80639e05d24014610830578063a22cb46514610850578063a9fc664e14610870578063b88d4fde14610890578063bb125ab0146108a3578063c23dc68f146108d057600080fd5b80638462151c116101495780638da5cb5b116101235780638da5cb5b146107a157806395d89b41146107bf578063997f2df6146107d457806399a2557a1461081057600080fd5b80638462151c1461073f5780638a8c523c1461076c5780638ba4cc3c1461078157600080fd5b80636afcb7b0146106b25780636bde2627146106c557806370a08231146106e0578063715018a6146107005780637b698331146107155780637fc278031461072a57600080fd5b806332cb6b0c1161024f57806355f804b31161020857806361d027b3116101e257806361d027b31461061d5780636221d13c146106515780636352211e14610672578063690d83201461069257600080fd5b806355f804b31461058357806359abbfe4146105a35780635bbb2177146105f057600080fd5b806332cb6b0c146104d757806342842e0e146104ed578063480cc0a1146105005780634ada218b146105205780634e71d92d1461053857806354d8bd251461054d57600080fd5b8063098144d4116102bc57806323b872dd1161029657806323b872dd146104505780632a55205a146104635780632d24eaa2146104a25780632d6b6224146104c257600080fd5b8063098144d4146103f05780630d705df61461040557806318160ddd1461042d57600080fd5b8063014635461461030457806301ffc9a71461034957806304634d8d1461037957806306fdde031461039b578063081812fc146103bd578063095ea7b3146103dd575b600080fd5b34801561031057600080fd5b5061032c73721c008fdff27bf06e7e123956e2fe03b63342e381565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561035557600080fd5b506103696103643660046123b9565b6109c7565b6040519015158152602001610340565b34801561038557600080fd5b506103996103943660046123ed565b6109e7565b005b3480156103a757600080fd5b506103b06109fd565b6040516103409190612480565b3480156103c957600080fd5b5061032c6103d8366004612493565b610a8f565b6103996103eb3660046124ac565b610aca565b3480156103fc57600080fd5b5061032c610ad6565b34801561041157600080fd5b506040805163657711f560e11b81526001602082015201610340565b34801561043957600080fd5b50610442610b10565b604051908152602001610340565b61039961045e3660046124d6565b610b2e565b34801561046f57600080fd5b5061048361047e366004612513565b610cad565b604080516001600160a01b039093168352602083019190915201610340565b3480156104ae57600080fd5b506103996104bd3660046124ac565b610d5b565b3480156104ce57600080fd5b50610369610dbc565b3480156104e357600080fd5b50610442610d4881565b6103996104fb3660046124d6565b610e09565b34801561050c57600080fd5b5061039961051b366004612535565b610e29565b34801561052c57600080fd5b50600e5460ff16610369565b34801561054457600080fd5b50610399610eef565b34801561055957600080fd5b50610442610568366004612535565b6001600160a01b031660009081526010602052604090205490565b34801561058f57600080fd5b5061039961059e366004612550565b610faa565b3480156105af57600080fd5b50600d546040805164ffffffffff8084168252602884901c81166020830152605084901c81169282019290925260789290921c166060820152608001610340565b3480156105fc57600080fd5b5061061061060b366004612606565b610fbf565b6040516103409190612683565b34801561062957600080fd5b5061032c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561065d57600080fd5b5060095461036990600160a81b900460ff1681565b34801561067e57600080fd5b5061032c61068d366004612493565b61100b565b34801561069e57600080fd5b506103996106ad366004612535565b611016565b6103996106c03660046126d1565b61104f565b3480156106d157600080fd5b5061044266bfd8b6c1df000081565b3480156106ec57600080fd5b506104426106fb366004612535565b6111d7565b34801561070c57600080fd5b5061039961121c565b34801561072157600080fd5b50610399611230565b34801561073657600080fd5b50610369611261565b34801561074b57600080fd5b5061075f61075a366004612535565b6112ab565b60405161034091906126fa565b34801561077857600080fd5b506103996112d2565b34801561078d57600080fd5b5061039961079c3660046124ac565b611312565b3480156107ad57600080fd5b50600a546001600160a01b031661032c565b3480156107cb57600080fd5b506103b061134c565b3480156107e057600080fd5b506104426107ef366004612535565b6001600160a01b031660009081526005602052604090205460c01c600f1690565b34801561081c57600080fd5b5061075f61082b366004612732565b61135b565b34801561083c57600080fd5b5061039961084b366004612775565b611368565b34801561085c57600080fd5b5061039961086b366004612790565b6113c8565b34801561087c57600080fd5b5061039961088b366004612535565b611441565b61039961089e3660046127d9565b6114fa565b3480156108af57600080fd5b506104426108be366004612535565b60106020526000908152604090205481565b3480156108dc57600080fd5b506108f06108eb366004612493565b611535565b60405161034091906128ba565b34801561090957600080fd5b506103b0610918366004612493565b611599565b34801561092957600080fd5b50610442600381565b34801561093e57600080fd5b50610442611614565b34801561095357600080fd5b506103996109623660046128c8565b611623565b34801561097357600080fd5b50610369610982366004612937565b61170c565b34801561099357600080fd5b506103996109a2366004612961565b611770565b3480156109b357600080fd5b506103996109c2366004612535565b611784565b60006109d282611802565b806109e157506109e182611842565b92915050565b6109ef611877565b6109f9828261187f565b5050565b606060028054610a0c90612993565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3890612993565b8015610a855780601f10610a5a57610100808354040283529160200191610a85565b820191906000526020600020905b815481529060010190602001808311610a6857829003601f168201915b5050505050905090565b6000610a9a826118cd565b610aae57610aae6333d1c03960e21b611919565b506000908152600660205260409020546001600160a01b031690565b6109f982826001611923565b60095461010090046001600160a01b031680610b0d5760095460ff16610b0d575073721c008fdff27bf06e7e123956e2fe03b63342e35b90565b60006001805460005403039050600019805b14610b0d576008540190565b6000610b39826119c6565b6001600160a01b039485169490915081168414610b5f57610b5f62a1148160e81b611919565b60008281526006602052604090208054338082146001600160a01b03881690911417610ba357610b8f863361170c565b610ba357610ba3632ce44b5f60e11b611919565b610bb08686866001611a67565b8015610bbb57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610c4d57600184016000818152600460205260408120549003610c4b576000548114610c4b5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a480600003610c9757610c97633a954ecd60e21b611919565b610ca48787876001611a8e565b50505050505050565b6000828152600c602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610d22575060408051808201909152600b546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610d41906001600160601b0316876129e3565b610d4b91906129fa565b91519350909150505b9250929050565b610d63611877565b6001600160a01b03821660008181526010602052604090819020839055517f6c0add1e3230ee6b1d1b1e63309097fb6b444622675350b1481ba088c56601d390610db09084815260200190565b60405180910390a25050565b6000428180610deb600d5464ffffffffff80821692602883901c821692605081901c83169260789190911c1690565b505091509150818310158015610e015750808311155b935050505090565b610e24838383604051806020016040528060008152506114fa565b505050565b806001600160a01b038116610e515760405163d92e233d60e01b815260040160405180910390fd5b610e59611877565b600d54429060281c64ffffffffff16808211610e8857604051636fa6d0a560e01b815260040160405180910390fd5b6000610e92611ab5565b90508015610ee857610ea48582611acb565b846001600160a01b03167f1792ba7634b5562f21d108baa2e1a5c4301ef2cf684f871fa5b0db56e63db82482604051610edf91815260200190565b60405180910390a25b5050505050565b600d54429064ffffffffff605082901c81169160781c1681831080610f1357508083115b15610f315760405163024fbaa960e41b815260040160405180910390fd5b3360009081526010602052604081205490819003610f6257604051639b0e91e160e01b815260040160405180910390fd5b80610f6b611ab5565b1015610f8a5760405163d05cb60960e01b815260040160405180910390fd5b33600081815260106020526040812055610fa49082611acb565b50505050565b610fb2611877565b600f610e24828483612a63565b60408051828152600583901b8082016020019092526060915b801561100357601f1980820191860101356000610ff482611535565b8484016020015250610fd89050565b509392505050565b60006109e1826119c6565b806001600160a01b03811661103e5760405163d92e233d60e01b815260040160405180910390fd5b611046611877565b6109f982611ae5565b600d54429064ffffffffff8082169160281c168183108061106f57508083115b1561108d5760405163cd967e3560e01b815260040160405180910390fd5b6001600160401b03841615806110ac57506003846001600160401b0316115b156110ca57604051632d3d9ce160e01b815260040160405180910390fd5b60006110e66001600160401b03861666bfd8b6c1df00006129e3565b905080341461110857604051636956f2ab60e11b815260040160405180910390fd5b846001600160401b031661111a611ab5565b10156111395760405163d05cb60960e01b815260040160405180910390fd5b3360009081526005602052604090205460c01c600f811660036111656001600160401b03891683612b22565b111561118457604051632d3d9ce160e01b815260040160405180910390fd5b6111c4336111928985612b35565b6001600160a01b03909116600090815260056020526040902080546001600160c01b031660c09290921b919091179055565b610ca433886001600160401b0316611acb565b60006001600160a01b0382166111f7576111f76323d3ad8160e21b611919565b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611224611b01565b61122e6000611b5b565b565b611238611877565b61122e7f0000000000000000000000000000000000000000000000000000000000000000611ae5565b6000428180611290600d5464ffffffffff80821692602883901c821692605081901c83169260789190911c1690565b935093505050818310158015610e0157509091111592915050565b600054606090600190828282146112ca576112c7858484611bad565b90505b949350505050565b6112da611877565b600e805460ff191660011790556040517f799663458a5ef2936f7fa0c99b3336c69c25890f82974f04e811e5bb359186c790600090a1565b61131a611877565b80611323611ab5565b10156113425760405163d05cb60960e01b815260040160405180910390fd5b6109f98282611acb565b606060038054610a0c90612993565b60606112ca848484611bad565b611370611877565b60098054821515600160a81b0260ff60a81b199091161790556040517f6787c7f9a80aa0f5ceddab2c54f1f5169c0b88e75dd5e19d5e858a64144c7dbc906113bd90831515815260200190565b60405180910390a150565b3360008181526007602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611435911515815260200190565b60405180910390a35050565b611449611877565b6001600160a01b038116803b15159015801590611464575080155b15611482576040516332483afb60e01b815260040160405180910390fd5b7fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac6114ab610ad6565b604080516001600160a01b03928316815291851660208301520160405180910390a1600980546001600160a01b038416610100026001600160a81b03199091161760011790556109f982611cb4565b611505848484610b2e565b6001600160a01b0383163b15610fa45761152184848484611d34565b610fa457610fa46368d2bf6b60e11b611919565b6040805160808101825260008082526020820181905291810182905260608101919091526001821061159457600054821015611594575b60008281526004602052604090205461158b576000199091019061156c565b6109e182611e16565b919050565b60606115a4826118cd565b6115b8576115b8630a14c4b560e41b611919565b60006115c2611e94565b905080516000036115e2576040518060200160405280600081525061160d565b806115ec84611ea3565b6040516020016115fd929190612b54565b6040516020818303038152906040525b9392505050565b600061161e611ab5565b905090565b61162b611877565b8281811461163857600080fd5b6000805b828110156116d05784848281811061165657611656612b83565b905060200201356010600089898581811061167357611673612b83565b90506020020160208101906116889190612535565b6001600160a01b031681526020810191909152604001600020558484828181106116b4576116b4612b83565b90506020020135826116c69190612b22565b915060010161163c565b506040518181527f9c1e6106877cde86be0c5f84b92159bb92a5cf5a7017d8d5638b18180e02b31f9060200160405180910390a1505050505050565b6001600160a01b0382811660009081526007602090815260408083209385168352929052205460ff16806109e157600954600160a81b900460ff16156109e157611754610ad6565b6001600160a01b0316826001600160a01b031614905092915050565b611778611877565b610fa484848484611ee7565b61178c611b01565b6001600160a01b0381166117f65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6117ff81611b5b565b50565b60006001600160e01b03198216632b435fdb60e21b148061183357506001600160e01b0319821663503e914d60e11b145b806109e157506109e182611f82565b60006001600160e01b0319821663152a902d60e11b14806109e157506301ffc9a760e01b6001600160e01b03198316146109e1565b61122e611b01565b6118898282611fd0565b6040516001600160601b03821681526001600160a01b038316907f8a8bae378cb731c5c40b632330c6836c2f916f48edb967699c86736f9a6a76ef90602001610db0565b600081600111611594576000548210156115945760005b506000828152600460205260408120549081900361190c5761190583612b99565b92506118e4565b600160e01b161592915050565b8060005260046000fd5b600061192e8361100b565b90508180156119465750336001600160a01b03821614155b1561196957611955813361170c565b611969576119696367d9dca160e11b611919565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b600081600111611a57575060008181526004602052604090205480600003611a44576000548210611a0157611a01636f96cda160e11b611919565b5b50600019016000818152600460205260409020548015611a0257600160e01b8116600003611a2f57919050565b611a3f636f96cda160e11b611919565b611a02565b600160e01b8116600003611a5757919050565b611594636f96cda160e11b611919565b60005b81811015610ee857611a868585611a818487612b22565b6120cd565b600101611a6a565b60005b81811015610ee857611aad8585611aa88487612b22565b6120e1565b600101611a91565b6000611abf61212f565b61161e90610d48612bb0565b6109f982826040518060200160405280600081525061213f565b60003860003847855af16117ff5763b12d13eb6000526004601cfd5b600a546001600160a01b0316331461122e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016117ed565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060818310611bc657611bc6631960ccad60e11b611919565b6001831015611bd457600192505b60005480808410611be3578093505b6000611bee876111d7565b9050848610611bfb575060005b8015611caa578086860311611c0f57508484035b604080516001830160051b81019182905294506000611c2d88611535565b905060008160400151611c3e575080515b60005b611c4a8a611e16565b9250604083015160008114611c625760009250611c87565b835115611c6e57835192505b8b831860601b611c87576001820191508a8260051b8a01525b5060018a01995083604052888a1480611c9f57508481145b15611c415787525050505b5050509392505050565b6001600160a01b038116156117ff57803b80156109f9576040805163fb2de5d760e01b81523060048201526102d1602482015290516001600160a01b0384169163fb2de5d791604480830192600092919082900301818387803b158015611d1a57600080fd5b505af1925050508015611d2b575060015b156109f9575050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611d69903390899088908890600401612bc3565b6020604051808303816000875af1925050508015611da4575060408051601f3d908101601f19168201909252611da191810190612c00565b60015b611df9573d808015611dd2576040519150601f19603f3d011682016040523d82523d6000602084013e611dd7565b606091505b508051600003611df157611df16368d2bf6b60e11b611919565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600460205260409020546109e190604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6060600f8054610a0c90612993565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611ebd5750819003601f19909101908152919050565b8284101580611ef65750808210155b80611f0057508184115b15611f1e5760405163d22806e360e01b815260040160405180910390fd5b607881901b605083901b602885901b86171717600d556040805185815260208101859052908101839052606081018290527fb4f7501f0db5825b71c48e8f363f9224a687d32f4c104130a997d35e9a909c159060800160405180910390a150505050565b60006301ffc9a760e01b6001600160e01b031983161480611fb357506380ac58cd60e01b6001600160e01b03198316145b806109e15750506001600160e01b031916635b5e139f60e01b1490565b6127106001600160601b038216111561203e5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016117ed565b6001600160a01b0382166120945760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016117ed565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600b55565b6120d68361219c565b610e248383836121d5565b6001600160a01b0383811615908316158180156120fb5750805b1561211957604051635cbd944160e01b815260040160405180910390fd5b8115612125575b610ee8565b8061212057610ee8565b6000546000199081019080610b22565b6121498383612224565b6001600160a01b0383163b15610e24576000548281035b6121736000868380600101945086611d34565b612187576121876368d2bf6b60e11b611919565b818110612160578160005414610ee857600080fd5b6001600160a01b038116158015906121b75750600e5460ff16155b156117ff576040516312f1f92360e01b815260040160405180910390fd5b6001600160a01b0383811615908316158180156121ef5750805b1561220d57604051635cbd944160e01b815260040160405180910390fd5b81612120578061212057610ee833868686346122f9565b60008054908290036122405761224063b562e8dd60e01b611919565b61224d6000848385611a67565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b178117909155808452600590925282208054680100000000000000018602019055908190036122ab576122ab622e076360e81b611919565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48181600101915081036122b057506000908155610e249150848385611a8e565b6000612303610ad6565b90506001600160a01b0381161561239b576001600160a01b038116330361232a5750610ee8565b60405163657711f560e11b81526001600160a01b038781166004830152868116602483015285811660448301526064820185905282169063caee23ea9060840160006040518083038186803b15801561238257600080fd5b505afa158015612396573d6000803e3d6000fd5b505050505b505050505050565b6001600160e01b0319811681146117ff57600080fd5b6000602082840312156123cb57600080fd5b813561160d816123a3565b80356001600160a01b038116811461159457600080fd5b6000806040838503121561240057600080fd5b612409836123d6565b915060208301356001600160601b038116811461242557600080fd5b809150509250929050565b60005b8381101561244b578181015183820152602001612433565b50506000910152565b6000815180845261246c816020860160208601612430565b601f01601f19169290920160200192915050565b60208152600061160d6020830184612454565b6000602082840312156124a557600080fd5b5035919050565b600080604083850312156124bf57600080fd5b6124c8836123d6565b946020939093013593505050565b6000806000606084860312156124eb57600080fd5b6124f4846123d6565b9250612502602085016123d6565b929592945050506040919091013590565b6000806040838503121561252657600080fd5b50508035926020909101359150565b60006020828403121561254757600080fd5b61160d826123d6565b6000806020838503121561256357600080fd5b82356001600160401b0381111561257957600080fd5b8301601f8101851361258a57600080fd5b80356001600160401b038111156125a057600080fd5b8560208284010111156125b257600080fd5b6020919091019590945092505050565b60008083601f8401126125d457600080fd5b5081356001600160401b038111156125eb57600080fd5b6020830191508360208260051b8501011115610d5457600080fd5b6000806020838503121561261957600080fd5b82356001600160401b0381111561262f57600080fd5b61263b858286016125c2565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b602080825282518282018190526000918401906040840190835b818110156126c6576126b0838551612647565b602093909301926080929092019160010161269d565b509095945050505050565b6000602082840312156126e357600080fd5b81356001600160401b038116811461160d57600080fd5b602080825282518282018190526000918401906040840190835b818110156126c6578351835260209384019390920191600101612714565b60008060006060848603121561274757600080fd5b612750846123d6565b95602085013595506040909401359392505050565b8035801515811461159457600080fd5b60006020828403121561278757600080fd5b61160d82612765565b600080604083850312156127a357600080fd5b6127ac836123d6565b91506127ba60208401612765565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156127ef57600080fd5b6127f8856123d6565b9350612806602086016123d6565b92506040850135915060608501356001600160401b0381111561282857600080fd5b8501601f8101871361283957600080fd5b80356001600160401b03811115612852576128526127c3565b604051601f8201601f19908116603f011681016001600160401b0381118282101715612880576128806127c3565b60405281815282820160200189101561289857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b608081016109e18284612647565b600080600080604085870312156128de57600080fd5b84356001600160401b038111156128f457600080fd5b612900878288016125c2565b90955093505060208501356001600160401b0381111561291f57600080fd5b61292b878288016125c2565b95989497509550505050565b6000806040838503121561294a57600080fd5b612953836123d6565b91506127ba602084016123d6565b6000806000806080858703121561297757600080fd5b5050823594602084013594506040840135936060013592509050565b600181811c908216806129a757607f821691505b6020821081036129c757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109e1576109e16129cd565b600082612a1757634e487b7160e01b600052601260045260246000fd5b500490565b601f821115610e2457806000526020600020601f840160051c81016020851015612a435750805b601f840160051c820191505b81811015610ee85760008155600101612a4f565b6001600160401b03831115612a7a57612a7a6127c3565b612a8e83612a888354612993565b83612a1c565b6000601f841160018114612ac25760008515612aaa5750838201355b600019600387901b1c1916600186901b178355610ee8565b600083815260209020601f19861690835b82811015612af35786850135825560209485019460019092019101612ad3565b5086821015612b105760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b808201808211156109e1576109e16129cd565b6001600160401b0381811683821601908111156109e1576109e16129cd565b60008351612b66818460208801612430565b835190830190612b7a818360208801612430565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b600081612ba857612ba86129cd565b506000190190565b818103818111156109e1576109e16129cd565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bf690830184612454565b9695505050505050565b600060208284031215612c1257600080fd5b815161160d816123a356fea264697066735822122036c03a30c361792d156c02ab1f12379e14baac7bbdeb34bddc2354dbdb1d1e3364736f6c634300081c0033000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000090208d7ead76d2c139980caa51aec021a61caa27000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000006863f7f00000000000000000000000000000000000000000000000000000000068641410000000000000000000000000000000000000000000000000000000006863f7f000000000000000000000000000000000000000000000000000000000687e721000000000000000000000000000000000000000000000000000000000000000044b617a650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044b415a4500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6d656469612e6b617a656372656174696f6e732e636f6d2f6e66742f6d657461646174612f00000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102ff5760003560e01c80636afcb7b0116101905780639e05d240116100dc578063c87b56dd11610095578063df9cbf381161006f578063df9cbf3814610947578063e985e9c514610967578063ee7f174814610987578063f2fde38b146109a757600080fd5b8063c87b56dd146108fd578063c8d5ed681461091d578063da0239a61461093257600080fd5b80639e05d24014610830578063a22cb46514610850578063a9fc664e14610870578063b88d4fde14610890578063bb125ab0146108a3578063c23dc68f146108d057600080fd5b80638462151c116101495780638da5cb5b116101235780638da5cb5b146107a157806395d89b41146107bf578063997f2df6146107d457806399a2557a1461081057600080fd5b80638462151c1461073f5780638a8c523c1461076c5780638ba4cc3c1461078157600080fd5b80636afcb7b0146106b25780636bde2627146106c557806370a08231146106e0578063715018a6146107005780637b698331146107155780637fc278031461072a57600080fd5b806332cb6b0c1161024f57806355f804b31161020857806361d027b3116101e257806361d027b31461061d5780636221d13c146106515780636352211e14610672578063690d83201461069257600080fd5b806355f804b31461058357806359abbfe4146105a35780635bbb2177146105f057600080fd5b806332cb6b0c146104d757806342842e0e146104ed578063480cc0a1146105005780634ada218b146105205780634e71d92d1461053857806354d8bd251461054d57600080fd5b8063098144d4116102bc57806323b872dd1161029657806323b872dd146104505780632a55205a146104635780632d24eaa2146104a25780632d6b6224146104c257600080fd5b8063098144d4146103f05780630d705df61461040557806318160ddd1461042d57600080fd5b8063014635461461030457806301ffc9a71461034957806304634d8d1461037957806306fdde031461039b578063081812fc146103bd578063095ea7b3146103dd575b600080fd5b34801561031057600080fd5b5061032c73721c008fdff27bf06e7e123956e2fe03b63342e381565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561035557600080fd5b506103696103643660046123b9565b6109c7565b6040519015158152602001610340565b34801561038557600080fd5b506103996103943660046123ed565b6109e7565b005b3480156103a757600080fd5b506103b06109fd565b6040516103409190612480565b3480156103c957600080fd5b5061032c6103d8366004612493565b610a8f565b6103996103eb3660046124ac565b610aca565b3480156103fc57600080fd5b5061032c610ad6565b34801561041157600080fd5b506040805163657711f560e11b81526001602082015201610340565b34801561043957600080fd5b50610442610b10565b604051908152602001610340565b61039961045e3660046124d6565b610b2e565b34801561046f57600080fd5b5061048361047e366004612513565b610cad565b604080516001600160a01b039093168352602083019190915201610340565b3480156104ae57600080fd5b506103996104bd3660046124ac565b610d5b565b3480156104ce57600080fd5b50610369610dbc565b3480156104e357600080fd5b50610442610d4881565b6103996104fb3660046124d6565b610e09565b34801561050c57600080fd5b5061039961051b366004612535565b610e29565b34801561052c57600080fd5b50600e5460ff16610369565b34801561054457600080fd5b50610399610eef565b34801561055957600080fd5b50610442610568366004612535565b6001600160a01b031660009081526010602052604090205490565b34801561058f57600080fd5b5061039961059e366004612550565b610faa565b3480156105af57600080fd5b50600d546040805164ffffffffff8084168252602884901c81166020830152605084901c81169282019290925260789290921c166060820152608001610340565b3480156105fc57600080fd5b5061061061060b366004612606565b610fbf565b6040516103409190612683565b34801561062957600080fd5b5061032c7f000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d081565b34801561065d57600080fd5b5060095461036990600160a81b900460ff1681565b34801561067e57600080fd5b5061032c61068d366004612493565b61100b565b34801561069e57600080fd5b506103996106ad366004612535565b611016565b6103996106c03660046126d1565b61104f565b3480156106d157600080fd5b5061044266bfd8b6c1df000081565b3480156106ec57600080fd5b506104426106fb366004612535565b6111d7565b34801561070c57600080fd5b5061039961121c565b34801561072157600080fd5b50610399611230565b34801561073657600080fd5b50610369611261565b34801561074b57600080fd5b5061075f61075a366004612535565b6112ab565b60405161034091906126fa565b34801561077857600080fd5b506103996112d2565b34801561078d57600080fd5b5061039961079c3660046124ac565b611312565b3480156107ad57600080fd5b50600a546001600160a01b031661032c565b3480156107cb57600080fd5b506103b061134c565b3480156107e057600080fd5b506104426107ef366004612535565b6001600160a01b031660009081526005602052604090205460c01c600f1690565b34801561081c57600080fd5b5061075f61082b366004612732565b61135b565b34801561083c57600080fd5b5061039961084b366004612775565b611368565b34801561085c57600080fd5b5061039961086b366004612790565b6113c8565b34801561087c57600080fd5b5061039961088b366004612535565b611441565b61039961089e3660046127d9565b6114fa565b3480156108af57600080fd5b506104426108be366004612535565b60106020526000908152604090205481565b3480156108dc57600080fd5b506108f06108eb366004612493565b611535565b60405161034091906128ba565b34801561090957600080fd5b506103b0610918366004612493565b611599565b34801561092957600080fd5b50610442600381565b34801561093e57600080fd5b50610442611614565b34801561095357600080fd5b506103996109623660046128c8565b611623565b34801561097357600080fd5b50610369610982366004612937565b61170c565b34801561099357600080fd5b506103996109a2366004612961565b611770565b3480156109b357600080fd5b506103996109c2366004612535565b611784565b60006109d282611802565b806109e157506109e182611842565b92915050565b6109ef611877565b6109f9828261187f565b5050565b606060028054610a0c90612993565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3890612993565b8015610a855780601f10610a5a57610100808354040283529160200191610a85565b820191906000526020600020905b815481529060010190602001808311610a6857829003601f168201915b5050505050905090565b6000610a9a826118cd565b610aae57610aae6333d1c03960e21b611919565b506000908152600660205260409020546001600160a01b031690565b6109f982826001611923565b60095461010090046001600160a01b031680610b0d5760095460ff16610b0d575073721c008fdff27bf06e7e123956e2fe03b63342e35b90565b60006001805460005403039050600019805b14610b0d576008540190565b6000610b39826119c6565b6001600160a01b039485169490915081168414610b5f57610b5f62a1148160e81b611919565b60008281526006602052604090208054338082146001600160a01b03881690911417610ba357610b8f863361170c565b610ba357610ba3632ce44b5f60e11b611919565b610bb08686866001611a67565b8015610bbb57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610c4d57600184016000818152600460205260408120549003610c4b576000548114610c4b5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a480600003610c9757610c97633a954ecd60e21b611919565b610ca48787876001611a8e565b50505050505050565b6000828152600c602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610d22575060408051808201909152600b546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610d41906001600160601b0316876129e3565b610d4b91906129fa565b91519350909150505b9250929050565b610d63611877565b6001600160a01b03821660008181526010602052604090819020839055517f6c0add1e3230ee6b1d1b1e63309097fb6b444622675350b1481ba088c56601d390610db09084815260200190565b60405180910390a25050565b6000428180610deb600d5464ffffffffff80821692602883901c821692605081901c83169260789190911c1690565b505091509150818310158015610e015750808311155b935050505090565b610e24838383604051806020016040528060008152506114fa565b505050565b806001600160a01b038116610e515760405163d92e233d60e01b815260040160405180910390fd5b610e59611877565b600d54429060281c64ffffffffff16808211610e8857604051636fa6d0a560e01b815260040160405180910390fd5b6000610e92611ab5565b90508015610ee857610ea48582611acb565b846001600160a01b03167f1792ba7634b5562f21d108baa2e1a5c4301ef2cf684f871fa5b0db56e63db82482604051610edf91815260200190565b60405180910390a25b5050505050565b600d54429064ffffffffff605082901c81169160781c1681831080610f1357508083115b15610f315760405163024fbaa960e41b815260040160405180910390fd5b3360009081526010602052604081205490819003610f6257604051639b0e91e160e01b815260040160405180910390fd5b80610f6b611ab5565b1015610f8a5760405163d05cb60960e01b815260040160405180910390fd5b33600081815260106020526040812055610fa49082611acb565b50505050565b610fb2611877565b600f610e24828483612a63565b60408051828152600583901b8082016020019092526060915b801561100357601f1980820191860101356000610ff482611535565b8484016020015250610fd89050565b509392505050565b60006109e1826119c6565b806001600160a01b03811661103e5760405163d92e233d60e01b815260040160405180910390fd5b611046611877565b6109f982611ae5565b600d54429064ffffffffff8082169160281c168183108061106f57508083115b1561108d5760405163cd967e3560e01b815260040160405180910390fd5b6001600160401b03841615806110ac57506003846001600160401b0316115b156110ca57604051632d3d9ce160e01b815260040160405180910390fd5b60006110e66001600160401b03861666bfd8b6c1df00006129e3565b905080341461110857604051636956f2ab60e11b815260040160405180910390fd5b846001600160401b031661111a611ab5565b10156111395760405163d05cb60960e01b815260040160405180910390fd5b3360009081526005602052604090205460c01c600f811660036111656001600160401b03891683612b22565b111561118457604051632d3d9ce160e01b815260040160405180910390fd5b6111c4336111928985612b35565b6001600160a01b03909116600090815260056020526040902080546001600160c01b031660c09290921b919091179055565b610ca433886001600160401b0316611acb565b60006001600160a01b0382166111f7576111f76323d3ad8160e21b611919565b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611224611b01565b61122e6000611b5b565b565b611238611877565b61122e7f000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d0611ae5565b6000428180611290600d5464ffffffffff80821692602883901c821692605081901c83169260789190911c1690565b935093505050818310158015610e0157509091111592915050565b600054606090600190828282146112ca576112c7858484611bad565b90505b949350505050565b6112da611877565b600e805460ff191660011790556040517f799663458a5ef2936f7fa0c99b3336c69c25890f82974f04e811e5bb359186c790600090a1565b61131a611877565b80611323611ab5565b10156113425760405163d05cb60960e01b815260040160405180910390fd5b6109f98282611acb565b606060038054610a0c90612993565b60606112ca848484611bad565b611370611877565b60098054821515600160a81b0260ff60a81b199091161790556040517f6787c7f9a80aa0f5ceddab2c54f1f5169c0b88e75dd5e19d5e858a64144c7dbc906113bd90831515815260200190565b60405180910390a150565b3360008181526007602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611435911515815260200190565b60405180910390a35050565b611449611877565b6001600160a01b038116803b15159015801590611464575080155b15611482576040516332483afb60e01b815260040160405180910390fd5b7fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac6114ab610ad6565b604080516001600160a01b03928316815291851660208301520160405180910390a1600980546001600160a01b038416610100026001600160a81b03199091161760011790556109f982611cb4565b611505848484610b2e565b6001600160a01b0383163b15610fa45761152184848484611d34565b610fa457610fa46368d2bf6b60e11b611919565b6040805160808101825260008082526020820181905291810182905260608101919091526001821061159457600054821015611594575b60008281526004602052604090205461158b576000199091019061156c565b6109e182611e16565b919050565b60606115a4826118cd565b6115b8576115b8630a14c4b560e41b611919565b60006115c2611e94565b905080516000036115e2576040518060200160405280600081525061160d565b806115ec84611ea3565b6040516020016115fd929190612b54565b6040516020818303038152906040525b9392505050565b600061161e611ab5565b905090565b61162b611877565b8281811461163857600080fd5b6000805b828110156116d05784848281811061165657611656612b83565b905060200201356010600089898581811061167357611673612b83565b90506020020160208101906116889190612535565b6001600160a01b031681526020810191909152604001600020558484828181106116b4576116b4612b83565b90506020020135826116c69190612b22565b915060010161163c565b506040518181527f9c1e6106877cde86be0c5f84b92159bb92a5cf5a7017d8d5638b18180e02b31f9060200160405180910390a1505050505050565b6001600160a01b0382811660009081526007602090815260408083209385168352929052205460ff16806109e157600954600160a81b900460ff16156109e157611754610ad6565b6001600160a01b0316826001600160a01b031614905092915050565b611778611877565b610fa484848484611ee7565b61178c611b01565b6001600160a01b0381166117f65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6117ff81611b5b565b50565b60006001600160e01b03198216632b435fdb60e21b148061183357506001600160e01b0319821663503e914d60e11b145b806109e157506109e182611f82565b60006001600160e01b0319821663152a902d60e11b14806109e157506301ffc9a760e01b6001600160e01b03198316146109e1565b61122e611b01565b6118898282611fd0565b6040516001600160601b03821681526001600160a01b038316907f8a8bae378cb731c5c40b632330c6836c2f916f48edb967699c86736f9a6a76ef90602001610db0565b600081600111611594576000548210156115945760005b506000828152600460205260408120549081900361190c5761190583612b99565b92506118e4565b600160e01b161592915050565b8060005260046000fd5b600061192e8361100b565b90508180156119465750336001600160a01b03821614155b1561196957611955813361170c565b611969576119696367d9dca160e11b611919565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b600081600111611a57575060008181526004602052604090205480600003611a44576000548210611a0157611a01636f96cda160e11b611919565b5b50600019016000818152600460205260409020548015611a0257600160e01b8116600003611a2f57919050565b611a3f636f96cda160e11b611919565b611a02565b600160e01b8116600003611a5757919050565b611594636f96cda160e11b611919565b60005b81811015610ee857611a868585611a818487612b22565b6120cd565b600101611a6a565b60005b81811015610ee857611aad8585611aa88487612b22565b6120e1565b600101611a91565b6000611abf61212f565b61161e90610d48612bb0565b6109f982826040518060200160405280600081525061213f565b60003860003847855af16117ff5763b12d13eb6000526004601cfd5b600a546001600160a01b0316331461122e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016117ed565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060818310611bc657611bc6631960ccad60e11b611919565b6001831015611bd457600192505b60005480808410611be3578093505b6000611bee876111d7565b9050848610611bfb575060005b8015611caa578086860311611c0f57508484035b604080516001830160051b81019182905294506000611c2d88611535565b905060008160400151611c3e575080515b60005b611c4a8a611e16565b9250604083015160008114611c625760009250611c87565b835115611c6e57835192505b8b831860601b611c87576001820191508a8260051b8a01525b5060018a01995083604052888a1480611c9f57508481145b15611c415787525050505b5050509392505050565b6001600160a01b038116156117ff57803b80156109f9576040805163fb2de5d760e01b81523060048201526102d1602482015290516001600160a01b0384169163fb2de5d791604480830192600092919082900301818387803b158015611d1a57600080fd5b505af1925050508015611d2b575060015b156109f9575050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611d69903390899088908890600401612bc3565b6020604051808303816000875af1925050508015611da4575060408051601f3d908101601f19168201909252611da191810190612c00565b60015b611df9573d808015611dd2576040519150601f19603f3d011682016040523d82523d6000602084013e611dd7565b606091505b508051600003611df157611df16368d2bf6b60e11b611919565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600460205260409020546109e190604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6060600f8054610a0c90612993565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611ebd5750819003601f19909101908152919050565b8284101580611ef65750808210155b80611f0057508184115b15611f1e5760405163d22806e360e01b815260040160405180910390fd5b607881901b605083901b602885901b86171717600d556040805185815260208101859052908101839052606081018290527fb4f7501f0db5825b71c48e8f363f9224a687d32f4c104130a997d35e9a909c159060800160405180910390a150505050565b60006301ffc9a760e01b6001600160e01b031983161480611fb357506380ac58cd60e01b6001600160e01b03198316145b806109e15750506001600160e01b031916635b5e139f60e01b1490565b6127106001600160601b038216111561203e5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016117ed565b6001600160a01b0382166120945760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016117ed565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600b55565b6120d68361219c565b610e248383836121d5565b6001600160a01b0383811615908316158180156120fb5750805b1561211957604051635cbd944160e01b815260040160405180910390fd5b8115612125575b610ee8565b8061212057610ee8565b6000546000199081019080610b22565b6121498383612224565b6001600160a01b0383163b15610e24576000548281035b6121736000868380600101945086611d34565b612187576121876368d2bf6b60e11b611919565b818110612160578160005414610ee857600080fd5b6001600160a01b038116158015906121b75750600e5460ff16155b156117ff576040516312f1f92360e01b815260040160405180910390fd5b6001600160a01b0383811615908316158180156121ef5750805b1561220d57604051635cbd944160e01b815260040160405180910390fd5b81612120578061212057610ee833868686346122f9565b60008054908290036122405761224063b562e8dd60e01b611919565b61224d6000848385611a67565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b178117909155808452600590925282208054680100000000000000018602019055908190036122ab576122ab622e076360e81b611919565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48181600101915081036122b057506000908155610e249150848385611a8e565b6000612303610ad6565b90506001600160a01b0381161561239b576001600160a01b038116330361232a5750610ee8565b60405163657711f560e11b81526001600160a01b038781166004830152868116602483015285811660448301526064820185905282169063caee23ea9060840160006040518083038186803b15801561238257600080fd5b505afa158015612396573d6000803e3d6000fd5b505050505b505050505050565b6001600160e01b0319811681146117ff57600080fd5b6000602082840312156123cb57600080fd5b813561160d816123a3565b80356001600160a01b038116811461159457600080fd5b6000806040838503121561240057600080fd5b612409836123d6565b915060208301356001600160601b038116811461242557600080fd5b809150509250929050565b60005b8381101561244b578181015183820152602001612433565b50506000910152565b6000815180845261246c816020860160208601612430565b601f01601f19169290920160200192915050565b60208152600061160d6020830184612454565b6000602082840312156124a557600080fd5b5035919050565b600080604083850312156124bf57600080fd5b6124c8836123d6565b946020939093013593505050565b6000806000606084860312156124eb57600080fd5b6124f4846123d6565b9250612502602085016123d6565b929592945050506040919091013590565b6000806040838503121561252657600080fd5b50508035926020909101359150565b60006020828403121561254757600080fd5b61160d826123d6565b6000806020838503121561256357600080fd5b82356001600160401b0381111561257957600080fd5b8301601f8101851361258a57600080fd5b80356001600160401b038111156125a057600080fd5b8560208284010111156125b257600080fd5b6020919091019590945092505050565b60008083601f8401126125d457600080fd5b5081356001600160401b038111156125eb57600080fd5b6020830191508360208260051b8501011115610d5457600080fd5b6000806020838503121561261957600080fd5b82356001600160401b0381111561262f57600080fd5b61263b858286016125c2565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b602080825282518282018190526000918401906040840190835b818110156126c6576126b0838551612647565b602093909301926080929092019160010161269d565b509095945050505050565b6000602082840312156126e357600080fd5b81356001600160401b038116811461160d57600080fd5b602080825282518282018190526000918401906040840190835b818110156126c6578351835260209384019390920191600101612714565b60008060006060848603121561274757600080fd5b612750846123d6565b95602085013595506040909401359392505050565b8035801515811461159457600080fd5b60006020828403121561278757600080fd5b61160d82612765565b600080604083850312156127a357600080fd5b6127ac836123d6565b91506127ba60208401612765565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156127ef57600080fd5b6127f8856123d6565b9350612806602086016123d6565b92506040850135915060608501356001600160401b0381111561282857600080fd5b8501601f8101871361283957600080fd5b80356001600160401b03811115612852576128526127c3565b604051601f8201601f19908116603f011681016001600160401b0381118282101715612880576128806127c3565b60405281815282820160200189101561289857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b608081016109e18284612647565b600080600080604085870312156128de57600080fd5b84356001600160401b038111156128f457600080fd5b612900878288016125c2565b90955093505060208501356001600160401b0381111561291f57600080fd5b61292b878288016125c2565b95989497509550505050565b6000806040838503121561294a57600080fd5b612953836123d6565b91506127ba602084016123d6565b6000806000806080858703121561297757600080fd5b5050823594602084013594506040840135936060013592509050565b600181811c908216806129a757607f821691505b6020821081036129c757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109e1576109e16129cd565b600082612a1757634e487b7160e01b600052601260045260246000fd5b500490565b601f821115610e2457806000526020600020601f840160051c81016020851015612a435750805b601f840160051c820191505b81811015610ee85760008155600101612a4f565b6001600160401b03831115612a7a57612a7a6127c3565b612a8e83612a888354612993565b83612a1c565b6000601f841160018114612ac25760008515612aaa5750838201355b600019600387901b1c1916600186901b178355610ee8565b600083815260209020601f19861690835b82811015612af35786850135825560209485019460019092019101612ad3565b5086821015612b105760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b808201808211156109e1576109e16129cd565b6001600160401b0381811683821601908111156109e1576109e16129cd565b60008351612b66818460208801612430565b835190830190612b7a818360208801612430565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b600081612ba857612ba86129cd565b506000190190565b818103818111156109e1576109e16129cd565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bf690830184612454565b9695505050505050565b600060208284031215612c1257600080fd5b815161160d816123a356fea264697066735822122036c03a30c361792d156c02ab1f12379e14baac7bbdeb34bddc2354dbdb1d1e3364736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000090208d7ead76d2c139980caa51aec021a61caa27000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000006863f7f00000000000000000000000000000000000000000000000000000000068641410000000000000000000000000000000000000000000000000000000006863f7f000000000000000000000000000000000000000000000000000000000687e721000000000000000000000000000000000000000000000000000000000000000044b617a650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044b415a4500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002d68747470733a2f2f6d656469612e6b617a656372656174696f6e732e636f6d2f6e66742f6d657461646174612f00000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): Kaze
Arg [1] : symbol_ (string): KAZE
Arg [2] : owner_ (address): 0x90208d7Ead76D2C139980CAA51aEc021A61cAA27
Arg [3] : royaltyReceiver_ (address): 0xe730e6403a8eF837eA6D8134dC493fb5d9A9a9d0
Arg [4] : royaltyFeeNumerator_ (uint96): 500
Arg [5] : treasury_ (address): 0xe730e6403a8eF837eA6D8134dC493fb5d9A9a9d0
Arg [6] : baseURI_ (string): https://media.kazecreations.com/nft/metadata/
Arg [7] : publicMintStartTime_ (uint256): 1751382000
Arg [8] : publicMintEndTime_ (uint256): 1751389200
Arg [9] : claimStartTime_ (uint256): 1751382000
Arg [10] : claimEndTime_ (uint256): 1753117200
-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [2] : 00000000000000000000000090208d7ead76d2c139980caa51aec021a61caa27
Arg [3] : 000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d0
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [5] : 000000000000000000000000e730e6403a8ef837ea6d8134dc493fb5d9a9a9d0
Arg [6] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [7] : 000000000000000000000000000000000000000000000000000000006863f7f0
Arg [8] : 0000000000000000000000000000000000000000000000000000000068641410
Arg [9] : 000000000000000000000000000000000000000000000000000000006863f7f0
Arg [10] : 00000000000000000000000000000000000000000000000000000000687e7210
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [12] : 4b617a6500000000000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [14] : 4b415a4500000000000000000000000000000000000000000000000000000000
Arg [15] : 000000000000000000000000000000000000000000000000000000000000002d
Arg [16] : 68747470733a2f2f6d656469612e6b617a656372656174696f6e732e636f6d2f
Arg [17] : 6e66742f6d657461646174612f00000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.