ERC-721
NFT
Overview
Max Total Supply
3,583 MBEAN
Holders
1,386
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
0 MBEANLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
MysteryBean
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "erc721a/contracts/ERC721A.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {BitMaps} from "@openzeppelin/contracts/utils/structs/BitMaps.sol"; import "closedsea/OperatorFilterer.sol"; import "./MultisigOwnable.sol"; error InvalidPresaleSetup(); error InvalidAuctionSetup(); error ChunkAlreadyProcessed(); error MismatchedArrays(); error AuctionMintNotOpen(); error MaxPresaleOrAuctionMintSupplyReached(); error RedeemBeanNotOpen(); error BeanRedeemerNotSet(); error ForceRedeemBeanOwnerMismatch(); error RegistryNotSet(); error NotAllowedByRegistry(); error WithdrawFailed(); error ClaimWindowNotOpen(); error MismatchedTokenOwnerForClaim(); error BeanCannotBeClaimed(); error InitialTransferLockOn(); error MaxAuctionMintForAddress(); error InsufficientFunds(); error RefundFailed(); error InvalidSignature(); error OverMaxSupply(); error AllowlistMintNotOpen(); error PresaleNotOpen(); error MintingTooMuchInPresale(); error InvalidContractSetup(); interface IBeanRedeemer { function redeemBeans(address to, uint256[] calldata beanIds) external returns (uint256[] memory); } interface IRegistry { function isAllowedOperator(address operator) external view returns (bool); } interface Azuki { function ownerOf(uint256 tokenId) external view returns (address owner); } contract MysteryBean is ERC2981, MultisigOwnable, OperatorFilterer, ERC721A { using ECDSA for bytes32; using EnumerableSet for EnumerableSet.UintSet; using BitMaps for BitMaps.BitMap; event AirdroppedChunk(uint256 indexed chunkNum); event ClaimedBean(uint256 indexed sourceAzukiId, uint256 indexed beanId); event PresaleMint(address indexed minter, uint16 indexed amount); // The set of chunks processed for the airdrop. // Intent is to help prevent double processing of chunks. EnumerableSet.UintSet private _processedChunksForAirdrop; bool public operatorFilteringEnabled = true; bool public initialTransferLockOn = true; bool public isRegistryActive = false; address public registryAddress; bool public claimBeanOpen = false; // Keys are azuki token ids BitMaps.BitMap private _azukiCanClaim; uint256 public immutable TOTAL_PRESALE_AND_AUCTION_SUPPLY; uint16 public totalPresaleAndAuctionMinted; struct PresaleInfo { uint32 presaleStartTime; uint32 presaleEndTime; uint64 presalePrice; } PresaleInfo public presaleInfo; mapping(address => uint256) public numMintedInPresale; struct AuctionInfo { uint32 auctionSaleStartTime; uint64 auctionStartPrice; uint64 auctionEndPrice; uint32 auctionPriceCurveLength; uint32 auctionDropInterval; } AuctionInfo public auctionInfo; address private _offchainSigner; struct RedeemInfo { bool redeemBeanOpen; address beanRedeemer; } RedeemInfo public redeemInfo; mapping(address => uint256) public allowlistMintsAlloc; uint256 public allowlistMintPrice; uint256 public immutable MAX_SUPPLY; string private _baseTokenURI; Azuki public immutable AZUKI; address payable public immutable WITHDRAW_ADDRESS; uint256 public constant MINT_BATCH_SIZE = 10; constructor( address _azukiAddress, uint256 _maxSupply, uint256 _totalPresaleAndAuctionSupply, address payable _withdrawAddress ) ERC721A("MysteryBean", "MBEAN") { AZUKI = Azuki(_azukiAddress); MAX_SUPPLY = _maxSupply; TOTAL_PRESALE_AND_AUCTION_SUPPLY = _totalPresaleAndAuctionSupply; WITHDRAW_ADDRESS = _withdrawAddress; if (TOTAL_PRESALE_AND_AUCTION_SUPPLY >= MAX_SUPPLY) revert InvalidContractSetup(); _registerForOperatorFiltering(); operatorFilteringEnabled = true; } // --------------------------- // Airdrop and privileged mint // --------------------------- // Thin wrapper around privilegedMint which does chunkNum checks to reduce chance of double processing chunks in a manual airdrop. function airdrop( address[] calldata receivers, uint256[] calldata amounts, uint256 chunkNum ) external onlyOwner { if (_processedChunksForAirdrop.contains(chunkNum)) revert ChunkAlreadyProcessed(); _processedChunksForAirdrop.add(chunkNum); privilegedMint(receivers, amounts); emit AirdroppedChunk(chunkNum); } // Used for airdrop and minting any of the total supply that's unminted. // Does not use safeMint (assumes the caller has checked whether contract receivers can receive 721s) function privilegedMint( address[] calldata receivers, uint256[] calldata amounts ) public onlyOwner { if (receivers.length != amounts.length || receivers.length == 0) revert MismatchedArrays(); for (uint256 i; i < receivers.length; ) { _mintWrapperNoSafeReceiverCheck(receivers[i], amounts[i]); unchecked { ++i; } } if (_totalMinted() > MAX_SUPPLY) { revert OverMaxSupply(); } } function _mintWrapperSafeReceiverCheck(address to, uint256 amount) private { uint256 numBatches = amount / MINT_BATCH_SIZE; for (uint256 i; i < numBatches; ) { _safeMint(to, MINT_BATCH_SIZE, ""); unchecked { ++i; } } if (amount % MINT_BATCH_SIZE > 0) { _safeMint(to, amount % MINT_BATCH_SIZE, ""); } } function _mintWrapperNoSafeReceiverCheck(address to, uint256 amount) private { uint256 numBatches = amount / MINT_BATCH_SIZE; for (uint256 i; i < numBatches; ) { _mint(to, MINT_BATCH_SIZE); unchecked { ++i; } } if (amount % MINT_BATCH_SIZE > 0) { _mint(to, amount % MINT_BATCH_SIZE); } } // ---------------------------------------------- // Claim Window // ---------------------------------------------- function claim(uint256[] calldata azukiTokenIds) external { if (!claimBeanOpen) { revert ClaimWindowNotOpen(); } uint256 numToClaim = azukiTokenIds.length; if (_totalMinted() + numToClaim > MAX_SUPPLY) { revert OverMaxSupply(); } uint256 nextTokenId = _nextTokenId(); for (uint256 i; i < numToClaim; ) { uint256 azukiId = azukiTokenIds[i]; if (AZUKI.ownerOf(azukiId) != msg.sender) revert MismatchedTokenOwnerForClaim(); if (!_azukiCanClaim.get(azukiId)) revert BeanCannotBeClaimed(); _azukiCanClaim.unset(azukiId); emit ClaimedBean(azukiId, nextTokenId + i); unchecked { ++i; } } _mintWrapperSafeReceiverCheck(msg.sender, numToClaim); } function setClaimBeanState(bool _claimBeanOpen) external onlyOwner { claimBeanOpen = _claimBeanOpen; } function setCanClaim(uint256[] calldata azukiIds) external onlyOwner { for (uint256 i; i < azukiIds.length; ) { _azukiCanClaim.set(azukiIds[i]); unchecked { ++i; } } } function getCanClaims(uint256[] calldata azukiIds) external view returns (bool[] memory) { bool[] memory result = new bool[](azukiIds.length); for (uint256 i; i < azukiIds.length; ) { result[i] = _azukiCanClaim.get(azukiIds[i]); unchecked { ++i; } } return result; } // ------------ // Presale mint // ------------ // maxAllowedForPresaleForAddr: the number the holder is allowed to mint during the entirety of the presale. // Its value is verified through the signature. We do this instead of seeding the contract with state to avoid a more complex contract setup. function presaleMint( uint16 amount, uint16 maxAllowedForPresaleForAddr, bytes calldata _signature ) external payable { PresaleInfo memory info = presaleInfo; if ( info.presaleStartTime == 0 || block.timestamp < info.presaleStartTime || block.timestamp >= info.presaleEndTime ) { revert PresaleNotOpen(); } uint256 numMintedInPresaleLoc = numMintedInPresale[msg.sender]; if (amount > maxAllowedForPresaleForAddr - numMintedInPresaleLoc) { revert MintingTooMuchInPresale(); } uint16 totalPresaleAndAuctionMintedLocal = totalPresaleAndAuctionMinted; if ( amount + totalPresaleAndAuctionMintedLocal > TOTAL_PRESALE_AND_AUCTION_SUPPLY ) { revert MaxPresaleOrAuctionMintSupplyReached(); } if (_totalMinted() + amount > MAX_SUPPLY) { revert OverMaxSupply(); } if (!_verifyPresaleSig(amount, maxAllowedForPresaleForAddr, _signature)) revert InvalidSignature(); uint256 totalCost = uint256(info.presalePrice) * amount; if (msg.value < totalCost) { revert InsufficientFunds(); } unchecked { numMintedInPresale[msg.sender] = amount + numMintedInPresaleLoc; totalPresaleAndAuctionMinted = totalPresaleAndAuctionMintedLocal + amount; } _mintWrapperNoSafeReceiverCheck(msg.sender, amount); emit PresaleMint(msg.sender, amount); } function _verifyPresaleSig( uint16 amount, uint16 maxAllowedForPresaleForAddr, bytes memory _signature ) private view returns (bool) { bytes32 hashVal = keccak256( abi.encodePacked(amount, msg.sender, maxAllowedForPresaleForAddr) ); bytes32 signedHash = hashVal.toEthSignedMessageHash(); address signingAddress = signedHash.recover(_signature); return signingAddress == _offchainSigner; } // Presale price to match starting price of dutch auction function setPresaleParams( uint32 _presaleStartTime, uint32 _presaleEndTime, uint64 _presalePrice ) external onlyOwner { if ( _presaleStartTime == 0 || _presaleEndTime == 0 || _presalePrice == 0 ) { revert InvalidPresaleSetup(); } if (_presaleStartTime >= _presaleEndTime) { revert InvalidPresaleSetup(); } presaleInfo = PresaleInfo( _presaleStartTime, _presaleEndTime, _presalePrice ); } function setOffchainSigner(address _signer) external onlyOwner { _offchainSigner = _signer; } // ------------- // Dutch auction // ------------- uint256 public constant MAX_PER_ADDRESS_PUBLIC_MINT = 3; function getAuctionPrice() public view returns (uint256) { AuctionInfo memory info = auctionInfo; if (block.timestamp < info.auctionSaleStartTime) { return info.auctionStartPrice; } if ( block.timestamp - info.auctionSaleStartTime >= info.auctionPriceCurveLength ) { return info.auctionEndPrice; } else { uint256 steps = (block.timestamp - info.auctionSaleStartTime) / info.auctionDropInterval; uint256 auctionDropPerStep = (info.auctionStartPrice - info.auctionEndPrice) / (info.auctionPriceCurveLength / info.auctionDropInterval); return info.auctionStartPrice - (steps * auctionDropPerStep); } } modifier isEOA() { require(tx.origin == msg.sender, "The caller is another contract"); _; } function auctionMint(uint8 amount, bytes calldata _signature) external payable isEOA { AuctionInfo memory info = auctionInfo; if ( info.auctionSaleStartTime == 0 || block.timestamp < info.auctionSaleStartTime ) { revert AuctionMintNotOpen(); } uint16 totalPresaleAndAuctionMintedLocal = totalPresaleAndAuctionMinted; if ( amount + totalPresaleAndAuctionMintedLocal > TOTAL_PRESALE_AND_AUCTION_SUPPLY ) { revert MaxPresaleOrAuctionMintSupplyReached(); } if (_totalMinted() + amount > MAX_SUPPLY) { revert OverMaxSupply(); } uint256 numAuctionMintedForThisAddr = _getAux(msg.sender); if ( numAuctionMintedForThisAddr + amount > MAX_PER_ADDRESS_PUBLIC_MINT ) { revert MaxAuctionMintForAddress(); } if (!_verifySig(_signature)) revert InvalidSignature(); uint256 totalCost = getAuctionPrice() * amount; if (msg.value < totalCost) { revert InsufficientFunds(); } unchecked { _setAux(msg.sender, uint64(numAuctionMintedForThisAddr) + amount); totalPresaleAndAuctionMinted = totalPresaleAndAuctionMintedLocal + amount; } _mint(msg.sender, amount); if (msg.value > totalCost) { (bool sent, ) = msg.sender.call{value: msg.value - totalCost}(""); if (!sent) { revert RefundFailed(); } } } function getNumAuctionMinted(address addr) external view returns (uint256) { return _getAux(addr); } function setAuctionParams( uint32 _startTime, uint64 _startPriceWei, uint64 _endPriceWei, uint32 _priceCurveNumSeconds, uint32 _dropIntervalNumSeconds ) public onlyOwner { if ( _startTime != 0 && (_startPriceWei == 0 || _priceCurveNumSeconds == 0 || _dropIntervalNumSeconds == 0) ) { revert InvalidAuctionSetup(); } auctionInfo = AuctionInfo( _startTime, _startPriceWei, _endPriceWei, _priceCurveNumSeconds, _dropIntervalNumSeconds ); } function setAuctionSaleStartTime(uint32 timestamp) external onlyOwner { AuctionInfo memory info = auctionInfo; if ( timestamp != 0 && (info.auctionStartPrice == 0 || info.auctionPriceCurveLength == 0 || info.auctionDropInterval == 0) ) { revert InvalidAuctionSetup(); } auctionInfo.auctionSaleStartTime = timestamp; } function _verifySig(bytes memory _signature) private view returns (bool) { bytes32 hashVal = keccak256(abi.encodePacked(msg.sender)); bytes32 signedHash = hashVal.toEthSignedMessageHash(); address signingAddress = signedHash.recover(_signature); return signingAddress == _offchainSigner; } function withdraw() external { (bool sent, ) = WITHDRAW_ADDRESS.call{value: address(this).balance}(""); if (!sent) { revert WithdrawFailed(); } } // ----------- // Redeem bean // ----------- function redeemBeans(uint256[] calldata beanIds) external returns (uint256[] memory) { RedeemInfo memory info = redeemInfo; if (!info.redeemBeanOpen) { revert RedeemBeanNotOpen(); } return _redeemBeansImpl(msg.sender, beanIds, true, info.beanRedeemer); } function _redeemBeansImpl( address beanOwner, uint256[] memory beanIds, bool burnOwnerOrApprovedCheck, address beanRedeemer ) private returns (uint256[] memory) { for (uint256 i; i < beanIds.length; ) { _burn(beanIds[i], burnOwnerOrApprovedCheck); unchecked { ++i; } } return IBeanRedeemer(beanRedeemer).redeemBeans(beanOwner, beanIds); } function forceRedeemBeans(address beanOwner, uint256[] calldata beanIds) external onlyOwner returns (uint256[] memory) { for (uint256 i; i < beanIds.length; ) { if (ownerOf(beanIds[i]) != beanOwner) { revert ForceRedeemBeanOwnerMismatch(); } unchecked { ++i; } } return _redeemBeansImpl( beanOwner, beanIds, false, redeemInfo.beanRedeemer ); } function openRedeemBeanState() external onlyOwner { RedeemInfo memory info = redeemInfo; if (info.beanRedeemer == address(0)) { revert BeanRedeemerNotSet(); } redeemInfo = RedeemInfo(true, info.beanRedeemer); } function setBeanRedeemer(address contractAddress) external onlyOwner { redeemInfo = RedeemInfo(redeemInfo.redeemBeanOpen, contractAddress); } // -------------- // Allowlist mint // -------------- function allowlistMint() external payable { if (allowlistMintPrice == 0) { revert AllowlistMintNotOpen(); } uint256 amount = allowlistMintsAlloc[msg.sender]; uint256 totalCost = allowlistMintPrice * amount; if (msg.value < totalCost) { revert InsufficientFunds(); } if (_totalMinted() + amount > MAX_SUPPLY) { revert OverMaxSupply(); } allowlistMintsAlloc[msg.sender] = 0; _safeMint(msg.sender, amount); } function setAllowlistMintsAlloc( address[] calldata addresses, uint256[] calldata amounts ) external onlyOwner { if (addresses.length != amounts.length || addresses.length == 0) revert MismatchedArrays(); for (uint256 i; i < addresses.length; ) { allowlistMintsAlloc[addresses[i]] = amounts[i]; unchecked { ++i; } } } function setAllowlistMintPrice(uint256 price) external onlyOwner { allowlistMintPrice = price; } // ------------------- // Break transfer lock // ------------------- function breakTransferLock() external onlyOwner { initialTransferLockOn = false; } // -------- // Metadata // -------- function _baseURI() internal view override returns (string memory) { return _baseTokenURI; } function setBaseURI(string calldata baseURI) external onlyOwner { _baseTokenURI = baseURI; } // -------- // EIP-2981 // -------- function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); } function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) external onlyOwner { _setTokenRoyalty(tokenId, receiver, feeNumerator); } // --------------------------------------------------- // OperatorFilterer overrides (overrides, values etc.) // --------------------------------------------------- function setApprovalForAll(address operator, bool approved) public override(ERC721A) onlyAllowedOperatorApproval(operator) { if (initialTransferLockOn) revert InitialTransferLockOn(); super.setApprovalForAll(operator, approved); } function setOperatorFilteringEnabled(bool value) public onlyOwner { operatorFilteringEnabled = value; } function _operatorFilteringEnabled() internal view override returns (bool) { return operatorFilteringEnabled; } function approve(address operator, uint256 tokenId) public payable override(ERC721A) onlyAllowedOperatorApproval(operator) { if (initialTransferLockOn) revert InitialTransferLockOn(); super.approve(operator, tokenId); } // ERC721A calls transferFrom internally in its two safeTransferFrom functions, so we don't need to override those. function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } // -------------- // Registry check // -------------- function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal override { if (initialTransferLockOn && from != address(0) && to != address(0)) revert InitialTransferLockOn(); if (_isValidAgainstRegistry(msg.sender)) { super._beforeTokenTransfers(from, to, startTokenId, quantity); } else { revert NotAllowedByRegistry(); } } 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; } // ---------------------------------------------- // EIP-165 // ---------------------------------------------- function supportsInterface(bytes4 interfaceId) public view override(ERC721A, ERC2981) returns (bool) { return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } }
// 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.selector); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Returns whether the ownership slot at `index` is initialized. * An uninitialized slot does not necessarily mean that the slot has no owner. */ function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) { return _packedOwnerships[index] != 0; } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = _packedOwnerships[tokenId]; // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = _packedOwnerships[--tokenId]; } if (packed == 0) continue; if (packed & _BITMASK_BURNED == 0) return packed; // Otherwise, the token is burned, and we must revert. // This handles the case of batch burned tokens, where only the burned bit // of the starting slot is set, and remaining slots are left uninitialized. _revert(OwnerQueryForNonexistentToken.selector); } } // Otherwise, the data exists and we can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. // If the token is not burned, return `packed`. Otherwise, revert. if (packed & _BITMASK_BURNED == 0) return packed; } _revert(OwnerQueryForNonexistentToken.selector); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool result) { if (_startTokenId() <= tokenId) { if (tokenId < _currentIndex) { uint256 packed; while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId; result = packed & _BITMASK_BURNED == 0; } } } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS)); if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. from, // `from`. toMasked, // `to`. tokenId // `tokenId`. ) } if (toMasked == 0) _revert(TransferToZeroAddress.selector); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC721ReceiverImplementer.selector); } assembly { revert(add(32, reason), mload(reason)) } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) _revert(MintZeroQuantity.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); uint256 end = startTokenId + quantity; uint256 tokenId = startTokenId; do { assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } // The `!=` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. } while (++tokenId != end); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) _revert(MintToZeroAddress.selector); if (quantity == 0) _revert(MintZeroQuantity.selector); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) _revert(bytes4(0)); } } } /** * @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 && _msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { _revert(ApprovalCallerNotOwnerNorApproved.selector); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/BitMaps.sol) pragma solidity ^0.8.0; /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { struct BitMap { mapping(uint256 => 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: CC0-1.0 // Source: https://github.com/tubby-cats/dual-ownership-nft pragma solidity ^0.8.4; import '@openzeppelin/contracts/access/Ownable.sol'; abstract contract MultisigOwnable is Ownable { address public realOwner; constructor() { realOwner = msg.sender; } modifier onlyRealOwner() { require( realOwner == msg.sender, 'MultisigOwnable: caller is not the real owner' ); _; } function transferRealOwnership(address newRealOwner) public onlyRealOwner { realOwner = newRealOwner; } function transferLowerOwnership(address newOwner) public onlyRealOwner { transferOwnership(newOwner); } }
// 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 v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. 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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "ERC721A/=lib/ERC721A/contracts/", "closedsea/=lib/closedsea/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "erc721a-upgradeable/=lib/closedsea/lib/erc721a-upgradeable/contracts/", "erc721a/=lib/ERC721A/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/closedsea/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "operator-filter-registry/=lib/closedsea/", "solbase/=lib/solbase/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_azukiAddress","type":"address"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_totalPresaleAndAuctionSupply","type":"uint256"},{"internalType":"address payable","name":"_withdrawAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllowlistMintNotOpen","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"AuctionMintNotOpen","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BeanCannotBeClaimed","type":"error"},{"inputs":[],"name":"BeanRedeemerNotSet","type":"error"},{"inputs":[],"name":"ChunkAlreadyProcessed","type":"error"},{"inputs":[],"name":"ClaimWindowNotOpen","type":"error"},{"inputs":[],"name":"ForceRedeemBeanOwnerMismatch","type":"error"},{"inputs":[],"name":"InitialTransferLockOn","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidAuctionSetup","type":"error"},{"inputs":[],"name":"InvalidContractSetup","type":"error"},{"inputs":[],"name":"InvalidPresaleSetup","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MaxAuctionMintForAddress","type":"error"},{"inputs":[],"name":"MaxPresaleOrAuctionMintSupplyReached","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MintingTooMuchInPresale","type":"error"},{"inputs":[],"name":"MismatchedArrays","type":"error"},{"inputs":[],"name":"MismatchedTokenOwnerForClaim","type":"error"},{"inputs":[],"name":"NotAllowedByRegistry","type":"error"},{"inputs":[],"name":"OverMaxSupply","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PresaleNotOpen","type":"error"},{"inputs":[],"name":"RedeemBeanNotOpen","type":"error"},{"inputs":[],"name":"RefundFailed","type":"error"},{"inputs":[],"name":"RegistryNotSet","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"WithdrawFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"chunkNum","type":"uint256"}],"name":"AirdroppedChunk","type":"event"},{"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":"sourceAzukiId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"beanId","type":"uint256"}],"name":"ClaimedBean","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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":true,"internalType":"uint16","name":"amount","type":"uint16"}],"name":"PresaleMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"AZUKI","outputs":[{"internalType":"contract Azuki","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PER_ADDRESS_PUBLIC_MINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_BATCH_SIZE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_PRESALE_AND_AUCTION_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_ADDRESS","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"chunkNum","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowlistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"allowlistMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowlistMintsAlloc","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"auctionInfo","outputs":[{"internalType":"uint32","name":"auctionSaleStartTime","type":"uint32"},{"internalType":"uint64","name":"auctionStartPrice","type":"uint64"},{"internalType":"uint64","name":"auctionEndPrice","type":"uint64"},{"internalType":"uint32","name":"auctionPriceCurveLength","type":"uint32"},{"internalType":"uint32","name":"auctionDropInterval","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"amount","type":"uint8"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"auctionMint","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":"breakTransferLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"azukiTokenIds","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimBeanOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"beanOwner","type":"address"},{"internalType":"uint256[]","name":"beanIds","type":"uint256[]"}],"name":"forceRedeemBeans","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAuctionPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"azukiIds","type":"uint256[]"}],"name":"getCanClaims","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getNumAuctionMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numMintedInPresale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openRedeemBeanState","outputs":[],"stateMutability":"nonpayable","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":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleInfo","outputs":[{"internalType":"uint32","name":"presaleStartTime","type":"uint32"},{"internalType":"uint32","name":"presaleEndTime","type":"uint32"},{"internalType":"uint64","name":"presalePrice","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"},{"internalType":"uint16","name":"maxAllowedForPresaleForAddr","type":"uint16"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"presaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"privilegedMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"realOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"beanIds","type":"uint256[]"}],"name":"redeemBeans","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemInfo","outputs":[{"internalType":"bool","name":"redeemBeanOpen","type":"bool"},{"internalType":"address","name":"beanRedeemer","type":"address"}],"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":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setAllowlistMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"setAllowlistMintsAlloc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_startTime","type":"uint32"},{"internalType":"uint64","name":"_startPriceWei","type":"uint64"},{"internalType":"uint64","name":"_endPriceWei","type":"uint64"},{"internalType":"uint32","name":"_priceCurveNumSeconds","type":"uint32"},{"internalType":"uint32","name":"_dropIntervalNumSeconds","type":"uint32"}],"name":"setAuctionParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"timestamp","type":"uint32"}],"name":"setAuctionSaleStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setBeanRedeemer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"azukiIds","type":"uint256[]"}],"name":"setCanClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_claimBeanOpen","type":"bool"}],"name":"setClaimBeanState","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":"bool","name":"_isRegistryActive","type":"bool"}],"name":"setIsRegistryActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setOffchainSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setOperatorFilteringEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_presaleStartTime","type":"uint32"},{"internalType":"uint32","name":"_presaleEndTime","type":"uint32"},{"internalType":"uint64","name":"_presalePrice","type":"uint64"}],"name":"setPresaleParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registryAddress","type":"address"}],"name":"setRegistryAddress","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":"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":"totalPresaleAndAuctionMinted","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","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":"transferLowerOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRealOwner","type":"address"}],"name":"transferRealOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
610100604052600e805462ffffff60ff60b81b0119166101011790553480156200002857600080fd5b50604051620048de380380620048de8339810160408190526200004b916200024a565b6040518060400160405280600b81526020016a26bcb9ba32b93ca132b0b760a91b8152506040518060400160405280600581526020016426a122a0a760d91b815250620000a7620000a16200013e60201b60201c565b62000142565b600380546001600160a01b031916331790556006620000c7838262000340565b506007620000d6828262000340565b50600060045550506001600160a01b0380851660c05260a08490526080839052811660e0528282106200011c57604051634808530f60e11b815260040160405180910390fd5b6200012662000194565b5050600e805460ff19166001179055506200040c9050565b3390565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620001b5733cc6cdda760b79bafa08df41ecfa224f810dceb66001620001b7565b565b6001600160a01b0390911690637d3e3dbe81620001e75782620001e05750634420e486620001e7565b5063a0af29035b8060e01b60005230600452826024526004600060446000806daaeb6d7670e522a718067333cd4e5af162000227578060005160e01c036200022757600080fd5b5060006024525050565b6001600160a01b03811681146200024757600080fd5b50565b600080600080608085870312156200026157600080fd5b84516200026e8162000231565b8094505060208501519250604085015191506060850151620002908162000231565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002c657607f821691505b602082108103620002e757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200033b57600081815260208120601f850160051c81016020861015620003165750805b601f850160051c820191505b81811015620003375782815560010162000322565b5050505b505050565b81516001600160401b038111156200035c576200035c6200029b565b62000374816200036d8454620002b1565b84620002ed565b602080601f831160018114620003ac5760008415620003935750858301515b600019600386901b1c1916600185901b17855562000337565b600085815260208120601f198616915b82811015620003dd57888601518255948401946001909101908401620003bc565b5085821015620003fc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e051614459620004856000396000818161050a01526112b7015260008181610bf9015261179b0152600081816106c6015281816113b0015281816114ad0152818161170801528181611bbf015261208e0152600081816108f001528181611b71015261203d01526144596000f3fe6080604052600436106103ef5760003560e01c806370a0823111610208578063abd017ea11610118578063e985e9c5116100ab578063f49ed4e71161007a578063f49ed4e714610d14578063f80067df14610d2a578063f99de7a014610d57578063fb796e6c14610d77578063fe6b301314610d9157600080fd5b8063e985e9c514610c3b578063ed9aab5114610c84578063efe7aa4914610cab578063f2fde38b14610cf457600080fd5b8063c78461d7116100e7578063c78461d714610ba7578063c87b56dd14610bc7578063d2c8ed4c14610be7578063d684340914610c1b57600080fd5b8063abd017ea14610b3f578063adceef0714610b5f578063b7c0b8e814610b74578063b88d4fde14610b9457600080fd5b80638da5cb5b1161019b578063a22cb4651161016a578063a22cb46514610a93578063a2623f7514610ab3578063a73762b514610aec578063a9ba0b8714610b0c578063ab7b499314610b1f57600080fd5b80638da5cb5b14610a1f578063954b801714610a3d57806395d89b4114610a5e57806395fd95fc14610a7357600080fd5b80637809c6b1116101d75780637809c6b1146109b4578063788ca64c146109c75780637bcbf571146109f55780637fd147a414610a0a57600080fd5b806370a0823114610932578063715018a614610952578063731186eb1461096757806376cba7441461098757600080fd5b806332cb6b0c1161030357806346fff98d116102965780635944c753116102655780635944c7531461087e5780636352211e1461089e5780636ba4c138146108be5780636cd10ae2146108de5780636ebc56011461091257600080fd5b806346fff98d1461079a5780634bd25c6f146107ba57806355d64d03146107cf57806355f804b31461085e57600080fd5b80633ccfd60b116102d25780633ccfd60b1461074a57806341fbddbd1461075f5780634202d18d1461076757806342842e0e1461078757600080fd5b806332cb6b0c146106b457806333d66b5b146106e8578063364a5c001461070857806337dc95411461073557600080fd5b806312b365101161038657806323b872dd1161035557806323b872dd146105ae57806324846647146105c15780632a55205a146105ee5780632cff67701461062d5780632edf08691461064d57600080fd5b806312b365101461052c578063139e633e1461054b57806318160ddd1461056b5780631df270f31461058e57600080fd5b8063081812fc116103c2578063081812fc1461048d578063095ea7b3146104c557806309af3f9a146104d8578063122e04a8146104f857600080fd5b806301ffc9a7146103f457806304634d8d1461042957806304f81b111461044b57806306fdde031461046b575b600080fd5b34801561040057600080fd5b5061041461040f36600461378e565b610db1565b60405190151581526020015b60405180910390f35b34801561043557600080fd5b506104496104443660046137d7565b610dd1565b005b34801561045757600080fd5b5061044961046636600461380c565b610de7565b34801561047757600080fd5b50610480610e11565b6040516104209190613879565b34801561049957600080fd5b506104ad6104a836600461388c565b610ea3565b6040516001600160a01b039091168152602001610420565b6104496104d33660046138a5565b610ede565b3480156104e457600080fd5b506104496104f336600461380c565b610f2b565b34801561050457600080fd5b506104ad7f000000000000000000000000000000000000000000000000000000000000000081565b34801561053857600080fd5b50600e5461041490610100900460ff1681565b34801561055757600080fd5b5061044961056636600461380c565b610f6a565b34801561057757600080fd5b50600554600454035b604051908152602001610420565b34801561059a57600080fd5b506003546104ad906001600160a01b031681565b6104496105bc3660046138d1565b610fc3565b3480156105cd57600080fd5b506105e16105dc366004613956565b610ff9565b6040516104209190613997565b3480156105fa57600080fd5b5061060e6106093660046139dd565b6110aa565b604080516001600160a01b039093168352602083019190915201610420565b34801561063957600080fd5b5061044961064836600461380c565b611158565b34801561065957600080fd5b506011546106889063ffffffff80821691600160201b810490911690600160401b90046001600160401b031683565b6040805163ffffffff94851681529390921660208401526001600160401b031690820152606001610420565b3480156106c057600080fd5b506105807f000000000000000000000000000000000000000000000000000000000000000081565b3480156106f457600080fd5b50610449610703366004613956565b6111a4565b34801561071457600080fd5b506107286107233660046139ff565b6111eb565b6040516104209190613a8e565b34801561074157600080fd5b50610580600381565b34801561075657600080fd5b506104496112b3565b610449611347565b34801561077357600080fd5b50610449610782366004613aa1565b61141c565b6104496107953660046138d1565b6114f4565b3480156107a657600080fd5b506104496107b5366004613b1a565b61150f565b3480156107c657600080fd5b50610580611563565b3480156107db57600080fd5b5060135461081f9063ffffffff808216916001600160401b03600160201b8204811692600160601b830490911691600160a01b8104821691600160c01b9091041685565b6040805163ffffffff96871681526001600160401b0395861660208201529390941693830193909352831660608201529116608082015260a001610420565b34801561086a57600080fd5b50610449610879366004613b78565b6116a8565b34801561088a57600080fd5b50610449610899366004613bad565b6116bd565b3480156108aa57600080fd5b506104ad6108b936600461388c565b6116d0565b3480156108ca57600080fd5b506104496108d9366004613956565b6116db565b3480156108ea57600080fd5b506105807f000000000000000000000000000000000000000000000000000000000000000081565b34801561091e57600080fd5b5061044961092d366004613bff565b6118f1565b34801561093e57600080fd5b5061058061094d36600461380c565b6119cd565b34801561095e57600080fd5b50610449611a12565b34801561097357600080fd5b50610449610982366004613c1a565b611a26565b34801561099357600080fd5b506105806109a236600461380c565b60126020526000908152604090205481565b6104496109c2366004613c9f565b611aa1565b3480156109d357600080fd5b506010546109e29061ffff1681565b60405161ffff9091168152602001610420565b348015610a0157600080fd5b50610449611d2a565b348015610a1657600080fd5b50610449611d3f565b348015610a2b57600080fd5b506002546001600160a01b03166104ad565b348015610a4957600080fd5b50600e5461041490600160b81b900460ff1681565b348015610a6a57600080fd5b50610480611dd0565b348015610a7f57600080fd5b50610449610a8e366004613b1a565b611ddf565b348015610a9f57600080fd5b50610449610aae366004613cf3565b611e05565b348015610abf57600080fd5b50610580610ace36600461380c565b6001600160a01b031660009081526009602052604090205460c01c90565b348015610af857600080fd5b50610449610b07366004613d43565b611e4d565b610449610b1a366004613da8565b611f5b565b348015610b2b57600080fd5b50610449610b3a36600461380c565b61228a565b348015610b4b57600080fd5b50600e546104149062010000900460ff1681565b348015610b6b57600080fd5b50610580600a81565b348015610b8057600080fd5b50610449610b8f366004613b1a565b6122be565b610449610ba2366004613e3b565b6122d9565b348015610bb357600080fd5b50610728610bc2366004613956565b612314565b348015610bd357600080fd5b50610480610be236600461388c565b6123a3565b348015610bf357600080fd5b506104ad7f000000000000000000000000000000000000000000000000000000000000000081565b348015610c2757600080fd5b50610449610c3636600461388c565b61241e565b348015610c4757600080fd5b50610414610c56366004613efe565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b348015610c9057600080fd5b50600e546104ad90630100000090046001600160a01b031681565b348015610cb757600080fd5b50601554610cd59060ff81169061010090046001600160a01b031682565b6040805192151583526001600160a01b03909116602083015201610420565b348015610d0057600080fd5b50610449610d0f36600461380c565b61242b565b348015610d2057600080fd5b5061058060175481565b348015610d3657600080fd5b50610580610d4536600461380c565b60166020526000908152604090205481565b348015610d6357600080fd5b50610449610d72366004613aa1565b6124a1565b348015610d8357600080fd5b50600e546104149060ff1681565b348015610d9d57600080fd5b50610449610dac366004613f2c565b61254c565b6000610dbc82612636565b80610dcb5750610dcb82612684565b92915050565b610dd96126b9565b610de38282612713565b5050565b610def6126b9565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b606060068054610e2090613f66565b80601f0160208091040260200160405190810160405280929190818152602001828054610e4c90613f66565b8015610e995780601f10610e6e57610100808354040283529160200191610e99565b820191906000526020600020905b815481529060010190602001808311610e7c57829003601f168201915b5050505050905090565b6000610eae826127cd565b610ec257610ec26333d1c03960e21b612813565b506000908152600a60205260409020546001600160a01b031690565b81600e5460ff1615610ef357610ef38161281d565b600e54610100900460ff1615610f1c57604051630b95754760e31b815260040160405180910390fd5b610f268383612861565b505050565b6003546001600160a01b03163314610f5e5760405162461bcd60e51b8152600401610f5590613fa0565b60405180910390fd5b610f678161242b565b50565b610f726126b9565b604080518082019091526015805460ff811615158084526001600160a01b039490941660209093018390526001600160a81b031916610100600160a81b031990931692909217610100909102179055565b826001600160a01b0381163314610fe857600e5460ff1615610fe857610fe83361281d565b610ff384848461286d565b50505050565b60606000826001600160401b0381111561101557611015613df5565b60405190808252806020026020018201604052801561103e578160200160208202803683370190505b50905060005b838110156110a25761107885858381811061106157611061613fed565b90506020020135600f6129e590919063ffffffff16565b82828151811061108a5761108a613fed565b91151560209283029190910190910152600101611044565b509392505050565b60008281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161111f5750604080518082019091526000546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061113e906001600160601b031687614019565b6111489190614046565b91519350909150505b9250929050565b6003546001600160a01b031633146111825760405162461bcd60e51b8152600401610f5590613fa0565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6111ac6126b9565b60005b81811015610f26576111e38383838181106111cc576111cc613fed565b90506020020135600f612a0990919063ffffffff16565b6001016111af565b60606111f56126b9565b60005b8281101561125a57846001600160a01b031661122b85858481811061121f5761121f613fed565b905060200201356116d0565b6001600160a01b03161461125257604051631f382b5160e01b815260040160405180910390fd5b6001016111f8565b506112ab84848480806020026020016040519081016040528093929190818152602001838360200280828437600092018290525060155490935061010090046001600160a01b03169150612a329050565b949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03164760405160006040518083038185875af1925050503d8060008114611320576040519150601f19603f3d011682016040523d82523d6000602084013e611325565b606091505b5050905080610f6757604051631d42c86760e21b815260040160405180910390fd5b60175460000361136a57604051638438385160e01b815260040160405180910390fd5b3360009081526016602052604081205460175490919061138b908390614019565b9050803410156113ae5760405163356680b760e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000826113d960045490565b6113e3919061405a565b111561140257604051634c9c5c3360e11b815260040160405180910390fd5b33600081815260166020526040812055610de39083612aea565b6114246126b9565b8281141580611431575082155b1561144f5760405163a121188760e01b815260040160405180910390fd5b60005b838110156114aa576114a285858381811061146f5761146f613fed565b9050602002016020810190611484919061380c565b84848481811061149657611496613fed565b90506020020135612b04565b600101611452565b507f00000000000000000000000000000000000000000000000000000000000000006114d560045490565b1115610ff357604051634c9c5c3360e11b815260040160405180910390fd5b610f26838383604051806020016040528060008152506122d9565b6115176126b9565b600e54630100000090046001600160a01b031661154757604051630e048e7160e41b815260040160405180910390fd5b600e8054911515620100000262ff000019909216919091179055565b6040805160a08101825260135463ffffffff8082168084526001600160401b03600160201b840481166020860152600160601b84041694840194909452600160a01b820481166060840152600160c01b9091041660808201526000914210156115d857602001516001600160401b0316919050565b6060810151815163ffffffff918216916115f391164261406d565b1061160a57604001516001600160401b0316919050565b6000816080015163ffffffff16826000015163ffffffff164261162d919061406d565b6116379190614046565b905060008260800151836060015161164f9190614080565b63ffffffff168360400151846020015161166991906140a3565b61167391906140ca565b6001600160401b031690506116888183614019565b83602001516001600160401b03166116a0919061406d565b935050505090565b6116b06126b9565b6018610f26828483614132565b6116c56126b9565b610f26838383612b59565b6000610dcb82612c24565b600e54600160b81b900460ff16611705576040516309ca1d3560e11b815260040160405180910390fd5b807f00000000000000000000000000000000000000000000000000000000000000008161173160045490565b61173b919061405a565b111561175a57604051634c9c5c3360e11b815260040160405180910390fd5b600061176560045490565b905060005b828110156118e657600085858381811061178657611786613fed565b905060200201359050336001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636352211e836040518263ffffffff1660e01b81526004016117e791815260200190565b602060405180830381865afa158015611804573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182891906141f1565b6001600160a01b03161461184f5760405163242e855d60e11b815260040160405180910390fd5b600881901c6000908152600f6020526040902054600160ff83161b1661188857604051635366f67d60e11b815260040160405180910390fd5b600881901c6000908152600f602052604090208054600160ff84161b191690556118b2828461405a565b60405182907fe2301216b3a6988694011d9b19d84b3171cb7166636ac0bee7ea70ccde950f7e90600090a35060010161176a565b50610ff33383612cba565b6118f96126b9565b6040805160a08101825260135463ffffffff80821683526001600160401b03600160201b830481166020850152600160601b83041693830193909352600160a01b810483166060830152600160c01b90048216608082015290821615801590611992575060208101516001600160401b0316158061197f5750606081015163ffffffff16155b806119925750608081015163ffffffff16155b156119b057604051630b21892f60e11b815260040160405180910390fd5b506013805463ffffffff191663ffffffff92909216919091179055565b60006001600160a01b0382166119ed576119ed6323d3ad8160e21b612813565b506001600160a01b03166000908152600960205260409020546001600160401b031690565b611a1a6126b9565b611a246000612d2f565b565b611a2e6126b9565b611a39600c82612d81565b15611a5757604051639acc88ef60e01b815260040160405180910390fd5b611a62600c82612d99565b50611a6f8585858561141c565b60405181907f413cafed652c0749798b60dc0fc27072e4370c1e64b5074b303140f24ccc78fe90600090a25050505050565b6040805160608101825260115463ffffffff808216808452600160201b83049091166020840152600160401b9091046001600160401b031692820192909252901580611af35750805163ffffffff1642105b80611b085750806020015163ffffffff164210155b15611b2657604051637963e2b560e01b815260040160405180910390fd5b33600090815260126020526040902054611b448161ffff871661406d565b8661ffff161115611b6857604051630b39b31760e11b815260040160405180910390fd5b60105461ffff167f0000000000000000000000000000000000000000000000000000000000000000611b9a828961420e565b61ffff161115611bbd576040516314231de560e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000008761ffff16611bec60045490565b611bf6919061405a565b1115611c1557604051634c9c5c3360e11b815260040160405180910390fd5b611c56878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612da592505050565b611c7357604051638baa579f60e01b815260040160405180910390fd5b60008761ffff1684604001516001600160401b0316611c929190614019565b905080341015611cb55760405163356680b760e01b815260040160405180910390fd5b33600081815260126020526040902061ffff8a81168681019092556010805461ffff1916868d01909216919091179055611cef9190612b04565b60405161ffff89169033907f0389e698beae4e95f3527cf960f0140615c9c3db399008f23fcc79f61853d91090600090a35050505050505050565b611d326126b9565b600e805461ff0019169055565b611d476126b9565b6040805180820190915260155460ff81161515825261010090046001600160a01b031660208201819052611d8e57604051630296fadb60e51b815260040160405180910390fd5b6040805180820190915260018082526020928301516001600160a01b031692909101829052601580546001600160a81b03191661010090930292909217179055565b606060078054610e2090613f66565b611de76126b9565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b81600e5460ff1615611e1a57611e1a8161281d565b600e54610100900460ff1615611e4357604051630b95754760e31b815260040160405180910390fd5b610f268383612e5c565b611e556126b9565b63ffffffff851615801590611e8e57506001600160401b0384161580611e7f575063ffffffff8216155b80611e8e575063ffffffff8116155b15611eac57604051630b21892f60e11b815260040160405180910390fd5b6040805160a08101825263ffffffff9687168082526001600160401b03968716602083018190529590961691810182905292861660608401819052919095166080909201829052601380546001600160601b031916909417600160201b909302929092176bffffffffffffffffffffffff60601b1916600160601b90940263ffffffff60a01b191693909317600160a01b9091021763ffffffff60c01b1916600160c01b909202919091179055565b323314611faa5760405162461bcd60e51b815260206004820152601e60248201527f5468652063616c6c657220697320616e6f7468657220636f6e747261637400006044820152606401610f55565b6040805160a08101825260135463ffffffff8082168084526001600160401b03600160201b840481166020860152600160601b84041694840194909452600160a01b820481166060840152600160c01b9091041660808201529015806120165750805163ffffffff1642105b1561203457604051635ccb0f5960e01b815260040160405180910390fd5b60105461ffff167f00000000000000000000000000000000000000000000000000000000000000006120698260ff881661420e565b61ffff16111561208c576040516314231de560e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000008560ff166120ba60045490565b6120c4919061405a565b11156120e357604051634c9c5c3360e11b815260040160405180910390fd5b3360009081526009602052604090205460c01c600361210560ff88168361405a565b111561212457604051639e3ef52560e01b815260040160405180910390fd5b61216385858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612ec892505050565b61218057604051638baa579f60e01b815260040160405180910390fd5b60008660ff1661218e611563565b6121989190614019565b9050803410156121bb5760405163356680b760e01b815260040160405180910390fd5b33600090815260096020526040902080546001600160c01b031660ff8916840160c01b1790556010805461ffff191660ff891685810161ffff1691909117909155612207903390612f5f565b803411156122815760003361221c833461406d565b604051600081818185875af1925050503d8060008114612258576040519150601f19603f3d011682016040523d82523d6000602084013e61225d565b606091505b505090508061227f57604051633c31275160e21b815260040160405180910390fd5b505b50505050505050565b6122926126b9565b600e80546001600160a01b039092166301000000026301000000600160b81b0319909216919091179055565b6122c66126b9565b600e805460ff1916911515919091179055565b6122e4848484610fc3565b6001600160a01b0383163b15610ff3576123008484848461302b565b610ff357610ff36368d2bf6b60e11b612813565b6040805180820190915260155460ff811615158083526101009091046001600160a01b031660208301526060919061235f576040516372a58b2b60e11b815260040160405180910390fd5b6112ab338585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050602085015160019150612a32565b60606123ae826127cd565b6123c2576123c2630a14c4b560e41b612813565b60006123cc61310a565b905080516000036123ec5760405180602001604052806000815250612417565b806123f684613119565b604051602001612407929190614229565b6040516020818303038152906040525b9392505050565b6124266126b9565b601755565b6124336126b9565b6001600160a01b0381166124985760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f55565b610f6781612d2f565b6124a96126b9565b82811415806124b6575082155b156124d45760405163a121188760e01b815260040160405180910390fd5b60005b83811015612545578282828181106124f1576124f1613fed565b905060200201356016600087878581811061250e5761250e613fed565b9050602002016020810190612523919061380c565b6001600160a01b031681526020810191909152604001600020556001016124d7565b5050505050565b6125546126b9565b63ffffffff8316158061256b575063ffffffff8216155b8061257d57506001600160401b038116155b1561259b57604051638299f4c360e01b815260040160405180910390fd5b8163ffffffff168363ffffffff16106125c757604051638299f4c360e01b815260040160405180910390fd5b6040805160608101825263ffffffff94851680825293909416602085018190526001600160401b039290921693018390526011805467ffffffffffffffff1916909217600160201b909102176fffffffffffffffff00000000000000001916600160401b909202919091179055565b60006301ffc9a760e01b6001600160e01b03198316148061266757506380ac58cd60e01b6001600160e01b03198316145b80610dcb5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610dcb57506301ffc9a760e01b6001600160e01b0319831614610dcb565b6002546001600160a01b03163314611a245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f55565b6127106001600160601b038216111561273e5760405162461bcd60e51b8152600401610f5590614258565b6001600160a01b0382166127945760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610f55565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600055565b600060045482101561280e5760005b5060008281526008602052604081205490819003612804576127fd836142a2565b92506127dc565b600160e01b161590505b919050565b8060005260046000fd5b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa612859573d6000803e3d6000fd5b6000603a5250565b610de38282600161315d565b600061287882612c24565b6001600160a01b03948516949091508116841461289e5761289e62a1148160e81b612813565b6000828152600a6020526040902080546128ca8187335b6001600160a01b039081169116811491141790565b6128ec576128d88633610c56565b6128ec576128ec632ce44b5f60e11b612813565b6128f98686866001613200565b801561290457600082555b6001600160a01b038681166000908152600960205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260086020526040812091909155600160e11b84169003612996576001840160008181526008602052604081205490036129945760045481146129945760008181526008602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4806000036129e0576129e0633a954ecd60e21b612813565b612281565b600881901c600090815260208390526040902054600160ff83161b16151592915050565b600881901c600090815260209290925260409091208054600160ff9093169290921b9091179055565b606060005b8451811015612a6b57612a63858281518110612a5557612a55613fed565b602002602001015185613277565b600101612a37565b506040516301a8875f60e71b81526001600160a01b0383169063d443af8090612a9a90889088906004016142b9565b6000604051808303816000875af1158015612ab9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ae191908101906142dd565b95945050505050565b610de38282604051806020016040528060008152506133c7565b6000612b11600a83614046565b905060005b81811015612b3157612b2984600a612f5f565b600101612b16565b506000612b3f600a84614382565b1115610f2657610f2683612b54600a85614382565b612f5f565b6127106001600160601b0382161115612b845760405162461bcd60e51b8152600401610f5590614258565b6001600160a01b038216612bda5760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606401610f55565b6040805180820182526001600160a01b0393841681526001600160601b0392831660208083019182526000968752600190529190942093519051909116600160a01b029116179055565b60008181526008602052604081205490819003612c97576004548210612c5457612c54636f96cda160e11b612813565b5b50600019016000818152600860205260409020548015612c5557600160e01b8116600003612c8257919050565b612c92636f96cda160e11b612813565b612c55565b600160e01b8116600003612caa57919050565b61280e636f96cda160e11b612813565b6000612cc7600a83614046565b905060005b81811015612cf757612cef84600a604051806020016040528060008152506133c7565b600101612ccc565b506000612d05600a84614382565b1115610f2657610f2683612d1a600a85614382565b604051806020016040528060008152506133c7565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008181526001830160205260408120541515612417565b60006124178383613429565b6040516001600160f01b031960f085811b821660208401526001600160601b03193360601b16602284015284901b16603682015260009081906038016040516020818303038152906040528051906020012090506000612e32827f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506000612e408286613478565b6014546001600160a01b03908116911614979650505050505050565b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6040516001600160601b03193360601b16602082015260009081906034016040516020818303038152906040528051906020012090506000612f37827f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506000612f458286613478565b6014546001600160a01b0391821691161495945050505050565b6004546000829003612f7b57612f7b63b562e8dd60e01b612813565b612f886000848385613200565b60008181526008602090815260408083206001600160a01b0387164260a01b6001881460e11b17811790915580845260099092528220805468010000000000000001860201905590819003612fe657612fe6622e076360e81b612813565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103612feb575060045550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613060903390899088908890600401614396565b6020604051808303816000875af192505050801561309b575060408051601f3d908101601f19168201909252613098918101906143d3565b60015b6130f0573d8080156130c9576040519150601f19603f3d011682016040523d82523d6000602084013e6130ce565b606091505b5080516000036130e8576130e86368d2bf6b60e11b612813565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506112ab565b606060188054610e2090613f66565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806131335750819003601f19909101908152919050565b6000613168836116d0565b90508180156131805750336001600160a01b03821614155b156131a35761318f8133610c56565b6131a3576131a36367d9dca160e11b612813565b6000838152600a602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b600e54610100900460ff16801561321f57506001600160a01b03841615155b801561323357506001600160a01b03831615155b1561325157604051630b95754760e31b815260040160405180910390fd5b61325a33613494565b610ff3576040516326406c5f60e11b815260040160405180910390fd5b600061328283612c24565b9050806000806132a0866000908152600a6020526040902080549091565b9150915084156132d7576132b58184336128b5565b6132d7576132c38333610c56565b6132d7576132d7632ce44b5f60e11b612813565b6132e5836000886001613200565b80156132f057600082555b6001600160a01b038316600081815260096020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260086020526040812091909155600160e11b8516900361337e5760018601600081815260086020526040812054900361337c57600454811461337c5760008181526008602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060058054600101905550505050565b6133d18383612f5f565b6001600160a01b0383163b15610f26576004548281035b6133fb600086838060010194508661302b565b61340f5761340f6368d2bf6b60e11b612813565b8181106133e8578160045414612545576125456000612813565b600081815260018301602052604081205461347057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610dcb565b506000610dcb565b60008060006134878585613528565b915091506110a28161356a565b600e5460009062010000900460ff161561352057600e546040516370c5e04560e11b81526001600160a01b038481166004830152630100000090920490911690819063e18bc08a90602401602060405180830381865afa1580156134fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061241791906143f0565b506001919050565b600080825160410361355e5760208301516040840151606085015160001a613552878285856136b4565b94509450505050611151565b50600090506002611151565b600081600481111561357e5761357e61440d565b036135865750565b600181600481111561359a5761359a61440d565b036135e75760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610f55565b60028160048111156135fb576135fb61440d565b036136485760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610f55565b600381600481111561365c5761365c61440d565b03610f675760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610f55565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156136eb575060009050600361376f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561373f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166137685760006001925092505061376f565b9150600090505b94509492505050565b6001600160e01b031981168114610f6757600080fd5b6000602082840312156137a057600080fd5b813561241781613778565b6001600160a01b0381168114610f6757600080fd5b80356001600160601b038116811461280e57600080fd5b600080604083850312156137ea57600080fd5b82356137f5816137ab565b9150613803602084016137c0565b90509250929050565b60006020828403121561381e57600080fd5b8135612417816137ab565b60005b8381101561384457818101518382015260200161382c565b50506000910152565b60008151808452613865816020860160208601613829565b601f01601f19169290920160200192915050565b602081526000612417602083018461384d565b60006020828403121561389e57600080fd5b5035919050565b600080604083850312156138b857600080fd5b82356138c3816137ab565b946020939093013593505050565b6000806000606084860312156138e657600080fd5b83356138f1816137ab565b92506020840135613901816137ab565b929592945050506040919091013590565b60008083601f84011261392457600080fd5b5081356001600160401b0381111561393b57600080fd5b6020830191508360208260051b850101111561115157600080fd5b6000806020838503121561396957600080fd5b82356001600160401b0381111561397f57600080fd5b61398b85828601613912565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156139d15783511515835292840192918401916001016139b3565b50909695505050505050565b600080604083850312156139f057600080fd5b50508035926020909101359150565b600080600060408486031215613a1457600080fd5b8335613a1f816137ab565b925060208401356001600160401b03811115613a3a57600080fd5b613a4686828701613912565b9497909650939450505050565b600081518084526020808501945080840160005b83811015613a8357815187529582019590820190600101613a67565b509495945050505050565b6020815260006124176020830184613a53565b60008060008060408587031215613ab757600080fd5b84356001600160401b0380821115613ace57600080fd5b613ada88838901613912565b90965094506020870135915080821115613af357600080fd5b50613b0087828801613912565b95989497509550505050565b8015158114610f6757600080fd5b600060208284031215613b2c57600080fd5b813561241781613b0c565b60008083601f840112613b4957600080fd5b5081356001600160401b03811115613b6057600080fd5b60208301915083602082850101111561115157600080fd5b60008060208385031215613b8b57600080fd5b82356001600160401b03811115613ba157600080fd5b61398b85828601613b37565b600080600060608486031215613bc257600080fd5b833592506020840135613bd4816137ab565b9150613be2604085016137c0565b90509250925092565b803563ffffffff8116811461280e57600080fd5b600060208284031215613c1157600080fd5b61241782613beb565b600080600080600060608688031215613c3257600080fd5b85356001600160401b0380821115613c4957600080fd5b613c5589838a01613912565b90975095506020880135915080821115613c6e57600080fd5b50613c7b88828901613912565b96999598509660400135949350505050565b803561ffff8116811461280e57600080fd5b60008060008060608587031215613cb557600080fd5b613cbe85613c8d565b9350613ccc60208601613c8d565b925060408501356001600160401b03811115613ce757600080fd5b613b0087828801613b37565b60008060408385031215613d0657600080fd5b8235613d11816137ab565b91506020830135613d2181613b0c565b809150509250929050565b80356001600160401b038116811461280e57600080fd5b600080600080600060a08688031215613d5b57600080fd5b613d6486613beb565b9450613d7260208701613d2c565b9350613d8060408701613d2c565b9250613d8e60608701613beb565b9150613d9c60808701613beb565b90509295509295909350565b600080600060408486031215613dbd57600080fd5b833560ff81168114613dce57600080fd5b925060208401356001600160401b03811115613de957600080fd5b613a4686828701613b37565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613e3357613e33613df5565b604052919050565b60008060008060808587031215613e5157600080fd5b8435613e5c816137ab565b9350602085810135613e6d816137ab565b93506040860135925060608601356001600160401b0380821115613e9057600080fd5b818801915088601f830112613ea457600080fd5b813581811115613eb657613eb6613df5565b613ec8601f8201601f19168501613e0b565b91508082528984828501011115613ede57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008060408385031215613f1157600080fd5b8235613f1c816137ab565b91506020830135613d21816137ab565b600080600060608486031215613f4157600080fd5b613f4a84613beb565b9250613f5860208501613beb565b9150613be260408501613d2c565b600181811c90821680613f7a57607f821691505b602082108103613f9a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4d756c74697369674f776e61626c653a2063616c6c6572206973206e6f74207460408201526c3432903932b0b61037bbb732b960991b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610dcb57610dcb614003565b634e487b7160e01b600052601260045260246000fd5b60008261405557614055614030565b500490565b80820180821115610dcb57610dcb614003565b81810381811115610dcb57610dcb614003565b600063ffffffff8084168061409757614097614030565b92169190910492915050565b6001600160401b038281168282160390808211156140c3576140c3614003565b5092915050565b60006001600160401b038084168061409757614097614030565b601f821115610f2657600081815260208120601f850160051c8101602086101561410b5750805b601f850160051c820191505b8181101561412a57828155600101614117565b505050505050565b6001600160401b0383111561414957614149613df5565b61415d836141578354613f66565b836140e4565b6000601f84116001811461419157600085156141795750838201355b600019600387901b1c1916600186901b178355612545565b600083815260209020601f19861690835b828110156141c257868501358255602094850194600190920191016141a2565b50868210156141df5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006020828403121561420357600080fd5b8151612417816137ab565b61ffff8181168382160190808211156140c3576140c3614003565b6000835161423b818460208801613829565b83519083019061424f818360208801613829565b01949350505050565b6020808252602a908201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646040820152692073616c65507269636560b01b606082015260800190565b6000816142b1576142b1614003565b506000190190565b6001600160a01b03831681526040602082018190526000906112ab90830184613a53565b600060208083850312156142f057600080fd5b82516001600160401b038082111561430757600080fd5b818501915085601f83011261431b57600080fd5b81518181111561432d5761432d613df5565b8060051b915061433e848301613e0b565b818152918301840191848101908884111561435857600080fd5b938501935b838510156143765784518252938501939085019061435d565b98975050505050505050565b60008261439157614391614030565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906143c99083018461384d565b9695505050505050565b6000602082840312156143e557600080fd5b815161241781613778565b60006020828403121561440257600080fd5b815161241781613b0c565b634e487b7160e01b600052602160045260246000fdfea264697066735822122099bbedd90deb5d677fd5b1a7f2952da95a5a3bda2cb0266ff2fbe96bd376225164736f6c63430008120033000000000000000000000000ed5af388653567af2f388e6224dc7c4b3241c5440000000000000000000000000000000000000000000000000000000000004e2000000000000000000000000000000000000000000000000000000000000027100000000000000000000000002ae6b0630ebb4d155c6e04fcb16840ffa77760aa
Deployed Bytecode
0x6080604052600436106103ef5760003560e01c806370a0823111610208578063abd017ea11610118578063e985e9c5116100ab578063f49ed4e71161007a578063f49ed4e714610d14578063f80067df14610d2a578063f99de7a014610d57578063fb796e6c14610d77578063fe6b301314610d9157600080fd5b8063e985e9c514610c3b578063ed9aab5114610c84578063efe7aa4914610cab578063f2fde38b14610cf457600080fd5b8063c78461d7116100e7578063c78461d714610ba7578063c87b56dd14610bc7578063d2c8ed4c14610be7578063d684340914610c1b57600080fd5b8063abd017ea14610b3f578063adceef0714610b5f578063b7c0b8e814610b74578063b88d4fde14610b9457600080fd5b80638da5cb5b1161019b578063a22cb4651161016a578063a22cb46514610a93578063a2623f7514610ab3578063a73762b514610aec578063a9ba0b8714610b0c578063ab7b499314610b1f57600080fd5b80638da5cb5b14610a1f578063954b801714610a3d57806395d89b4114610a5e57806395fd95fc14610a7357600080fd5b80637809c6b1116101d75780637809c6b1146109b4578063788ca64c146109c75780637bcbf571146109f55780637fd147a414610a0a57600080fd5b806370a0823114610932578063715018a614610952578063731186eb1461096757806376cba7441461098757600080fd5b806332cb6b0c1161030357806346fff98d116102965780635944c753116102655780635944c7531461087e5780636352211e1461089e5780636ba4c138146108be5780636cd10ae2146108de5780636ebc56011461091257600080fd5b806346fff98d1461079a5780634bd25c6f146107ba57806355d64d03146107cf57806355f804b31461085e57600080fd5b80633ccfd60b116102d25780633ccfd60b1461074a57806341fbddbd1461075f5780634202d18d1461076757806342842e0e1461078757600080fd5b806332cb6b0c146106b457806333d66b5b146106e8578063364a5c001461070857806337dc95411461073557600080fd5b806312b365101161038657806323b872dd1161035557806323b872dd146105ae57806324846647146105c15780632a55205a146105ee5780632cff67701461062d5780632edf08691461064d57600080fd5b806312b365101461052c578063139e633e1461054b57806318160ddd1461056b5780631df270f31461058e57600080fd5b8063081812fc116103c2578063081812fc1461048d578063095ea7b3146104c557806309af3f9a146104d8578063122e04a8146104f857600080fd5b806301ffc9a7146103f457806304634d8d1461042957806304f81b111461044b57806306fdde031461046b575b600080fd5b34801561040057600080fd5b5061041461040f36600461378e565b610db1565b60405190151581526020015b60405180910390f35b34801561043557600080fd5b506104496104443660046137d7565b610dd1565b005b34801561045757600080fd5b5061044961046636600461380c565b610de7565b34801561047757600080fd5b50610480610e11565b6040516104209190613879565b34801561049957600080fd5b506104ad6104a836600461388c565b610ea3565b6040516001600160a01b039091168152602001610420565b6104496104d33660046138a5565b610ede565b3480156104e457600080fd5b506104496104f336600461380c565b610f2b565b34801561050457600080fd5b506104ad7f0000000000000000000000002ae6b0630ebb4d155c6e04fcb16840ffa77760aa81565b34801561053857600080fd5b50600e5461041490610100900460ff1681565b34801561055757600080fd5b5061044961056636600461380c565b610f6a565b34801561057757600080fd5b50600554600454035b604051908152602001610420565b34801561059a57600080fd5b506003546104ad906001600160a01b031681565b6104496105bc3660046138d1565b610fc3565b3480156105cd57600080fd5b506105e16105dc366004613956565b610ff9565b6040516104209190613997565b3480156105fa57600080fd5b5061060e6106093660046139dd565b6110aa565b604080516001600160a01b039093168352602083019190915201610420565b34801561063957600080fd5b5061044961064836600461380c565b611158565b34801561065957600080fd5b506011546106889063ffffffff80821691600160201b810490911690600160401b90046001600160401b031683565b6040805163ffffffff94851681529390921660208401526001600160401b031690820152606001610420565b3480156106c057600080fd5b506105807f0000000000000000000000000000000000000000000000000000000000004e2081565b3480156106f457600080fd5b50610449610703366004613956565b6111a4565b34801561071457600080fd5b506107286107233660046139ff565b6111eb565b6040516104209190613a8e565b34801561074157600080fd5b50610580600381565b34801561075657600080fd5b506104496112b3565b610449611347565b34801561077357600080fd5b50610449610782366004613aa1565b61141c565b6104496107953660046138d1565b6114f4565b3480156107a657600080fd5b506104496107b5366004613b1a565b61150f565b3480156107c657600080fd5b50610580611563565b3480156107db57600080fd5b5060135461081f9063ffffffff808216916001600160401b03600160201b8204811692600160601b830490911691600160a01b8104821691600160c01b9091041685565b6040805163ffffffff96871681526001600160401b0395861660208201529390941693830193909352831660608201529116608082015260a001610420565b34801561086a57600080fd5b50610449610879366004613b78565b6116a8565b34801561088a57600080fd5b50610449610899366004613bad565b6116bd565b3480156108aa57600080fd5b506104ad6108b936600461388c565b6116d0565b3480156108ca57600080fd5b506104496108d9366004613956565b6116db565b3480156108ea57600080fd5b506105807f000000000000000000000000000000000000000000000000000000000000271081565b34801561091e57600080fd5b5061044961092d366004613bff565b6118f1565b34801561093e57600080fd5b5061058061094d36600461380c565b6119cd565b34801561095e57600080fd5b50610449611a12565b34801561097357600080fd5b50610449610982366004613c1a565b611a26565b34801561099357600080fd5b506105806109a236600461380c565b60126020526000908152604090205481565b6104496109c2366004613c9f565b611aa1565b3480156109d357600080fd5b506010546109e29061ffff1681565b60405161ffff9091168152602001610420565b348015610a0157600080fd5b50610449611d2a565b348015610a1657600080fd5b50610449611d3f565b348015610a2b57600080fd5b506002546001600160a01b03166104ad565b348015610a4957600080fd5b50600e5461041490600160b81b900460ff1681565b348015610a6a57600080fd5b50610480611dd0565b348015610a7f57600080fd5b50610449610a8e366004613b1a565b611ddf565b348015610a9f57600080fd5b50610449610aae366004613cf3565b611e05565b348015610abf57600080fd5b50610580610ace36600461380c565b6001600160a01b031660009081526009602052604090205460c01c90565b348015610af857600080fd5b50610449610b07366004613d43565b611e4d565b610449610b1a366004613da8565b611f5b565b348015610b2b57600080fd5b50610449610b3a36600461380c565b61228a565b348015610b4b57600080fd5b50600e546104149062010000900460ff1681565b348015610b6b57600080fd5b50610580600a81565b348015610b8057600080fd5b50610449610b8f366004613b1a565b6122be565b610449610ba2366004613e3b565b6122d9565b348015610bb357600080fd5b50610728610bc2366004613956565b612314565b348015610bd357600080fd5b50610480610be236600461388c565b6123a3565b348015610bf357600080fd5b506104ad7f000000000000000000000000ed5af388653567af2f388e6224dc7c4b3241c54481565b348015610c2757600080fd5b50610449610c3636600461388c565b61241e565b348015610c4757600080fd5b50610414610c56366004613efe565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205460ff1690565b348015610c9057600080fd5b50600e546104ad90630100000090046001600160a01b031681565b348015610cb757600080fd5b50601554610cd59060ff81169061010090046001600160a01b031682565b6040805192151583526001600160a01b03909116602083015201610420565b348015610d0057600080fd5b50610449610d0f36600461380c565b61242b565b348015610d2057600080fd5b5061058060175481565b348015610d3657600080fd5b50610580610d4536600461380c565b60166020526000908152604090205481565b348015610d6357600080fd5b50610449610d72366004613aa1565b6124a1565b348015610d8357600080fd5b50600e546104149060ff1681565b348015610d9d57600080fd5b50610449610dac366004613f2c565b61254c565b6000610dbc82612636565b80610dcb5750610dcb82612684565b92915050565b610dd96126b9565b610de38282612713565b5050565b610def6126b9565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b606060068054610e2090613f66565b80601f0160208091040260200160405190810160405280929190818152602001828054610e4c90613f66565b8015610e995780601f10610e6e57610100808354040283529160200191610e99565b820191906000526020600020905b815481529060010190602001808311610e7c57829003601f168201915b5050505050905090565b6000610eae826127cd565b610ec257610ec26333d1c03960e21b612813565b506000908152600a60205260409020546001600160a01b031690565b81600e5460ff1615610ef357610ef38161281d565b600e54610100900460ff1615610f1c57604051630b95754760e31b815260040160405180910390fd5b610f268383612861565b505050565b6003546001600160a01b03163314610f5e5760405162461bcd60e51b8152600401610f5590613fa0565b60405180910390fd5b610f678161242b565b50565b610f726126b9565b604080518082019091526015805460ff811615158084526001600160a01b039490941660209093018390526001600160a81b031916610100600160a81b031990931692909217610100909102179055565b826001600160a01b0381163314610fe857600e5460ff1615610fe857610fe83361281d565b610ff384848461286d565b50505050565b60606000826001600160401b0381111561101557611015613df5565b60405190808252806020026020018201604052801561103e578160200160208202803683370190505b50905060005b838110156110a25761107885858381811061106157611061613fed565b90506020020135600f6129e590919063ffffffff16565b82828151811061108a5761108a613fed565b91151560209283029190910190910152600101611044565b509392505050565b60008281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161111f5750604080518082019091526000546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061113e906001600160601b031687614019565b6111489190614046565b91519350909150505b9250929050565b6003546001600160a01b031633146111825760405162461bcd60e51b8152600401610f5590613fa0565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6111ac6126b9565b60005b81811015610f26576111e38383838181106111cc576111cc613fed565b90506020020135600f612a0990919063ffffffff16565b6001016111af565b60606111f56126b9565b60005b8281101561125a57846001600160a01b031661122b85858481811061121f5761121f613fed565b905060200201356116d0565b6001600160a01b03161461125257604051631f382b5160e01b815260040160405180910390fd5b6001016111f8565b506112ab84848480806020026020016040519081016040528093929190818152602001838360200280828437600092018290525060155490935061010090046001600160a01b03169150612a329050565b949350505050565b60007f0000000000000000000000002ae6b0630ebb4d155c6e04fcb16840ffa77760aa6001600160a01b03164760405160006040518083038185875af1925050503d8060008114611320576040519150601f19603f3d011682016040523d82523d6000602084013e611325565b606091505b5050905080610f6757604051631d42c86760e21b815260040160405180910390fd5b60175460000361136a57604051638438385160e01b815260040160405180910390fd5b3360009081526016602052604081205460175490919061138b908390614019565b9050803410156113ae5760405163356680b760e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000004e20826113d960045490565b6113e3919061405a565b111561140257604051634c9c5c3360e11b815260040160405180910390fd5b33600081815260166020526040812055610de39083612aea565b6114246126b9565b8281141580611431575082155b1561144f5760405163a121188760e01b815260040160405180910390fd5b60005b838110156114aa576114a285858381811061146f5761146f613fed565b9050602002016020810190611484919061380c565b84848481811061149657611496613fed565b90506020020135612b04565b600101611452565b507f0000000000000000000000000000000000000000000000000000000000004e206114d560045490565b1115610ff357604051634c9c5c3360e11b815260040160405180910390fd5b610f26838383604051806020016040528060008152506122d9565b6115176126b9565b600e54630100000090046001600160a01b031661154757604051630e048e7160e41b815260040160405180910390fd5b600e8054911515620100000262ff000019909216919091179055565b6040805160a08101825260135463ffffffff8082168084526001600160401b03600160201b840481166020860152600160601b84041694840194909452600160a01b820481166060840152600160c01b9091041660808201526000914210156115d857602001516001600160401b0316919050565b6060810151815163ffffffff918216916115f391164261406d565b1061160a57604001516001600160401b0316919050565b6000816080015163ffffffff16826000015163ffffffff164261162d919061406d565b6116379190614046565b905060008260800151836060015161164f9190614080565b63ffffffff168360400151846020015161166991906140a3565b61167391906140ca565b6001600160401b031690506116888183614019565b83602001516001600160401b03166116a0919061406d565b935050505090565b6116b06126b9565b6018610f26828483614132565b6116c56126b9565b610f26838383612b59565b6000610dcb82612c24565b600e54600160b81b900460ff16611705576040516309ca1d3560e11b815260040160405180910390fd5b807f0000000000000000000000000000000000000000000000000000000000004e208161173160045490565b61173b919061405a565b111561175a57604051634c9c5c3360e11b815260040160405180910390fd5b600061176560045490565b905060005b828110156118e657600085858381811061178657611786613fed565b905060200201359050336001600160a01b03167f000000000000000000000000ed5af388653567af2f388e6224dc7c4b3241c5446001600160a01b0316636352211e836040518263ffffffff1660e01b81526004016117e791815260200190565b602060405180830381865afa158015611804573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182891906141f1565b6001600160a01b03161461184f5760405163242e855d60e11b815260040160405180910390fd5b600881901c6000908152600f6020526040902054600160ff83161b1661188857604051635366f67d60e11b815260040160405180910390fd5b600881901c6000908152600f602052604090208054600160ff84161b191690556118b2828461405a565b60405182907fe2301216b3a6988694011d9b19d84b3171cb7166636ac0bee7ea70ccde950f7e90600090a35060010161176a565b50610ff33383612cba565b6118f96126b9565b6040805160a08101825260135463ffffffff80821683526001600160401b03600160201b830481166020850152600160601b83041693830193909352600160a01b810483166060830152600160c01b90048216608082015290821615801590611992575060208101516001600160401b0316158061197f5750606081015163ffffffff16155b806119925750608081015163ffffffff16155b156119b057604051630b21892f60e11b815260040160405180910390fd5b506013805463ffffffff191663ffffffff92909216919091179055565b60006001600160a01b0382166119ed576119ed6323d3ad8160e21b612813565b506001600160a01b03166000908152600960205260409020546001600160401b031690565b611a1a6126b9565b611a246000612d2f565b565b611a2e6126b9565b611a39600c82612d81565b15611a5757604051639acc88ef60e01b815260040160405180910390fd5b611a62600c82612d99565b50611a6f8585858561141c565b60405181907f413cafed652c0749798b60dc0fc27072e4370c1e64b5074b303140f24ccc78fe90600090a25050505050565b6040805160608101825260115463ffffffff808216808452600160201b83049091166020840152600160401b9091046001600160401b031692820192909252901580611af35750805163ffffffff1642105b80611b085750806020015163ffffffff164210155b15611b2657604051637963e2b560e01b815260040160405180910390fd5b33600090815260126020526040902054611b448161ffff871661406d565b8661ffff161115611b6857604051630b39b31760e11b815260040160405180910390fd5b60105461ffff167f0000000000000000000000000000000000000000000000000000000000002710611b9a828961420e565b61ffff161115611bbd576040516314231de560e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000004e208761ffff16611bec60045490565b611bf6919061405a565b1115611c1557604051634c9c5c3360e11b815260040160405180910390fd5b611c56878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612da592505050565b611c7357604051638baa579f60e01b815260040160405180910390fd5b60008761ffff1684604001516001600160401b0316611c929190614019565b905080341015611cb55760405163356680b760e01b815260040160405180910390fd5b33600081815260126020526040902061ffff8a81168681019092556010805461ffff1916868d01909216919091179055611cef9190612b04565b60405161ffff89169033907f0389e698beae4e95f3527cf960f0140615c9c3db399008f23fcc79f61853d91090600090a35050505050505050565b611d326126b9565b600e805461ff0019169055565b611d476126b9565b6040805180820190915260155460ff81161515825261010090046001600160a01b031660208201819052611d8e57604051630296fadb60e51b815260040160405180910390fd5b6040805180820190915260018082526020928301516001600160a01b031692909101829052601580546001600160a81b03191661010090930292909217179055565b606060078054610e2090613f66565b611de76126b9565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b81600e5460ff1615611e1a57611e1a8161281d565b600e54610100900460ff1615611e4357604051630b95754760e31b815260040160405180910390fd5b610f268383612e5c565b611e556126b9565b63ffffffff851615801590611e8e57506001600160401b0384161580611e7f575063ffffffff8216155b80611e8e575063ffffffff8116155b15611eac57604051630b21892f60e11b815260040160405180910390fd5b6040805160a08101825263ffffffff9687168082526001600160401b03968716602083018190529590961691810182905292861660608401819052919095166080909201829052601380546001600160601b031916909417600160201b909302929092176bffffffffffffffffffffffff60601b1916600160601b90940263ffffffff60a01b191693909317600160a01b9091021763ffffffff60c01b1916600160c01b909202919091179055565b323314611faa5760405162461bcd60e51b815260206004820152601e60248201527f5468652063616c6c657220697320616e6f7468657220636f6e747261637400006044820152606401610f55565b6040805160a08101825260135463ffffffff8082168084526001600160401b03600160201b840481166020860152600160601b84041694840194909452600160a01b820481166060840152600160c01b9091041660808201529015806120165750805163ffffffff1642105b1561203457604051635ccb0f5960e01b815260040160405180910390fd5b60105461ffff167f00000000000000000000000000000000000000000000000000000000000027106120698260ff881661420e565b61ffff16111561208c576040516314231de560e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000004e208560ff166120ba60045490565b6120c4919061405a565b11156120e357604051634c9c5c3360e11b815260040160405180910390fd5b3360009081526009602052604090205460c01c600361210560ff88168361405a565b111561212457604051639e3ef52560e01b815260040160405180910390fd5b61216385858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612ec892505050565b61218057604051638baa579f60e01b815260040160405180910390fd5b60008660ff1661218e611563565b6121989190614019565b9050803410156121bb5760405163356680b760e01b815260040160405180910390fd5b33600090815260096020526040902080546001600160c01b031660ff8916840160c01b1790556010805461ffff191660ff891685810161ffff1691909117909155612207903390612f5f565b803411156122815760003361221c833461406d565b604051600081818185875af1925050503d8060008114612258576040519150601f19603f3d011682016040523d82523d6000602084013e61225d565b606091505b505090508061227f57604051633c31275160e21b815260040160405180910390fd5b505b50505050505050565b6122926126b9565b600e80546001600160a01b039092166301000000026301000000600160b81b0319909216919091179055565b6122c66126b9565b600e805460ff1916911515919091179055565b6122e4848484610fc3565b6001600160a01b0383163b15610ff3576123008484848461302b565b610ff357610ff36368d2bf6b60e11b612813565b6040805180820190915260155460ff811615158083526101009091046001600160a01b031660208301526060919061235f576040516372a58b2b60e11b815260040160405180910390fd5b6112ab338585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050602085015160019150612a32565b60606123ae826127cd565b6123c2576123c2630a14c4b560e41b612813565b60006123cc61310a565b905080516000036123ec5760405180602001604052806000815250612417565b806123f684613119565b604051602001612407929190614229565b6040516020818303038152906040525b9392505050565b6124266126b9565b601755565b6124336126b9565b6001600160a01b0381166124985760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f55565b610f6781612d2f565b6124a96126b9565b82811415806124b6575082155b156124d45760405163a121188760e01b815260040160405180910390fd5b60005b83811015612545578282828181106124f1576124f1613fed565b905060200201356016600087878581811061250e5761250e613fed565b9050602002016020810190612523919061380c565b6001600160a01b031681526020810191909152604001600020556001016124d7565b5050505050565b6125546126b9565b63ffffffff8316158061256b575063ffffffff8216155b8061257d57506001600160401b038116155b1561259b57604051638299f4c360e01b815260040160405180910390fd5b8163ffffffff168363ffffffff16106125c757604051638299f4c360e01b815260040160405180910390fd5b6040805160608101825263ffffffff94851680825293909416602085018190526001600160401b039290921693018390526011805467ffffffffffffffff1916909217600160201b909102176fffffffffffffffff00000000000000001916600160401b909202919091179055565b60006301ffc9a760e01b6001600160e01b03198316148061266757506380ac58cd60e01b6001600160e01b03198316145b80610dcb5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610dcb57506301ffc9a760e01b6001600160e01b0319831614610dcb565b6002546001600160a01b03163314611a245760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f55565b6127106001600160601b038216111561273e5760405162461bcd60e51b8152600401610f5590614258565b6001600160a01b0382166127945760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610f55565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600055565b600060045482101561280e5760005b5060008281526008602052604081205490819003612804576127fd836142a2565b92506127dc565b600160e01b161590505b919050565b8060005260046000fd5b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa612859573d6000803e3d6000fd5b6000603a5250565b610de38282600161315d565b600061287882612c24565b6001600160a01b03948516949091508116841461289e5761289e62a1148160e81b612813565b6000828152600a6020526040902080546128ca8187335b6001600160a01b039081169116811491141790565b6128ec576128d88633610c56565b6128ec576128ec632ce44b5f60e11b612813565b6128f98686866001613200565b801561290457600082555b6001600160a01b038681166000908152600960205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260086020526040812091909155600160e11b84169003612996576001840160008181526008602052604081205490036129945760045481146129945760008181526008602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4806000036129e0576129e0633a954ecd60e21b612813565b612281565b600881901c600090815260208390526040902054600160ff83161b16151592915050565b600881901c600090815260209290925260409091208054600160ff9093169290921b9091179055565b606060005b8451811015612a6b57612a63858281518110612a5557612a55613fed565b602002602001015185613277565b600101612a37565b506040516301a8875f60e71b81526001600160a01b0383169063d443af8090612a9a90889088906004016142b9565b6000604051808303816000875af1158015612ab9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ae191908101906142dd565b95945050505050565b610de38282604051806020016040528060008152506133c7565b6000612b11600a83614046565b905060005b81811015612b3157612b2984600a612f5f565b600101612b16565b506000612b3f600a84614382565b1115610f2657610f2683612b54600a85614382565b612f5f565b6127106001600160601b0382161115612b845760405162461bcd60e51b8152600401610f5590614258565b6001600160a01b038216612bda5760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606401610f55565b6040805180820182526001600160a01b0393841681526001600160601b0392831660208083019182526000968752600190529190942093519051909116600160a01b029116179055565b60008181526008602052604081205490819003612c97576004548210612c5457612c54636f96cda160e11b612813565b5b50600019016000818152600860205260409020548015612c5557600160e01b8116600003612c8257919050565b612c92636f96cda160e11b612813565b612c55565b600160e01b8116600003612caa57919050565b61280e636f96cda160e11b612813565b6000612cc7600a83614046565b905060005b81811015612cf757612cef84600a604051806020016040528060008152506133c7565b600101612ccc565b506000612d05600a84614382565b1115610f2657610f2683612d1a600a85614382565b604051806020016040528060008152506133c7565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008181526001830160205260408120541515612417565b60006124178383613429565b6040516001600160f01b031960f085811b821660208401526001600160601b03193360601b16602284015284901b16603682015260009081906038016040516020818303038152906040528051906020012090506000612e32827f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506000612e408286613478565b6014546001600160a01b03908116911614979650505050505050565b336000818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6040516001600160601b03193360601b16602082015260009081906034016040516020818303038152906040528051906020012090506000612f37827f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b90506000612f458286613478565b6014546001600160a01b0391821691161495945050505050565b6004546000829003612f7b57612f7b63b562e8dd60e01b612813565b612f886000848385613200565b60008181526008602090815260408083206001600160a01b0387164260a01b6001881460e11b17811790915580845260099092528220805468010000000000000001860201905590819003612fe657612fe6622e076360e81b612813565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103612feb575060045550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613060903390899088908890600401614396565b6020604051808303816000875af192505050801561309b575060408051601f3d908101601f19168201909252613098918101906143d3565b60015b6130f0573d8080156130c9576040519150601f19603f3d011682016040523d82523d6000602084013e6130ce565b606091505b5080516000036130e8576130e86368d2bf6b60e11b612813565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506112ab565b606060188054610e2090613f66565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806131335750819003601f19909101908152919050565b6000613168836116d0565b90508180156131805750336001600160a01b03821614155b156131a35761318f8133610c56565b6131a3576131a36367d9dca160e11b612813565b6000838152600a602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b600e54610100900460ff16801561321f57506001600160a01b03841615155b801561323357506001600160a01b03831615155b1561325157604051630b95754760e31b815260040160405180910390fd5b61325a33613494565b610ff3576040516326406c5f60e11b815260040160405180910390fd5b600061328283612c24565b9050806000806132a0866000908152600a6020526040902080549091565b9150915084156132d7576132b58184336128b5565b6132d7576132c38333610c56565b6132d7576132d7632ce44b5f60e11b612813565b6132e5836000886001613200565b80156132f057600082555b6001600160a01b038316600081815260096020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260086020526040812091909155600160e11b8516900361337e5760018601600081815260086020526040812054900361337c57600454811461337c5760008181526008602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060058054600101905550505050565b6133d18383612f5f565b6001600160a01b0383163b15610f26576004548281035b6133fb600086838060010194508661302b565b61340f5761340f6368d2bf6b60e11b612813565b8181106133e8578160045414612545576125456000612813565b600081815260018301602052604081205461347057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610dcb565b506000610dcb565b60008060006134878585613528565b915091506110a28161356a565b600e5460009062010000900460ff161561352057600e546040516370c5e04560e11b81526001600160a01b038481166004830152630100000090920490911690819063e18bc08a90602401602060405180830381865afa1580156134fc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061241791906143f0565b506001919050565b600080825160410361355e5760208301516040840151606085015160001a613552878285856136b4565b94509450505050611151565b50600090506002611151565b600081600481111561357e5761357e61440d565b036135865750565b600181600481111561359a5761359a61440d565b036135e75760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610f55565b60028160048111156135fb576135fb61440d565b036136485760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610f55565b600381600481111561365c5761365c61440d565b03610f675760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610f55565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156136eb575060009050600361376f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561373f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166137685760006001925092505061376f565b9150600090505b94509492505050565b6001600160e01b031981168114610f6757600080fd5b6000602082840312156137a057600080fd5b813561241781613778565b6001600160a01b0381168114610f6757600080fd5b80356001600160601b038116811461280e57600080fd5b600080604083850312156137ea57600080fd5b82356137f5816137ab565b9150613803602084016137c0565b90509250929050565b60006020828403121561381e57600080fd5b8135612417816137ab565b60005b8381101561384457818101518382015260200161382c565b50506000910152565b60008151808452613865816020860160208601613829565b601f01601f19169290920160200192915050565b602081526000612417602083018461384d565b60006020828403121561389e57600080fd5b5035919050565b600080604083850312156138b857600080fd5b82356138c3816137ab565b946020939093013593505050565b6000806000606084860312156138e657600080fd5b83356138f1816137ab565b92506020840135613901816137ab565b929592945050506040919091013590565b60008083601f84011261392457600080fd5b5081356001600160401b0381111561393b57600080fd5b6020830191508360208260051b850101111561115157600080fd5b6000806020838503121561396957600080fd5b82356001600160401b0381111561397f57600080fd5b61398b85828601613912565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156139d15783511515835292840192918401916001016139b3565b50909695505050505050565b600080604083850312156139f057600080fd5b50508035926020909101359150565b600080600060408486031215613a1457600080fd5b8335613a1f816137ab565b925060208401356001600160401b03811115613a3a57600080fd5b613a4686828701613912565b9497909650939450505050565b600081518084526020808501945080840160005b83811015613a8357815187529582019590820190600101613a67565b509495945050505050565b6020815260006124176020830184613a53565b60008060008060408587031215613ab757600080fd5b84356001600160401b0380821115613ace57600080fd5b613ada88838901613912565b90965094506020870135915080821115613af357600080fd5b50613b0087828801613912565b95989497509550505050565b8015158114610f6757600080fd5b600060208284031215613b2c57600080fd5b813561241781613b0c565b60008083601f840112613b4957600080fd5b5081356001600160401b03811115613b6057600080fd5b60208301915083602082850101111561115157600080fd5b60008060208385031215613b8b57600080fd5b82356001600160401b03811115613ba157600080fd5b61398b85828601613b37565b600080600060608486031215613bc257600080fd5b833592506020840135613bd4816137ab565b9150613be2604085016137c0565b90509250925092565b803563ffffffff8116811461280e57600080fd5b600060208284031215613c1157600080fd5b61241782613beb565b600080600080600060608688031215613c3257600080fd5b85356001600160401b0380821115613c4957600080fd5b613c5589838a01613912565b90975095506020880135915080821115613c6e57600080fd5b50613c7b88828901613912565b96999598509660400135949350505050565b803561ffff8116811461280e57600080fd5b60008060008060608587031215613cb557600080fd5b613cbe85613c8d565b9350613ccc60208601613c8d565b925060408501356001600160401b03811115613ce757600080fd5b613b0087828801613b37565b60008060408385031215613d0657600080fd5b8235613d11816137ab565b91506020830135613d2181613b0c565b809150509250929050565b80356001600160401b038116811461280e57600080fd5b600080600080600060a08688031215613d5b57600080fd5b613d6486613beb565b9450613d7260208701613d2c565b9350613d8060408701613d2c565b9250613d8e60608701613beb565b9150613d9c60808701613beb565b90509295509295909350565b600080600060408486031215613dbd57600080fd5b833560ff81168114613dce57600080fd5b925060208401356001600160401b03811115613de957600080fd5b613a4686828701613b37565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613e3357613e33613df5565b604052919050565b60008060008060808587031215613e5157600080fd5b8435613e5c816137ab565b9350602085810135613e6d816137ab565b93506040860135925060608601356001600160401b0380821115613e9057600080fd5b818801915088601f830112613ea457600080fd5b813581811115613eb657613eb6613df5565b613ec8601f8201601f19168501613e0b565b91508082528984828501011115613ede57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008060408385031215613f1157600080fd5b8235613f1c816137ab565b91506020830135613d21816137ab565b600080600060608486031215613f4157600080fd5b613f4a84613beb565b9250613f5860208501613beb565b9150613be260408501613d2c565b600181811c90821680613f7a57607f821691505b602082108103613f9a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4d756c74697369674f776e61626c653a2063616c6c6572206973206e6f74207460408201526c3432903932b0b61037bbb732b960991b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610dcb57610dcb614003565b634e487b7160e01b600052601260045260246000fd5b60008261405557614055614030565b500490565b80820180821115610dcb57610dcb614003565b81810381811115610dcb57610dcb614003565b600063ffffffff8084168061409757614097614030565b92169190910492915050565b6001600160401b038281168282160390808211156140c3576140c3614003565b5092915050565b60006001600160401b038084168061409757614097614030565b601f821115610f2657600081815260208120601f850160051c8101602086101561410b5750805b601f850160051c820191505b8181101561412a57828155600101614117565b505050505050565b6001600160401b0383111561414957614149613df5565b61415d836141578354613f66565b836140e4565b6000601f84116001811461419157600085156141795750838201355b600019600387901b1c1916600186901b178355612545565b600083815260209020601f19861690835b828110156141c257868501358255602094850194600190920191016141a2565b50868210156141df5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006020828403121561420357600080fd5b8151612417816137ab565b61ffff8181168382160190808211156140c3576140c3614003565b6000835161423b818460208801613829565b83519083019061424f818360208801613829565b01949350505050565b6020808252602a908201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646040820152692073616c65507269636560b01b606082015260800190565b6000816142b1576142b1614003565b506000190190565b6001600160a01b03831681526040602082018190526000906112ab90830184613a53565b600060208083850312156142f057600080fd5b82516001600160401b038082111561430757600080fd5b818501915085601f83011261431b57600080fd5b81518181111561432d5761432d613df5565b8060051b915061433e848301613e0b565b818152918301840191848101908884111561435857600080fd5b938501935b838510156143765784518252938501939085019061435d565b98975050505050505050565b60008261439157614391614030565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906143c99083018461384d565b9695505050505050565b6000602082840312156143e557600080fd5b815161241781613778565b60006020828403121561440257600080fd5b815161241781613b0c565b634e487b7160e01b600052602160045260246000fdfea264697066735822122099bbedd90deb5d677fd5b1a7f2952da95a5a3bda2cb0266ff2fbe96bd376225164736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ed5af388653567af2f388e6224dc7c4b3241c5440000000000000000000000000000000000000000000000000000000000004e2000000000000000000000000000000000000000000000000000000000000027100000000000000000000000002ae6b0630ebb4d155c6e04fcb16840ffa77760aa
-----Decoded View---------------
Arg [0] : _azukiAddress (address): 0xED5AF388653567Af2F388E6224dC7C4b3241C544
Arg [1] : _maxSupply (uint256): 20000
Arg [2] : _totalPresaleAndAuctionSupply (uint256): 10000
Arg [3] : _withdrawAddress (address): 0x2aE6B0630EBb4D155C6e04fCB16840FFA77760AA
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000ed5af388653567af2f388e6224dc7c4b3241c544
Arg [1] : 0000000000000000000000000000000000000000000000000000000000004e20
Arg [2] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [3] : 0000000000000000000000002ae6b0630ebb4d155c6e04fcb16840ffa77760aa
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.