Overview
APE Balance
APE Value
$7.82 (@ $0.18/APE)More Info
Private Name Tags
ContractCreator
TokenTracker
Multichain Info
Latest 11 from a total of 11 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Safe Transfer Fr... | 32570126 | 6 days ago | IN | 0 APE | 0.00507183 | ||||
| Set Base URI | 31121456 | 39 days ago | IN | 0 APE | 0.01161095 | ||||
| Set Price Phase2 | 31104646 | 39 days ago | IN | 0 APE | 0.00243398 | ||||
| Mint Phase2 | 31029939 | 41 days ago | IN | 8.03811985 APE | 0.01422796 | ||||
| Mint Phase2 | 31029476 | 41 days ago | IN | 8.03811985 APE | 0.01422796 | ||||
| Mint Phase2 | 31019879 | 41 days ago | IN | 40.19059925 APE | 0.01675172 | ||||
| Set Approval For... | 31012110 | 41 days ago | IN | 0 APE | 0.00520056 | ||||
| Mint Phase1 | 31012107 | 41 days ago | IN | 7.03811985 APE | 0.01422348 | ||||
| Mint Phase1 | 31010363 | 41 days ago | IN | 7.03811985 APE | 0.01422348 | ||||
| Mint Phase1 | 31010119 | 41 days ago | IN | 21.11435955 APE | 0.01461598 | ||||
| Mint Phase1 | 31010101 | 41 days ago | IN | 7.03811985 APE | 0.01596226 |
Latest 7 internal transactions
Cross-Chain Transactions
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import {ERC721A} from "erc721a/contracts/ERC721A.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {BitMaps} from "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import {OperatorFilterer} from "closedsea/src/OperatorFilterer.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
error MaxSupplyExceeded();
error PublicSaleClosed();
error TransfersLocked();
error NotAllowedByRegistry();
error RegistryNotSet();
error WrongWeiSent();
error MaxFeeExceeded();
error InputLengthsMismatch();
error InvalidMerkleProof();
error InvalidLaunchpadFee();
error InvalidLaunchpadFeeAddress();
error TransferFailed();
error PaymentTransferFailed();
error FeeTransferFailed();
error NotEnoughBalance();
error NotEnoughAllowance();
interface ICreatorToken {
event TransferValidatorUpdated(address oldValidator, address newValidator);
function getTransferValidator() external view returns (address validator);
function getTransferValidationFunction() external view
returns (bytes4 functionSignature, bool isViewFunction);
function setTransferValidator(address validator) external;
}
interface ITransferValidator {
function validateTransfer(address caller, address from, address to, uint256 tokenId) external view;
}
interface IRegistry {
function isAllowedOperator(address operator) external view returns (bool);
}
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function isApprovedForAll(address owner, address spender) external view returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
}
contract CryptoCats is Ownable, OperatorFilterer, ERC2981, ERC721A, ICreatorToken {
// Transfer validator for royalty enforcement
address private _transferValidator;
bytes4 private constant VALIDATE_TRANSFER_SELECTOR = 0xcaee23ea;
// Launchpad Fee
uint256 public launchpadFee = 4038119851397189208;
uint256 public launchpadCutBps = 500;
address public launchpadFeeAddress = 0xbDb9e0b47a02C45E3b50973A18452DC23CE72697;
event LaunchpadFeeSent(address indexed feeAddress, uint256 feeAmount);
event TokenPaymentSent(address indexed recipient, uint256 amount);
using BitMaps for BitMaps.BitMap;
address public currency = 0x0000000000000000000000000000000000000000;
uint256 public maxSupply = 3333;
bool public operatorFilteringEnabled = true;
bool public initialTransferLockOn = false;
bool public isRegistryActive;
address public registryAddress;
string private _baseTokenURI = "";
string private _placeHolderTokenURI = "https://mintify-launchpad.nyc3.cdn.digitaloceanspaces.com/c489d521-7924-402b-8e57-1237d6d2e7bf.webp";
// Phase 1 variables
uint256 public startTimePhase1 = 1765825200;
uint256 public endTimePhase1 = 1765832400;
uint256 public maxSupplyPhase1 = 0;
uint256 public totalSupplyPhase1;
uint256 public pricePhase1 = 3000000000000000000;
uint256 public maxPerWalletPhase1 = 5;
bytes32 public merkleRootPhase1 = 0x0;
mapping(address => uint256) public walletMintsPhase1;
// Phase 2 variables
uint256 public startTimePhase2 = 1765832400;
uint256 public endTimePhase2 = 1766264400;
uint256 public maxSupplyPhase2 = 0;
uint256 public totalSupplyPhase2;
uint256 public pricePhase2 = 4000000000000000000;
uint256 public maxPerWalletPhase2 = 5;
bytes32 public merkleRootPhase2 = 0x0;
mapping(address => uint256) public walletMintsPhase2;
constructor() ERC721A("CryptoCats", "CCAT") Ownable(msg.sender) {
// Register operator filtering
_registerForOperatorFiltering();
// Set initial royalty
_setDefaultRoyalty(0xD111170de94C2b87469855cc93fB2AaF036F565d, 500);
// Deployment Airdrop
_mint(0x158429cF5785a77Ad45D3Eb545612928c763267e, 100);
}
// Phase 1 Mint
function mintPhase1(uint256 quantity) external payable {
// Check if mint has started
if (startTimePhase1 != 0 && block.timestamp < startTimePhase1) {
revert PublicSaleClosed();
}
// Check if mint has ended
if (endTimePhase1 != 0 && block.timestamp > endTimePhase1) {
revert PublicSaleClosed();
}
// Check if the mint will exceed total max supply, if set.
if (maxSupply != 0 && totalSupply() + quantity > maxSupply) {
revert MaxSupplyExceeded();
}
// If phase max supply is set, check if it's exceeded
if (maxSupplyPhase1 != 0 && totalSupplyPhase1 + quantity > maxSupplyPhase1) {
revert MaxSupplyExceeded();
}
uint256 totalOrderPrice = (pricePhase1 + launchpadFee) * quantity;
// Check if the price is correct if native currency
if (currency == address(0)) {
if (msg.value != totalOrderPrice) {
revert WrongWeiSent();
}
}
else {
// Check if the user has enough balance and allowance if ERC20
IERC20 token = IERC20(currency);
if (token.balanceOf(msg.sender) < totalOrderPrice) {
revert NotEnoughBalance();
}
if (token.allowance(msg.sender, address(this)) < totalOrderPrice) {
revert NotEnoughAllowance();
}
}
// Check if we have exceeded phase max per wallet if set.
if (maxPerWalletPhase1 != 0 && walletMintsPhase1[msg.sender] + quantity > maxPerWalletPhase1) {
revert MaxSupplyExceeded();
}
uint256 flatFees = 0;
// Get the Launchpad Flat Fee if set
if (launchpadFee != 0 && launchpadFeeAddress != address(0)) {
flatFees = launchpadFee * quantity;
}
// Get the Launchpad Percentage Fee if set
uint256 percentageFees = 0;
if (launchpadCutBps != 0 && launchpadFeeAddress != address(0)) {
percentageFees = (launchpadCutBps * (totalOrderPrice - flatFees)) / 10000;
}
// Send the fees
uint256 totalFees = flatFees + percentageFees;
if (totalFees != 0) {
_sendLaunchpadFee(totalFees);
}
// Transfer the payment if ERC20
if (currency != address(0) && totalOrderPrice > totalFees) {
_sendTokenPayment(address(this), totalOrderPrice - totalFees);
}
// Mint the tokens
walletMintsPhase1[msg.sender] += quantity;
totalSupplyPhase1 += quantity;
_mint(msg.sender, quantity);
}
// Phase 2 Mint
function mintPhase2(uint256 quantity) external payable {
// Check if mint has started
if (startTimePhase2 != 0 && block.timestamp < startTimePhase2) {
revert PublicSaleClosed();
}
// Check if mint has ended
if (endTimePhase2 != 0 && block.timestamp > endTimePhase2) {
revert PublicSaleClosed();
}
// Check if the mint will exceed total max supply, if set.
if (maxSupply != 0 && totalSupply() + quantity > maxSupply) {
revert MaxSupplyExceeded();
}
// If phase max supply is set, check if it's exceeded
if (maxSupplyPhase2 != 0 && totalSupplyPhase2 + quantity > maxSupplyPhase2) {
revert MaxSupplyExceeded();
}
uint256 totalOrderPrice = (pricePhase2 + launchpadFee) * quantity;
// Check if the price is correct if native currency
if (currency == address(0)) {
if (msg.value != totalOrderPrice) {
revert WrongWeiSent();
}
}
else {
// Check if the user has enough balance and allowance if ERC20
IERC20 token = IERC20(currency);
if (token.balanceOf(msg.sender) < totalOrderPrice) {
revert NotEnoughBalance();
}
if (token.allowance(msg.sender, address(this)) < totalOrderPrice) {
revert NotEnoughAllowance();
}
}
// Check if we have exceeded phase max per wallet if set.
if (maxPerWalletPhase2 != 0 && walletMintsPhase2[msg.sender] + quantity > maxPerWalletPhase2) {
revert MaxSupplyExceeded();
}
uint256 flatFees = 0;
// Get the Launchpad Flat Fee if set
if (launchpadFee != 0 && launchpadFeeAddress != address(0)) {
flatFees = launchpadFee * quantity;
}
// Get the Launchpad Percentage Fee if set
uint256 percentageFees = 0;
if (launchpadCutBps != 0 && launchpadFeeAddress != address(0)) {
percentageFees = (launchpadCutBps * (totalOrderPrice - flatFees)) / 10000;
}
// Send the fees
uint256 totalFees = flatFees + percentageFees;
if (totalFees != 0) {
_sendLaunchpadFee(totalFees);
}
// Transfer the payment if ERC20
if (currency != address(0) && totalOrderPrice > totalFees) {
_sendTokenPayment(address(this), totalOrderPrice - totalFees);
}
// Mint the tokens
walletMintsPhase2[msg.sender] += quantity;
totalSupplyPhase2 += quantity;
_mint(msg.sender, quantity);
}
// =========================================================================
// Owner Only Functions
// =========================================================================
// Owner airdrop
function airDrop(address[] memory users, uint256[] memory amounts) external onlyOwner {
// iterate over users and amounts
if (users.length != amounts.length) {
revert InputLengthsMismatch();
}
for (uint256 i; i < users.length;) {
if (maxSupply != 0 && totalSupply() + amounts[i] > maxSupply) {
revert MaxSupplyExceeded();
}
_mint(users[i], amounts[i]);
unchecked {
++i;
}
}
}
// Owner unrestricted mint
function ownerMint(address to, uint256 quantity) external onlyOwner {
if (maxSupply != 0 && totalSupply() + quantity > maxSupply) {
revert MaxSupplyExceeded();
}
_mint(to, quantity);
}
// Set max supply
function setMaxSupply(uint256 newMaxSupply) external onlyOwner {
maxSupply = newMaxSupply;
}
// Withdraw Balance to owner
function withdraw() public onlyOwner {
(bool success, ) = payable(owner()).call{value: address(this).balance}("");
if (!success) {
revert TransferFailed();
}
}
// Withdraw Balance to Address
function withdrawTo(address payable _to) public onlyOwner {
(bool success, ) = payable(_to).call{value: address(this).balance}("");
if (!success) {
revert TransferFailed();
}
}
// Withdraw ERC20 to owner
function withdrawERC20(address tokenAddress) public onlyOwner {
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
if (balance == 0) {
revert TransferFailed();
}
bool success = token.transfer(owner(), balance);
if (!success) {
revert TransferFailed();
}
}
// Withdraw ERC20 to Address
function withdrawERC20To(address tokenAddress, address to) public onlyOwner {
IERC20 token = IERC20(tokenAddress);
uint256 balance = token.balanceOf(address(this));
if (balance == 0) {
revert TransferFailed();
}
bool success = token.transfer(to, balance);
if (!success) {
revert TransferFailed();
}
}
// Send Launchpad Flat Fee
function _sendLaunchpadFee(uint256 feeAmount) private {
if (feeAmount == 0) {
revert InvalidLaunchpadFee();
}
if (launchpadFeeAddress == address(0)) {
revert InvalidLaunchpadFeeAddress();
}
if (currency == address(0)) {
(bool success, ) = payable(launchpadFeeAddress).call{value: feeAmount}("");
if (!success) {
revert FeeTransferFailed();
}
}
else {
// Transfer the fee in the specified currency
IERC20 token = IERC20(currency);
try token.transferFrom(msg.sender, launchpadFeeAddress, feeAmount) {
// Success
} catch {
revert FeeTransferFailed();
}
}
emit LaunchpadFeeSent(launchpadFeeAddress, feeAmount);
}
// Send ERC20 Payment
function _sendTokenPayment(address recipient, uint256 amount) private {
if (amount == 0) {
revert PaymentTransferFailed();
}
if (recipient == address(0)) {
revert PaymentTransferFailed();
}
// Transfer the fee in the specified currency
IERC20 token = IERC20(currency);
try token.transferFrom(msg.sender, address(this), amount) {
// Success
} catch {
revert PaymentTransferFailed();
}
emit TokenPaymentSent(recipient, amount);
}
// Break Transfer Lock
function breakLock() external onlyOwner {
initialTransferLockOn = false;
}
// Set the start time for the phase
function setStartTimePhase1(uint256 newStartTime) external onlyOwner {
startTimePhase1 = newStartTime;
}
// Set the end time for the phase
function setEndTimePhase1(uint256 newEndTime) external onlyOwner {
endTimePhase1 = newEndTime;
}
// Set the max supply for the phase
function setMaxSupplyPhase1(uint256 newMaxSupply) external onlyOwner {
maxSupplyPhase1 = newMaxSupply;
}
// Set max per wallet for the phase
function setMaxPerWalletPhase1(uint256 newMaxPerWallet) external onlyOwner {
maxPerWalletPhase1 = newMaxPerWallet;
}
// Set the price for the phase
function setPricePhase1(uint256 newPrice) external onlyOwner {
pricePhase1 = newPrice;
}
// Set the merkle root for the phase
function setMerkleRootPhase1(bytes32 newMerkleRoot) external onlyOwner {
merkleRootPhase1 = newMerkleRoot;
}// Set the start time for the phase
function setStartTimePhase2(uint256 newStartTime) external onlyOwner {
startTimePhase2 = newStartTime;
}
// Set the end time for the phase
function setEndTimePhase2(uint256 newEndTime) external onlyOwner {
endTimePhase2 = newEndTime;
}
// Set the max supply for the phase
function setMaxSupplyPhase2(uint256 newMaxSupply) external onlyOwner {
maxSupplyPhase2 = newMaxSupply;
}
// Set max per wallet for the phase
function setMaxPerWalletPhase2(uint256 newMaxPerWallet) external onlyOwner {
maxPerWalletPhase2 = newMaxPerWallet;
}
// Set the price for the phase
function setPricePhase2(uint256 newPrice) external onlyOwner {
pricePhase2 = newPrice;
}
// Set the merkle root for the phase
function setMerkleRootPhase2(bytes32 newMerkleRoot) external onlyOwner {
merkleRootPhase2 = newMerkleRoot;
}
// =========================================================================
// ERC721A Misc
// =========================================================================
function _startTokenId() internal pure override returns (uint256) {
return 1;
}
// =========================================================================
// ICreatorToken Implementation
// =========================================================================
function getTransferValidator() external view override returns (address validator) {
return _transferValidator;
}
function getTransferValidationFunction() external pure override
returns (bytes4 functionSignature, bool isViewFunction) {
return (VALIDATE_TRANSFER_SELECTOR, true);
}
function setTransferValidator(address validator) external override onlyOwner {
address oldValidator = _transferValidator;
_transferValidator = validator;
emit TransferValidatorUpdated(oldValidator, validator);
}
// =========================================================================
// Operator filtering
// =========================================================================
function setApprovalForAll(address operator, bool approved)
public
override (ERC721A)
onlyAllowedOperatorApproval(operator)
{
if (initialTransferLockOn) {
revert TransfersLocked();
}
super.setApprovalForAll(operator, approved);
}
function approve(address operator, uint256 tokenId)
public
payable
override (ERC721A)
onlyAllowedOperatorApproval(operator)
{
if (initialTransferLockOn) {
revert TransfersLocked();
}
super.approve(operator, tokenId);
}
function transferFrom(address from, address to, uint256 tokenId)
public
payable
override (ERC721A)
onlyAllowedOperator(from)
{
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId)
public
payable
override (ERC721A)
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
public
payable
override (ERC721A)
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId, data);
}
function setOperatorFilteringEnabled(bool value) public onlyOwner {
operatorFilteringEnabled = value;
}
function _operatorFilteringEnabled() internal view override returns (bool) {
return operatorFilteringEnabled;
}
// =========================================================================
// Registry Check
// =========================================================================
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override {
// Check transfer lock
if (initialTransferLockOn && from != address(0) && to != address(0)) {
revert TransfersLocked();
}
// Check your custom registry
if (!_isValidAgainstRegistry(msg.sender)) {
revert NotAllowedByRegistry();
}
// Add royalty enforcement validation (skip for minting)
if (from != address(0) && _transferValidator != address(0)) {
// For ERC721A batch transfers, validate each token
for (uint256 i = 0; i < quantity; i++) {
ITransferValidator(_transferValidator).validateTransfer(
msg.sender,
from,
to,
startTokenId + i
);
}
}
super._beforeTokenTransfers(from, to, startTokenId, quantity);
}
function _isValidAgainstRegistry(address operator)
internal
view
returns (bool)
{
if (isRegistryActive) {
IRegistry registry = IRegistry(registryAddress);
return registry.isAllowedOperator(operator);
}
return true;
}
function setIsRegistryActive(bool _isRegistryActive) external onlyOwner {
if (registryAddress == address(0)) revert RegistryNotSet();
isRegistryActive = _isRegistryActive;
}
function setRegistryAddress(address _registryAddress) external onlyOwner {
registryAddress = _registryAddress;
}
// =========================================================================
// ERC165
// =========================================================================
function supportsInterface(bytes4 interfaceId) public view override (ERC721A, ERC2981) returns (bool) {
return
interfaceId == type(ICreatorToken).interfaceId ||
ERC721A.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
// =========================================================================
// ERC2891
// =========================================================================
function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyOwner {
if (feeNumerator > 1000) {
revert MaxFeeExceeded();
}
_setDefaultRoyalty(receiver, feeNumerator);
}
function setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) external onlyOwner {
if (feeNumerator > 1000) {
revert MaxFeeExceeded();
}
_setTokenRoyalty(tokenId, receiver, feeNumerator);
}
// =========================================================================
// Metadata
// =========================================================================
function setBaseURI(string calldata baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
function setPlaceholderBaseURI(string calldata placeholderURI) external onlyOwner {
_placeHolderTokenURI = placeholderURI;
}
function _baseURI() internal view override returns (string memory) {
return _baseTokenURI;
}
function _placeHolderURI() internal view returns (string memory) {
return _placeHolderTokenURI;
}
function tokenURI(uint256 tokenId) public view override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
string memory placeHolderURI = _placeHolderURI();
if (bytes(baseURI).length != 0) {
return string(abi.encodePacked(baseURI, "/", _toString(tokenId), ".json"));
}
if (bytes(placeHolderURI).length != 0) {
return placeHolderURI;
}
return "";
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// 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()`.
*
* 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;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @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) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// 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();
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();
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 Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
if (_startTokenId() <= tokenId) {
packed = _packedOwnerships[tokenId];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) {
if (tokenId >= _currentIndex) revert OwnerQueryForNonexistentToken();
// 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;
return packed;
}
}
// Otherwise, the data exists and is not burned. 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.
return packed;
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @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();
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) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not 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);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(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();
if (to == address(0)) revert TransferToZeroAddress();
_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;
}
}
}
}
emit Transfer(from, to, tokenId);
_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();
}
}
/**
* @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();
} else {
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();
_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:
// - `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)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
// The duplicated `log4` removes an extra check and reduces stack juggling.
// The assembly, together with the surrounding Solidity code, have been
// delicately arranged to nudge the compiler into producing optimized opcodes.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// 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`.
startTokenId // `tokenId`.
)
// The `iszero(eq(,))` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
// The compiler will optimize the `iszero` away for performance.
for {
let tokenId := add(startTokenId, 1)
} iszero(eq(tokenId, end)) {
tokenId := add(tokenId, 1)
} {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_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();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_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)
);
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();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// 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)
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_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();
}
_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 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();
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)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.20;
import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);
/**
* @dev The default royalty receiver is invalid.
*/
error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);
/**
* @dev The royalty set for a specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);
/**
* @dev The royalty receiver for `tokenId` is invalid.
*/
error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) public view virtual returns (address receiver, uint256 amount) {
RoyaltyInfo storage _royaltyInfo = _tokenRoyaltyInfo[tokenId];
address royaltyReceiver = _royaltyInfo.receiver;
uint96 royaltyFraction = _royaltyInfo.royaltyFraction;
if (royaltyReceiver == address(0)) {
royaltyReceiver = _defaultRoyaltyInfo.receiver;
royaltyFraction = _defaultRoyaltyInfo.royaltyFraction;
}
uint256 royaltyAmount = (salePrice * royaltyFraction) / _feeDenominator();
return (royaltyReceiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
}
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
}
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)
pragma solidity ^0.8.20;
/**
* @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.
* Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
*
* BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.
* Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,
* unlike the regular `bool` which would consume an entire slot for a single value.
*
* This results in gas savings in two ways:
*
* - Setting a zero value to non-zero only once every 256 times
* - Accessing the same warm slot for every 256 _sequential_ indices
*/
library BitMaps {
struct BitMap {
mapping(uint256 bucket => uint256) _data;
}
/**
* @dev Returns whether the bit at `index` is set.
*/
function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
return bitmap._data[bucket] & mask != 0;
}
/**
* @dev Sets the bit at `index` to the boolean `value`.
*/
function setTo(BitMap storage bitmap, uint256 index, bool value) internal {
if (value) {
set(bitmap, index);
} else {
unset(bitmap, index);
}
}
/**
* @dev Sets the bit at `index`.
*/
function set(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
bitmap._data[bucket] |= mask;
}
/**
* @dev Unsets the bit at `index`.
*/
function unset(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
bitmap._data[bucket] &= ~mask;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Optimized and flexible operator filterer to abide to OpenSea's
/// mandatory on-chain royalty enforcement in order for new collections to
/// receive royalties.
/// For more information, see:
/// See: https://github.com/ProjectOpenSea/operator-filter-registry
abstract contract OperatorFilterer {
/// @dev The default OpenSea operator blocklist subscription.
address internal constant _DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
/// @dev The OpenSea operator filter registry.
address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
/// @dev Registers the current contract to OpenSea's operator filter,
/// and subscribe to the default OpenSea operator blocklist.
/// Note: Will not revert nor update existing settings for repeated registration.
function _registerForOperatorFiltering() internal virtual {
_registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true);
}
/// @dev Registers the current contract to OpenSea's operator filter.
/// Note: Will not revert nor update existing settings for repeated registration.
function _registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe)
internal
virtual
{
/// @solidity memory-safe-assembly
assembly {
let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.
// Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
for {} iszero(subscribe) {} {
if iszero(subscriptionOrRegistrantToCopy) {
functionSelector := 0x4420e486 // `register(address)`.
break
}
functionSelector := 0xa0af2903 // `registerAndCopyEntries(address,address)`.
break
}
// Store the function selector.
mstore(0x00, shl(224, functionSelector))
// Store the `address(this)`.
mstore(0x04, address())
// Store the `subscriptionOrRegistrantToCopy`.
mstore(0x24, subscriptionOrRegistrantToCopy)
// Register into the registry.
if iszero(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x04)) {
// If the function selector has not been overwritten,
// it is an out-of-gas error.
if eq(shr(224, mload(0x00)), functionSelector) {
// To prevent gas under-estimation.
revert(0, 0)
}
}
// Restore the part of the free memory pointer that was overwritten,
// which is guaranteed to be zero, because of Solidity's memory size limits.
mstore(0x24, 0)
}
}
/// @dev Modifier to guard a function and revert if the caller is a blocked operator.
modifier onlyAllowedOperator(address from) virtual {
if (from != msg.sender) {
if (!_isPriorityOperator(msg.sender)) {
if (_operatorFilteringEnabled()) _revertIfBlocked(msg.sender);
}
}
_;
}
/// @dev Modifier to guard a function from approving a blocked operator..
modifier onlyAllowedOperatorApproval(address operator) virtual {
if (!_isPriorityOperator(operator)) {
if (_operatorFilteringEnabled()) _revertIfBlocked(operator);
}
_;
}
/// @dev Helper function that reverts if the `operator` is blocked by the registry.
function _revertIfBlocked(address operator) private view {
/// @solidity memory-safe-assembly
assembly {
// Store the function selector of `isOperatorAllowed(address,address)`,
// shifted left by 6 bytes, which is enough for 8tb of memory.
// We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
mstore(0x00, 0xc6171134001122334455)
// Store the `address(this)`.
mstore(0x1a, address())
// Store the `operator`.
mstore(0x3a, operator)
// `isOperatorAllowed` always returns true if it does not revert.
if iszero(staticcall(gas(), _OPERATOR_FILTER_REGISTRY, 0x16, 0x44, 0x00, 0x00)) {
// Bubble up the revert if the staticcall reverts.
returndatacopy(0x00, 0x00, returndatasize())
revert(0x00, returndatasize())
}
// We'll skip checking if `from` is inside the blacklist.
// Even though that can block transferring out of wrapper contracts,
// we don't want tokens to be stuck.
// Restore the part of the free memory pointer that was overwritten,
// which is guaranteed to be zero, if less than 8tb of memory is used.
mstore(0x3a, 0)
}
}
/// @dev For deriving contracts to override, so that operator filtering
/// can be turned on / off.
/// Returns true by default.
function _operatorFilteringEnabled() internal view virtual returns (bool) {
return true;
}
/// @dev For deriving contracts to override, so that preferred marketplaces can
/// skip operator filtering, helping users save gas.
/// Returns false for all inputs by default.
function _isPriorityOperator(address) internal view virtual returns (bool) {
return false;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MerkleProof.sol)
// This file was procedurally generated from scripts/generate/templates/MerkleProof.js.
pragma solidity ^0.8.20;
import {Hashes} from "./Hashes.sol";
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the Merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates Merkle trees that are safe
* against this attack out of the box.
*
* IMPORTANT: Consider memory side-effects when using custom hashing functions
* that access memory in an unsafe way.
*
* NOTE: This library supports proof verification for merkle trees built using
* custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving
* leaf inclusion in trees built using non-commutative hashing functions requires
* additional logic that is not supported by this library.
*/
library MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in memory with the default hashing function.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with the default hashing function.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in memory with a custom hashing function.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProof(proof, leaf, hasher) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in memory with a custom hashing function.
*/
function processProof(
bytes32[] memory proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with the default hashing function.
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with the default hashing function.
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processProofCalldata(proof, leaf, hasher) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leaves & pre-images are assumed to be sorted.
*
* This version handles proofs in calldata with a custom hashing function.
*/
function processProofCalldata(
bytes32[] calldata proof,
bytes32 leaf,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = hasher(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in memory with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProof}.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProof(proof, proofFlags, leaves, hasher) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in memory with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in calldata with the default hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = Hashes.commutativeKeccak256(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*
* NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
* The `leaves` must be validated independently. See {processMultiProofCalldata}.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* This version handles multiproofs in calldata with a custom hashing function.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
* and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
* validating the leaves elsewhere.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves,
function(bytes32, bytes32) view returns (bytes32) hasher
) internal view returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofFlagsLen = proofFlags.length;
// Check proof validity.
if (leavesLen + proof.length != proofFlagsLen + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](proofFlagsLen);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < proofFlagsLen; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = hasher(a, b);
}
if (proofFlagsLen > 0) {
if (proofPos != proof.length) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[proofFlagsLen - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// 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();
// =============================================================
// 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
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*
* NOTE: ERC-2981 allows setting the royalty to 100% of the price. In that case all the price would be sent to the
* royalty receiver and 0 tokens to the seller. Contracts dealing with royalty should consider empty transfers.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol)
pragma solidity ^0.8.20;
/**
* @dev Library of standard hash functions.
*
* _Available since v5.1._
*/
library Hashes {
/**
* @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs.
*
* NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
*/
function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
return a < b ? efficientKeccak256(a, b) : efficientKeccak256(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function efficientKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32 value) {
assembly ("memory-safe") {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* 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[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}{
"remappings": [
"@rari-capital/solmate/=lib/solmate/",
"ds-test/=lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"murky/=lib/murky/src/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"solarray/=lib/solarray/src/",
"solady/=lib/solady/",
"seaport-sol/=lib/seaport-sol/",
"seaport-types/=lib/seaport-types/",
"seaport-core/=lib/seaport-core/",
"seaport/=contracts/",
"closedsea/=lib/closedsea/",
"erc721a/=lib/closedsea/lib/erc721a/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"erc721a-upgradeable/=lib/closedsea/lib/erc721a-upgradeable/contracts/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/closedsea/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"operator-filter-registry/=lib/closedsea/lib/operator-filter-registry/",
"solmate/=lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"FeeTransferFailed","type":"error"},{"inputs":[],"name":"InputLengthsMismatch","type":"error"},{"inputs":[],"name":"InvalidLaunchpadFee","type":"error"},{"inputs":[],"name":"InvalidLaunchpadFeeAddress","type":"error"},{"inputs":[],"name":"MaxFeeExceeded","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotAllowedByRegistry","type":"error"},{"inputs":[],"name":"NotEnoughAllowance","type":"error"},{"inputs":[],"name":"NotEnoughBalance","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PaymentTransferFailed","type":"error"},{"inputs":[],"name":"PublicSaleClosed","type":"error"},{"inputs":[],"name":"RegistryNotSet","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"TransfersLocked","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"WrongWeiSent","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"feeAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeAmount","type":"uint256"}],"name":"LaunchpadFeeSent","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":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenPaymentSent","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":[{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"airDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"breakLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTimePhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTimePhase2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"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":[],"name":"initialTransferLockOn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRegistryActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchpadCutBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchpadFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchpadFeeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerWalletPhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerWalletPhase2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupplyPhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupplyPhase2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRootPhase1","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRootPhase2","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintPhase1","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintPhase2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilteringEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePhase2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newEndTime","type":"uint256"}],"name":"setEndTimePhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newEndTime","type":"uint256"}],"name":"setEndTimePhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isRegistryActive","type":"bool"}],"name":"setIsRegistryActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxPerWallet","type":"uint256"}],"name":"setMaxPerWalletPhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxPerWallet","type":"uint256"}],"name":"setMaxPerWalletPhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"setMaxSupplyPhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"setMaxSupplyPhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"setMerkleRootPhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"setMerkleRootPhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setOperatorFilteringEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"placeholderURI","type":"string"}],"name":"setPlaceholderBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setPricePhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setPricePhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registryAddress","type":"address"}],"name":"setRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newStartTime","type":"uint256"}],"name":"setStartTimePhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newStartTime","type":"uint256"}],"name":"setStartTimePhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validator","type":"address"}],"name":"setTransferValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimePhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTimePhase2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupplyPhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupplyPhase2","outputs":[{"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":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletMintsPhase1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletMintsPhase2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawERC20To","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"}],"name":"withdrawTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
67380a489c26fb8e58600c556101f4600d55600e80546001600160a01b031990811673bdb9e0b47a02c45e3b50973a18452dc23ce7269717909155600f80549091169055610d056010556011805461ffff1916600117905560a06040525f608090815260129061006f90826106ba565b506040518060a0016040528060638152602001613c3c6063913960139061009690826106ba565b506369405ab060145563694076d06015555f6016556729a2241af62c000060185560056019555f5f1b601a5563694076d0601c556369470e50601d555f601e55673782dace9d90000060205560056021555f5f1b6022553480156100f8575f5ffd5b50604080518082018252600a81526943727970746f4361747360b01b6020808301919091528251808401909352600483526310d0d05560e21b9083015290338061015c57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b610165816101d3565b50600561017283826106ba565b50600661017f82826106ba565b505060016003555061018f610222565b6101af73d111170de94c2b87469855cc93fb2aaf036f565d6101f4610243565b6101ce73158429cf5785a77ad45d3eb545612928c763267e60646102e5565b6107b8565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610241733cc6cdda760b79bafa08df41ecfa224f810dceb660016103c5565b565b6127106001600160601b03821681101561028257604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610153565b6001600160a01b0383166102ab57604051635b6cc80560e11b81525f6004820152602401610153565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600155565b6003545f8290036103095760405163b562e8dd60e01b815260040160405180910390fd5b6103155f848385610434565b6001600160a01b0383165f8181526008602090815260408083208054680100000000000000018802019055848352600790915281206001851460e11b4260a01b178317905582840190839083905f516020613c1c5f395f51905f528180a4600183015b81811461039b5780835f5f516020613c1c5f395f51905f525f5fa4600101610378565b50815f036103bb57604051622e076360e81b815260040160405180910390fd5b600355505b505050565b6001600160a01b0390911690637d3e3dbe816103f257826103eb5750634420e4866103f2565b5063a0af29035b8060e01b5f52306004528260245260045f60445f5f6daaeb6d7670e522a718067333cd4e5af161042b57805f5160e01c0361042b575f5ffd5b505f6024525050565b601154610100900460ff16801561045357506001600160a01b03841615155b801561046757506001600160a01b03831615155b15610485576040516336e278fd60e21b815260040160405180910390fd5b61048e3361058b565b6104ab576040516326406c5f60e11b815260040160405180910390fd5b6001600160a01b038416158015906104cd5750600b546001600160a01b031615155b15610572575f5b8181101561057057600b546001600160a01b031663caee23ea3387876104fa8689610774565b6040516001600160e01b031960e087901b1681526001600160a01b03948516600482015292841660248401529216604482015260648101919091526084015f6040518083038186803b15801561054e575f5ffd5b505afa158015610560573d5f5f3e3d5ffd5b5050600190920191506104d49050565b505b610585848484846001600160e01b038516565b50505050565b6011545f9062010000900460ff161561061b576011546040516370c5e04560e11b81526001600160a01b038481166004830152630100000090920490911690819063e18bc08a90602401602060405180830381865afa1580156105f0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106149190610799565b9392505050565b506001919050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061064b57607f821691505b60208210810361066957634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156103c057805f5260205f20601f840160051c810160208510156106945750805b601f840160051c820191505b818110156106b3575f81556001016106a0565b5050505050565b81516001600160401b038111156106d3576106d3610623565b6106e7816106e18454610637565b8461066f565b6020601f821160018114610719575f83156107025750848201515b5f19600385901b1c1916600184901b1784556106b3565b5f84815260208120601f198516915b828110156107485787850151825560209485019460019092019101610728565b508482101561076557868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b8082018082111561079357634e487b7160e01b5f52601160045260245ffd5b92915050565b5f602082840312156107a9575f5ffd5b81518015158114610614575f5ffd5b613457806107c55f395ff3fe60806040526004361061042c575f3560e01c80636352211e1161022b578063abd017ea11610129578063e1136b3d116100b3578063ed9aab5111610078578063ed9aab5114610c03578063f2fde38b14610c29578063f3f119f114610c48578063f4f3b20014610c5d578063fb796e6c14610c7c575f5ffd5b8063e1136b3d14610b7c578063e56e9ac014610b9b578063e5a6b10f14610bb0578063e5e2a0f614610bcf578063e985e9c514610be4575f5ffd5b8063c3d923a6116100f9578063c3d923a614610af5578063c87b56dd14610b14578063d2762b4614610b33578063d5abeb0114610b48578063e079e46114610b5d575f5ffd5b8063abd017ea14610a85578063ac19701b14610aa4578063b7c0b8e814610ac3578063b88d4fde14610ae2575f5ffd5b8063871215d4116101b5578063a70138c11161017a578063a70138c1146109ff578063a9fc664e14610a13578063aa0678ff14610a32578063aa60bdd014610a47578063ab7b499314610a66575f5ffd5b8063871215d41461097c5780638da5cb5b1461099157806395d89b41146109ad57806396db3e89146109c1578063a22cb465146109e0575f5ffd5b806370a08231116101fb57806370a08231146108f6578063715018a61461091557806372b0d90c1461092957806379544c8614610948578063858633f21461095d575f5ffd5b80636352211e1461088457806364f52a1f146108a357806365216a41146108b85780636f8b44b0146108d7575f5ffd5b80633bf30394116103385780634b21839e116102c257806355f804b31161028757806355f804b3146108075780635944c7531461082657806359a2f3bd146108455780635c1afecb1461085a5780635d99a0cf1461086f575f5ffd5b80634b21839e146107805780634ed69eaf1461079f5780634f115db1146107be578063545b70b2146107d357806355f5f066146107e8575f5ffd5b8063423c9fcb11610308578063423c9fcb146106fd57806342842e0e14610710578063462fed141461072357806346fff98d14610742578063484b973c14610761575f5ffd5b80633bf30394146106945780633c6d5762146106a95780633ccfd60b146106d457806341d94c98146106e8575f5ffd5b806312b36510116103b9578063251c21ec11610389578063251c21ec146105e65780632a55205a146106055780633073dbfd1461064357806330a089651461065657806330db1d5b14610675575f5ffd5b806312b365101461058257806318160ddd146105a0578063189ce8b1146105b457806323b872dd146105d3575f5ffd5b8063081812fc116103ff578063081812fc146104c9578063095ea7b314610500578063098144d4146105135780630d4c1828146105305780630d705df61461055b575f5ffd5b806301ffc9a71461043057806304634d8d1461046457806306fdde03146104855780630759f2d8146104a6575b5f5ffd5b34801561043b575f5ffd5b5061044f61044a366004612c92565b610c95565b60405190151581526020015b60405180910390f35b34801561046f575f5ffd5b5061048361047e366004612cd7565b610cce565b005b348015610490575f5ffd5b50610499610d10565b60405161045b9190612d38565b3480156104b1575f5ffd5b506104bb60165481565b60405190815260200161045b565b3480156104d4575f5ffd5b506104e86104e3366004612d4a565b610da0565b6040516001600160a01b03909116815260200161045b565b61048361050e366004612d61565b610de2565b34801561051e575f5ffd5b50600b546001600160a01b03166104e8565b34801561053b575f5ffd5b506104bb61054a366004612d8b565b60236020525f908152604090205481565b348015610566575f5ffd5b506040805163657711f560e11b8152600160208201520161045b565b34801561058d575f5ffd5b5060115461044f90610100900460ff1681565b3480156105ab575f5ffd5b506104bb610e2f565b3480156105bf575f5ffd5b506104836105ce366004612da6565b610e3c565b6104836105e1366004612ddd565b610f6a565b3480156105f1575f5ffd5b50610483610600366004612d4a565b610fa0565b348015610610575f5ffd5b5061062461061f366004612e1b565b610fad565b604080516001600160a01b03909316835260208301919091520161045b565b610483610651366004612d4a565b611030565b348015610661575f5ffd5b50600e546104e8906001600160a01b031681565b348015610680575f5ffd5b5061048361068f366004612d4a565b6113d7565b34801561069f575f5ffd5b506104bb601e5481565b3480156106b4575f5ffd5b506104bb6106c3366004612d8b565b601b6020525f908152604090205481565b3480156106df575f5ffd5b506104836113e4565b3480156106f3575f5ffd5b506104bb60155481565b61048361070b366004612d4a565b611460565b61048361071e366004612ddd565b6117f2565b34801561072e575f5ffd5b5061048361073d366004612d4a565b611822565b34801561074d575f5ffd5b5061048361075c366004612e48565b61182f565b34801561076c575f5ffd5b5061048361077b366004612d61565b611883565b34801561078b575f5ffd5b5061048361079a366004612d4a565b6118d7565b3480156107aa575f5ffd5b506104836107b9366004612e63565b6118e4565b3480156107c9575f5ffd5b506104bb601c5481565b3480156107de575f5ffd5b506104bb60175481565b3480156107f3575f5ffd5b50610483610802366004612d4a565b6118f9565b348015610812575f5ffd5b50610483610821366004612e63565b611906565b348015610831575f5ffd5b50610483610840366004612ed1565b61191b565b348015610850575f5ffd5b506104bb60215481565b348015610865575f5ffd5b506104bb601f5481565b34801561087a575f5ffd5b506104bb60205481565b34801561088f575f5ffd5b506104e861089e366004612d4a565b61195a565b3480156108ae575f5ffd5b506104bb601a5481565b3480156108c3575f5ffd5b506104836108d2366004612fde565b611964565b3480156108e2575f5ffd5b506104836108f1366004612d4a565b611a38565b348015610901575f5ffd5b506104bb610910366004612d8b565b611a45565b348015610920575f5ffd5b50610483611a92565b348015610934575f5ffd5b50610483610943366004612d8b565b611aa5565b348015610953575f5ffd5b506104bb601d5481565b348015610968575f5ffd5b50610483610977366004612d4a565b611b1d565b348015610987575f5ffd5b506104bb600c5481565b34801561099c575f5ffd5b505f546001600160a01b03166104e8565b3480156109b8575f5ffd5b50610499611b2a565b3480156109cc575f5ffd5b506104836109db366004612d4a565b611b39565b3480156109eb575f5ffd5b506104836109fa3660046130a3565b611b46565b348015610a0a575f5ffd5b50610483611b8e565b348015610a1e575f5ffd5b50610483610a2d366004612d8b565b611ba3565b348015610a3d575f5ffd5b506104bb60145481565b348015610a52575f5ffd5b50610483610a61366004612d4a565b611c0c565b348015610a71575f5ffd5b50610483610a80366004612d8b565b611c19565b348015610a90575f5ffd5b5060115461044f9062010000900460ff1681565b348015610aaf575f5ffd5b50610483610abe366004612d4a565b611c4d565b348015610ace575f5ffd5b50610483610add366004612e48565b611c5a565b610483610af03660046130cf565b611c75565b348015610b00575f5ffd5b50610483610b0f366004612d4a565b611ca6565b348015610b1f575f5ffd5b50610499610b2e366004612d4a565b611cb3565b348015610b3e575f5ffd5b506104bb600d5481565b348015610b53575f5ffd5b506104bb60105481565b348015610b68575f5ffd5b50610483610b77366004612d4a565b611d50565b348015610b87575f5ffd5b50610483610b96366004612d4a565b611d5d565b348015610ba6575f5ffd5b506104bb60195481565b348015610bbb575f5ffd5b50600f546104e8906001600160a01b031681565b348015610bda575f5ffd5b506104bb60185481565b348015610bef575f5ffd5b5061044f610bfe366004612da6565b611d6a565b348015610c0e575f5ffd5b506011546104e890630100000090046001600160a01b031681565b348015610c34575f5ffd5b50610483610c43366004612d8b565b611d97565b348015610c53575f5ffd5b506104bb60225481565b348015610c68575f5ffd5b50610483610c77366004612d8b565b611dd6565b348015610c87575f5ffd5b5060115461044f9060ff1681565b5f6001600160e01b03198216632b435fdb60e21b1480610cb95750610cb982611f19565b80610cc85750610cc882611f66565b92915050565b610cd6611f9a565b6103e8816001600160601b03161115610d025760405163f4df6ae560e01b815260040160405180910390fd5b610d0c8282611fc6565b5050565b606060058054610d1f90613191565b80601f0160208091040260200160405190810160405280929190818152602001828054610d4b90613191565b8015610d965780601f10610d6d57610100808354040283529160200191610d96565b820191905f5260205f20905b815481529060010190602001808311610d7957829003601f168201915b5050505050905090565b5f610daa82612068565b610dc7576040516333d1c03960e21b815260040160405180910390fd5b505f908152600960205260409020546001600160a01b031690565b8160115460ff1615610df757610df78161209b565b601154610100900460ff1615610e20576040516336e278fd60e21b815260040160405180910390fd5b610e2a83836120da565b505050565b600454600354035f190190565b610e44611f9a565b6040516370a0823160e01b815230600482015282905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610e8a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eae91906131c9565b9050805f03610ed0576040516312171d8360e31b815260040160405180910390fd5b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390525f919084169063a9059cbb906044016020604051808303815f875af1158015610f1f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f4391906131e0565b905080610f63576040516312171d8360e31b815260040160405180910390fd5b5050505050565b826001600160a01b0381163314610f8f5760115460ff1615610f8f57610f8f3361209b565b610f9a8484846120e6565b50505050565b610fa8611f9a565b601455565b5f82815260026020526040812080548291906001600160a01b03811690600160a01b90046001600160601b0316816110005750506001546001600160a01b03811690600160a01b90046001600160601b03165b5f6127106110176001600160601b0384168961320f565b6110219190613226565b92989297509195505050505050565b601c54158015906110425750601c5442105b1561106057604051636ea7008360e11b815260040160405180910390fd5b601d54158015906110725750601d5442115b1561109057604051636ea7008360e11b815260040160405180910390fd5b601054158015906110b45750601054816110a8610e2f565b6110b29190613245565b115b156110d257604051638a164f6360e01b815260040160405180910390fd5b601e54158015906110f15750601e5481601f546110ef9190613245565b115b1561110f57604051638a164f6360e01b815260040160405180910390fd5b5f81600c546020546111219190613245565b61112b919061320f565b600f549091506001600160a01b03166111635780341461115e5760405163193e352b60e11b815260040160405180910390fd5b61127f565b600f546040516370a0823160e01b81523360048201526001600160a01b0390911690829082906370a0823190602401602060405180830381865afa1580156111ad573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111d191906131c9565b10156111f05760405163569d45cf60e11b815260040160405180910390fd5b604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa15801561123a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061125e91906131c9565b101561127d57604051634fd3af0760e01b815260040160405180910390fd5b505b602154158015906112aa5750602154335f908152602360205260409020546112a8908490613245565b115b156112c857604051638a164f6360e01b815260040160405180910390fd5b600c545f90158015906112e55750600e546001600160a01b031615155b156112fb5782600c546112f8919061320f565b90505b600d545f90158015906113185750600e546001600160a01b031615155b156113445761271061132a8385613258565b600d54611337919061320f565b6113419190613226565b90505b5f61134f8284613245565b905080156113605761136081612283565b600f546001600160a01b03161580159061137957508084115b15611391576113913061138c8387613258565b612430565b335f90815260236020526040812080548792906113af908490613245565b9250508190555084601f5f8282546113c79190613245565b90915550610f6390503386612551565b6113df611f9a565b602055565b6113ec611f9a565b5f80546040516001600160a01b039091169047908381818185875af1925050503d805f8114611436576040519150601f19603f3d011682016040523d82523d5f602084013e61143b565b606091505b505090508061145d576040516312171d8360e31b815260040160405180910390fd5b50565b60145415801590611472575060145442105b1561149057604051636ea7008360e11b815260040160405180910390fd5b601554158015906114a2575060155442115b156114c057604051636ea7008360e11b815260040160405180910390fd5b601054158015906114e45750601054816114d8610e2f565b6114e29190613245565b115b1561150257604051638a164f6360e01b815260040160405180910390fd5b6016541580159061152157506016548160175461151f9190613245565b115b1561153f57604051638a164f6360e01b815260040160405180910390fd5b5f81600c546018546115519190613245565b61155b919061320f565b600f549091506001600160a01b03166115935780341461158e5760405163193e352b60e11b815260040160405180910390fd5b6116af565b600f546040516370a0823160e01b81523360048201526001600160a01b0390911690829082906370a0823190602401602060405180830381865afa1580156115dd573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160191906131c9565b10156116205760405163569d45cf60e11b815260040160405180910390fd5b604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa15801561166a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061168e91906131c9565b10156116ad57604051634fd3af0760e01b815260040160405180910390fd5b505b601954158015906116da5750601954335f908152601b60205260409020546116d8908490613245565b115b156116f857604051638a164f6360e01b815260040160405180910390fd5b600c545f90158015906117155750600e546001600160a01b031615155b1561172b5782600c54611728919061320f565b90505b600d545f90158015906117485750600e546001600160a01b031615155b156117745761271061175a8385613258565b600d54611767919061320f565b6117719190613226565b90505b5f61177f8284613245565b905080156117905761179081612283565b600f546001600160a01b0316158015906117a957508084115b156117bc576117bc3061138c8387613258565b335f908152601b6020526040812080548792906117da908490613245565b925050819055508460175f8282546113c79190613245565b826001600160a01b03811633146118175760115460ff1615611817576118173361209b565b610f9a848484612656565b61182a611f9a565b602155565b611837611f9a565b601154630100000090046001600160a01b031661186757604051630e048e7160e41b815260040160405180910390fd5b60118054911515620100000262ff000019909216919091179055565b61188b611f9a565b601054158015906118af5750601054816118a3610e2f565b6118ad9190613245565b115b156118cd57604051638a164f6360e01b815260040160405180910390fd5b610d0c8282612551565b6118df611f9a565b601955565b6118ec611f9a565b6013610e2a8284836132af565b611901611f9a565b601a55565b61190e611f9a565b6012610e2a8284836132af565b611923611f9a565b6103e8816001600160601b0316111561194f5760405163f4df6ae560e01b815260040160405180910390fd5b610e2a838383612670565b5f610cc882612730565b61196c611f9a565b805182511461198e57604051637e26301b60e11b815260040160405180910390fd5b5f5b8251811015610e2a57601054158015906119d657506010548282815181106119ba576119ba613369565b60200260200101516119ca610e2f565b6119d49190613245565b115b156119f457604051638a164f6360e01b815260040160405180910390fd5b611a30838281518110611a0957611a09613369565b6020026020010151838381518110611a2357611a23613369565b6020026020010151612551565b600101611990565b611a40611f9a565b601055565b5f6001600160a01b038216611a6d576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03165f9081526008602052604090205467ffffffffffffffff1690565b611a9a611f9a565b611aa35f6127b7565b565b611aad611f9a565b5f816001600160a01b0316476040515f6040518083038185875af1925050503d805f8114611af6576040519150601f19603f3d011682016040523d82523d5f602084013e611afb565b606091505b5050905080610d0c576040516312171d8360e31b815260040160405180910390fd5b611b25611f9a565b601655565b606060068054610d1f90613191565b611b41611f9a565b602255565b8160115460ff1615611b5b57611b5b8161209b565b601154610100900460ff1615611b84576040516336e278fd60e21b815260040160405180910390fd5b610e2a8383612806565b611b96611f9a565b6011805461ff0019169055565b611bab611f9a565b600b80546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a15050565b611c14611f9a565b601c55565b611c21611f9a565b601180546001600160a01b039092166301000000026301000000600160b81b0319909216919091179055565b611c55611f9a565b601555565b611c62611f9a565b6011805460ff1916911515919091179055565b836001600160a01b0381163314611c9a5760115460ff1615611c9a57611c9a3361209b565b610f6385858585612871565b611cae611f9a565b601e55565b6060611cbe82612068565b611cdb57604051630a14c4b560e41b815260040160405180910390fd5b5f611ce46128b5565b90505f611cef6128c4565b905081515f14611d2c5781611d03856128d3565b604051602001611d14929190613394565b60405160208183030381529060405292505050919050565b805115611d3a579392505050565b505060408051602081019091525f815292915050565b611d58611f9a565b601d55565b611d65611f9a565b601855565b6001600160a01b039182165f908152600a6020908152604080832093909416825291909152205460ff1690565b611d9f611f9a565b6001600160a01b038116611dcd57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61145d816127b7565b611dde611f9a565b6040516370a0823160e01b815230600482015281905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015611e24573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e4891906131c9565b9050805f03611e6a576040516312171d8360e31b815260040160405180910390fd5b5f826001600160a01b031663a9059cbb611e8b5f546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303815f875af1158015611ed5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ef991906131e0565b905080610f9a576040516312171d8360e31b815260040160405180910390fd5b5f6301ffc9a760e01b6001600160e01b031983161480611f4957506380ac58cd60e01b6001600160e01b03198316145b80610cc85750506001600160e01b031916635b5e139f60e01b1490565b5f6001600160e01b0319821663152a902d60e11b1480610cc857506301ffc9a760e01b6001600160e01b0319831614610cc8565b5f546001600160a01b03163314611aa35760405163118cdaa760e01b8152336004820152602401611dc4565b6127106001600160601b03821681101561200557604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401611dc4565b6001600160a01b03831661202e57604051635b6cc80560e11b81525f6004820152602401611dc4565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600155565b5f8160011115801561207b575060035482105b8015610cc85750505f90815260076020526040902054600160e01b161590565b69c61711340011223344555f5230601a5280603a525f5f604460166daaeb6d7670e522a718067333cd4e5afa6120d3573d5f5f3e3d5ffd5b5f603a5250565b610d0c82826001612916565b5f6120f082612730565b9050836001600160a01b0316816001600160a01b0316146121235760405162a1148160e81b815260040160405180910390fd5b5f8281526009602052604090208054338082146001600160a01b0388169091141761216f576121528633611d6a565b61216f57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661219657604051633a954ecd60e21b815260040160405180910390fd5b6121a386868660016129bb565b80156121ad575f82555b6001600160a01b038681165f9081526008602052604080822080545f19019055918716808252919020805460010190554260a01b17600160e11b175f85815260076020526040812091909155600160e11b8416900361223a57600184015f818152600760205260408120549003612238576003548114612238575f8181526007602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b805f036122a357604051635e2a89dd60e01b815260040160405180910390fd5b600e546001600160a01b03166122cc5760405163668040e160e11b815260040160405180910390fd5b600f546001600160a01b031661235357600e546040515f916001600160a01b03169083908381818185875af1925050503d805f8114612326576040519150601f19603f3d011682016040523d82523d5f602084013e61232b565b606091505b505090508061234d57604051634033e4e360e01b815260040160405180910390fd5b506123eb565b600f54600e546040516323b872dd60e01b81523360048201526001600160a01b0391821660248201526044810184905291169081906323b872dd906064016020604051808303815f875af19250505080156123cb575060408051601f3d908101601f191682019092526123c8918101906131e0565b60015b6123e857604051634033e4e360e01b815260040160405180910390fd5b50505b600e546040518281526001600160a01b03909116907f2b5dffd9914ddb43acdb6963bacf053a87bf9354300844f6339f17741e25145a9060200160405180910390a250565b805f0361245057604051632ee66eed60e01b815260040160405180910390fd5b6001600160a01b03821661247757604051632ee66eed60e01b815260040160405180910390fd5b600f546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b039091169081906323b872dd906064016020604051808303815f875af19250505080156124eb575060408051601f3d908101601f191682019092526124e8918101906131e0565b60015b61250857604051632ee66eed60e01b815260040160405180910390fd5b50826001600160a01b03167f5bfd86dd1dfba5846abf8c8ff49e529e997ac11be6a5ad81501ef4418f3596898360405161254491815260200190565b60405180910390a2505050565b6003545f8290036125755760405163b562e8dd60e01b815260040160405180910390fd5b6125815f8483856129bb565b6001600160a01b0383165f8181526008602090815260408083208054680100000000000000018802019055848352600790915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461262d5780835f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f5fa46001016125f7565b50815f0361264d57604051622e076360e81b815260040160405180910390fd5b60035550505050565b610e2a83838360405180602001604052805f815250611c75565b6127106001600160601b0382168110156126b65760405163dfd1fc1b60e01b8152600481018590526001600160601b038316602482015260448101829052606401611dc4565b6001600160a01b0383166126e657604051634b4f842960e11b8152600481018590525f6024820152604401611dc4565b506040805180820182526001600160a01b0393841681526001600160601b0392831660208083019182525f968752600290529190942093519051909116600160a01b029116179055565b5f8160011161279e57505f8181526007602052604081205490600160e01b8216900361279e57805f0361279957600354821061277f57604051636f96cda160e11b815260040160405180910390fd5b5b505f19015f818152600760205260409020548015612780575b919050565b604051636f96cda160e11b815260040160405180910390fd5b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b335f818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61287c848484610f6a565b6001600160a01b0383163b15610f9a5761289884848484612afe565b610f9a576040516368d2bf6b60e11b815260040160405180910390fd5b606060128054610d1f90613191565b606060138054610d1f90613191565b606060a06040510180604052602081039150505f815280825b600183039250600a81066030018353600a9004806128ec5750819003601f19909101908152919050565b5f6129208361195a565b9050811561295f57336001600160a01b0382161461295f576129428133611d6a565b61295f576040516367d9dca160e11b815260040160405180910390fd5b5f8381526009602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b601154610100900460ff1680156129da57506001600160a01b03841615155b80156129ee57506001600160a01b03831615155b15612a0c576040516336e278fd60e21b815260040160405180910390fd5b612a1533612be5565b612a32576040516326406c5f60e11b815260040160405180910390fd5b6001600160a01b03841615801590612a545750600b546001600160a01b031615155b15612af9575f5b81811015612af757600b546001600160a01b031663caee23ea338787612a818689613245565b6040516001600160e01b031960e087901b1681526001600160a01b03948516600482015292841660248401529216604482015260648101919091526084015f6040518083038186803b158015612ad5575f5ffd5b505afa158015612ae7573d5f5f3e3d5ffd5b505060019092019150612a5b9050565b505b610f9a565b604051630a85bd0160e11b81525f906001600160a01b0385169063150b7a0290612b329033908990889088906004016133ca565b6020604051808303815f875af1925050508015612b6c575060408051601f3d908101601f19168201909252612b6991810190613406565b60015b612bc8573d808015612b99576040519150601f19603f3d011682016040523d82523d5f602084013e612b9e565b606091505b5080515f03612bc0576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6011545f9062010000900460ff1615612c75576011546040516370c5e04560e11b81526001600160a01b038481166004830152630100000090920490911690819063e18bc08a90602401602060405180830381865afa158015612c4a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c6e91906131e0565b9392505050565b506001919050565b6001600160e01b03198116811461145d575f5ffd5b5f60208284031215612ca2575f5ffd5b8135612c6e81612c7d565b6001600160a01b038116811461145d575f5ffd5b80356001600160601b0381168114612799575f5ffd5b5f5f60408385031215612ce8575f5ffd5b8235612cf381612cad565b9150612d0160208401612cc1565b90509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f612c6e6020830184612d0a565b5f60208284031215612d5a575f5ffd5b5035919050565b5f5f60408385031215612d72575f5ffd5b8235612d7d81612cad565b946020939093013593505050565b5f60208284031215612d9b575f5ffd5b8135612c6e81612cad565b5f5f60408385031215612db7575f5ffd5b8235612dc281612cad565b91506020830135612dd281612cad565b809150509250929050565b5f5f5f60608486031215612def575f5ffd5b8335612dfa81612cad565b92506020840135612e0a81612cad565b929592945050506040919091013590565b5f5f60408385031215612e2c575f5ffd5b50508035926020909101359150565b801515811461145d575f5ffd5b5f60208284031215612e58575f5ffd5b8135612c6e81612e3b565b5f5f60208385031215612e74575f5ffd5b823567ffffffffffffffff811115612e8a575f5ffd5b8301601f81018513612e9a575f5ffd5b803567ffffffffffffffff811115612eb0575f5ffd5b856020828401011115612ec1575f5ffd5b6020919091019590945092505050565b5f5f5f60608486031215612ee3575f5ffd5b833592506020840135612ef581612cad565b9150612f0360408501612cc1565b90509250925092565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612f4957612f49612f0c565b604052919050565b5f67ffffffffffffffff821115612f6a57612f6a612f0c565b5060051b60200190565b5f82601f830112612f83575f5ffd5b8135612f96612f9182612f51565b612f20565b8082825260208201915060208360051b860101925085831115612fb7575f5ffd5b602085015b83811015612fd4578035835260209283019201612fbc565b5095945050505050565b5f5f60408385031215612fef575f5ffd5b823567ffffffffffffffff811115613005575f5ffd5b8301601f81018513613015575f5ffd5b8035613023612f9182612f51565b8082825260208201915060208360051b850101925087831115613044575f5ffd5b6020840193505b8284101561306f57833561305e81612cad565b82526020938401939091019061304b565b9450505050602083013567ffffffffffffffff81111561308d575f5ffd5b61309985828601612f74565b9150509250929050565b5f5f604083850312156130b4575f5ffd5b82356130bf81612cad565b91506020830135612dd281612e3b565b5f5f5f5f608085870312156130e2575f5ffd5b84356130ed81612cad565b935060208501356130fd81612cad565b925060408501359150606085013567ffffffffffffffff81111561311f575f5ffd5b8501601f8101871361312f575f5ffd5b803567ffffffffffffffff81111561314957613149612f0c565b61315c601f8201601f1916602001612f20565b818152886020838501011115613170575f5ffd5b816020840160208301375f6020838301015280935050505092959194509250565b600181811c908216806131a557607f821691505b6020821081036131c357634e487b7160e01b5f52602260045260245ffd5b50919050565b5f602082840312156131d9575f5ffd5b5051919050565b5f602082840312156131f0575f5ffd5b8151612c6e81612e3b565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610cc857610cc86131fb565b5f8261324057634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610cc857610cc86131fb565b81810381811115610cc857610cc86131fb565b601f821115610e2a57805f5260205f20601f840160051c810160208510156132905750805b601f840160051c820191505b81811015610f63575f815560010161329c565b67ffffffffffffffff8311156132c7576132c7612f0c565b6132db836132d58354613191565b8361326b565b5f601f84116001811461330c575f85156132f55750838201355b5f19600387901b1c1916600186901b178355610f63565b5f83815260208120601f198716915b8281101561333b578685013582556020948501946001909201910161331b565b5086821015613357575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b5f52603260045260245ffd5b5f81518060208401855e5f93019283525090919050565b5f61339f828561337d565b602f60f81b81526133b3600182018561337d565b64173539b7b760d91b815260050195945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906133fc90830184612d0a565b9695505050505050565b5f60208284031215613416575f5ffd5b8151612c6e81612c7d56fea2646970667358221220d6fba9b97d97ecb80c361fff2a057376a8bb47ea5579deeafd63d2a4f2cf588c64736f6c634300081c0033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef68747470733a2f2f6d696e746966792d6c61756e63687061642e6e7963332e63646e2e6469676974616c6f6365616e7370616365732e636f6d2f63343839643532312d373932342d343032622d386535372d3132333764366432653762662e77656270
Deployed Bytecode
0x60806040526004361061042c575f3560e01c80636352211e1161022b578063abd017ea11610129578063e1136b3d116100b3578063ed9aab5111610078578063ed9aab5114610c03578063f2fde38b14610c29578063f3f119f114610c48578063f4f3b20014610c5d578063fb796e6c14610c7c575f5ffd5b8063e1136b3d14610b7c578063e56e9ac014610b9b578063e5a6b10f14610bb0578063e5e2a0f614610bcf578063e985e9c514610be4575f5ffd5b8063c3d923a6116100f9578063c3d923a614610af5578063c87b56dd14610b14578063d2762b4614610b33578063d5abeb0114610b48578063e079e46114610b5d575f5ffd5b8063abd017ea14610a85578063ac19701b14610aa4578063b7c0b8e814610ac3578063b88d4fde14610ae2575f5ffd5b8063871215d4116101b5578063a70138c11161017a578063a70138c1146109ff578063a9fc664e14610a13578063aa0678ff14610a32578063aa60bdd014610a47578063ab7b499314610a66575f5ffd5b8063871215d41461097c5780638da5cb5b1461099157806395d89b41146109ad57806396db3e89146109c1578063a22cb465146109e0575f5ffd5b806370a08231116101fb57806370a08231146108f6578063715018a61461091557806372b0d90c1461092957806379544c8614610948578063858633f21461095d575f5ffd5b80636352211e1461088457806364f52a1f146108a357806365216a41146108b85780636f8b44b0146108d7575f5ffd5b80633bf30394116103385780634b21839e116102c257806355f804b31161028757806355f804b3146108075780635944c7531461082657806359a2f3bd146108455780635c1afecb1461085a5780635d99a0cf1461086f575f5ffd5b80634b21839e146107805780634ed69eaf1461079f5780634f115db1146107be578063545b70b2146107d357806355f5f066146107e8575f5ffd5b8063423c9fcb11610308578063423c9fcb146106fd57806342842e0e14610710578063462fed141461072357806346fff98d14610742578063484b973c14610761575f5ffd5b80633bf30394146106945780633c6d5762146106a95780633ccfd60b146106d457806341d94c98146106e8575f5ffd5b806312b36510116103b9578063251c21ec11610389578063251c21ec146105e65780632a55205a146106055780633073dbfd1461064357806330a089651461065657806330db1d5b14610675575f5ffd5b806312b365101461058257806318160ddd146105a0578063189ce8b1146105b457806323b872dd146105d3575f5ffd5b8063081812fc116103ff578063081812fc146104c9578063095ea7b314610500578063098144d4146105135780630d4c1828146105305780630d705df61461055b575f5ffd5b806301ffc9a71461043057806304634d8d1461046457806306fdde03146104855780630759f2d8146104a6575b5f5ffd5b34801561043b575f5ffd5b5061044f61044a366004612c92565b610c95565b60405190151581526020015b60405180910390f35b34801561046f575f5ffd5b5061048361047e366004612cd7565b610cce565b005b348015610490575f5ffd5b50610499610d10565b60405161045b9190612d38565b3480156104b1575f5ffd5b506104bb60165481565b60405190815260200161045b565b3480156104d4575f5ffd5b506104e86104e3366004612d4a565b610da0565b6040516001600160a01b03909116815260200161045b565b61048361050e366004612d61565b610de2565b34801561051e575f5ffd5b50600b546001600160a01b03166104e8565b34801561053b575f5ffd5b506104bb61054a366004612d8b565b60236020525f908152604090205481565b348015610566575f5ffd5b506040805163657711f560e11b8152600160208201520161045b565b34801561058d575f5ffd5b5060115461044f90610100900460ff1681565b3480156105ab575f5ffd5b506104bb610e2f565b3480156105bf575f5ffd5b506104836105ce366004612da6565b610e3c565b6104836105e1366004612ddd565b610f6a565b3480156105f1575f5ffd5b50610483610600366004612d4a565b610fa0565b348015610610575f5ffd5b5061062461061f366004612e1b565b610fad565b604080516001600160a01b03909316835260208301919091520161045b565b610483610651366004612d4a565b611030565b348015610661575f5ffd5b50600e546104e8906001600160a01b031681565b348015610680575f5ffd5b5061048361068f366004612d4a565b6113d7565b34801561069f575f5ffd5b506104bb601e5481565b3480156106b4575f5ffd5b506104bb6106c3366004612d8b565b601b6020525f908152604090205481565b3480156106df575f5ffd5b506104836113e4565b3480156106f3575f5ffd5b506104bb60155481565b61048361070b366004612d4a565b611460565b61048361071e366004612ddd565b6117f2565b34801561072e575f5ffd5b5061048361073d366004612d4a565b611822565b34801561074d575f5ffd5b5061048361075c366004612e48565b61182f565b34801561076c575f5ffd5b5061048361077b366004612d61565b611883565b34801561078b575f5ffd5b5061048361079a366004612d4a565b6118d7565b3480156107aa575f5ffd5b506104836107b9366004612e63565b6118e4565b3480156107c9575f5ffd5b506104bb601c5481565b3480156107de575f5ffd5b506104bb60175481565b3480156107f3575f5ffd5b50610483610802366004612d4a565b6118f9565b348015610812575f5ffd5b50610483610821366004612e63565b611906565b348015610831575f5ffd5b50610483610840366004612ed1565b61191b565b348015610850575f5ffd5b506104bb60215481565b348015610865575f5ffd5b506104bb601f5481565b34801561087a575f5ffd5b506104bb60205481565b34801561088f575f5ffd5b506104e861089e366004612d4a565b61195a565b3480156108ae575f5ffd5b506104bb601a5481565b3480156108c3575f5ffd5b506104836108d2366004612fde565b611964565b3480156108e2575f5ffd5b506104836108f1366004612d4a565b611a38565b348015610901575f5ffd5b506104bb610910366004612d8b565b611a45565b348015610920575f5ffd5b50610483611a92565b348015610934575f5ffd5b50610483610943366004612d8b565b611aa5565b348015610953575f5ffd5b506104bb601d5481565b348015610968575f5ffd5b50610483610977366004612d4a565b611b1d565b348015610987575f5ffd5b506104bb600c5481565b34801561099c575f5ffd5b505f546001600160a01b03166104e8565b3480156109b8575f5ffd5b50610499611b2a565b3480156109cc575f5ffd5b506104836109db366004612d4a565b611b39565b3480156109eb575f5ffd5b506104836109fa3660046130a3565b611b46565b348015610a0a575f5ffd5b50610483611b8e565b348015610a1e575f5ffd5b50610483610a2d366004612d8b565b611ba3565b348015610a3d575f5ffd5b506104bb60145481565b348015610a52575f5ffd5b50610483610a61366004612d4a565b611c0c565b348015610a71575f5ffd5b50610483610a80366004612d8b565b611c19565b348015610a90575f5ffd5b5060115461044f9062010000900460ff1681565b348015610aaf575f5ffd5b50610483610abe366004612d4a565b611c4d565b348015610ace575f5ffd5b50610483610add366004612e48565b611c5a565b610483610af03660046130cf565b611c75565b348015610b00575f5ffd5b50610483610b0f366004612d4a565b611ca6565b348015610b1f575f5ffd5b50610499610b2e366004612d4a565b611cb3565b348015610b3e575f5ffd5b506104bb600d5481565b348015610b53575f5ffd5b506104bb60105481565b348015610b68575f5ffd5b50610483610b77366004612d4a565b611d50565b348015610b87575f5ffd5b50610483610b96366004612d4a565b611d5d565b348015610ba6575f5ffd5b506104bb60195481565b348015610bbb575f5ffd5b50600f546104e8906001600160a01b031681565b348015610bda575f5ffd5b506104bb60185481565b348015610bef575f5ffd5b5061044f610bfe366004612da6565b611d6a565b348015610c0e575f5ffd5b506011546104e890630100000090046001600160a01b031681565b348015610c34575f5ffd5b50610483610c43366004612d8b565b611d97565b348015610c53575f5ffd5b506104bb60225481565b348015610c68575f5ffd5b50610483610c77366004612d8b565b611dd6565b348015610c87575f5ffd5b5060115461044f9060ff1681565b5f6001600160e01b03198216632b435fdb60e21b1480610cb95750610cb982611f19565b80610cc85750610cc882611f66565b92915050565b610cd6611f9a565b6103e8816001600160601b03161115610d025760405163f4df6ae560e01b815260040160405180910390fd5b610d0c8282611fc6565b5050565b606060058054610d1f90613191565b80601f0160208091040260200160405190810160405280929190818152602001828054610d4b90613191565b8015610d965780601f10610d6d57610100808354040283529160200191610d96565b820191905f5260205f20905b815481529060010190602001808311610d7957829003601f168201915b5050505050905090565b5f610daa82612068565b610dc7576040516333d1c03960e21b815260040160405180910390fd5b505f908152600960205260409020546001600160a01b031690565b8160115460ff1615610df757610df78161209b565b601154610100900460ff1615610e20576040516336e278fd60e21b815260040160405180910390fd5b610e2a83836120da565b505050565b600454600354035f190190565b610e44611f9a565b6040516370a0823160e01b815230600482015282905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610e8a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eae91906131c9565b9050805f03610ed0576040516312171d8360e31b815260040160405180910390fd5b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390525f919084169063a9059cbb906044016020604051808303815f875af1158015610f1f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f4391906131e0565b905080610f63576040516312171d8360e31b815260040160405180910390fd5b5050505050565b826001600160a01b0381163314610f8f5760115460ff1615610f8f57610f8f3361209b565b610f9a8484846120e6565b50505050565b610fa8611f9a565b601455565b5f82815260026020526040812080548291906001600160a01b03811690600160a01b90046001600160601b0316816110005750506001546001600160a01b03811690600160a01b90046001600160601b03165b5f6127106110176001600160601b0384168961320f565b6110219190613226565b92989297509195505050505050565b601c54158015906110425750601c5442105b1561106057604051636ea7008360e11b815260040160405180910390fd5b601d54158015906110725750601d5442115b1561109057604051636ea7008360e11b815260040160405180910390fd5b601054158015906110b45750601054816110a8610e2f565b6110b29190613245565b115b156110d257604051638a164f6360e01b815260040160405180910390fd5b601e54158015906110f15750601e5481601f546110ef9190613245565b115b1561110f57604051638a164f6360e01b815260040160405180910390fd5b5f81600c546020546111219190613245565b61112b919061320f565b600f549091506001600160a01b03166111635780341461115e5760405163193e352b60e11b815260040160405180910390fd5b61127f565b600f546040516370a0823160e01b81523360048201526001600160a01b0390911690829082906370a0823190602401602060405180830381865afa1580156111ad573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111d191906131c9565b10156111f05760405163569d45cf60e11b815260040160405180910390fd5b604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa15801561123a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061125e91906131c9565b101561127d57604051634fd3af0760e01b815260040160405180910390fd5b505b602154158015906112aa5750602154335f908152602360205260409020546112a8908490613245565b115b156112c857604051638a164f6360e01b815260040160405180910390fd5b600c545f90158015906112e55750600e546001600160a01b031615155b156112fb5782600c546112f8919061320f565b90505b600d545f90158015906113185750600e546001600160a01b031615155b156113445761271061132a8385613258565b600d54611337919061320f565b6113419190613226565b90505b5f61134f8284613245565b905080156113605761136081612283565b600f546001600160a01b03161580159061137957508084115b15611391576113913061138c8387613258565b612430565b335f90815260236020526040812080548792906113af908490613245565b9250508190555084601f5f8282546113c79190613245565b90915550610f6390503386612551565b6113df611f9a565b602055565b6113ec611f9a565b5f80546040516001600160a01b039091169047908381818185875af1925050503d805f8114611436576040519150601f19603f3d011682016040523d82523d5f602084013e61143b565b606091505b505090508061145d576040516312171d8360e31b815260040160405180910390fd5b50565b60145415801590611472575060145442105b1561149057604051636ea7008360e11b815260040160405180910390fd5b601554158015906114a2575060155442115b156114c057604051636ea7008360e11b815260040160405180910390fd5b601054158015906114e45750601054816114d8610e2f565b6114e29190613245565b115b1561150257604051638a164f6360e01b815260040160405180910390fd5b6016541580159061152157506016548160175461151f9190613245565b115b1561153f57604051638a164f6360e01b815260040160405180910390fd5b5f81600c546018546115519190613245565b61155b919061320f565b600f549091506001600160a01b03166115935780341461158e5760405163193e352b60e11b815260040160405180910390fd5b6116af565b600f546040516370a0823160e01b81523360048201526001600160a01b0390911690829082906370a0823190602401602060405180830381865afa1580156115dd573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160191906131c9565b10156116205760405163569d45cf60e11b815260040160405180910390fd5b604051636eb1769f60e11b815233600482015230602482015282906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa15801561166a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061168e91906131c9565b10156116ad57604051634fd3af0760e01b815260040160405180910390fd5b505b601954158015906116da5750601954335f908152601b60205260409020546116d8908490613245565b115b156116f857604051638a164f6360e01b815260040160405180910390fd5b600c545f90158015906117155750600e546001600160a01b031615155b1561172b5782600c54611728919061320f565b90505b600d545f90158015906117485750600e546001600160a01b031615155b156117745761271061175a8385613258565b600d54611767919061320f565b6117719190613226565b90505b5f61177f8284613245565b905080156117905761179081612283565b600f546001600160a01b0316158015906117a957508084115b156117bc576117bc3061138c8387613258565b335f908152601b6020526040812080548792906117da908490613245565b925050819055508460175f8282546113c79190613245565b826001600160a01b03811633146118175760115460ff1615611817576118173361209b565b610f9a848484612656565b61182a611f9a565b602155565b611837611f9a565b601154630100000090046001600160a01b031661186757604051630e048e7160e41b815260040160405180910390fd5b60118054911515620100000262ff000019909216919091179055565b61188b611f9a565b601054158015906118af5750601054816118a3610e2f565b6118ad9190613245565b115b156118cd57604051638a164f6360e01b815260040160405180910390fd5b610d0c8282612551565b6118df611f9a565b601955565b6118ec611f9a565b6013610e2a8284836132af565b611901611f9a565b601a55565b61190e611f9a565b6012610e2a8284836132af565b611923611f9a565b6103e8816001600160601b0316111561194f5760405163f4df6ae560e01b815260040160405180910390fd5b610e2a838383612670565b5f610cc882612730565b61196c611f9a565b805182511461198e57604051637e26301b60e11b815260040160405180910390fd5b5f5b8251811015610e2a57601054158015906119d657506010548282815181106119ba576119ba613369565b60200260200101516119ca610e2f565b6119d49190613245565b115b156119f457604051638a164f6360e01b815260040160405180910390fd5b611a30838281518110611a0957611a09613369565b6020026020010151838381518110611a2357611a23613369565b6020026020010151612551565b600101611990565b611a40611f9a565b601055565b5f6001600160a01b038216611a6d576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03165f9081526008602052604090205467ffffffffffffffff1690565b611a9a611f9a565b611aa35f6127b7565b565b611aad611f9a565b5f816001600160a01b0316476040515f6040518083038185875af1925050503d805f8114611af6576040519150601f19603f3d011682016040523d82523d5f602084013e611afb565b606091505b5050905080610d0c576040516312171d8360e31b815260040160405180910390fd5b611b25611f9a565b601655565b606060068054610d1f90613191565b611b41611f9a565b602255565b8160115460ff1615611b5b57611b5b8161209b565b601154610100900460ff1615611b84576040516336e278fd60e21b815260040160405180910390fd5b610e2a8383612806565b611b96611f9a565b6011805461ff0019169055565b611bab611f9a565b600b80546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a15050565b611c14611f9a565b601c55565b611c21611f9a565b601180546001600160a01b039092166301000000026301000000600160b81b0319909216919091179055565b611c55611f9a565b601555565b611c62611f9a565b6011805460ff1916911515919091179055565b836001600160a01b0381163314611c9a5760115460ff1615611c9a57611c9a3361209b565b610f6385858585612871565b611cae611f9a565b601e55565b6060611cbe82612068565b611cdb57604051630a14c4b560e41b815260040160405180910390fd5b5f611ce46128b5565b90505f611cef6128c4565b905081515f14611d2c5781611d03856128d3565b604051602001611d14929190613394565b60405160208183030381529060405292505050919050565b805115611d3a579392505050565b505060408051602081019091525f815292915050565b611d58611f9a565b601d55565b611d65611f9a565b601855565b6001600160a01b039182165f908152600a6020908152604080832093909416825291909152205460ff1690565b611d9f611f9a565b6001600160a01b038116611dcd57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61145d816127b7565b611dde611f9a565b6040516370a0823160e01b815230600482015281905f906001600160a01b038316906370a0823190602401602060405180830381865afa158015611e24573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e4891906131c9565b9050805f03611e6a576040516312171d8360e31b815260040160405180910390fd5b5f826001600160a01b031663a9059cbb611e8b5f546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303815f875af1158015611ed5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ef991906131e0565b905080610f9a576040516312171d8360e31b815260040160405180910390fd5b5f6301ffc9a760e01b6001600160e01b031983161480611f4957506380ac58cd60e01b6001600160e01b03198316145b80610cc85750506001600160e01b031916635b5e139f60e01b1490565b5f6001600160e01b0319821663152a902d60e11b1480610cc857506301ffc9a760e01b6001600160e01b0319831614610cc8565b5f546001600160a01b03163314611aa35760405163118cdaa760e01b8152336004820152602401611dc4565b6127106001600160601b03821681101561200557604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401611dc4565b6001600160a01b03831661202e57604051635b6cc80560e11b81525f6004820152602401611dc4565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600155565b5f8160011115801561207b575060035482105b8015610cc85750505f90815260076020526040902054600160e01b161590565b69c61711340011223344555f5230601a5280603a525f5f604460166daaeb6d7670e522a718067333cd4e5afa6120d3573d5f5f3e3d5ffd5b5f603a5250565b610d0c82826001612916565b5f6120f082612730565b9050836001600160a01b0316816001600160a01b0316146121235760405162a1148160e81b815260040160405180910390fd5b5f8281526009602052604090208054338082146001600160a01b0388169091141761216f576121528633611d6a565b61216f57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661219657604051633a954ecd60e21b815260040160405180910390fd5b6121a386868660016129bb565b80156121ad575f82555b6001600160a01b038681165f9081526008602052604080822080545f19019055918716808252919020805460010190554260a01b17600160e11b175f85815260076020526040812091909155600160e11b8416900361223a57600184015f818152600760205260408120549003612238576003548114612238575f8181526007602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b805f036122a357604051635e2a89dd60e01b815260040160405180910390fd5b600e546001600160a01b03166122cc5760405163668040e160e11b815260040160405180910390fd5b600f546001600160a01b031661235357600e546040515f916001600160a01b03169083908381818185875af1925050503d805f8114612326576040519150601f19603f3d011682016040523d82523d5f602084013e61232b565b606091505b505090508061234d57604051634033e4e360e01b815260040160405180910390fd5b506123eb565b600f54600e546040516323b872dd60e01b81523360048201526001600160a01b0391821660248201526044810184905291169081906323b872dd906064016020604051808303815f875af19250505080156123cb575060408051601f3d908101601f191682019092526123c8918101906131e0565b60015b6123e857604051634033e4e360e01b815260040160405180910390fd5b50505b600e546040518281526001600160a01b03909116907f2b5dffd9914ddb43acdb6963bacf053a87bf9354300844f6339f17741e25145a9060200160405180910390a250565b805f0361245057604051632ee66eed60e01b815260040160405180910390fd5b6001600160a01b03821661247757604051632ee66eed60e01b815260040160405180910390fd5b600f546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b039091169081906323b872dd906064016020604051808303815f875af19250505080156124eb575060408051601f3d908101601f191682019092526124e8918101906131e0565b60015b61250857604051632ee66eed60e01b815260040160405180910390fd5b50826001600160a01b03167f5bfd86dd1dfba5846abf8c8ff49e529e997ac11be6a5ad81501ef4418f3596898360405161254491815260200190565b60405180910390a2505050565b6003545f8290036125755760405163b562e8dd60e01b815260040160405180910390fd5b6125815f8483856129bb565b6001600160a01b0383165f8181526008602090815260408083208054680100000000000000018802019055848352600790915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461262d5780835f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f5fa46001016125f7565b50815f0361264d57604051622e076360e81b815260040160405180910390fd5b60035550505050565b610e2a83838360405180602001604052805f815250611c75565b6127106001600160601b0382168110156126b65760405163dfd1fc1b60e01b8152600481018590526001600160601b038316602482015260448101829052606401611dc4565b6001600160a01b0383166126e657604051634b4f842960e11b8152600481018590525f6024820152604401611dc4565b506040805180820182526001600160a01b0393841681526001600160601b0392831660208083019182525f968752600290529190942093519051909116600160a01b029116179055565b5f8160011161279e57505f8181526007602052604081205490600160e01b8216900361279e57805f0361279957600354821061277f57604051636f96cda160e11b815260040160405180910390fd5b5b505f19015f818152600760205260409020548015612780575b919050565b604051636f96cda160e11b815260040160405180910390fd5b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b335f818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61287c848484610f6a565b6001600160a01b0383163b15610f9a5761289884848484612afe565b610f9a576040516368d2bf6b60e11b815260040160405180910390fd5b606060128054610d1f90613191565b606060138054610d1f90613191565b606060a06040510180604052602081039150505f815280825b600183039250600a81066030018353600a9004806128ec5750819003601f19909101908152919050565b5f6129208361195a565b9050811561295f57336001600160a01b0382161461295f576129428133611d6a565b61295f576040516367d9dca160e11b815260040160405180910390fd5b5f8381526009602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b601154610100900460ff1680156129da57506001600160a01b03841615155b80156129ee57506001600160a01b03831615155b15612a0c576040516336e278fd60e21b815260040160405180910390fd5b612a1533612be5565b612a32576040516326406c5f60e11b815260040160405180910390fd5b6001600160a01b03841615801590612a545750600b546001600160a01b031615155b15612af9575f5b81811015612af757600b546001600160a01b031663caee23ea338787612a818689613245565b6040516001600160e01b031960e087901b1681526001600160a01b03948516600482015292841660248401529216604482015260648101919091526084015f6040518083038186803b158015612ad5575f5ffd5b505afa158015612ae7573d5f5f3e3d5ffd5b505060019092019150612a5b9050565b505b610f9a565b604051630a85bd0160e11b81525f906001600160a01b0385169063150b7a0290612b329033908990889088906004016133ca565b6020604051808303815f875af1925050508015612b6c575060408051601f3d908101601f19168201909252612b6991810190613406565b60015b612bc8573d808015612b99576040519150601f19603f3d011682016040523d82523d5f602084013e612b9e565b606091505b5080515f03612bc0576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6011545f9062010000900460ff1615612c75576011546040516370c5e04560e11b81526001600160a01b038481166004830152630100000090920490911690819063e18bc08a90602401602060405180830381865afa158015612c4a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c6e91906131e0565b9392505050565b506001919050565b6001600160e01b03198116811461145d575f5ffd5b5f60208284031215612ca2575f5ffd5b8135612c6e81612c7d565b6001600160a01b038116811461145d575f5ffd5b80356001600160601b0381168114612799575f5ffd5b5f5f60408385031215612ce8575f5ffd5b8235612cf381612cad565b9150612d0160208401612cc1565b90509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f612c6e6020830184612d0a565b5f60208284031215612d5a575f5ffd5b5035919050565b5f5f60408385031215612d72575f5ffd5b8235612d7d81612cad565b946020939093013593505050565b5f60208284031215612d9b575f5ffd5b8135612c6e81612cad565b5f5f60408385031215612db7575f5ffd5b8235612dc281612cad565b91506020830135612dd281612cad565b809150509250929050565b5f5f5f60608486031215612def575f5ffd5b8335612dfa81612cad565b92506020840135612e0a81612cad565b929592945050506040919091013590565b5f5f60408385031215612e2c575f5ffd5b50508035926020909101359150565b801515811461145d575f5ffd5b5f60208284031215612e58575f5ffd5b8135612c6e81612e3b565b5f5f60208385031215612e74575f5ffd5b823567ffffffffffffffff811115612e8a575f5ffd5b8301601f81018513612e9a575f5ffd5b803567ffffffffffffffff811115612eb0575f5ffd5b856020828401011115612ec1575f5ffd5b6020919091019590945092505050565b5f5f5f60608486031215612ee3575f5ffd5b833592506020840135612ef581612cad565b9150612f0360408501612cc1565b90509250925092565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612f4957612f49612f0c565b604052919050565b5f67ffffffffffffffff821115612f6a57612f6a612f0c565b5060051b60200190565b5f82601f830112612f83575f5ffd5b8135612f96612f9182612f51565b612f20565b8082825260208201915060208360051b860101925085831115612fb7575f5ffd5b602085015b83811015612fd4578035835260209283019201612fbc565b5095945050505050565b5f5f60408385031215612fef575f5ffd5b823567ffffffffffffffff811115613005575f5ffd5b8301601f81018513613015575f5ffd5b8035613023612f9182612f51565b8082825260208201915060208360051b850101925087831115613044575f5ffd5b6020840193505b8284101561306f57833561305e81612cad565b82526020938401939091019061304b565b9450505050602083013567ffffffffffffffff81111561308d575f5ffd5b61309985828601612f74565b9150509250929050565b5f5f604083850312156130b4575f5ffd5b82356130bf81612cad565b91506020830135612dd281612e3b565b5f5f5f5f608085870312156130e2575f5ffd5b84356130ed81612cad565b935060208501356130fd81612cad565b925060408501359150606085013567ffffffffffffffff81111561311f575f5ffd5b8501601f8101871361312f575f5ffd5b803567ffffffffffffffff81111561314957613149612f0c565b61315c601f8201601f1916602001612f20565b818152886020838501011115613170575f5ffd5b816020840160208301375f6020838301015280935050505092959194509250565b600181811c908216806131a557607f821691505b6020821081036131c357634e487b7160e01b5f52602260045260245ffd5b50919050565b5f602082840312156131d9575f5ffd5b5051919050565b5f602082840312156131f0575f5ffd5b8151612c6e81612e3b565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610cc857610cc86131fb565b5f8261324057634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610cc857610cc86131fb565b81810381811115610cc857610cc86131fb565b601f821115610e2a57805f5260205f20601f840160051c810160208510156132905750805b601f840160051c820191505b81811015610f63575f815560010161329c565b67ffffffffffffffff8311156132c7576132c7612f0c565b6132db836132d58354613191565b8361326b565b5f601f84116001811461330c575f85156132f55750838201355b5f19600387901b1c1916600186901b178355610f63565b5f83815260208120601f198716915b8281101561333b578685013582556020948501946001909201910161331b565b5086821015613357575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b5f52603260045260245ffd5b5f81518060208401855e5f93019283525090919050565b5f61339f828561337d565b602f60f81b81526133b3600182018561337d565b64173539b7b760d91b815260050195945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906133fc90830184612d0a565b9695505050505050565b5f60208284031215613416575f5ffd5b8151612c6e81612c7d56fea2646970667358221220d6fba9b97d97ecb80c361fff2a057376a8bb47ea5579deeafd63d2a4f2cf588c64736f6c634300081c0033
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.