ERC-721
Overview
Max Total Supply
493 X-KEY
Holders
156
Market
Volume (24H)
0.315 ETH
Min Price (24H)
$397.03 @ 0.125000 ETH
Max Price (24H)
$603.48 @ 0.190000 ETH
Other Info
Token Contract
Balance
2 X-KEYLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
XKeys
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ @@@, @@@@@( @@@ @/ &# @ .@@@@@@ *@@@@@@@@@@* %@@@ @@ V. @@@@@ @@@ / @ @ %@@@ @@, @@ @@ @> @. @@@@@ @@ @ @@@@@@, @@@@@@@ @@@ /@* *@@ @@ ^. @@@@ (@ @ /@@@, @& #& %@@@@@@@@@@ @@ (@, @@@@ % (@ @ /@@@, @ @& .@@@@@@@@@@@ @@ ,@@@@@, @@@# @ @ @@@@@@, @@@@@@@* @ @@@ @@@ @@ ,@@@@@, # #% @ @ @ @@@, @@@@@@ /@@& @@ @@ ,@@@@@, # #@, @ @/ @ @@@, @@@@@@@ @@@@@@@( *@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Planet-X X-Keys playplanetx.com Planet-X Ltd © 2023 | All rights reserved cfec19b223b57f38d96f52994b515d455b5dd1bb3741b8791ada32f862e95879 */ // #region Layout of Contract: // version // imports // errors // interfaces, libraries, contracts // Type declarations // State variables // Events // Modifiers // Functions // Layout of Functions: // constructor // receive function (if exists) // fallback function (if exists) // external // public // internal // private // view & pure functions // #endregion // SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "../base/Withdrawer.sol"; import "./XRaffleBase.sol"; import "../auctions/XAuctions.sol"; // #region errors error NullAddressParameters(); error ForbiddenDuringRaffle(); // #endregion /** X-Keys raffle auctions contract. @dev This contract is used to mint an X-Key NFTs in 3 different ways: 1. Raffle: users can mint an XKey for free by owning a specific NFT. 2. Auction: users can bid for a chance to buy an XKey in an auction round. 3. Limited airdrop, see RESERVED_SUPPLY */ contract XKeys is XRaffleBase, XAuctions, ReentrancyGuard { enum RoundType { None, Raffle, Auction } // the total number of X Key NFTs that have been allocated by rounds created so far uint16 public totalSupplyAllocated; // the total number of X Key NFTs that can be minted uint16 private constant MAX_SUPPLY = 500; // the number of reserved X Keys for team & marketing uint8 private constant RESERVED_SUPPLY = 25; // reserved tokens already minted uint8 public mintedReserved; // current round type RoundType currentRound; modifier requireRound(RoundType _round) { _checkRoundType(_round); _; } constructor( address vrfCoordinator, uint64 vrfSubscriptionId, bytes32 vrfKeyHash, address delegateRegistryAddress ) payable XRaffleBase( "X-Key", "X-KEY", 500, // 5% royalty msg.sender, // royalty recipient vrfCoordinator, vrfSubscriptionId, vrfKeyHash, delegateRegistryAddress, 48 hours // reward claim deadline for raffle rounds ) {} // #region External functions function mintReservedTokens(uint8 number, address to) external payable onlyOwner { // don't allow airdrops during a raffle if (currentRound == RoundType.Raffle) { revert ForbiddenDuringRaffle(); } uint8 _minted = mintedReserved; if (_minted + number > RESERVED_SUPPLY) { revert ExceedsMaxSupply(); } mintedReserved = _minted + number; _mint(to, number); } function closeRound() external payable onlyOwner { _closeRound(true); } function releaseNewRaffleRound( uint16 _supply, address requiredOwnership ) external payable onlyOwner { // no raffle can be created with less than 2 tokens if (_supply < 2) { revert SupplyTooSmall(); } // the contract must be an ERC721 contract if (!_isNFTContract(requiredOwnership)) { revert NotAnNFTContract(requiredOwnership); } if (currentRound == RoundType.Raffle) { revert RoundMustBeClosed(); } // supply must not exceed max supply, taking into account the reserved supply _addNewRoundWithSupply(_supply); uint8 _roundId = roundId; raffles[roundId] = Raffle({ id: _roundId, requiredOwnership: requiredOwnership, supply: _supply, supplyLeft: _supply, stage: RaffleStage.Open, startTokenId: uint16(_totalMinted() + 1) }); // set the current round to raffle currentRound = RoundType.Raffle; emit RoundCreated(_roundId, requiredOwnership, _supply); } function releaseNewAuctionRound( uint16 _supply, uint8 _maxWinPerWallet, uint64 _minimumBid ) external payable onlyOwner requireRound(RoundType.None) { // _checkCreateParams(_supply, _maxWinPerWallet, _minimumBid); _addNewRoundWithSupply(_supply); // set the current round to auction currentRound = RoundType.Auction; _saveNewAuction(roundId, _supply, _maxWinPerWallet, _minimumBid); } /** * @notice Respond to a mint request * @param _roundId The round id * @param minter The minter address * @param approved Whether the mint request is approved * @dev To ensure 1 holder can only claim 1 XKey per round, we need to verify * that the NFT which they hold, allowing them to mint, is not already used by another minter * this is done externally by our backend, and the result is passed to this function */ function validateMintRequest( uint8 _roundId, address minter, bool approved ) external payable onlyOwner requireRound(RoundType.Raffle) { // mint if the request is approved uint256 _supplyLeft = _validateMintRequest(_roundId, minter, approved); if (_supplyLeft < 1) { // if the pool is full, close the round _closeRound(false); } } function mintXKey() external nonReentrant requireRound(RoundType.Raffle) { _mintInRaffle(roundId); } /** * @notice Claim an XKey from a hot wallet */ function mintXKeyDelegated( address vault, address to ) external nonReentrant requireRound(RoundType.Raffle) { if (vault == address(0) || to == address(0)) { revert NullAddressParameters(); } _mintInRaffleDelegated(vault, to, roundId); } /// @notice Claim the reward via a delegated wallet /// @param _roundId The round id /// @param vault The vault for which to check delegation for msg.sender function claimRewardDelegated( uint8 _roundId, address vault ) external isDelegated(vault) { _claimRewardInternal(_roundId, vault); } /// @notice Open a crate via a delegated wallet /// @param _crateId The crate id /// @param vault The vault which will function openCrateDelegated( uint16 _crateId, address vault ) external isDelegated(vault) { _openCrateInternal(_crateId, msg.sender); } // #region auction functions function startAuction() external payable onlyOwner requireRound(RoundType.Auction) { _startAuction(roundId); } function bid() external payable requireRound(RoundType.Auction) { XAuctions.bid(roundId); } function setPriceForAuction( uint8 _auctionId, uint64 newPrice ) external payable onlyOwner { _setPrice(_auctionId, newPrice); } function startClaimsForAuction(uint8 _auctionId) external payable onlyOwner { _startClaims(_auctionId); } /** * @notice Claim tokens and refund for a specific auction. */ function claimForAuction(uint8 forAuctionId) external nonReentrant { // don't allow claims during an active raffle if (currentRound == RoundType.Raffle) { revert ForbiddenDuringRaffle(); } _internalClaim(msg.sender, forAuctionId); } // function currentAuction() // external // view // requireRound(RoundType.Auction) // returns (Auction memory) // { // return auctions[roundId]; // } // #endregion /** * @notice Withdraw function for the owner * @dev since only NFT sales funds can be withdrawn at any time * and users' funds need to be protected, this is marked as nonReentrant */ function withdraw(address payable receiver) external onlyOwner nonReentrant { _withdraw(receiver); } // #endregion // #region internal functions function _addNewRoundWithSupply(uint16 _newSupply) internal { // supply must not exceed max supply, taking into account the reserved supply uint16 _totalSupply = totalSupplyAllocated; if (_totalSupply + _newSupply > MAX_SUPPLY - RESERVED_SUPPLY) { revert ExceedsMaxSupply(); } unchecked { // allocate the supply totalSupplyAllocated = _totalSupply + _newSupply; // increment the round id ++roundId; } } // #endregion // #region private functions function _checkRoundType(RoundType _round) private view { if (_round != currentRound) { revert InvalidRound(); } } function _closeRound(bool checkSupply) private { RoundType _round = currentRound; if (_round == RoundType.None) { revert InvalidRound(); } currentRound = RoundType.None; uint8 _roundId = roundId; if (_round == RoundType.Raffle) { if (raffles[_roundId].stage != RaffleStage.Open) { revert InvalidRaffleStage(); } // close the round raffles[_roundId].stage = RaffleStage.Closed; // if the full supply allocated for this round is not claimed // release it back if (checkSupply) { uint16 _supplyLeft = raffles[_roundId].supplyLeft; if (_supplyLeft > 0) { unchecked { totalSupplyAllocated = totalSupplyAllocated - _supplyLeft; } } } emit RoundClosed(roundId); } else { if (auctions[_roundId].stage != AuctionStage.Active) { revert AuctionMustBeActive(); } // end the auction auctions[_roundId].stage = AuctionStage.Closed; activeAuctionId = 0; emit AuctionEnded(_roundId); } } // #endregion }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // 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, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * 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) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress( uint256 tokenId ) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom(address from, address to, uint256 tokenId) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint(address to, uint256 quantity, bytes memory _data) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData(address from, address to, uint24 previousExtraData) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData(address from, address to, uint256 prevOwnershipPacked) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // 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 // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface VRFCoordinatorV2Interface { /** * @notice Get configuration relevant for making requests * @return minimumRequestConfirmations global min for request confirmations * @return maxGasLimit global max for request gas limit * @return s_provingKeyHashes list of registered key hashes */ function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory ); /** * @notice Request a set of random words. * @param keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * @param subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * @param minimumRequestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * @param callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * @param numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords( bytes32 keyHash, uint64 subId, uint16 minimumRequestConfirmations, uint32 callbackGasLimit, uint32 numWords ) external returns (uint256 requestId); /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); */ function createSubscription() external returns (uint64 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return reqCount - number of requests for this subscription, determines fee tier. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription(uint64 subId) external view returns ( uint96 balance, uint64 reqCount, address owner, address[] memory consumers ); /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint64 subId) external; /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint64 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint64 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint64 subId, address to) external; /* * @notice Check to see if there exists a request commitment consumers * for all consumers and keyhashes for a given sub. * @param subId - ID of the subscription * @return true if there exists at least one unfulfilled request for the subscription, false * otherwise. */ function pendingRequestExists(uint64 subId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinator * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords), * @dev see (VRFCoordinatorInterface for a description of the arguments). * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) { vrfCoordinator = _vrfCoordinator; } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external { if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); } fulfillRandomWords(requestId, randomWords); } }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.17; /** * @title An immutable registry contract to be deployed as a standalone primitive * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations * from here and integrate those permissions into their flow */ interface IDelegationRegistry { /// @notice Delegation type enum DelegationType { NONE, ALL, CONTRACT, TOKEN } /// @notice Info about a single delegation, used for onchain enumeration struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; } /// @notice Info about a single contract-level delegation struct ContractDelegation { address contract_; address delegate; } /// @notice Info about a single token-level delegation struct TokenDelegation { address contract_; uint256 tokenId; address delegate; } /// @notice Emitted when a user delegates their entire wallet event DelegateForAll(address vault, address delegate, bool value); /// @notice Emitted when a user delegates a specific contract event DelegateForContract(address vault, address delegate, address contract_, bool value); /// @notice Emitted when a user delegates a specific token event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value); /// @notice Emitted when a user revokes all delegations event RevokeAllDelegates(address vault); /// @notice Emitted when a user revoes all delegations for a given delegate event RevokeDelegate(address vault, address delegate); /** * ----------- WRITE ----------- */ /** * @notice Allow the delegate to act on your behalf for all contracts * @param delegate The hotwallet to act on your behalf * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForAll(address delegate, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific contract * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForContract(address delegate, address contract_, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific token * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external; /** * @notice Revoke all delegates */ function revokeAllDelegates() external; /** * @notice Revoke a specific delegate for all their permissions * @param delegate The hotwallet to revoke */ function revokeDelegate(address delegate) external; /** * @notice Remove yourself as a delegate for a specific vault * @param vault The vault which delegated to the msg.sender, and should be removed */ function revokeSelf(address vault) external; /** * ----------- READ ----------- */ /** * @notice Returns all active delegations a given delegate is able to claim on behalf of * @param delegate The delegate that you would like to retrieve delegations for * @return info Array of DelegationInfo structs */ function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory); /** * @notice Returns an array of wallet-level delegates for a given vault * @param vault The cold wallet who issued the delegation * @return addresses Array of wallet-level delegates for a given vault */ function getDelegatesForAll(address vault) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault and contract * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract you're delegating * @return addresses Array of contract-level delegates for a given vault and contract */ function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault's token * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract holding the token * @param tokenId The token id for the token you're delegating * @return addresses Array of contract-level delegates for a given vault's token */ function getDelegatesForToken(address vault, address contract_, uint256 tokenId) external view returns (address[] memory); /** * @notice Returns all contract-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of ContractDelegation structs */ function getContractLevelDelegations(address vault) external view returns (ContractDelegation[] memory delegations); /** * @notice Returns all token-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of TokenDelegation structs */ function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations); /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll(address delegate, address vault) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForContract(address delegate, address vault, address contract_) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @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`. * * 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 calldata data ) external; /** * @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 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 ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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; /** * @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; /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // 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) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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 10, 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 * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.20; /* Stages of the auction None - initial stage, before bidding is allowed Active - bids are allowed, the auction is active Closed - bids are closed, the price needs to be set Claims - bidders can claim their winnings and receive any refunds Reveals - claims and refunds are still active, additionally owners of pods are now able to reveal their pod */ enum AuctionStage { None, Active, Closed, Claims, Reveals }
// SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "./AuctionEnums.sol"; // uint120 is 15 bytes, therefore the whole struct is 31 bytes // this improves gas perfomance of claim and bid by quite a large margin struct Bidder { // the sum of the user's bids uint120 totalBid; // total funds refunded to the user uint120 refundedFunds; // whether or not the user has claimed already bool claimed; // 1 byte } // @dev the uint limits are intentional struct Auction { // the auction id uint8 id; // 1 byte // the auction stage AuctionStage stage; // 1 byte // the maximum number of pods that can be won by a single wallet uint8 maxWinPerWallet; // 1 byte // // the maximum number of pods that can be minted in this auction uint16 supply; // 2 bytes // // the number of minted NFTs for this auction uint16 remainingSupply; // 2 bytes // // minimum bid uint64 minimumBid; // 8 bytes // the price as computed by the binary search algorithm // it get set after the bidding is closed uint64 price; // 8 bytes }
// SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "./AuctionEnums.sol"; interface IXAuction { /** * EVENTS */ event Bid( uint8 indexed auctionId, address indexed bidder, uint256 bidAmount, uint256 bidderTotal ); // when a bidder is refunded event RefundSent(address indexed recipient, uint256 value); event AuctionCreated( uint8 indexed auctionId, uint16 supply, uint8 maxWinPerWallet, uint64 minimumBid ); event AuctionStarted(uint8 indexed auctionId); event MinimumBidChanged(uint8 indexed auctionId, uint256 newMinBid); event AuctionEnded(uint8 indexed auctionId); event PriceSet(uint8 indexed auctionId, uint256 newPrice); event ClaimsAndRefundsStarted(uint8 indexed auctionId); // when a user claims their NFTs and/or refunds event Claimed(address recipient, uint256 totalBid, uint256 podsWon, uint256 refund); /** * ERRORS */ error InvalidCreateAuctionParams(); error NullAddressParameter(); error AuctionMustNotBeStarted(); error InvalidStageForOperation(AuctionStage currentStage, AuctionStage requiredStage); error AuctionMustBeActive(); error BidLowerThanMinimum(uint256 bid, uint256 minBid); error StageMustBeBiddingClosed(AuctionStage currentStage); error PriceMustBeSet(); error PriceIsLowerThanTheMinBid(uint256 priceInput, uint256 minBid); error MultipleAuctionsViolation(); error ZeroBids(address user); error NoActiveAuction(); error AuctionDoesNotExist(uint8 auctionId); error MaxSupplyExceeded(); error RefundFailed(address recipient, uint256 amount); error ContractCallersNotAllowed(); // function bid() external payable; }
/** playplanetx.com Planet-X Ltd © 2023 | All rights reserved */ // #region Layout of Contract: // version // imports // errors // interfaces, libraries, contracts // Type declarations // State variables // Events // Modifiers // Functions // Layout of Functions: // constructor // receive function (if exists) // fallback function (if exists) // external // public // internal // private // view & pure functions // #endregion // SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./IXAuction.sol"; import "./AuctionStructs.sol"; import "../base/Withdrawer.sol"; import "../base/XNFTRoyaltyBase.sol"; error AlreadyClaimed(address claimaint); abstract contract XAuctions is IXAuction, Withdrawer, XNFTRoyaltyBase { using SafeCast for uint256; using Math for uint256; uint8 public activeAuctionId; // the auctions data mapping(uint16 auctionId => Auction) public auctions; // users bids and refunds // auctionId -> userAddress -> User mapping(uint16 auctionId => mapping(address => Bidder)) public bidders; function _startClaims(uint8 _auctionId) internal { // read auction to memory Auction memory auction = auctions[_auctionId]; // revert if the stage is not "bidding closed" if (auction.stage != AuctionStage.Closed) { revert StageMustBeBiddingClosed(auction.stage); } if (auction.price == 0) { revert PriceMustBeSet(); } // write back to storage auctions[_auctionId].stage = AuctionStage.Claims; emit ClaimsAndRefundsStarted(_auctionId); } function _setPrice(uint8 _auctionId, uint64 newPrice) internal { // read auction to memory Auction memory auction = auctions[_auctionId]; if (auction.stage != AuctionStage.Closed) { revert StageMustBeBiddingClosed(auction.stage); } uint64 minBid = auction.minimumBid; // storage to memory if (newPrice < minBid) { revert PriceIsLowerThanTheMinBid(newPrice, minBid); } auctions[auction.id].price = newPrice; emit PriceSet(_auctionId, newPrice); } function bid(uint8 auctionId) internal { if (auctions[auctionId].stage != AuctionStage.Active) { revert AuctionMustBeActive(); } uint256 userBid = bidders[auctionId][msg.sender].totalBid; // increment the bid of the user userBid += msg.value; // if their new total bid is less than the current minimum bid // revert with an error uint64 minBid = auctions[auctionId].minimumBid; if (userBid < minBid) { revert BidLowerThanMinimum(userBid, minBid); } // save the bid bidders[auctionId][msg.sender].totalBid = SafeCast.toUint120(userBid); emit Bid(auctionId, msg.sender, msg.value, userBid); } function _startAuction(uint8 id) internal { if (auctions[id].stage != AuctionStage.None) { revert AuctionMustNotBeStarted(); } auctions[id].stage = AuctionStage.Active; activeAuctionId = id; emit AuctionStarted(id); } function _saveNewAuction( uint8 _id, uint16 _supply, uint8 _maxWinPerWallet, uint64 _minimumBid ) internal { if ( _supply == 0 || _minimumBid == 0 || _maxWinPerWallet == 0 || _supply < _maxWinPerWallet ) { revert InvalidCreateAuctionParams(); } // create the auction auctions[_id] = Auction({ id: _id, maxWinPerWallet: _maxWinPerWallet, supply: _supply, remainingSupply: _supply, minimumBid: _minimumBid, price: 0, stage: AuctionStage.None }); emit AuctionCreated(_id, _supply, _maxWinPerWallet, _minimumBid); } /** * @notice claim function to be used both by the user and by the support role * @dev used by claim() and claimOnBehalfOf() * @param claimant the address to claim tokens for. */ function _internalClaim(address claimant, uint8 _auctionId) internal { // early revert if the auction is not in the right stage Auction memory auction = auctions[_auctionId]; if (auction.stage < AuctionStage.Claims) { revert InvalidStageForOperation(auction.stage, AuctionStage.Claims); } // read user in memory Bidder memory user = bidders[_auctionId][claimant]; // revert if the user has already claimed if (user.claimed) { revert AlreadyClaimed(claimant); } // @dev state modification CEI pattern bidders[_auctionId][claimant].claimed = true; uint120 userTotalBid = user.totalBid; if (userTotalBid == 0) { revert ZeroBids(claimant); } // determine the split between tokens and refund // limit to the maximum tokens a wallet can win in the auction uint mintAmount = Math.min( // @dev no precision loss in division below, we only need the whole part Math.min(userTotalBid / auction.price, auction.maxWinPerWallet), auction.remainingSupply ); uint128 podsMintCost = uint128(mintAmount) * auction.price; // if any pods are won // the mintAmount is adjusted for supply above, // hence it can be 0 again if no supply has been left if (mintAmount > 0) { unchecked { // does not overflow, mintAmount is limited to the supply left auctions[_auctionId].remainingSupply = uint16( auction.remainingSupply - mintAmount ); // increase the withdrawable amount withdrawableFunds = withdrawableFunds + podsMintCost; } // mint the tokens _mint(claimant, mintAmount); } // send the refund uint128 refund = userTotalBid - podsMintCost; if (refund > 0) { // write the refund to state bidders[_auctionId][claimant].refundedFunds = user.refundedFunds + SafeCast.toUint120(refund); (bool success, ) = claimant.call{value: refund}(""); if (!success) { revert RefundFailed(claimant, refund); } emit RefundSent(claimant, refund); } emit Claimed(claimant, userTotalBid, mintAmount, refund); } // function currentAuction() external view returns (Auction memory) { // return auctions[activeAuction]; // } }
// SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; // Errors error NoFundsToWithdraw(); error WithdrawFailed(address recipient, uint256 amount); error WithdrawToNullAddress(); contract Withdrawer { using SafeCast for uint256; // Events event FundsWithdrawn(address recipient, uint256 amount); // the total funds that can be withdrawn by the owner uint128 internal withdrawableFunds; /** * @notice Withdraw function for the owner * @dev since only pod sales funds can be withdrawn at any time * and users' funds need to be protected, this is marked as nonReentrant */ function _withdraw(address payable receiver) internal { // allow the owner to withdraw the balance for any minted pods // allow the owner to withdraw the balance if (receiver == address(0)) { revert WithdrawToNullAddress(); } uint128 funds = withdrawableFunds; if (funds == 0) { revert NoFundsToWithdraw(); } // reset the withdrawable funds withdrawableFunds = 0; // emit the withdraw event emit FundsWithdrawn(receiver, funds); // send the funds to the receiver (bool success, ) = receiver.call{value: funds}(""); if (!success) { revert WithdrawFailed(receiver, funds); } } /** @dev fallback function to receive ether */ receive() external payable { // increase the withdrawable funds by the ETH received // += is less gas efficient withdrawableFunds = withdrawableFunds + SafeCast.toUint128(msg.value); } }
// SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "operator-filter-registry/src/DefaultOperatorFilterer.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; /** This base contract provides a combination of common base inheritance for PlanetX NFTs. It includes: Royalties (ERC2981), OperatorFiltering (OperatorFilterRegistry) and overries for basic ERC721A functionality - start token id and base uri. */ contract XNFTRoyaltyBase is DefaultOperatorFilterer, ERC721AQueryable, ERC2981, Ownable { // the base URI for the metadata string public baseURI; // the URI for the contract level metadata // @dev see https://docs.opensea.io/docs/contract-level-metadata string private contractMetadataURI; event RoyaltyChanged(address indexed receiver, uint96 feeNumerator); event BaseURISet(string baseURI); error EmptyBaseURI(); constructor( string memory name, string memory symbol, uint96 royalty, address receiver ) ERC721A(name, symbol) { // set the default royalty _setDefaultRoyalty(receiver, royalty); } /** * @dev override from ERC721A */ function _baseURI() internal view override returns (string memory) { return baseURI; } /** * @dev overriding from ERC721: start at the 1st token instead of 0 */ function _startTokenId() internal pure override returns (uint256) { return 1; } /** * @dev sets the base uri for {_baseURI} */ function setBaseURI(string calldata newBaseURI) external onlyOwner { if (bytes(newBaseURI).length == 0) { revert EmptyBaseURI(); } baseURI = newBaseURI; emit BaseURISet(newBaseURI); } // contract level metadata function contractURI() external view returns (string memory) { return contractMetadataURI; } function setContractURI(string calldata newURI) external payable onlyOwner { contractMetadataURI = newURI; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC2981, IERC721A, ERC721A) returns (bool) { return ERC721A.supportsInterface(interfaceId); } //////////////// // ERC2981 royalty standard //////////////// /** * @dev See {ERC2981-_setDefaultRoyalty}. */ function setDefaultRoyalty( address receiver, uint96 feeNumerator ) external payable onlyOwner { _setDefaultRoyalty(receiver, feeNumerator); emit RoyaltyChanged(receiver, feeNumerator); } /** * @dev See {ERC2981-_deleteDefaultRoyalty}. */ function deleteDefaultRoyalty() external payable onlyOwner { _deleteDefaultRoyalty(); } //////////////// // overrides for using OpenSea's OperatorFilter to filter out platforms which are know to not enforce // creator earnings //////////////// function setApprovalForAll( address operator, bool approved ) public override(ERC721A, IERC721A) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve( address operator, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override(ERC721A, IERC721A) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } ////////// // end of OpenSea DefaultOperatorFilter overrides }
// #region Layout of Contract: // version // imports // errors // interfaces, libraries, contracts // Type declarations // State variables // Events // Modifiers // Functions // Layout of Functions: // constructor // receive function (if exists) // fallback function (if exists) // external // public // internal // private // view & pure functions // #endregion // SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "delegate.cash/IDelegationRegistry.sol"; // #region errors error WalletNotDelegated(address hotWallet, address vault); // #endregion contract DelegateUtils { // the delegation registry contract IDelegationRegistry public immutable delegationRegistry; constructor(address _registryAddress) { // initialize the delegation registry delegationRegistry = IDelegationRegistry(_registryAddress); } modifier isDelegated(address vault) { _checkDelegation(vault, address(this)); _; } function _checkDelegation(address vault, address _contract) internal view { // check that the caller delegated to the vault if (!delegationRegistry.checkDelegateForContract(msg.sender, vault, _contract)) { revert WalletNotDelegated(msg.sender, vault); } } }
// #region Layout of Contract: // version // imports // errors // interfaces, libraries, contracts // Type declarations // State variables // Events // Modifiers // Functions // Layout of Functions: // constructor // receive function (if exists) // fallback function (if exists) // external // public // internal // private // view & pure functions // #endregion // SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; contract XCrates { using SafeCast for uint256; enum CrateState { None, Locked, WinnerDrawn, Unlocked } struct XCrate { /* Slot 1 - 32 bytes */ address requiredOwnership; // 20 bytes // the expiration time for the winner to open the crate // typically it's CLAIM_DEADLINE (i.e. 48hrs) from the winner being drawn uint64 expires; // 8 bytes uint16 id; // 2 bytes uint8 forRound; // 1 byte CrateState state; // 1 byte } // the current crate id uint16 public crateId; mapping(uint16 crateId => uint16 tokenId) internal crateWinningToken; // the released x crates mapping(uint16 crateId => XCrate) public crates; mapping(uint16 crateId => address winner) public crateWinners; // #region events event XCreateCreated( uint16 indexed crateId, uint8 indexed forRound, address indexed requiredOwnership ); // #endregion // #region internal functions function _setupCrate(uint8 forRound, address requiredOwnership) internal { // throw if exceeding 2^16-1 crates uint16 _crateId = SafeCast.toUint16(crateId + 1); // increment the crate id crateId = _crateId; // create the new crate crates[_crateId] = XCrate({ requiredOwnership: requiredOwnership, id: _crateId, forRound: forRound, state: CrateState.Locked, expires: 0 }); emit XCreateCreated(_crateId, forRound, requiredOwnership); } // #endregion // #region external functions // #endregion }
// Layout of Contract: // version // imports // errors // interfaces, libraries, contracts // Type declarations // State variables // Events // Modifiers // Functions // Layout of Functions: // constructor // receive function (if exists) // fallback function (if exists) // external // public // internal // private // view & pure functions // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/access/Ownable.sol"; import {VRFCoordinatorV2Interface} from "@chainlink/interfaces/VRFCoordinatorV2Interface.sol"; import {VRFConsumerBaseV2} from "@chainlink/vrf/VRFConsumerBaseV2.sol"; // import {AutomationCompatibleInterface} from "@chainlink/interfaces/automation/AutomationCompatibleInterface.sol"; /* Enums */ enum RequestType { None, Raffle, XCrate } /**@title A sample VRF Contract * @notice This contract is for creating a sample raffle contract * @dev This implements the Chainlink VRF Version 2 */ abstract contract XKeyVRFInterface is VRFConsumerBaseV2 { /* Errors */ error AlreadyRequested(); error InvalidVRFRequestType(); /* Events */ // event VRFRequest(uint256 indexed requestId, RequestType indexed _type); /* State variables */ // Chainlink VRF Variables VRFCoordinatorV2Interface private immutable vrfCoordinator; uint64 private immutable vrfSubscriptionId; address private immutable vrfV2CoordinatorAddress; bytes32 private immutable gasLane; /* VRF config constants */ uint32 private constant CALLBACK_GAS_LIMIT = 500000; uint16 private constant REQUEST_CONFIRMATIONS = 3; uint32 private constant NUM_WORDS = 1; // current request for a winner for a round uint8 public awaitingWinnerForRound; // current request for a winner for a crate uint16 public awaitingWinnerForCrate; mapping(uint256 => RequestType) internal vrfRequests; mapping(uint256 requestId => uint16 crateId) internal vrfIdToCrateId; /* Functions */ constructor( address _vrfCoordinator, uint64 _vrfSubscriptionId, bytes32 _gasLane ) VRFConsumerBaseV2(_vrfCoordinator) { // initialize Chainlink VRF vrfCoordinator = VRFCoordinatorV2Interface(_vrfCoordinator); // initialize immutable variables vrfV2CoordinatorAddress = _vrfCoordinator; vrfSubscriptionId = _vrfSubscriptionId; gasLane = _gasLane; } function sendVRFRequest() internal returns (uint256) { uint256 requestId = vrfCoordinator.requestRandomWords( gasLane, vrfSubscriptionId, REQUEST_CONFIRMATIONS, CALLBACK_GAS_LIMIT, NUM_WORDS ); // @todo comment out for mainnet; // only needed for VRFCoordinatorV2Mock in unit tests // pendingRequestId = requestId; return requestId; } function _placeRequestInternal(RequestType _type) internal returns (uint256) { uint256 requestId = sendVRFRequest(); // set the request type vrfRequests[requestId] = _type; // emit VRFRequest(requestId, _type); return requestId; } function requestWinningTokenForRound(uint8 round) internal { if (awaitingWinnerForRound != 0) { revert AlreadyRequested(); } awaitingWinnerForRound = round; _placeRequestInternal(RequestType.Raffle); } function requestWinnerForCrate(uint16 crateId) internal { if (awaitingWinnerForCrate != 0) { revert AlreadyRequested(); } awaitingWinnerForCrate = crateId; uint256 requestId = _placeRequestInternal(RequestType.XCrate); // record the crateId for the requestId vrfIdToCrateId[requestId] = crateId; } }
// #region Layout of Contract: // version // imports // errors // interfaces, libraries, contracts // Type declarations // State variables // Events // Modifiers // Functions // Layout of Functions: // constructor // receive function (if exists) // fallback function (if exists) // external // public // internal // private // view & pure functions // #endregion // SPDX-License-Identifier: UNLICENCED pragma solidity 0.8.20; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "../utils/DelegateUtils.sol"; import "./XKeyVRFInterface.sol"; import "../base/XNFTRoyaltyBase.sol"; import "./XCrates.sol"; // #region Errors error AlreadyMinted(); error RoundMustBeClosed(); error NFTOwnershipMissing(address nftContract); error InsufficientBalance(); error NotAnNFTContract(address nftContract); error ExceedsMaxSupply(); error CannotResetReward(); error RewardExpired(); error RewardNotExpired(); error YouDidNotWin(); error InvalidRaffleStage(); error NoWinningToken(); error CrateMustBeLocked(); error CrateAlreadyOpened(); error SupplyTooSmall(); error RoundPoolTooSmall(); error InvalidRound(); error RoundTokenPoolEmpty(); error MintRequestStateMismatch(); error CannotRedrawUnwonCrate(); // #endregion contract XRaffleBase is XCrates, XKeyVRFInterface, XNFTRoyaltyBase, DelegateUtils { using SafeCast for uint256; struct Raffle { address requiredOwnership; // 20 bytes uint16 id; // 2 bytes uint16 supply; // 2 bytes uint16 supplyLeft; // 2 bytes uint16 startTokenId; // 2 bytes RaffleStage stage; // 1 byte } enum MintStatus { None, Pending, Fulfilled, Rejected, SupplyExceeded, UsedAsVault, UsedAsDelegate } enum RaffleStage { None, Open, Closed, WinnerDrawn, RewardClaimed } // the number of seconds after which the reward can be claimed uint64 private immutable CLAIM_DEADLINE; // the timestamp beyond which the reward can not be claimed uint64 public nextClaimDeadline; // the current raffle round uint8 public roundId; mapping(uint8 roundId => address) public roundWinners; mapping(uint8 roundId => uint16 tokenId) private _roundWinningToken; mapping(uint8 roundId => Raffle) public raffles; // the status of a minter address in each raffle round mapping(uint8 roundId => mapping(address minter => MintStatus)) public raffleMinters; // the pool of tokens for each round mapping(uint8 roundId => uint16[] tokenId) public roundTokenPool; // #region Events event RoundCreated( uint16 indexed roundId, address indexed requiredOwnership, uint16 supply ); event RoundClosed(uint16 indexed roundId); event WinnerDrawn(RequestType indexed _type, uint16 indexed id); event RewardClaimed( uint16 indexed roundId, uint16 indexed tokenId, address indexed winner ); event MintRequested(uint16 indexed roundId, address indexed minter); event MintDecision(uint16 indexed roundId, address indexed minter, bool isApproved); event CrateUnlocked(uint16 indexed crateId, address indexed winner); event WinningToken(uint256 tokenId); // #endregion // #region Modifiers modifier notMintedInRound(uint8 _roundId, address minter) { // must mint once per round _checkNotMintedInRound(_roundId, minter); _; } // #endregion constructor( string memory name, string memory symbol, uint96 royalty, address receiver, address vrfCoordinator, uint64 vrfSubscriptionId, bytes32 vrfKeyHash, address delegateRegistryAddress, uint64 claimDeadline ) payable XKeyVRFInterface(vrfCoordinator, vrfSubscriptionId, vrfKeyHash) XNFTRoyaltyBase(name, symbol, royalty, receiver) DelegateUtils(delegateRegistryAddress) { CLAIM_DEADLINE = claimDeadline; } // #region External functions // function hasMintedInThisRound(address minter) external view returns (bool) { // return _hasMintedInRound(minter, roundId); // } // function currentRaffle() external view returns (Raffle memory) { // return raffles[roundId]; // } function checkCanOpenCrate( uint16 _crateId, address minter ) external view returns (bool) { uint16 tokenId = crateWinningToken[_crateId]; bool canOpen = _exists(tokenId) && ownerOf(crateWinningToken[_crateId]) == minter; if (canOpen) { address _mustOwn = crates[_crateId].requiredOwnership; if (_mustOwn != address(0)) { // check that the claimant owns the required token if (IERC721(_mustOwn).balanceOf(minter) < 1) { canOpen = false; } } } return canOpen; } // function balancesOf( // address[] calldata addresses // ) external view returns (uint256[] memory) { // uint256[] memory balances = new uint256[](addresses.length); // for (uint256 i = 0; i < addresses.length; i++) { // balances[i] = balanceOf(addresses[i]); // } // return balances; // } function claimReward(uint8 _roundId) external { _claimRewardInternal(_roundId, msg.sender); } function openCrate(uint16 _crateId) external { _openCrateInternal(_crateId, msg.sender); } function drawWinner(RequestType _type, uint16 id) external payable onlyOwner { _drawWinnerInternal(_type, id); } function resetWinnerWhenRewardExpires() external payable onlyOwner { // the reward must have a winner selected uint8 _roundId = roundId; if (raffles[_roundId].stage != RaffleStage.WinnerDrawn) { revert CannotResetReward(); } // the time for claiming the reward must have passed if (!isRewardExpired()) { revert RewardNotExpired(); } // reset the winner _roundWinningToken[_roundId] = 0; // draw a random winner requestWinningTokenForRound(_roundId); } /** * @notice Release a new X-Crate, which can be opened by holders of a specific NFT and/or an X-Key from a specific round * @param forRound The round for which the crate is released (0 - for all rounds) * @param requiredOwnership The address of the NFT contract which must be owned to open the crate (address(0) - removes the requirement) */ function releaseCrate( uint8 forRound, address requiredOwnership ) external payable onlyOwner { if (requiredOwnership != address(0)) { // the contract must be an ERC721 contract if (!_isNFTContract(requiredOwnership)) { revert NotAnNFTContract(requiredOwnership); } } // if the crate is only for a specific round if (forRound > 0) { // no crates can be created for a round in the future if (forRound > roundId) { revert InvalidRound(); } // revert if there are no tokens in the round pool if (roundTokenPool[forRound].length == 0) { revert RoundTokenPoolEmpty(); } // prevent creating a crate for a round // if so many keys have been burned, that less than 2 are left if (!_checkEnoughTokensInRoundPool(forRound)) { revert RoundPoolTooSmall(); } } else { // ensure that enough supply is left for a crate if (totalSupply() < 2) { revert SupplyTooSmall(); } } _setupCrate(forRound, requiredOwnership); } function tokenPoolOfRound(uint8 _roundId) external view returns (uint16[] memory) { return roundTokenPool[_roundId]; } function checkWin(uint8 _roundId, address minter) external view returns (bool) { return _checkWinInternal(_roundId, minter); } // #endregion // #region Public functions function isRewardExpired() public view returns (bool) { // when nextClaimDeadline is 0 initially or when reward is claimed // the timestamp will always be greater than nextClaimDeadline // therefore the reward is always expired except when after the draw return block.timestamp > nextClaimDeadline; } // #endregion // #region Internal functions function _isNFTContract(address contractAddress) internal view returns (bool) { // check if the contract supports the ERC721 interface return IERC721(contractAddress).supportsInterface(0x80ac58cd); } function _checkNotMintedInRound(uint8 _roundId, address minter) internal view { if (raffleMinters[_roundId][minter] != MintStatus.None) { revert AlreadyMinted(); } } function _checkWinInternal( uint8 _roundId, address winner ) internal view returns (bool) { uint16 tokenId = _roundWinningToken[_roundId]; return _exists(tokenId) && ownerOf(tokenId) == winner; } function _adjustWinnerForBurnedTokens( uint256 tokenId, uint256 rangeLimit ) internal view returns (uint256) { // if the token selected has been burned, // select the previous token and wrap around if necessary while (!_exists(tokenId)) { unchecked { if (tokenId > 1) { --tokenId; } else { // loop back to the end of the range tokenId = rangeLimit; } } } return tokenId; } /** * @dev iterate over the supply to find an unburned winning token based on the Chainlink VRF random number * @param vrfWord the random number returned by Chainlink */ function _getWinningTokenFromSupply(uint256 vrfWord) internal view returns (uint256) { // @dev randomWord % _totalMinted() will give a number between 0 and _totalMinted(). // However, startTokenId is 1 and the modulus will give (totalMinted - 1) as the maximum value selected, // therefore adding 1 to the result will give a number between 1 and _totalMinted() inclusive uint256 mintCount = _totalMinted(); uint256 winningToken = _adjustWinnerForBurnedTokens( (vrfWord % mintCount) + 1, mintCount ); return winningToken; } function _mintInRaffle( uint8 _roundId ) internal notMintedInRound(_roundId, msg.sender) { // minting this token must not exceed the max supply for the round if (raffles[_roundId].supplyLeft == 0) { revert ExceedsMaxSupply(); } // must own the required NFT _checkOwnsNFT(raffles[_roundId].requiredOwnership, msg.sender); // add the minter to the round minters raffleMinters[_roundId][msg.sender] = MintStatus.Pending; emit MintRequested(_roundId, msg.sender); } function _mintInRaffleDelegated( address vault, address to, uint8 _roundId ) internal notMintedInRound(_roundId, vault) { // add the receiver to the round minters raffleMinters[_roundId][to] = MintStatus.Pending; // mark the vault as used if (vault != to) { raffleMinters[_roundId][vault] = MintStatus.UsedAsVault; } if (msg.sender != to) { raffleMinters[_roundId][msg.sender] = MintStatus.UsedAsDelegate; } // minting this token must not exceed the max supply for the round // if (raffleTokenPool[_roundId].length + 1 > raffle.supply) { if (raffles[_roundId].supplyLeft == 0) { revert ExceedsMaxSupply(); } // check the delegation registry to see if the msg.sender is delegated by the vault address requiredOwnership = raffles[_roundId].requiredOwnership; _checkDelegation(vault, requiredOwnership); // must own the required NFT _checkOwnsNFT(requiredOwnership, vault); emit MintRequested(_roundId, to); } /** * @dev This is the function that Chainlink VRF node calls */ function fulfillRandomWords( uint256 requestId, uint256[] memory randomWords ) internal override { RequestType _type = vrfRequests[requestId]; if (_type == RequestType.Raffle) { // handle winner being picked for a raffle // select a winner from the existing tokens in supply uint256 winningToken = _getWinningTokenFromSupply(randomWords[0]); // set the winning token for the round _recordRoundWinner(roundId, uint16(winningToken)); } else if (_type == RequestType.XCrate) { // read crate in memory // XCrate memory crate = crates[vrfIdToCrateId[requestId]]; uint16 _crateId = vrfIdToCrateId[requestId]; uint8 forRound = crates[_crateId].forRound; uint256 winningToken; // if the crate is only openable by keys in a given round if (forRound > 0) { // read the token pool size uint16[] memory pool = roundTokenPool[forRound]; uint256 poolSize = pool.length; uint256 indexOfWinToken = randomWords[0] % poolSize; // in case of any burned tokens, search for the previous token // and wrap around if necessary while (!_exists(pool[indexOfWinToken])) { unchecked { if (indexOfWinToken > 0) { --indexOfWinToken; } else { // loop back to the end of the array indexOfWinToken = poolSize - 1; } } } // set the winning token winningToken = pool[indexOfWinToken]; } else { // pick a random token from the entire supply winningToken = _getWinningTokenFromSupply(randomWords[0]); } // set the winning token for the crate _recordCrateWinner(_crateId, uint16(winningToken)); } else { revert InvalidVRFRequestType(); } } function _drawWinnerInternal(RequestType _type, uint16 id) internal { if (_type == RequestType.Raffle) { uint8 raffleId = SafeCast.toUint8(id); if (raffles[raffleId].stage != RaffleStage.Closed) { revert RoundMustBeClosed(); } if (roundTokenPool[raffleId].length == 0) { revert NoWinningToken(); } // draw a random winner requestWinningTokenForRound(raffleId); } else if (_type == RequestType.XCrate) { // @dev crates winners can be drawn, after which the winner has a certain amount of time // to open the crate, otherwise the crate expires and a new winner can be drawn // check for an expired crate uint256 expires = crates[id].expires; if (expires > 0 && expires > block.timestamp) { // the crate has expired // check that the crate is in a state where a new winner can be drawn if (crates[id].state != CrateState.WinnerDrawn) { revert CannotRedrawUnwonCrate(); } // continue to draw a new winner } else { // crate has no expiration or has not expired // check that the crate is locked if (crates[id].state != CrateState.Locked) { revert CrateMustBeLocked(); } } requestWinnerForCrate(id); } } function _recordRoundWinner(uint8 _roundId, uint16 tokenId) internal { awaitingWinnerForRound = 0; // set the winning token _roundWinningToken[_roundId] = tokenId; // set the raffle stage raffles[_roundId].stage = RaffleStage.WinnerDrawn; // set the deadline for claiming the reward nextClaimDeadline = SafeCast.toUint64(block.timestamp + CLAIM_DEADLINE); emit WinningToken(tokenId); // the omission of the winning token is intentional emit WinnerDrawn(RequestType.Raffle, _roundId); } function _recordCrateWinner(uint16 _crateId, uint16 tokenId) internal { // reset the crate state awaitingWinnerForCrate = 0; // store the winning token crateWinningToken[_crateId] = tokenId; // set the crate state if (crates[_crateId].state != CrateState.WinnerDrawn) { // set the crate state crates[_crateId].state = CrateState.WinnerDrawn; } // set the deadline for claiming the reward crates[_crateId].expires = SafeCast.toUint64(block.timestamp + CLAIM_DEADLINE); emit WinningToken(tokenId); // emit the event emit WinnerDrawn(RequestType.XCrate, _crateId); } function _claimRewardInternal(uint8 _roundId, address claimant) internal { uint16 winningToken = _roundWinningToken[_roundId]; if (winningToken == 0) { revert NoWinningToken(); } if (ownerOf(winningToken) != claimant) { revert YouDidNotWin(); } if (isRewardExpired()) { revert RewardExpired(); } // set reward as claimed and reset the deadline raffles[_roundId].stage = RaffleStage.RewardClaimed; nextClaimDeadline = 0; // record the winner roundWinners[_roundId] = claimant; // burn the winning token _burn(winningToken); // // set the token as burned // burnedTokens.set(winningToken); emit RewardClaimed(_roundId, winningToken, claimant); } function _openCrateInternal(uint16 _crateId, address claimant) internal { if (balanceOf(claimant) < 1) { revert InsufficientBalance(); } uint16 winningToken = crateWinningToken[_crateId]; if (winningToken == 0) { revert NoWinningToken(); } // @dev no need to check if the crate is locked, because the winning token // would have been burned and an earlier check would have reverted // CrateState state = crates[_crateId].state; // if (state == CrateState.Unlocked) { // revert CrateAlreadyOpened(); // } if (ownerOf(winningToken) != claimant) { revert YouDidNotWin(); } // check that the opening hasn't expired if (block.timestamp > crates[_crateId].expires) { revert RewardExpired(); } address _mustOwn = crates[_crateId].requiredOwnership; if (_mustOwn != address(0)) { // check that the claimant owns the required token _checkOwnsNFT(_mustOwn, claimant); } // burn the winning token _burn(winningToken); // set crate as unlocked and record the winner crates[_crateId].state = CrateState.Unlocked; crateWinners[_crateId] = claimant; emit CrateUnlocked(_crateId, claimant); } function _checkEnoughTokensInRoundPool(uint8 _roundId) internal view returns (bool) { uint16[] memory pool = roundTokenPool[_roundId]; uint256 unburned; uint256 poolIdx = pool.length - 1; // does not overflow unchecked { do { if (_exists(pool[poolIdx])) { ++unburned; } // at least 2 tokens must be unburned if (unburned > 1) { return true; } --poolIdx; } while (poolIdx > 0); } return false; } function _checkOwnsNFT(address _erc721, address _owner) internal view { if (IERC721(_erc721).balanceOf(_owner) < 1) { revert NFTOwnershipMissing(_erc721); } } function _validateMintRequest( uint8 _roundId, address minter, bool approved ) internal returns (uint256) { if (raffleMinters[_roundId][minter] != MintStatus.Pending) { revert MintRequestStateMismatch(); } // total supply for this round uint16 _supplyLeft = raffles[_roundId].supplyLeft; // update the mint status raffleMinters[_roundId][minter] = _supplyLeft < 1 ? MintStatus.SupplyExceeded : approved ? MintStatus.Fulfilled : MintStatus.Rejected; bool _willMint = approved && _supplyLeft > 0; if (_willMint) { // update the supply left unchecked { // @dev does not wrap around, because _supplyLeft > 0 in the if statement above --_supplyLeft; raffles[_roundId].supplyLeft = _supplyLeft; } // mint an XKey to the minter _mint(minter, 1); // add the last minted token to the pool roundTokenPool[_roundId].push(uint16(_totalMinted())); } emit MintDecision(_roundId, minter, _willMint); return _supplyLeft; } // #endregion // #region Private functions // #endregion }
{ "remappings": [ "@chainlink/=lib/chainlink/contracts/src/v0.8/", "@openzeppelin/=lib/openzeppelin-contracts/", "CramBit/=lib/foundry-random/lib/CramBit/", "ERC721A/=lib/ERC721A/contracts/", "chainlink/=lib/chainlink/", "delegate-registry/=lib/delegate-registry/", "delegate.cash/=lib/delegate-registry/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/", "erc721a/=lib/ERC721A/", "forge-std/=lib/forge-std/src/", "foundry-random/=lib/foundry-random/src/", "openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "operator-filter-registry/=lib/operator-filter-registry/", "prb-test/=lib/foundry-random/lib/prb-test/src/", "solidity-bytes-utils/=lib/foundry-random/lib/solidity-bytes-utils/contracts/" ], "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":"vrfCoordinator","type":"address"},{"internalType":"uint64","name":"vrfSubscriptionId","type":"uint64"},{"internalType":"bytes32","name":"vrfKeyHash","type":"bytes32"},{"internalType":"address","name":"delegateRegistryAddress","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"address","name":"claimaint","type":"address"}],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"AlreadyMinted","type":"error"},{"inputs":[],"name":"AlreadyRequested","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[{"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"AuctionDoesNotExist","type":"error"},{"inputs":[],"name":"AuctionMustBeActive","type":"error"},{"inputs":[],"name":"AuctionMustNotBeStarted","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"bid","type":"uint256"},{"internalType":"uint256","name":"minBid","type":"uint256"}],"name":"BidLowerThanMinimum","type":"error"},{"inputs":[],"name":"CannotRedrawUnwonCrate","type":"error"},{"inputs":[],"name":"CannotResetReward","type":"error"},{"inputs":[],"name":"ContractCallersNotAllowed","type":"error"},{"inputs":[],"name":"CrateMustBeLocked","type":"error"},{"inputs":[],"name":"EmptyBaseURI","type":"error"},{"inputs":[],"name":"ExceedsMaxSupply","type":"error"},{"inputs":[],"name":"ForbiddenDuringRaffle","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidCreateAuctionParams","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"InvalidRaffleStage","type":"error"},{"inputs":[],"name":"InvalidRound","type":"error"},{"inputs":[{"internalType":"enum AuctionStage","name":"currentStage","type":"uint8"},{"internalType":"enum AuctionStage","name":"requiredStage","type":"uint8"}],"name":"InvalidStageForOperation","type":"error"},{"inputs":[],"name":"InvalidVRFRequestType","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintRequestStateMismatch","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MultipleAuctionsViolation","type":"error"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"}],"name":"NFTOwnershipMissing","type":"error"},{"inputs":[],"name":"NoActiveAuction","type":"error"},{"inputs":[],"name":"NoFundsToWithdraw","type":"error"},{"inputs":[],"name":"NoWinningToken","type":"error"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"}],"name":"NotAnNFTContract","type":"error"},{"inputs":[],"name":"NullAddressParameter","type":"error"},{"inputs":[],"name":"NullAddressParameters","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[{"internalType":"uint256","name":"priceInput","type":"uint256"},{"internalType":"uint256","name":"minBid","type":"uint256"}],"name":"PriceIsLowerThanTheMinBid","type":"error"},{"inputs":[],"name":"PriceMustBeSet","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RefundFailed","type":"error"},{"inputs":[],"name":"RewardExpired","type":"error"},{"inputs":[],"name":"RewardNotExpired","type":"error"},{"inputs":[],"name":"RoundMustBeClosed","type":"error"},{"inputs":[],"name":"RoundPoolTooSmall","type":"error"},{"inputs":[],"name":"RoundTokenPoolEmpty","type":"error"},{"inputs":[{"internalType":"enum AuctionStage","name":"currentStage","type":"uint8"}],"name":"StageMustBeBiddingClosed","type":"error"},{"inputs":[],"name":"SupplyTooSmall","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":[{"internalType":"address","name":"hotWallet","type":"address"},{"internalType":"address","name":"vault","type":"address"}],"name":"WalletNotDelegated","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFailed","type":"error"},{"inputs":[],"name":"WithdrawToNullAddress","type":"error"},{"inputs":[],"name":"YouDidNotWin","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"ZeroBids","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"},{"indexed":false,"internalType":"uint16","name":"supply","type":"uint16"},{"indexed":false,"internalType":"uint8","name":"maxWinPerWallet","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"minimumBid","type":"uint64"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"AuctionEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"AuctionStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"},{"indexed":true,"internalType":"address","name":"bidder","type":"address"},{"indexed":false,"internalType":"uint256","name":"bidAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bidderTotal","type":"uint256"}],"name":"Bid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"podsWon","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refund","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"ClaimsAndRefundsStarted","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":"uint16","name":"crateId","type":"uint16"},{"indexed":true,"internalType":"address","name":"winner","type":"address"}],"name":"CrateUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newMinBid","type":"uint256"}],"name":"MinimumBidChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"roundId","type":"uint16"},{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"bool","name":"isApproved","type":"bool"}],"name":"MintDecision","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"roundId","type":"uint16"},{"indexed":true,"internalType":"address","name":"minter","type":"address"}],"name":"MintRequested","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":"uint8","name":"auctionId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"RefundSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"roundId","type":"uint16"},{"indexed":true,"internalType":"uint16","name":"tokenId","type":"uint16"},{"indexed":true,"internalType":"address","name":"winner","type":"address"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"roundId","type":"uint16"}],"name":"RoundClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"roundId","type":"uint16"},{"indexed":true,"internalType":"address","name":"requiredOwnership","type":"address"},{"indexed":false,"internalType":"uint16","name":"supply","type":"uint16"}],"name":"RoundCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"RoyaltyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"enum RequestType","name":"_type","type":"uint8"},{"indexed":true,"internalType":"uint16","name":"id","type":"uint16"}],"name":"WinnerDrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"WinningToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"crateId","type":"uint16"},{"indexed":true,"internalType":"uint8","name":"forRound","type":"uint8"},{"indexed":true,"internalType":"address","name":"requiredOwnership","type":"address"}],"name":"XCreateCreated","type":"event"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activeAuctionId","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":[{"internalType":"uint16","name":"auctionId","type":"uint16"}],"name":"auctions","outputs":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"enum AuctionStage","name":"stage","type":"uint8"},{"internalType":"uint8","name":"maxWinPerWallet","type":"uint8"},{"internalType":"uint16","name":"supply","type":"uint16"},{"internalType":"uint16","name":"remainingSupply","type":"uint16"},{"internalType":"uint64","name":"minimumBid","type":"uint64"},{"internalType":"uint64","name":"price","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"awaitingWinnerForCrate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"awaitingWinnerForRound","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"auctionId","type":"uint16"},{"internalType":"address","name":"","type":"address"}],"name":"bidders","outputs":[{"internalType":"uint120","name":"totalBid","type":"uint120"},{"internalType":"uint120","name":"refundedFunds","type":"uint120"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_crateId","type":"uint16"},{"internalType":"address","name":"minter","type":"address"}],"name":"checkCanOpenCrate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_roundId","type":"uint8"},{"internalType":"address","name":"minter","type":"address"}],"name":"checkWin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"forAuctionId","type":"uint8"}],"name":"claimForAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_roundId","type":"uint8"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_roundId","type":"uint8"},{"internalType":"address","name":"vault","type":"address"}],"name":"claimRewardDelegated","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"closeRound","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"crateId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"crateId","type":"uint16"}],"name":"crateWinners","outputs":[{"internalType":"address","name":"winner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"crateId","type":"uint16"}],"name":"crates","outputs":[{"internalType":"address","name":"requiredOwnership","type":"address"},{"internalType":"uint64","name":"expires","type":"uint64"},{"internalType":"uint16","name":"id","type":"uint16"},{"internalType":"uint8","name":"forRound","type":"uint8"},{"internalType":"enum XCrates.CrateState","name":"state","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegationRegistry","outputs":[{"internalType":"contract IDelegationRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"enum RequestType","name":"_type","type":"uint8"},{"internalType":"uint16","name":"id","type":"uint16"}],"name":"drawWinner","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRewardExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"number","type":"uint8"},{"internalType":"address","name":"to","type":"address"}],"name":"mintReservedTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintXKey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"mintXKeyDelegated","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintedReserved","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextClaimDeadline","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_crateId","type":"uint16"}],"name":"openCrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_crateId","type":"uint16"},{"internalType":"address","name":"vault","type":"address"}],"name":"openCrateDelegated","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"roundId","type":"uint8"},{"internalType":"address","name":"minter","type":"address"}],"name":"raffleMinters","outputs":[{"internalType":"enum XRaffleBase.MintStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"roundId","type":"uint8"}],"name":"raffles","outputs":[{"internalType":"address","name":"requiredOwnership","type":"address"},{"internalType":"uint16","name":"id","type":"uint16"},{"internalType":"uint16","name":"supply","type":"uint16"},{"internalType":"uint16","name":"supplyLeft","type":"uint16"},{"internalType":"uint16","name":"startTokenId","type":"uint16"},{"internalType":"enum XRaffleBase.RaffleStage","name":"stage","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"forRound","type":"uint8"},{"internalType":"address","name":"requiredOwnership","type":"address"}],"name":"releaseCrate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_supply","type":"uint16"},{"internalType":"uint8","name":"_maxWinPerWallet","type":"uint8"},{"internalType":"uint64","name":"_minimumBid","type":"uint64"}],"name":"releaseNewAuctionRound","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_supply","type":"uint16"},{"internalType":"address","name":"requiredOwnership","type":"address"}],"name":"releaseNewRaffleRound","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetWinnerWhenRewardExpires","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"roundId","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"roundId","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"roundTokenPool","outputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"roundId","type":"uint8"}],"name":"roundWinners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"},{"internalType":"uint64","name":"newPrice","type":"uint64"}],"name":"setPriceForAuction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"startAuction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"}],"name":"startClaimsForAuction","outputs":[],"stateMutability":"payable","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":"uint8","name":"_roundId","type":"uint8"}],"name":"tokenPoolOfRound","outputs":[{"internalType":"uint16[]","name":"","type":"uint16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupplyAllocated","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_roundId","type":"uint8"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"validateMintRequest","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
610160604052604051620064fc380380620064fc8339810160408190526200002791620003e2565b604080518082018252600580825264582d4b657960d81b602080840191909152835180850190945290835264582d4b455960d81b908301526001600160a01b038616608081905260a081905260e0526001600160401b03851660c052610100849052906101f433878787876202a30081898989898383733cc6cdda760b79bafa08df41ecfa224f810dceb660016daaeb6d7670e522a718067333cd4e3b15620001f95780156200014757604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200012857600080fd5b505af11580156200013d573d6000803e3d6000fd5b50505050620001f9565b6001600160a01b03821615620001985760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af2903906044016200010d565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001df57600080fd5b505af1158015620001f4573d6000803e3d6000fd5b505050505b50600a90506200020a8382620004ea565b50600b620002198282620004ea565b50506001600855506200022c336200026e565b620002388183620002c0565b505050506001600160a01b0316610120526001600160401b03166101405250506001601e5550620005b698505050505050505050565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382161115620003345760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b0382166200038c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016200032b565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601055565b80516001600160a01b0381168114620003dd57600080fd5b919050565b60008060008060808587031215620003f957600080fd5b6200040485620003c5565b60208601519094506001600160401b03811681146200042257600080fd5b604086015190935091506200043a60608601620003c5565b905092959194509250565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200047057607f821691505b6020821081036200049157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004e557600081815260208120601f850160051c81016020861015620004c05750805b601f850160051c820191505b81811015620004e157828155600101620004cc565b5050505b505050565b81516001600160401b0381111562000506576200050662000445565b6200051e816200051784546200045b565b8462000497565b602080601f8311600181146200055657600084156200053d5750858301515b600019600386901b1c1916600185901b178555620004e1565b600085815260208120601f198616915b82811015620005875788860151825594840194600190910190840162000566565b5085821015620005a65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e051610100516101205161014051615ed962000623600039600081816149b70152614b0b0152600081816105f30152613a5a015260006150a001526000505060006150ce0152600061511901526000818161125f01526112a10152615ed96000f3fe6080604052600436106104145760003560e01c806370a082311161021e578063b2264a1011610123578063e278fe6f116100ab578063f2fde38b1161007a578063f2fde38b14610d81578063f73118bf14610da1578063f8c759b614610db4578063fd526af414610e35578063fdd099c314610e7d57600080fd5b8063e278fe6f14610d08578063e8a3d48514610d10578063e985e9c514610d25578063efa13e1714610d6e57600080fd5b8063c52a7744116100f2578063c52a774414610c8b578063c87b56dd14610ca5578063c906103e14610cc5578063c95d9ced14610ce0578063d68aac7614610cf357600080fd5b8063b2264a1014610bdd578063b88d4fde14610c15578063b8f20cb814610c28578063c23dc68f14610c5e57600080fd5b806395d89b41116101a6578063a22cb46511610175578063a22cb46514610b3f578063a54ac98014610b5f578063a92d538014610b95578063aa1b103f14610bc2578063b106724814610bca57600080fd5b806395d89b4114610add578063989f156614610af257806398ca335214610b0557806399a2557a14610b1f57600080fd5b80638462151c116101ed5780638462151c14610a4b57806384a3756714610a785780638cd221c914610a8b5780638da5cb5b14610aac578063938e3d7b14610aca57600080fd5b806370a0823114610975578063715018a61461099557806379fdb84e146109aa5780637f9c94c1146109ca57600080fd5b806329df4cf91161032457806355f804b3116102ac578063641af4f21161027b578063641af4f21461089e57806365871c7e14610918578063689f1623146109385780636b64c769146109585780636c0360eb1461096057600080fd5b806355f804b3146108115780635a459d18146108315780635bbb2177146108515780636352211e1461087e57600080fd5b8063425a15f7116102f3578063425a15f71461070457806342842e0e1461078c57806346216f281461079f57806351cff8d9146107bf57806355d5482a146107df57600080fd5b806329df4cf9146106705780632a55205a14610683578063413542b5146106c257806341f43434146106e257600080fd5b80630b9e7a9f116103a75780631fbdd72d116103765780631fbdd72d146105e15780631fe543e31461061557806323b872dd1461063557806326e52c08146106485780632913abcd1461066857600080fd5b80630b9e7a9f1461057257806312b92eea1461059257806318160ddd146105b25780631998aeef146105d957600080fd5b8063081812fc116103e3578063081812fc146104f4578063095ea7b31461052c57806309b121a71461053f57806309c241f11461055f57600080fd5b806301ffc9a71461045a57806304634d8d1461048f578063062325b2146104a457806306fdde03146104d257600080fd5b366104555761042234610e9d565b60075461043891906001600160801b031661519c565b600780546001600160801b0319166001600160801b038316179055005b600080fd5b34801561046657600080fd5b5061047a6104753660046151d9565b610f0f565b60405190151581526020015b60405180910390f35b6104a261049d36600461520b565b610f20565b005b3480156104b057600080fd5b506000546104bf9061ffff1681565b60405161ffff9091168152602001610486565b3480156104de57600080fd5b506104e7610f7d565b60405161048691906152a0565b34801561050057600080fd5b5061051461050f3660046152b3565b61100f565b6040516001600160a01b039091168152602001610486565b6104a261053a3660046152cc565b611053565b34801561054b57600080fd5b5061047a61055a36600461530f565b61106c565b6104a261056d36600461534c565b611178565b34801561057e57600080fd5b506015546001600160401b0316421161047a565b34801561059e57600080fd5b506104a26105ad366004615368565b611226565b3480156105be57600080fd5b5060095460085403600019015b604051908152602001610486565b6104a2611233565b3480156105ed57600080fd5b506105147f000000000000000000000000000000000000000000000000000000000000000081565b34801561062157600080fd5b506104a26106303660046153c9565b611254565b6104a261064336600461547a565b6112dc565b34801561065457600080fd5b506004546104bf90610100900461ffff1681565b6104a2611307565b6104a261067e36600461534c565b6113b8565b34801561068f57600080fd5b506106a361069e3660046154bb565b6114cf565b604080516001600160a01b039093168352602083019190915201610486565b3480156106ce57600080fd5b506104a26106dd3660046154dd565b61157b565b3480156106ee57600080fd5b506105146daaeb6d7670e522a718067333cd4e81565b34801561071057600080fd5b5061077961071f366004615368565b601c6020526000908152604090205460ff808216916101008104821691620100008204169061ffff63010000008204811691600160281b8104909116906001600160401b03600160381b8204811691600160781b90041687565b604051610486979695949392919061551e565b6104a261079a36600461547a565b6115d5565b3480156107ab57600080fd5b506104bf6107ba366004615574565b6115fa565b3480156107cb57600080fd5b506104a26107da366004615590565b611641565b3480156107eb57600080fd5b50601f546107ff9062010000900460ff1681565b60405160ff9091168152602001610486565b34801561081d57600080fd5b506104a261082c3660046155ad565b61165a565b34801561083d57600080fd5b5061047a61084c36600461534c565b6116cf565b34801561085d57600080fd5b5061087161086c36600461561e565b6116e2565b60405161048691906156bc565b34801561088a57600080fd5b506105146108993660046152b3565b6117a4565b3480156108aa57600080fd5b506109076108b9366004615368565b6002602052600090815260409020546001600160a01b038116906001600160401b03600160a01b8204169061ffff600160e01b8204169060ff600160f01b8204811691600160f81b90041685565b6040516104869594939291906156fe565b34801561092457600080fd5b506104a2610933366004615750565b6117af565b34801561094457600080fd5b506104a26109533660046154dd565b611822565b6104a261182c565b34801561096c57600080fd5b506104e7611855565b34801561098157600080fd5b506105cb610990366004615590565b6118e3565b3480156109a157600080fd5b506104a2611931565b3480156109b657600080fd5b506104a26109c536600461530f565b611945565b3480156109d657600080fd5b50610a396109e53660046154dd565b6018602052600090815260409020546001600160a01b0381169061ffff600160a01b8204811691600160b01b8104821691600160c01b8204811691600160d01b81049091169060ff600160e01b9091041686565b6040516104869695949392919061576e565b348015610a5757600080fd5b50610a6b610a66366004615590565b61195a565b60405161048691906157ba565b6104a2610a86366004615800565b611a62565b348015610a9757600080fd5b506015546107ff90600160401b900460ff1681565b348015610ab857600080fd5b506012546001600160a01b0316610514565b6104a2610ad83660046155ad565b611a9e565b348015610ae957600080fd5b506104e7611ab3565b6104a2610b00366004615860565b611ac2565b348015610b1157600080fd5b50601b546107ff9060ff1681565b348015610b2b57600080fd5b50610a6b610b3a3660046158a3565b611b0a565b348015610b4b57600080fd5b506104a2610b5a3660046158d8565b611c8f565b348015610b6b57600080fd5b50610514610b7a3660046154dd565b6016602052600090815260409020546001600160a01b031681565b348015610ba157600080fd5b50610bb5610bb03660046154dd565b611ca3565b6040516104869190615906565b6104a2611d31565b6104a2610bd836600461530f565b611d43565b348015610be957600080fd5b50601554610bfd906001600160401b031681565b6040516001600160401b039091168152602001610486565b6104a2610c23366004615942565b611f93565b348015610c3457600080fd5b50610514610c43366004615368565b6003602052600090815260409020546001600160a01b031681565b348015610c6a57600080fd5b50610c7e610c793660046152b3565b611fb9565b6040516104869190615a05565b348015610c9757600080fd5b506004546107ff9060ff1681565b348015610cb157600080fd5b506104e7610cc03660046152b3565b612041565b348015610cd157600080fd5b50601f546104bf9061ffff1681565b6104a2610cee3660046154dd565b6120c4565b348015610cff57600080fd5b506104a26120d5565b6104a2612109565b348015610d1c57600080fd5b506104e761211b565b348015610d3157600080fd5b5061047a610d40366004615750565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205460ff1690565b6104a2610d7c366004615a13565b61212a565b348015610d8d57600080fd5b506104a2610d9c366004615590565b61213c565b6104a2610daf366004615a46565b6121b2565b348015610dc057600080fd5b50610e0d610dcf36600461530f565b601d6020908152600092835260408084209091529082529020546001600160781b0380821691600160781b810490911690600160f01b900460ff1683565b604080516001600160781b039485168152939092166020840152151590820152606001610486565b348015610e4157600080fd5b50610e70610e5036600461534c565b601960209081526000928352604080842090915290825290205460ff1681565b6040516104869190615a76565b348015610e8957600080fd5b506104a2610e9836600461534c565b6121c4565b60006001600160801b03821115610f0b5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084015b60405180910390fd5b5090565b6000610f1a826121d9565b92915050565b610f28612227565b610f328282612281565b6040516001600160601b03821681526001600160a01b038316907f37523b98c1c6df523d38b204c981070f443e5d875f794f9e45c1cc8ab7b2cd4e9060200160405180910390a25050565b6060600a8054610f8c90615a90565b80601f0160208091040260200160405190810160405280929190818152602001828054610fb890615a90565b80156110055780601f10610fda57610100808354040283529160200191611005565b820191906000526020600020905b815481529060010190602001808311610fe857829003601f168201915b5050505050905090565b600061101a8261237e565b611037576040516333d1c03960e21b815260040160405180910390fd5b506000908152600e60205260409020546001600160a01b031690565b8161105d816123b3565b611067838361246c565b505050565b61ffff8083166000908152600160205260408120549091168161108e8261237e565b80156110ca575061ffff8086166000908152600160205260409020546001600160a01b038616916110bf91166117a4565b6001600160a01b0316145b905080156111705761ffff85166000908152600260205260409020546001600160a01b0316801561116e576040516370a0823160e01b81526001600160a01b038681166004830152600191908316906370a0823190602401602060405180830381865afa15801561113f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111639190615aca565b101561116e57600091505b505b949350505050565b611180612227565b6001601f546301000000900460ff1660028111156111a0576111a06154f8565b036111be5760405163873be78760e01b815260040160405180910390fd5b601f5462010000900460ff1660196111d68483615ae3565b60ff1611156111f85760405163c30436e960e01b815260040160405180910390fd5b6112028382615ae3565b601f805462ff000019166201000060ff93841602179055611067908390851661250c565b61123081336125e6565b50565b600261123e81612780565b60155461123090600160401b900460ff166127ce565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146112ce5760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610f02565b6112d88282612928565b5050565b826001600160a01b03811633146112f6576112f6336123b3565b611301848484612b4a565b50505050565b61130f612227565b601554600160401b900460ff16600360ff808316600090815260186020526040902054600160e01b900416600481111561134b5761134b6154f8565b146113695760405163230c3b6f60e11b815260040160405180910390fd5b6015546001600160401b03164211611394576040516376adf2e760e11b815260040160405180910390fd5b60ff81166000908152601760205260409020805461ffff1916905561123081612cda565b6113c0612227565b6001600160a01b03811615611400576113d881612d17565b6114005760405163930bba6160e01b81526001600160a01b0382166004820152602401610f02565b60ff8216156114975760155460ff600160401b9091048116908316111561143a576040516328ad4a9560e21b815260040160405180910390fd5b60ff82166000908152601a6020526040812054900361146c5760405163d5d4996960e01b815260040160405180910390fd5b61147582612d89565b611492576040516334f764fb60e11b815260040160405180910390fd5b6114c5565b60095460085460029190036000190110156114c5576040516316000a0960e31b815260040160405180910390fd5b6112d88282612e6c565b60008281526011602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916115445750604080518082019091526010546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090611563906001600160601b031687615afc565b61156d9190615b29565b915196919550909350505050565b611583612fbe565b6001601f546301000000900460ff1660028111156115a3576115a36154f8565b036115c15760405163873be78760e01b815260040160405180910390fd5b6115cb3382613017565b6112306001601e55565b826001600160a01b03811633146115ef576115ef336123b3565b611301848484613498565b601a602052816000526040600020818154811061161657600080fd5b9060005260206000209060109182820401919006600202915091509054906101000a900461ffff1681565b611649612227565b611651612fbe565b6115cb816134b3565b611662612227565b6000819003611684576040516305442caf60e41b815260040160405180910390fd5b6013611691828483615b83565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f682826040516116c3929190615c42565b60405180910390a15050565b60006116db83836135d3565b9392505050565b6060816000816001600160401b038111156116ff576116ff615383565b60405190808252806020026020018201604052801561175157816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161171d5790505b50905060005b82811461116e5761177f86868381811061177357611773615c71565b90506020020135611fb9565b82828151811061179157611791615c71565b6020908102919091010152600101611757565b6000610f1a82613623565b6117b7612fbe565b60016117c281612780565b6001600160a01b03831615806117df57506001600160a01b038216155b156117fd5760405163f7bc91b360e01b815260040160405180910390fd5b6118178383601560089054906101000a900460ff16613692565b506112d86001601e55565b61123081336137f2565b611834612227565b600261183f81612780565b60155461123090600160401b900460ff1661393c565b6013805461186290615a90565b80601f016020809104026020016040519081016040528092919081815260200182805461188e90615a90565b80156118db5780601f106118b0576101008083540402835291602001916118db565b820191906000526020600020905b8154815290600101906020018083116118be57829003601f168201915b505050505081565b60006001600160a01b03821661190c576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600d60205260409020546001600160401b031690565b611939612227565b61194360006139db565b565b806119508130613a2d565b61106783336125e6565b6060600080600061196a856118e3565b90506000816001600160401b0381111561198657611986615383565b6040519080825280602002602001820160405280156119af578160200160208202803683370190505b5090506119dc60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614611a56576119ef81613af3565b91508160400151611a4e5781516001600160a01b031615611a0f57815194505b876001600160a01b0316856001600160a01b031603611a4e5780838780600101985081518110611a4157611a41615c71565b6020026020010181815250505b6001016119df565b50909695505050505050565b611a6a612227565b6001611a7581612780565b6000611a82858585613b2f565b90506001811015611a9757611a976000613d0f565b5050505050565b611aa6612227565b6014611067828483615b83565b6060600b8054610f8c90615a90565b611aca612227565b6000611ad581612780565b611ade84613f12565b601f805463ff0000001916630200000017905560155461130190600160401b900460ff16858585613f99565b6060818310611b2c57604051631960ccad60e11b815260040160405180910390fd5b600080611b3860085490565b90506001851015611b4857600194505b80841115611b54578093505b6000611b5f876118e3565b905084861015611b7e5785850381811015611b78578091505b50611b82565b5060005b6000816001600160401b03811115611b9c57611b9c615383565b604051908082528060200260200182016040528015611bc5578160200160208202803683370190505b50905081600003611bdb5793506116db92505050565b6000611be688611fb9565b905060008160400151611bf7575080515b885b888114158015611c095750848714155b15611c7e57611c1781613af3565b92508260400151611c765782516001600160a01b031615611c3757825191505b8a6001600160a01b0316826001600160a01b031603611c765780848880600101995081518110611c6957611c69615c71565b6020026020010181815250505b600101611bf9565b505050928352509095945050505050565b81611c99816123b3565b6110678383614175565b60ff81166000908152601a6020908152604091829020805483518184028101840190945280845260609392830182828015611d2557602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411611cec5790505b50505050509050919050565b611d39612227565b6119436000601055565b611d4b612227565b60028261ffff161015611d71576040516316000a0960e31b815260040160405180910390fd5b611d7a81612d17565b611da25760405163930bba6160e01b81526001600160a01b0382166004820152602401610f02565b6001601f546301000000900460ff166002811115611dc257611dc26154f8565b03611ddf576040516289bea360e01b815260040160405180910390fd5b611de882613f12565b6015546040805160c0810182526001600160a01b0384168152600160401b90920460ff166020830181905261ffff851691830182905260608301919091529060808101611e386008546000190190565b611e43906001615c87565b61ffff16815260200160019052601554600160401b900460ff16600090815260186020908152604091829020835181549285015193850151606086015160808701516001600160a01b039093166001600160b01b031990951694909417600160a01b61ffff968716021763ffffffff60b01b1916600160b01b9186169190910261ffff60c01b191617600160c01b938516939093029290921761ffff60d01b198116600160d01b9490931693909302918217815560a084015190929091839162ffffff60d01b191660ff60e01b1990911617600160e01b836004811115611f2c57611f2c6154f8565b021790555050601f805463ff000000191663010000001790555060405161ffff841681526001600160a01b0383169060ff8316907f1a43acdcbde88a8ade406d8060dab87b28688e8e7033e0ac38238d6fcff7a601906020015b60405180910390a3505050565b836001600160a01b0381163314611fad57611fad336123b3565b611a97858585856141e1565b604080516080810182526000808252602082018190529181018290526060810191909152604080516080810182526000808252602082018190529181018290526060810191909152600183108061201257506008548310155b1561201d5792915050565b61202683613af3565b90508060400151156120385792915050565b6116db83614225565b606061204c8261237e565b61206957604051630a14c4b560e41b815260040160405180910390fd5b600061207361425a565b9050805160000361209357604051806020016040528060008152506116db565b8061209d84614269565b6040516020016120ae929190615c9a565b6040516020818303038152906040529392505050565b6120cc612227565b611230816142ad565b6120dd612fbe565b60016120e881612780565b6015546120fe90600160401b900460ff1661440f565b506119436001601e55565b612111612227565b6119436001613d0f565b606060148054610f8c90615a90565b612132612227565b6112d882826144d3565b612144612227565b6001600160a01b0381166121a95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f02565b611230816139db565b6121ba612227565b6112d88282614676565b806121cf8130613a2d565b61106783836137f2565b60006301ffc9a760e01b6001600160e01b03198316148061220a57506380ac58cd60e01b6001600160e01b03198316145b80610f1a5750506001600160e01b031916635b5e139f60e01b1490565b6012546001600160a01b031633146119435760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f02565b6127106001600160601b03821611156122ef5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610f02565b6001600160a01b0382166123455760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610f02565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601055565b600081600111158015612392575060085482105b8015610f1a5750506000908152600c6020526040902054600160e01b161590565b6daaeb6d7670e522a718067333cd4e3b1561123057604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124449190615cc9565b61123057604051633b79c77360e21b81526001600160a01b0382166004820152602401610f02565b6000612477826117a4565b9050336001600160a01b038216146124b0576124938133610d40565b6124b0576040516367d9dca160e11b815260040160405180910390fd5b6000828152600e602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60085460008290036125315760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0383166000818152600d602090815260408083208054680100000000000000018802019055848352600c90915281206001851460e11b4260a01b17831790558284019083908390600080516020615e848339815191528180a4600183015b8181146125bc5780836000600080516020615e84833981519152600080a4600101612596565b50816000036125dd57604051622e076360e81b815260040160405180910390fd5b60085550505050565b60016125f1826118e3565b101561261057604051631e9acf1760e31b815260040160405180910390fd5b61ffff80831660009081526001602052604081205490911690819003612649576040516304d6ef8560e41b815260040160405180910390fd5b816001600160a01b03166126608261ffff166117a4565b6001600160a01b03161461268757604051637bc8194f60e01b815260040160405180910390fd5b61ffff8316600090815260026020526040902054600160a01b90046001600160401b03164211156126cb57604051631fb3b62f60e21b815260040160405180910390fd5b61ffff83166000908152600260205260409020546001600160a01b031680156126f8576126f88184614823565b6127058261ffff166148bb565b61ffff8416600081815260026020908152604080832080546001600160f81b0316600360f81b179055600390915280822080546001600160a01b0319166001600160a01b03881690811790915590519092917f266497d074e9fdb256d2a17aa4642d1ba83d795e9493e07c0912a23151bfee0691a350505050565b601f546301000000900460ff16600281111561279e5761279e6154f8565b8160028111156127b0576127b06154f8565b14611230576040516328ad4a9560e21b815260040160405180910390fd5b600160ff8083166000908152601c602052604090205461010090041660048111156127fb576127fb6154f8565b14612819576040516386e0ca7f60e01b815260040160405180910390fd5b60ff81166000908152601d602090815260408083203384529091529020546001600160781b031661284a3482615c87565b60ff83166000908152601c6020526040902054909150600160381b90046001600160401b0316808210156128a3576040516330f9447360e11b8152600481018390526001600160401b0382166024820152604401610f02565b6128ac826148c6565b60ff84166000818152601d60209081526040808320338085529083529281902080546effffffffffffffffffffffffffffff19166001600160781b039690961695909517909455835134815290810186905290927fa7482bf206d390208a853677d417d96e604b5a4e8f5e2e84fde01c580062ae019101611f86565b60008281526005602052604090205460ff16600181600281111561294e5761294e6154f8565b036129925760006129788360008151811061296b5761296b615c71565b602002602001015161492f565b60155490915061130190600160401b900460ff1682614961565b60028160028111156129a6576129a66154f8565b03612b315760008381526006602090815260408083205461ffff1680845260029092528220549091600160f01b90910460ff16908115612b065760ff82166000908152601a6020908152604080832080548251818502810185019093528083529192909190830182828015612a6257602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411612a295790505b5050505050905060008151905060008188600081518110612a8557612a85615c71565b6020026020010151612a979190615ce6565b90505b612ac0838281518110612aaf57612aaf615c71565b602002602001015161ffff1661237e565b612ade578015612ad35760001901612a9a565b506000198101612a9a565b828181518110612af057612af0615c71565b602002602001015161ffff169350505050612b1f565b612b1c8560008151811061296b5761296b615c71565b90505b612b298382614a6e565b505050505050565b60405163561a53ad60e11b815260040160405180910390fd5b6000612b5582613623565b9050836001600160a01b0316816001600160a01b031614612b885760405162a1148160e81b815260040160405180910390fd5b6000828152600e602052604090208054612bb48187335b6001600160a01b039081169116811491141790565b612bdf57612bc28633610d40565b612bdf57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516612c0657604051633a954ecd60e21b815260040160405180910390fd5b8015612c1157600082555b6001600160a01b038681166000908152600d60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b176000858152600c6020526040812091909155600160e11b84169003612ca357600184016000818152600c60205260408120549003612ca1576008548114612ca1576000818152600c602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020615e8483398151915260405160405180910390a4505050505050565b60045460ff1615612cfe57604051632981f6c160e11b815260040160405180910390fd5b6004805460ff191660ff83161790556112d86001614bb1565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526000906001600160a01b038316906301ffc9a790602401602060405180830381865afa158015612d65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a9190615cc9565b60ff81166000908152601a6020908152604080832080548251818502810185019093528083528493830182828015612e0857602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411612dcf5790505b5050505050905060008060018351612e209190615cfa565b90505b612e38838281518110612aaf57612aaf615c71565b15612e44578160010191505b6001821115612e5857506001949350505050565b6000190180612e2357506000949350505050565b60008054612e8c90612e839061ffff166001615d0d565b61ffff16614bf4565b6000805461ffff83811661ffff19909216821783556040805160a0810182526001600160a01b038881168252602080830187815283850187815260ff8d811660608701908152600160808801908152998b526002909452959098208451815492519951935194166001600160e01b031990921691909117600160a01b6001600160401b03909916989098029790971762ffffff60e01b1916600160e01b919095160260ff60f01b191693909317600160f01b9390921692909202178084559151939450929082906001600160f81b0316600160f81b836003811115612f7357612f736154f8565b0217905550506040516001600160a01b038416915060ff85169061ffff8416907f74c8202ac83b4a7f3eb5aea0ad8c46547467a59f01448f4c546a3d69b92ee1d390600090a4505050565b6002601e54036130105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f02565b6002601e55565b60ff8082166000908152601c60209081526040808320815160e081019092528054808616835293949193909284019161010090910416600481111561305e5761305e6154f8565b600481111561306f5761306f6154f8565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a09091015290506003816020015160048111156130de576130de6154f8565b1015613106578060200151600360405163fafc2a6b60e01b8152600401610f02929190615d28565b60ff8083166000908152601d602090815260408083206001600160a01b0388168452825291829020825160608101845290546001600160781b038082168352600160781b82041692820192909252600160f01b9091049092161580159183019190915261319157604051632058b6db60e01b81526001600160a01b0385166004820152602401610f02565b60ff83166000908152601d602090815260408083206001600160a01b03881684529091528120805460ff60f01b1916600160f01b1790558151906001600160781b03821690036131ff57604051636a6ae80d60e01b81526001600160a01b0386166004820152602401610f02565b60006132446132368560c001516001600160401b0316846132209190615d4e565b6001600160781b0316866040015160ff16614c57565b856080015161ffff16614c57565b905060008460c001516001600160401b0316826132619190615d74565b905081156132d157608085015160ff87166000908152601c60205260409020805461ffff928316859003909216600160281b0266ffff000000000019909216919091179055600780546001600160801b038082168401166001600160801b03199091161790556132d1878361250c565b60006132e6826001600160781b038616615d9f565b90506001600160801b0381161561342d57613309816001600160801b03166148c6565b85602001516133189190615dbf565b60ff88166000908152601d602090815260408083206001600160a01b038d16808552925280832080546001600160781b0395909516600160781b026effffffffffffffffffffffffffffff60781b199095169490941790935591519091906001600160801b038416908381818185875af1925050503d80600081146133b9576040519150601f19603f3d011682016040523d82523d6000602084013e6133be565b606091505b50509050806133e45788826040516357b9d85960e11b8152600401610f02929190615ddf565b6040516001600160801b03831681526001600160a01b038a16907fe309aa15fd2f6bd8a58603632508694071e7d35e967bdbb827926e429b7ef34d9060200160405180910390a2505b604080516001600160a01b038a1681526001600160781b03861660208201529081018490526001600160801b03821660608201527f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e9060800160405180910390a15050505050505050565b61106783838360405180602001604052806000815250611f93565b6001600160a01b0381166134da5760405163160f651560e01b815260040160405180910390fd5b6007546001600160801b03166000819003613508576040516367e3990d60e01b815260040160405180910390fd5b600780546001600160801b03191690556040517feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9061354a9084908490615ddf565b60405180910390a16000826001600160a01b0316826001600160801b031660405160006040518083038185875af1925050503d80600081146135a8576040519150601f19603f3d011682016040523d82523d6000602084013e6135ad565b606091505b50509050806110675782826040516351134c8960e11b8152600401610f02929190615ddf565b60ff821660009081526017602052604081205461ffff166135f38161237e565b80156111705750826001600160a01b03166136118261ffff166117a4565b6001600160a01b031614949350505050565b6000818060011161367957600854811015613679576000818152600c602052604081205490600160e01b82169003613677575b806000036116db5750600019016000818152600c6020526040902054613656565b505b604051636f96cda160e11b815260040160405180910390fd5b808361369e8282614c6d565b60ff831660009081526019602090815260408083206001600160a01b03888116808652919093529220805460ff1916600117905586161461370b5760ff831660009081526019602090815260408083206001600160a01b03891684529091529020805460ff191660051790555b336001600160a01b038516146137445760ff831660009081526019602090815260408083203384529091529020805460ff191660061790555b60ff8316600090815260186020526040812054600160c01b900461ffff1690036137815760405163c30436e960e01b815260040160405180910390fd5b60ff83166000908152601860205260409020546001600160a01b03166137a78682613a2d565b6137b18187614823565b6040516001600160a01b0386169060ff8616907ffddbd426944cc828296abc4422fb0058e8eb10580fe5890609698b5c3e2a3e4490600090a3505050505050565b60ff821660009081526017602052604081205461ffff169081900361382a576040516304d6ef8560e41b815260040160405180910390fd5b816001600160a01b03166138418261ffff166117a4565b6001600160a01b03161461386857604051637bc8194f60e01b815260040160405180910390fd5b6015546001600160401b031642111561389457604051631fb3b62f60e21b815260040160405180910390fd5b60ff83166000908152601860209081526040808320805460ff60e01b1916600160e21b1790556015805467ffffffffffffffff191690556016909152902080546001600160a01b0319166001600160a01b0384161790556138f861ffff82166148bb565b816001600160a01b03168161ffff168460ff167f7546ae7bbee4f32cdce01224d868d679d33d626107e0dfc5e265b7ea1c1838d860405160405180910390a4505050565b600060ff8083166000908152601c60205260409020546101009004166004811115613969576139696154f8565b146139875760405163bf2176c560e01b815260040160405180910390fd5b60ff81166000818152601c6020526040808220805461ff001916610100179055601b805460ff191684179055517f0a237b7489ab9c5d93a843b86f3936ab88b43c2cee7a9cced35fc31c22c0bfc49190a250565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60405163090c9a2d60e41b81523360048201526001600160a01b03838116602483015282811660448301527f000000000000000000000000000000000000000000000000000000000000000016906390c9a2d090606401602060405180830381865afa158015613aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac59190615cc9565b6112d85760405163bd6e768360e01b81523360048201526001600160a01b0383166024820152604401610f02565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600c6020526040902054610f1a90614cc7565b6000600160ff80861660009081526019602090815260408083206001600160a01b0389168452909152902054166006811115613b6d57613b6d6154f8565b14613b8b57604051639d48fe2960e01b815260040160405180910390fd5b60ff8416600090815260186020526040902054600160c01b900461ffff1660018110613bc45782613bbd576003613bc7565b6002613bc7565b60045b60ff861660009081526019602090815260408083206001600160a01b03891684529091529020805460ff19166001836006811115613c0757613c076154f8565b02179055506000838015613c1f575060008261ffff16115b90508015613cb95760ff86166000908152601860205260409020805461ffff600019909401938416600160c01b0261ffff60c01b19909116179055613c6585600161250c565b60ff86166000908152601a602052604090206008546000190181546001810183556000928352602090922060108304018054600f9093166002026101000a61ffff8181021990941692909316929092021790555b846001600160a01b03168660ff167f664c51efcad1dad362a02a82f44ba0f83178e05205eae24f25ba3aba01a4c2e583604051613cfa911515815260200190565b60405180910390a35061ffff16949350505050565b601f546301000000900460ff166000816002811115613d3057613d306154f8565b03613d4e576040516328ad4a9560e21b815260040160405180910390fd5b601f805463ff00000019169055601554600160401b900460ff166001826002811115613d7c57613d7c6154f8565b03613e7357600160ff808316600090815260186020526040902054600160e01b9004166004811115613db057613db06154f8565b14613dce5760405163ca131ae360e01b815260040160405180910390fd5b60ff81166000908152601860205260409020805460ff60e01b1916600160e11b1790558215613e365760ff8116600090815260186020526040902054600160c01b900461ffff168015613e3457601f805461ffff8082168490031661ffff199091161790555b505b601554604051600160401b90910460ff16907f78faa5c4bccaf6f587a3b6d84a1caa82d0238eefcea272c15bdc7f8bc176b85f90600090a2505050565b600160ff8083166000908152601c60205260409020546101009004166004811115613ea057613ea06154f8565b14613ebe576040516386e0ca7f60e01b815260040160405180910390fd5b60ff81166000818152601c6020526040808220805461ff001916610200179055601b805460ff19169055517f788af3986a665e7e8ae7723656fb1c55205619ac0026e1540108d1ede59548fe9190a2505050565b601f5461ffff16613f2660196101f4615e01565b61ffff16613f348383615d0d565b61ffff161115613f575760405163c30436e960e01b815260040160405180910390fd5b601f805461ffff19169290910161ffff169190911790556015805468ff0000000000000000198116600160401b9182900460ff90811660010116909102179055565b61ffff83161580613fb157506001600160401b038116155b80613fbd575060ff8216155b80613fce57508160ff168361ffff16105b15613fec57604051631d0b451360e01b815260040160405180910390fd5b6040805160e08101825260ff868116808352600060208085018281528885168688015261ffff8a166060870181905260808701526001600160401b03881660a087015260c08601839052928252601c90529390932082518154921660ff1983168117825593519293909291839161ffff1990911617610100836004811115614076576140766154f8565b02179055506040828101518254606080860151608087015160a088015160c09098015164ffffff0000199094166201000060ff9687160264ffff000000191617630100000061ffff93841602176effffffffffffffffffff00000000001916600160281b918316919091026effffffffffffffff00000000000000191617600160381b6001600160401b03988916021767ffffffffffffffff60781b1916600160781b9388169390930292909217909455825190881681528682166020820152938516918401919091528616917f5a95bbb1e3343dc606cca217733c02ae8f07a9729f050fa28163666f74591a1691015b60405180910390a250505050565b336000818152600f602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6141ec8484846112dc565b6001600160a01b0383163b156113015761420884848484614d0e565b611301576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610f1a61425583613623565b614cc7565b606060138054610f8c90615a90565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806142835750819003601f19909101908152919050565b60ff8082166000908152601c60209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156142f4576142f46154f8565b6004811115614305576143056154f8565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a0909101529050600281602001516004811115614374576143746154f8565b146143985780602001516040516302bb7f1160e51b8152600401610f029190615e1c565b8060c001516001600160401b03166000036143c65760405163c0758c9b60e01b815260040160405180910390fd5b60ff82166000818152601c6020526040808220805461ff001916610300179055517f6a5530a778c16d9236227755ff6776c2e05c79130ccf99fd5203b3898bfd76fe9190a25050565b803361441b8282614c6d565b60ff8316600090815260186020526040812054600160c01b900461ffff1690036144585760405163c30436e960e01b815260040160405180910390fd5b60ff831660009081526018602052604090205461447e906001600160a01b031633614823565b60ff83166000818152601960209081526040808320338085529252808320805460ff19166001179055519092917ffddbd426944cc828296abc4422fb0058e8eb10580fe5890609698b5c3e2a3e4491a3505050565b60ff8083166000908152601c60209081526040808320815160e081019092528054808616835293949193909284019161010090910416600481111561451a5761451a6154f8565b600481111561452b5761452b6154f8565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a090910152905060028160200151600481111561459a5761459a6154f8565b146145be5780602001516040516302bb7f1160e51b8152600401610f029190615e1c565b60a08101516001600160401b03808216908416101561460357604051635d3144b360e01b81526001600160401b03808516600483015282166024820152604401610f02565b815160ff9081166000908152601c6020908152604091829020805467ffffffffffffffff60781b1916600160781b6001600160401b038916908102919091179091559151918252918616917f9968e5953e3a2743f99ce40212438cfd1f1c35e05af7149c1459d4c2b50ba3299101614167565b600182600281111561468a5761468a6154f8565b0361472757600061469e8261ffff16614df9565b9050600260ff808316600090815260186020526040902054600160e01b90041660048111156146cf576146cf6154f8565b146146ec576040516289bea360e01b815260040160405180910390fd5b60ff81166000908152601a6020526040812054900361471e576040516304d6ef8560e41b815260040160405180910390fd5b61106781612cda565b600282600281111561473b5761473b6154f8565b036112d85761ffff8116600090815260026020526040902054600160a01b90046001600160401b0316801580159061477257504281115b156147cb57600261ffff8316600090815260026020526040902054600160f81b900460ff1660038111156147a8576147a86154f8565b146147c6576040516364938e1560e01b815260040160405180910390fd5b61481a565b600161ffff8316600090815260026020526040902054600160f81b900460ff1660038111156147fc576147fc6154f8565b1461481a57604051631323dceb60e21b815260040160405180910390fd5b61106782614e5a565b6040516370a0823160e01b81526001600160a01b038281166004830152600191908416906370a0823190602401602060405180830381865afa15801561486d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148919190615aca565b10156112d85760405163b2b0b78b60e01b81526001600160a01b0383166004820152602401610f02565b611230816000614ecc565b60006001600160781b03821115610f0b5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663230206269747360c81b6064820152608401610f02565b60008061493f6008546000190190565b905060006111706149508386615ce6565b61495b906001615c87565b83614ffc565b6004805460ff1916905560ff82166000908152601760209081526040808320805461ffff191661ffff861617905560189091529020805460ff60e01b1916600360e01b1790556149e26149dd6001600160401b037f00000000000000000000000000000000000000000000000000000000000000001642615c87565b615029565b6015805467ffffffffffffffff19166001600160401b039290921691909117905560405161ffff821681527f55e198f457f75be0542f25522d105d47cebf74eeba874ad8ee90eddc95e944dc9060200160405180910390a160ff821660015b6040517f2f1e2b412552af553afe0e4fc67cb080afc8d420e2730f66c9ea42c55e8075fa90600090a35050565b6004805462ffff001916905561ffff8281166000908152600160205260409020805461ffff1916918316919091179055600261ffff8316600090815260026020526040902054600160f81b900460ff166003811115614acf57614acf6154f8565b14614afb5761ffff8216600090815260026020526040902080546001600160f81b0316600160f91b1790555b614b316149dd6001600160401b037f00000000000000000000000000000000000000000000000000000000000000001642615c87565b61ffff83811660009081526002602090815260409182902080546001600160401b0395909516600160a01b0267ffffffffffffffff60a01b19909516949094179093555190831681527f55e198f457f75be0542f25522d105d47cebf74eeba874ad8ee90eddc95e944dc910160405180910390a161ffff82166002614a41565b600080614bbc615091565b60008181526005602052604090208054919250849160ff19166001836002811115614be957614be96154f8565b021790555092915050565b600061ffff821115610f0b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b6064820152608401610f02565b6000818310614c6657816116db565b5090919050565b600060ff80841660009081526019602090815260408083206001600160a01b0387168452909152902054166006811115614ca957614ca96154f8565b146112d857604051631bbdf5c560e31b815260040160405180910390fd5b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290614d43903390899088908890600401615e29565b6020604051808303816000875af1925050508015614d7e575060408051601f3d908101601f19168201909252614d7b91810190615e66565b60015b614ddc573d808015614dac576040519150601f19603f3d011682016040523d82523d6000602084013e614db1565b606091505b508051600003614dd4576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b600060ff821115610f0b5760405162461bcd60e51b815260206004820152602560248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2038604482015264206269747360d81b6064820152608401610f02565b600454610100900461ffff1615614e8457604051632981f6c160e11b815260040160405180910390fd5b6004805462ffff00191661010061ffff8416021790556000614ea66002614bb1565b6000908152600660205260409020805461ffff191661ffff939093169290921790915550565b6000614ed783613623565b905080600080614ef5866000908152600e6020526040902080549091565b915091508415614f3557614f0a818433612b9f565b614f3557614f188333610d40565b614f3557604051632ce44b5f60e11b815260040160405180910390fd5b8015614f4057600082555b6001600160a01b0383166000818152600d6020526040902080546001600160801b030190554260a01b17600360e01b176000878152600c6020526040812091909155600160e11b85169003614fc557600186016000818152600c60205260408120549003614fc3576008548114614fc3576000818152600c602052604090208590555b505b60405186906000906001600160a01b03861690600080516020615e84833981519152908390a4505060098054600101905550505050565b60005b6150088361237e565b614c665760018311156150215760001990920191614fff565b819250614fff565b60006001600160401b03821115610f0b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610f02565b6040516305d3b1d360e41b81527f000000000000000000000000000000000000000000000000000000000000000060048201526001600160401b037f0000000000000000000000000000000000000000000000000000000000000000166024820152600360448201526207a12060648201526001608482015260009081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635d3b1d309060a4016020604051808303816000875af1158015615162573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a9190615aca565b634e487b7160e01b600052601160045260246000fd5b6001600160801b038181168382160190808211156151bc576151bc615186565b5092915050565b6001600160e01b03198116811461123057600080fd5b6000602082840312156151eb57600080fd5b81356116db816151c3565b6001600160a01b038116811461123057600080fd5b6000806040838503121561521e57600080fd5b8235615229816151f6565b915060208301356001600160601b038116811461524557600080fd5b809150509250929050565b60005b8381101561526b578181015183820152602001615253565b50506000910152565b6000815180845261528c816020860160208601615250565b601f01601f19169290920160200192915050565b6020815260006116db6020830184615274565b6000602082840312156152c557600080fd5b5035919050565b600080604083850312156152df57600080fd5b82356152ea816151f6565b946020939093013593505050565b803561ffff8116811461530a57600080fd5b919050565b6000806040838503121561532257600080fd5b61532b836152f8565b91506020830135615245816151f6565b803560ff8116811461530a57600080fd5b6000806040838503121561535f57600080fd5b61532b8361533b565b60006020828403121561537a57600080fd5b6116db826152f8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156153c1576153c1615383565b604052919050565b600080604083850312156153dc57600080fd5b823591506020808401356001600160401b03808211156153fb57600080fd5b818601915086601f83011261540f57600080fd5b81358181111561542157615421615383565b8060051b9150615432848301615399565b818152918301840191848101908984111561544c57600080fd5b938501935b8385101561546a57843582529385019390850190615451565b8096505050505050509250929050565b60008060006060848603121561548f57600080fd5b833561549a816151f6565b925060208401356154aa816151f6565b929592945050506040919091013590565b600080604083850312156154ce57600080fd5b50508035926020909101359150565b6000602082840312156154ef57600080fd5b6116db8261533b565b634e487b7160e01b600052602160045260246000fd5b60058110611230576112306154f8565b60ff8816815260e081016155318861550e565b602082019790975260ff95909516604086015261ffff93841660608601529190921660808401526001600160401b0391821660a08401521660c090910152919050565b6000806040838503121561558757600080fd5b6152ea8361533b565b6000602082840312156155a257600080fd5b81356116db816151f6565b600080602083850312156155c057600080fd5b82356001600160401b03808211156155d757600080fd5b818501915085601f8301126155eb57600080fd5b8135818111156155fa57600080fd5b86602082850101111561560c57600080fd5b60209290920196919550909350505050565b6000806020838503121561563157600080fd5b82356001600160401b038082111561564857600080fd5b818501915085601f83011261565c57600080fd5b81358181111561566b57600080fd5b8660208260051b850101111561560c57600080fd5b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611a56576156eb838551615680565b92840192608092909201916001016156d8565b6001600160a01b03861681526001600160401b038516602082015261ffff8416604082015260ff8316606082015260a0810160048310615740576157406154f8565b8260808301529695505050505050565b6000806040838503121561576357600080fd5b823561532b816151f6565b6001600160a01b038716815261ffff8681166020830152858116604083015284811660608301528316608082015260c081016157a98361550e565b8260a0830152979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611a56578351835292840192918401916001016157d6565b801515811461123057600080fd5b60008060006060848603121561581557600080fd5b61581e8461533b565b9250602084013561582e816151f6565b9150604084013561583e816157f2565b809150509250925092565b80356001600160401b038116811461530a57600080fd5b60008060006060848603121561587557600080fd5b61587e846152f8565b925061588c6020850161533b565b915061589a60408501615849565b90509250925092565b6000806000606084860312156158b857600080fd5b83356158c3816151f6565b95602085013595506040909401359392505050565b600080604083850312156158eb57600080fd5b82356158f6816151f6565b91506020830135615245816157f2565b6020808252825182820181905260009190848201906040850190845b81811015611a5657835161ffff1683529284019291840191600101615922565b6000806000806080858703121561595857600080fd5b8435615963816151f6565b9350602085810135615974816151f6565b93506040860135925060608601356001600160401b038082111561599757600080fd5b818801915088601f8301126159ab57600080fd5b8135818111156159bd576159bd615383565b6159cf601f8201601f19168501615399565b915080825289848285010111156159e557600080fd5b808484018584013760008482840101525080935050505092959194509250565b60808101610f1a8284615680565b60008060408385031215615a2657600080fd5b615a2f8361533b565b9150615a3d60208401615849565b90509250929050565b60008060408385031215615a5957600080fd5b823560038110615a6857600080fd5b9150615a3d602084016152f8565b6020810160078310615a8a57615a8a6154f8565b91905290565b600181811c90821680615aa457607f821691505b602082108103615ac457634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215615adc57600080fd5b5051919050565b60ff8181168382160190811115610f1a57610f1a615186565b8082028115828204841417610f1a57610f1a615186565b634e487b7160e01b600052601260045260246000fd5b600082615b3857615b38615b13565b500490565b601f82111561106757600081815260208120601f850160051c81016020861015615b645750805b601f850160051c820191505b81811015612b2957828155600101615b70565b6001600160401b03831115615b9a57615b9a615383565b615bae83615ba88354615a90565b83615b3d565b6000601f841160018114615be25760008515615bca5750838201355b600019600387901b1c1916600186901b178355611a97565b600083815260209020601f19861690835b82811015615c135786850135825560209485019460019092019101615bf3565b5086821015615c305760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610f1a57610f1a615186565b60008351615cac818460208801615250565b835190830190615cc0818360208801615250565b01949350505050565b600060208284031215615cdb57600080fd5b81516116db816157f2565b600082615cf557615cf5615b13565b500690565b81810381811115610f1a57610f1a615186565b61ffff8181168382160190808211156151bc576151bc615186565b60408101615d358461550e565b838252615d418361550e565b8260208301529392505050565b60006001600160781b0380841680615d6857615d68615b13565b92169190910492915050565b6001600160801b03818116838216028082169190828114615d9757615d97615186565b505092915050565b6001600160801b038281168282160390808211156151bc576151bc615186565b6001600160781b038181168382160190808211156151bc576151bc615186565b6001600160a01b039290921682526001600160801b0316602082015260400190565b61ffff8281168282160390808211156151bc576151bc615186565b60208101615a8a8361550e565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e5c90830184615274565b9695505050505050565b600060208284031215615e7857600080fd5b81516116db816151c356feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203e9b2ef83dc75ef1dcf7aac7a77ed0aec34a05e82fbb350ca5178223bd7f2ece64736f6c63430008140033000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990900000000000000000000000000000000000000000000000000000000000003178af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
Deployed Bytecode
0x6080604052600436106104145760003560e01c806370a082311161021e578063b2264a1011610123578063e278fe6f116100ab578063f2fde38b1161007a578063f2fde38b14610d81578063f73118bf14610da1578063f8c759b614610db4578063fd526af414610e35578063fdd099c314610e7d57600080fd5b8063e278fe6f14610d08578063e8a3d48514610d10578063e985e9c514610d25578063efa13e1714610d6e57600080fd5b8063c52a7744116100f2578063c52a774414610c8b578063c87b56dd14610ca5578063c906103e14610cc5578063c95d9ced14610ce0578063d68aac7614610cf357600080fd5b8063b2264a1014610bdd578063b88d4fde14610c15578063b8f20cb814610c28578063c23dc68f14610c5e57600080fd5b806395d89b41116101a6578063a22cb46511610175578063a22cb46514610b3f578063a54ac98014610b5f578063a92d538014610b95578063aa1b103f14610bc2578063b106724814610bca57600080fd5b806395d89b4114610add578063989f156614610af257806398ca335214610b0557806399a2557a14610b1f57600080fd5b80638462151c116101ed5780638462151c14610a4b57806384a3756714610a785780638cd221c914610a8b5780638da5cb5b14610aac578063938e3d7b14610aca57600080fd5b806370a0823114610975578063715018a61461099557806379fdb84e146109aa5780637f9c94c1146109ca57600080fd5b806329df4cf91161032457806355f804b3116102ac578063641af4f21161027b578063641af4f21461089e57806365871c7e14610918578063689f1623146109385780636b64c769146109585780636c0360eb1461096057600080fd5b806355f804b3146108115780635a459d18146108315780635bbb2177146108515780636352211e1461087e57600080fd5b8063425a15f7116102f3578063425a15f71461070457806342842e0e1461078c57806346216f281461079f57806351cff8d9146107bf57806355d5482a146107df57600080fd5b806329df4cf9146106705780632a55205a14610683578063413542b5146106c257806341f43434146106e257600080fd5b80630b9e7a9f116103a75780631fbdd72d116103765780631fbdd72d146105e15780631fe543e31461061557806323b872dd1461063557806326e52c08146106485780632913abcd1461066857600080fd5b80630b9e7a9f1461057257806312b92eea1461059257806318160ddd146105b25780631998aeef146105d957600080fd5b8063081812fc116103e3578063081812fc146104f4578063095ea7b31461052c57806309b121a71461053f57806309c241f11461055f57600080fd5b806301ffc9a71461045a57806304634d8d1461048f578063062325b2146104a457806306fdde03146104d257600080fd5b366104555761042234610e9d565b60075461043891906001600160801b031661519c565b600780546001600160801b0319166001600160801b038316179055005b600080fd5b34801561046657600080fd5b5061047a6104753660046151d9565b610f0f565b60405190151581526020015b60405180910390f35b6104a261049d36600461520b565b610f20565b005b3480156104b057600080fd5b506000546104bf9061ffff1681565b60405161ffff9091168152602001610486565b3480156104de57600080fd5b506104e7610f7d565b60405161048691906152a0565b34801561050057600080fd5b5061051461050f3660046152b3565b61100f565b6040516001600160a01b039091168152602001610486565b6104a261053a3660046152cc565b611053565b34801561054b57600080fd5b5061047a61055a36600461530f565b61106c565b6104a261056d36600461534c565b611178565b34801561057e57600080fd5b506015546001600160401b0316421161047a565b34801561059e57600080fd5b506104a26105ad366004615368565b611226565b3480156105be57600080fd5b5060095460085403600019015b604051908152602001610486565b6104a2611233565b3480156105ed57600080fd5b506105147f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b81565b34801561062157600080fd5b506104a26106303660046153c9565b611254565b6104a261064336600461547a565b6112dc565b34801561065457600080fd5b506004546104bf90610100900461ffff1681565b6104a2611307565b6104a261067e36600461534c565b6113b8565b34801561068f57600080fd5b506106a361069e3660046154bb565b6114cf565b604080516001600160a01b039093168352602083019190915201610486565b3480156106ce57600080fd5b506104a26106dd3660046154dd565b61157b565b3480156106ee57600080fd5b506105146daaeb6d7670e522a718067333cd4e81565b34801561071057600080fd5b5061077961071f366004615368565b601c6020526000908152604090205460ff808216916101008104821691620100008204169061ffff63010000008204811691600160281b8104909116906001600160401b03600160381b8204811691600160781b90041687565b604051610486979695949392919061551e565b6104a261079a36600461547a565b6115d5565b3480156107ab57600080fd5b506104bf6107ba366004615574565b6115fa565b3480156107cb57600080fd5b506104a26107da366004615590565b611641565b3480156107eb57600080fd5b50601f546107ff9062010000900460ff1681565b60405160ff9091168152602001610486565b34801561081d57600080fd5b506104a261082c3660046155ad565b61165a565b34801561083d57600080fd5b5061047a61084c36600461534c565b6116cf565b34801561085d57600080fd5b5061087161086c36600461561e565b6116e2565b60405161048691906156bc565b34801561088a57600080fd5b506105146108993660046152b3565b6117a4565b3480156108aa57600080fd5b506109076108b9366004615368565b6002602052600090815260409020546001600160a01b038116906001600160401b03600160a01b8204169061ffff600160e01b8204169060ff600160f01b8204811691600160f81b90041685565b6040516104869594939291906156fe565b34801561092457600080fd5b506104a2610933366004615750565b6117af565b34801561094457600080fd5b506104a26109533660046154dd565b611822565b6104a261182c565b34801561096c57600080fd5b506104e7611855565b34801561098157600080fd5b506105cb610990366004615590565b6118e3565b3480156109a157600080fd5b506104a2611931565b3480156109b657600080fd5b506104a26109c536600461530f565b611945565b3480156109d657600080fd5b50610a396109e53660046154dd565b6018602052600090815260409020546001600160a01b0381169061ffff600160a01b8204811691600160b01b8104821691600160c01b8204811691600160d01b81049091169060ff600160e01b9091041686565b6040516104869695949392919061576e565b348015610a5757600080fd5b50610a6b610a66366004615590565b61195a565b60405161048691906157ba565b6104a2610a86366004615800565b611a62565b348015610a9757600080fd5b506015546107ff90600160401b900460ff1681565b348015610ab857600080fd5b506012546001600160a01b0316610514565b6104a2610ad83660046155ad565b611a9e565b348015610ae957600080fd5b506104e7611ab3565b6104a2610b00366004615860565b611ac2565b348015610b1157600080fd5b50601b546107ff9060ff1681565b348015610b2b57600080fd5b50610a6b610b3a3660046158a3565b611b0a565b348015610b4b57600080fd5b506104a2610b5a3660046158d8565b611c8f565b348015610b6b57600080fd5b50610514610b7a3660046154dd565b6016602052600090815260409020546001600160a01b031681565b348015610ba157600080fd5b50610bb5610bb03660046154dd565b611ca3565b6040516104869190615906565b6104a2611d31565b6104a2610bd836600461530f565b611d43565b348015610be957600080fd5b50601554610bfd906001600160401b031681565b6040516001600160401b039091168152602001610486565b6104a2610c23366004615942565b611f93565b348015610c3457600080fd5b50610514610c43366004615368565b6003602052600090815260409020546001600160a01b031681565b348015610c6a57600080fd5b50610c7e610c793660046152b3565b611fb9565b6040516104869190615a05565b348015610c9757600080fd5b506004546107ff9060ff1681565b348015610cb157600080fd5b506104e7610cc03660046152b3565b612041565b348015610cd157600080fd5b50601f546104bf9061ffff1681565b6104a2610cee3660046154dd565b6120c4565b348015610cff57600080fd5b506104a26120d5565b6104a2612109565b348015610d1c57600080fd5b506104e761211b565b348015610d3157600080fd5b5061047a610d40366004615750565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205460ff1690565b6104a2610d7c366004615a13565b61212a565b348015610d8d57600080fd5b506104a2610d9c366004615590565b61213c565b6104a2610daf366004615a46565b6121b2565b348015610dc057600080fd5b50610e0d610dcf36600461530f565b601d6020908152600092835260408084209091529082529020546001600160781b0380821691600160781b810490911690600160f01b900460ff1683565b604080516001600160781b039485168152939092166020840152151590820152606001610486565b348015610e4157600080fd5b50610e70610e5036600461534c565b601960209081526000928352604080842090915290825290205460ff1681565b6040516104869190615a76565b348015610e8957600080fd5b506104a2610e9836600461534c565b6121c4565b60006001600160801b03821115610f0b5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084015b60405180910390fd5b5090565b6000610f1a826121d9565b92915050565b610f28612227565b610f328282612281565b6040516001600160601b03821681526001600160a01b038316907f37523b98c1c6df523d38b204c981070f443e5d875f794f9e45c1cc8ab7b2cd4e9060200160405180910390a25050565b6060600a8054610f8c90615a90565b80601f0160208091040260200160405190810160405280929190818152602001828054610fb890615a90565b80156110055780601f10610fda57610100808354040283529160200191611005565b820191906000526020600020905b815481529060010190602001808311610fe857829003601f168201915b5050505050905090565b600061101a8261237e565b611037576040516333d1c03960e21b815260040160405180910390fd5b506000908152600e60205260409020546001600160a01b031690565b8161105d816123b3565b611067838361246c565b505050565b61ffff8083166000908152600160205260408120549091168161108e8261237e565b80156110ca575061ffff8086166000908152600160205260409020546001600160a01b038616916110bf91166117a4565b6001600160a01b0316145b905080156111705761ffff85166000908152600260205260409020546001600160a01b0316801561116e576040516370a0823160e01b81526001600160a01b038681166004830152600191908316906370a0823190602401602060405180830381865afa15801561113f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111639190615aca565b101561116e57600091505b505b949350505050565b611180612227565b6001601f546301000000900460ff1660028111156111a0576111a06154f8565b036111be5760405163873be78760e01b815260040160405180910390fd5b601f5462010000900460ff1660196111d68483615ae3565b60ff1611156111f85760405163c30436e960e01b815260040160405180910390fd5b6112028382615ae3565b601f805462ff000019166201000060ff93841602179055611067908390851661250c565b61123081336125e6565b50565b600261123e81612780565b60155461123090600160401b900460ff166127ce565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990916146112ce5760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909166024820152604401610f02565b6112d88282612928565b5050565b826001600160a01b03811633146112f6576112f6336123b3565b611301848484612b4a565b50505050565b61130f612227565b601554600160401b900460ff16600360ff808316600090815260186020526040902054600160e01b900416600481111561134b5761134b6154f8565b146113695760405163230c3b6f60e11b815260040160405180910390fd5b6015546001600160401b03164211611394576040516376adf2e760e11b815260040160405180910390fd5b60ff81166000908152601760205260409020805461ffff1916905561123081612cda565b6113c0612227565b6001600160a01b03811615611400576113d881612d17565b6114005760405163930bba6160e01b81526001600160a01b0382166004820152602401610f02565b60ff8216156114975760155460ff600160401b9091048116908316111561143a576040516328ad4a9560e21b815260040160405180910390fd5b60ff82166000908152601a6020526040812054900361146c5760405163d5d4996960e01b815260040160405180910390fd5b61147582612d89565b611492576040516334f764fb60e11b815260040160405180910390fd5b6114c5565b60095460085460029190036000190110156114c5576040516316000a0960e31b815260040160405180910390fd5b6112d88282612e6c565b60008281526011602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916115445750604080518082019091526010546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090611563906001600160601b031687615afc565b61156d9190615b29565b915196919550909350505050565b611583612fbe565b6001601f546301000000900460ff1660028111156115a3576115a36154f8565b036115c15760405163873be78760e01b815260040160405180910390fd5b6115cb3382613017565b6112306001601e55565b826001600160a01b03811633146115ef576115ef336123b3565b611301848484613498565b601a602052816000526040600020818154811061161657600080fd5b9060005260206000209060109182820401919006600202915091509054906101000a900461ffff1681565b611649612227565b611651612fbe565b6115cb816134b3565b611662612227565b6000819003611684576040516305442caf60e41b815260040160405180910390fd5b6013611691828483615b83565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f682826040516116c3929190615c42565b60405180910390a15050565b60006116db83836135d3565b9392505050565b6060816000816001600160401b038111156116ff576116ff615383565b60405190808252806020026020018201604052801561175157816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161171d5790505b50905060005b82811461116e5761177f86868381811061177357611773615c71565b90506020020135611fb9565b82828151811061179157611791615c71565b6020908102919091010152600101611757565b6000610f1a82613623565b6117b7612fbe565b60016117c281612780565b6001600160a01b03831615806117df57506001600160a01b038216155b156117fd5760405163f7bc91b360e01b815260040160405180910390fd5b6118178383601560089054906101000a900460ff16613692565b506112d86001601e55565b61123081336137f2565b611834612227565b600261183f81612780565b60155461123090600160401b900460ff1661393c565b6013805461186290615a90565b80601f016020809104026020016040519081016040528092919081815260200182805461188e90615a90565b80156118db5780601f106118b0576101008083540402835291602001916118db565b820191906000526020600020905b8154815290600101906020018083116118be57829003601f168201915b505050505081565b60006001600160a01b03821661190c576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600d60205260409020546001600160401b031690565b611939612227565b61194360006139db565b565b806119508130613a2d565b61106783336125e6565b6060600080600061196a856118e3565b90506000816001600160401b0381111561198657611986615383565b6040519080825280602002602001820160405280156119af578160200160208202803683370190505b5090506119dc60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614611a56576119ef81613af3565b91508160400151611a4e5781516001600160a01b031615611a0f57815194505b876001600160a01b0316856001600160a01b031603611a4e5780838780600101985081518110611a4157611a41615c71565b6020026020010181815250505b6001016119df565b50909695505050505050565b611a6a612227565b6001611a7581612780565b6000611a82858585613b2f565b90506001811015611a9757611a976000613d0f565b5050505050565b611aa6612227565b6014611067828483615b83565b6060600b8054610f8c90615a90565b611aca612227565b6000611ad581612780565b611ade84613f12565b601f805463ff0000001916630200000017905560155461130190600160401b900460ff16858585613f99565b6060818310611b2c57604051631960ccad60e11b815260040160405180910390fd5b600080611b3860085490565b90506001851015611b4857600194505b80841115611b54578093505b6000611b5f876118e3565b905084861015611b7e5785850381811015611b78578091505b50611b82565b5060005b6000816001600160401b03811115611b9c57611b9c615383565b604051908082528060200260200182016040528015611bc5578160200160208202803683370190505b50905081600003611bdb5793506116db92505050565b6000611be688611fb9565b905060008160400151611bf7575080515b885b888114158015611c095750848714155b15611c7e57611c1781613af3565b92508260400151611c765782516001600160a01b031615611c3757825191505b8a6001600160a01b0316826001600160a01b031603611c765780848880600101995081518110611c6957611c69615c71565b6020026020010181815250505b600101611bf9565b505050928352509095945050505050565b81611c99816123b3565b6110678383614175565b60ff81166000908152601a6020908152604091829020805483518184028101840190945280845260609392830182828015611d2557602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411611cec5790505b50505050509050919050565b611d39612227565b6119436000601055565b611d4b612227565b60028261ffff161015611d71576040516316000a0960e31b815260040160405180910390fd5b611d7a81612d17565b611da25760405163930bba6160e01b81526001600160a01b0382166004820152602401610f02565b6001601f546301000000900460ff166002811115611dc257611dc26154f8565b03611ddf576040516289bea360e01b815260040160405180910390fd5b611de882613f12565b6015546040805160c0810182526001600160a01b0384168152600160401b90920460ff166020830181905261ffff851691830182905260608301919091529060808101611e386008546000190190565b611e43906001615c87565b61ffff16815260200160019052601554600160401b900460ff16600090815260186020908152604091829020835181549285015193850151606086015160808701516001600160a01b039093166001600160b01b031990951694909417600160a01b61ffff968716021763ffffffff60b01b1916600160b01b9186169190910261ffff60c01b191617600160c01b938516939093029290921761ffff60d01b198116600160d01b9490931693909302918217815560a084015190929091839162ffffff60d01b191660ff60e01b1990911617600160e01b836004811115611f2c57611f2c6154f8565b021790555050601f805463ff000000191663010000001790555060405161ffff841681526001600160a01b0383169060ff8316907f1a43acdcbde88a8ade406d8060dab87b28688e8e7033e0ac38238d6fcff7a601906020015b60405180910390a3505050565b836001600160a01b0381163314611fad57611fad336123b3565b611a97858585856141e1565b604080516080810182526000808252602082018190529181018290526060810191909152604080516080810182526000808252602082018190529181018290526060810191909152600183108061201257506008548310155b1561201d5792915050565b61202683613af3565b90508060400151156120385792915050565b6116db83614225565b606061204c8261237e565b61206957604051630a14c4b560e41b815260040160405180910390fd5b600061207361425a565b9050805160000361209357604051806020016040528060008152506116db565b8061209d84614269565b6040516020016120ae929190615c9a565b6040516020818303038152906040529392505050565b6120cc612227565b611230816142ad565b6120dd612fbe565b60016120e881612780565b6015546120fe90600160401b900460ff1661440f565b506119436001601e55565b612111612227565b6119436001613d0f565b606060148054610f8c90615a90565b612132612227565b6112d882826144d3565b612144612227565b6001600160a01b0381166121a95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f02565b611230816139db565b6121ba612227565b6112d88282614676565b806121cf8130613a2d565b61106783836137f2565b60006301ffc9a760e01b6001600160e01b03198316148061220a57506380ac58cd60e01b6001600160e01b03198316145b80610f1a5750506001600160e01b031916635b5e139f60e01b1490565b6012546001600160a01b031633146119435760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f02565b6127106001600160601b03821611156122ef5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610f02565b6001600160a01b0382166123455760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610f02565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601055565b600081600111158015612392575060085482105b8015610f1a5750506000908152600c6020526040902054600160e01b161590565b6daaeb6d7670e522a718067333cd4e3b1561123057604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124449190615cc9565b61123057604051633b79c77360e21b81526001600160a01b0382166004820152602401610f02565b6000612477826117a4565b9050336001600160a01b038216146124b0576124938133610d40565b6124b0576040516367d9dca160e11b815260040160405180910390fd5b6000828152600e602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60085460008290036125315760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0383166000818152600d602090815260408083208054680100000000000000018802019055848352600c90915281206001851460e11b4260a01b17831790558284019083908390600080516020615e848339815191528180a4600183015b8181146125bc5780836000600080516020615e84833981519152600080a4600101612596565b50816000036125dd57604051622e076360e81b815260040160405180910390fd5b60085550505050565b60016125f1826118e3565b101561261057604051631e9acf1760e31b815260040160405180910390fd5b61ffff80831660009081526001602052604081205490911690819003612649576040516304d6ef8560e41b815260040160405180910390fd5b816001600160a01b03166126608261ffff166117a4565b6001600160a01b03161461268757604051637bc8194f60e01b815260040160405180910390fd5b61ffff8316600090815260026020526040902054600160a01b90046001600160401b03164211156126cb57604051631fb3b62f60e21b815260040160405180910390fd5b61ffff83166000908152600260205260409020546001600160a01b031680156126f8576126f88184614823565b6127058261ffff166148bb565b61ffff8416600081815260026020908152604080832080546001600160f81b0316600360f81b179055600390915280822080546001600160a01b0319166001600160a01b03881690811790915590519092917f266497d074e9fdb256d2a17aa4642d1ba83d795e9493e07c0912a23151bfee0691a350505050565b601f546301000000900460ff16600281111561279e5761279e6154f8565b8160028111156127b0576127b06154f8565b14611230576040516328ad4a9560e21b815260040160405180910390fd5b600160ff8083166000908152601c602052604090205461010090041660048111156127fb576127fb6154f8565b14612819576040516386e0ca7f60e01b815260040160405180910390fd5b60ff81166000908152601d602090815260408083203384529091529020546001600160781b031661284a3482615c87565b60ff83166000908152601c6020526040902054909150600160381b90046001600160401b0316808210156128a3576040516330f9447360e11b8152600481018390526001600160401b0382166024820152604401610f02565b6128ac826148c6565b60ff84166000818152601d60209081526040808320338085529083529281902080546effffffffffffffffffffffffffffff19166001600160781b039690961695909517909455835134815290810186905290927fa7482bf206d390208a853677d417d96e604b5a4e8f5e2e84fde01c580062ae019101611f86565b60008281526005602052604090205460ff16600181600281111561294e5761294e6154f8565b036129925760006129788360008151811061296b5761296b615c71565b602002602001015161492f565b60155490915061130190600160401b900460ff1682614961565b60028160028111156129a6576129a66154f8565b03612b315760008381526006602090815260408083205461ffff1680845260029092528220549091600160f01b90910460ff16908115612b065760ff82166000908152601a6020908152604080832080548251818502810185019093528083529192909190830182828015612a6257602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411612a295790505b5050505050905060008151905060008188600081518110612a8557612a85615c71565b6020026020010151612a979190615ce6565b90505b612ac0838281518110612aaf57612aaf615c71565b602002602001015161ffff1661237e565b612ade578015612ad35760001901612a9a565b506000198101612a9a565b828181518110612af057612af0615c71565b602002602001015161ffff169350505050612b1f565b612b1c8560008151811061296b5761296b615c71565b90505b612b298382614a6e565b505050505050565b60405163561a53ad60e11b815260040160405180910390fd5b6000612b5582613623565b9050836001600160a01b0316816001600160a01b031614612b885760405162a1148160e81b815260040160405180910390fd5b6000828152600e602052604090208054612bb48187335b6001600160a01b039081169116811491141790565b612bdf57612bc28633610d40565b612bdf57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516612c0657604051633a954ecd60e21b815260040160405180910390fd5b8015612c1157600082555b6001600160a01b038681166000908152600d60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b176000858152600c6020526040812091909155600160e11b84169003612ca357600184016000818152600c60205260408120549003612ca1576008548114612ca1576000818152600c602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020615e8483398151915260405160405180910390a4505050505050565b60045460ff1615612cfe57604051632981f6c160e11b815260040160405180910390fd5b6004805460ff191660ff83161790556112d86001614bb1565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526000906001600160a01b038316906301ffc9a790602401602060405180830381865afa158015612d65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a9190615cc9565b60ff81166000908152601a6020908152604080832080548251818502810185019093528083528493830182828015612e0857602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411612dcf5790505b5050505050905060008060018351612e209190615cfa565b90505b612e38838281518110612aaf57612aaf615c71565b15612e44578160010191505b6001821115612e5857506001949350505050565b6000190180612e2357506000949350505050565b60008054612e8c90612e839061ffff166001615d0d565b61ffff16614bf4565b6000805461ffff83811661ffff19909216821783556040805160a0810182526001600160a01b038881168252602080830187815283850187815260ff8d811660608701908152600160808801908152998b526002909452959098208451815492519951935194166001600160e01b031990921691909117600160a01b6001600160401b03909916989098029790971762ffffff60e01b1916600160e01b919095160260ff60f01b191693909317600160f01b9390921692909202178084559151939450929082906001600160f81b0316600160f81b836003811115612f7357612f736154f8565b0217905550506040516001600160a01b038416915060ff85169061ffff8416907f74c8202ac83b4a7f3eb5aea0ad8c46547467a59f01448f4c546a3d69b92ee1d390600090a4505050565b6002601e54036130105760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610f02565b6002601e55565b60ff8082166000908152601c60209081526040808320815160e081019092528054808616835293949193909284019161010090910416600481111561305e5761305e6154f8565b600481111561306f5761306f6154f8565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a09091015290506003816020015160048111156130de576130de6154f8565b1015613106578060200151600360405163fafc2a6b60e01b8152600401610f02929190615d28565b60ff8083166000908152601d602090815260408083206001600160a01b0388168452825291829020825160608101845290546001600160781b038082168352600160781b82041692820192909252600160f01b9091049092161580159183019190915261319157604051632058b6db60e01b81526001600160a01b0385166004820152602401610f02565b60ff83166000908152601d602090815260408083206001600160a01b03881684529091528120805460ff60f01b1916600160f01b1790558151906001600160781b03821690036131ff57604051636a6ae80d60e01b81526001600160a01b0386166004820152602401610f02565b60006132446132368560c001516001600160401b0316846132209190615d4e565b6001600160781b0316866040015160ff16614c57565b856080015161ffff16614c57565b905060008460c001516001600160401b0316826132619190615d74565b905081156132d157608085015160ff87166000908152601c60205260409020805461ffff928316859003909216600160281b0266ffff000000000019909216919091179055600780546001600160801b038082168401166001600160801b03199091161790556132d1878361250c565b60006132e6826001600160781b038616615d9f565b90506001600160801b0381161561342d57613309816001600160801b03166148c6565b85602001516133189190615dbf565b60ff88166000908152601d602090815260408083206001600160a01b038d16808552925280832080546001600160781b0395909516600160781b026effffffffffffffffffffffffffffff60781b199095169490941790935591519091906001600160801b038416908381818185875af1925050503d80600081146133b9576040519150601f19603f3d011682016040523d82523d6000602084013e6133be565b606091505b50509050806133e45788826040516357b9d85960e11b8152600401610f02929190615ddf565b6040516001600160801b03831681526001600160a01b038a16907fe309aa15fd2f6bd8a58603632508694071e7d35e967bdbb827926e429b7ef34d9060200160405180910390a2505b604080516001600160a01b038a1681526001600160781b03861660208201529081018490526001600160801b03821660608201527f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e9060800160405180910390a15050505050505050565b61106783838360405180602001604052806000815250611f93565b6001600160a01b0381166134da5760405163160f651560e01b815260040160405180910390fd5b6007546001600160801b03166000819003613508576040516367e3990d60e01b815260040160405180910390fd5b600780546001600160801b03191690556040517feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9061354a9084908490615ddf565b60405180910390a16000826001600160a01b0316826001600160801b031660405160006040518083038185875af1925050503d80600081146135a8576040519150601f19603f3d011682016040523d82523d6000602084013e6135ad565b606091505b50509050806110675782826040516351134c8960e11b8152600401610f02929190615ddf565b60ff821660009081526017602052604081205461ffff166135f38161237e565b80156111705750826001600160a01b03166136118261ffff166117a4565b6001600160a01b031614949350505050565b6000818060011161367957600854811015613679576000818152600c602052604081205490600160e01b82169003613677575b806000036116db5750600019016000818152600c6020526040902054613656565b505b604051636f96cda160e11b815260040160405180910390fd5b808361369e8282614c6d565b60ff831660009081526019602090815260408083206001600160a01b03888116808652919093529220805460ff1916600117905586161461370b5760ff831660009081526019602090815260408083206001600160a01b03891684529091529020805460ff191660051790555b336001600160a01b038516146137445760ff831660009081526019602090815260408083203384529091529020805460ff191660061790555b60ff8316600090815260186020526040812054600160c01b900461ffff1690036137815760405163c30436e960e01b815260040160405180910390fd5b60ff83166000908152601860205260409020546001600160a01b03166137a78682613a2d565b6137b18187614823565b6040516001600160a01b0386169060ff8616907ffddbd426944cc828296abc4422fb0058e8eb10580fe5890609698b5c3e2a3e4490600090a3505050505050565b60ff821660009081526017602052604081205461ffff169081900361382a576040516304d6ef8560e41b815260040160405180910390fd5b816001600160a01b03166138418261ffff166117a4565b6001600160a01b03161461386857604051637bc8194f60e01b815260040160405180910390fd5b6015546001600160401b031642111561389457604051631fb3b62f60e21b815260040160405180910390fd5b60ff83166000908152601860209081526040808320805460ff60e01b1916600160e21b1790556015805467ffffffffffffffff191690556016909152902080546001600160a01b0319166001600160a01b0384161790556138f861ffff82166148bb565b816001600160a01b03168161ffff168460ff167f7546ae7bbee4f32cdce01224d868d679d33d626107e0dfc5e265b7ea1c1838d860405160405180910390a4505050565b600060ff8083166000908152601c60205260409020546101009004166004811115613969576139696154f8565b146139875760405163bf2176c560e01b815260040160405180910390fd5b60ff81166000818152601c6020526040808220805461ff001916610100179055601b805460ff191684179055517f0a237b7489ab9c5d93a843b86f3936ab88b43c2cee7a9cced35fc31c22c0bfc49190a250565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60405163090c9a2d60e41b81523360048201526001600160a01b03838116602483015282811660448301527f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b16906390c9a2d090606401602060405180830381865afa158015613aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ac59190615cc9565b6112d85760405163bd6e768360e01b81523360048201526001600160a01b0383166024820152604401610f02565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600c6020526040902054610f1a90614cc7565b6000600160ff80861660009081526019602090815260408083206001600160a01b0389168452909152902054166006811115613b6d57613b6d6154f8565b14613b8b57604051639d48fe2960e01b815260040160405180910390fd5b60ff8416600090815260186020526040902054600160c01b900461ffff1660018110613bc45782613bbd576003613bc7565b6002613bc7565b60045b60ff861660009081526019602090815260408083206001600160a01b03891684529091529020805460ff19166001836006811115613c0757613c076154f8565b02179055506000838015613c1f575060008261ffff16115b90508015613cb95760ff86166000908152601860205260409020805461ffff600019909401938416600160c01b0261ffff60c01b19909116179055613c6585600161250c565b60ff86166000908152601a602052604090206008546000190181546001810183556000928352602090922060108304018054600f9093166002026101000a61ffff8181021990941692909316929092021790555b846001600160a01b03168660ff167f664c51efcad1dad362a02a82f44ba0f83178e05205eae24f25ba3aba01a4c2e583604051613cfa911515815260200190565b60405180910390a35061ffff16949350505050565b601f546301000000900460ff166000816002811115613d3057613d306154f8565b03613d4e576040516328ad4a9560e21b815260040160405180910390fd5b601f805463ff00000019169055601554600160401b900460ff166001826002811115613d7c57613d7c6154f8565b03613e7357600160ff808316600090815260186020526040902054600160e01b9004166004811115613db057613db06154f8565b14613dce5760405163ca131ae360e01b815260040160405180910390fd5b60ff81166000908152601860205260409020805460ff60e01b1916600160e11b1790558215613e365760ff8116600090815260186020526040902054600160c01b900461ffff168015613e3457601f805461ffff8082168490031661ffff199091161790555b505b601554604051600160401b90910460ff16907f78faa5c4bccaf6f587a3b6d84a1caa82d0238eefcea272c15bdc7f8bc176b85f90600090a2505050565b600160ff8083166000908152601c60205260409020546101009004166004811115613ea057613ea06154f8565b14613ebe576040516386e0ca7f60e01b815260040160405180910390fd5b60ff81166000818152601c6020526040808220805461ff001916610200179055601b805460ff19169055517f788af3986a665e7e8ae7723656fb1c55205619ac0026e1540108d1ede59548fe9190a2505050565b601f5461ffff16613f2660196101f4615e01565b61ffff16613f348383615d0d565b61ffff161115613f575760405163c30436e960e01b815260040160405180910390fd5b601f805461ffff19169290910161ffff169190911790556015805468ff0000000000000000198116600160401b9182900460ff90811660010116909102179055565b61ffff83161580613fb157506001600160401b038116155b80613fbd575060ff8216155b80613fce57508160ff168361ffff16105b15613fec57604051631d0b451360e01b815260040160405180910390fd5b6040805160e08101825260ff868116808352600060208085018281528885168688015261ffff8a166060870181905260808701526001600160401b03881660a087015260c08601839052928252601c90529390932082518154921660ff1983168117825593519293909291839161ffff1990911617610100836004811115614076576140766154f8565b02179055506040828101518254606080860151608087015160a088015160c09098015164ffffff0000199094166201000060ff9687160264ffff000000191617630100000061ffff93841602176effffffffffffffffffff00000000001916600160281b918316919091026effffffffffffffff00000000000000191617600160381b6001600160401b03988916021767ffffffffffffffff60781b1916600160781b9388169390930292909217909455825190881681528682166020820152938516918401919091528616917f5a95bbb1e3343dc606cca217733c02ae8f07a9729f050fa28163666f74591a1691015b60405180910390a250505050565b336000818152600f602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6141ec8484846112dc565b6001600160a01b0383163b156113015761420884848484614d0e565b611301576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610f1a61425583613623565b614cc7565b606060138054610f8c90615a90565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806142835750819003601f19909101908152919050565b60ff8082166000908152601c60209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156142f4576142f46154f8565b6004811115614305576143056154f8565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a0909101529050600281602001516004811115614374576143746154f8565b146143985780602001516040516302bb7f1160e51b8152600401610f029190615e1c565b8060c001516001600160401b03166000036143c65760405163c0758c9b60e01b815260040160405180910390fd5b60ff82166000818152601c6020526040808220805461ff001916610300179055517f6a5530a778c16d9236227755ff6776c2e05c79130ccf99fd5203b3898bfd76fe9190a25050565b803361441b8282614c6d565b60ff8316600090815260186020526040812054600160c01b900461ffff1690036144585760405163c30436e960e01b815260040160405180910390fd5b60ff831660009081526018602052604090205461447e906001600160a01b031633614823565b60ff83166000818152601960209081526040808320338085529252808320805460ff19166001179055519092917ffddbd426944cc828296abc4422fb0058e8eb10580fe5890609698b5c3e2a3e4491a3505050565b60ff8083166000908152601c60209081526040808320815160e081019092528054808616835293949193909284019161010090910416600481111561451a5761451a6154f8565b600481111561452b5761452b6154f8565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a090910152905060028160200151600481111561459a5761459a6154f8565b146145be5780602001516040516302bb7f1160e51b8152600401610f029190615e1c565b60a08101516001600160401b03808216908416101561460357604051635d3144b360e01b81526001600160401b03808516600483015282166024820152604401610f02565b815160ff9081166000908152601c6020908152604091829020805467ffffffffffffffff60781b1916600160781b6001600160401b038916908102919091179091559151918252918616917f9968e5953e3a2743f99ce40212438cfd1f1c35e05af7149c1459d4c2b50ba3299101614167565b600182600281111561468a5761468a6154f8565b0361472757600061469e8261ffff16614df9565b9050600260ff808316600090815260186020526040902054600160e01b90041660048111156146cf576146cf6154f8565b146146ec576040516289bea360e01b815260040160405180910390fd5b60ff81166000908152601a6020526040812054900361471e576040516304d6ef8560e41b815260040160405180910390fd5b61106781612cda565b600282600281111561473b5761473b6154f8565b036112d85761ffff8116600090815260026020526040902054600160a01b90046001600160401b0316801580159061477257504281115b156147cb57600261ffff8316600090815260026020526040902054600160f81b900460ff1660038111156147a8576147a86154f8565b146147c6576040516364938e1560e01b815260040160405180910390fd5b61481a565b600161ffff8316600090815260026020526040902054600160f81b900460ff1660038111156147fc576147fc6154f8565b1461481a57604051631323dceb60e21b815260040160405180910390fd5b61106782614e5a565b6040516370a0823160e01b81526001600160a01b038281166004830152600191908416906370a0823190602401602060405180830381865afa15801561486d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906148919190615aca565b10156112d85760405163b2b0b78b60e01b81526001600160a01b0383166004820152602401610f02565b611230816000614ecc565b60006001600160781b03821115610f0b5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663230206269747360c81b6064820152608401610f02565b60008061493f6008546000190190565b905060006111706149508386615ce6565b61495b906001615c87565b83614ffc565b6004805460ff1916905560ff82166000908152601760209081526040808320805461ffff191661ffff861617905560189091529020805460ff60e01b1916600360e01b1790556149e26149dd6001600160401b037f000000000000000000000000000000000000000000000000000000000002a3001642615c87565b615029565b6015805467ffffffffffffffff19166001600160401b039290921691909117905560405161ffff821681527f55e198f457f75be0542f25522d105d47cebf74eeba874ad8ee90eddc95e944dc9060200160405180910390a160ff821660015b6040517f2f1e2b412552af553afe0e4fc67cb080afc8d420e2730f66c9ea42c55e8075fa90600090a35050565b6004805462ffff001916905561ffff8281166000908152600160205260409020805461ffff1916918316919091179055600261ffff8316600090815260026020526040902054600160f81b900460ff166003811115614acf57614acf6154f8565b14614afb5761ffff8216600090815260026020526040902080546001600160f81b0316600160f91b1790555b614b316149dd6001600160401b037f000000000000000000000000000000000000000000000000000000000002a3001642615c87565b61ffff83811660009081526002602090815260409182902080546001600160401b0395909516600160a01b0267ffffffffffffffff60a01b19909516949094179093555190831681527f55e198f457f75be0542f25522d105d47cebf74eeba874ad8ee90eddc95e944dc910160405180910390a161ffff82166002614a41565b600080614bbc615091565b60008181526005602052604090208054919250849160ff19166001836002811115614be957614be96154f8565b021790555092915050565b600061ffff821115610f0b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b6064820152608401610f02565b6000818310614c6657816116db565b5090919050565b600060ff80841660009081526019602090815260408083206001600160a01b0387168452909152902054166006811115614ca957614ca96154f8565b146112d857604051631bbdf5c560e31b815260040160405180910390fd5b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290614d43903390899088908890600401615e29565b6020604051808303816000875af1925050508015614d7e575060408051601f3d908101601f19168201909252614d7b91810190615e66565b60015b614ddc573d808015614dac576040519150601f19603f3d011682016040523d82523d6000602084013e614db1565b606091505b508051600003614dd4576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b600060ff821115610f0b5760405162461bcd60e51b815260206004820152602560248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2038604482015264206269747360d81b6064820152608401610f02565b600454610100900461ffff1615614e8457604051632981f6c160e11b815260040160405180910390fd5b6004805462ffff00191661010061ffff8416021790556000614ea66002614bb1565b6000908152600660205260409020805461ffff191661ffff939093169290921790915550565b6000614ed783613623565b905080600080614ef5866000908152600e6020526040902080549091565b915091508415614f3557614f0a818433612b9f565b614f3557614f188333610d40565b614f3557604051632ce44b5f60e11b815260040160405180910390fd5b8015614f4057600082555b6001600160a01b0383166000818152600d6020526040902080546001600160801b030190554260a01b17600360e01b176000878152600c6020526040812091909155600160e11b85169003614fc557600186016000818152600c60205260408120549003614fc3576008548114614fc3576000818152600c602052604090208590555b505b60405186906000906001600160a01b03861690600080516020615e84833981519152908390a4505060098054600101905550505050565b60005b6150088361237e565b614c665760018311156150215760001990920191614fff565b819250614fff565b60006001600160401b03821115610f0b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610f02565b6040516305d3b1d360e41b81527f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef60048201526001600160401b037f0000000000000000000000000000000000000000000000000000000000000317166024820152600360448201526207a12060648201526001608482015260009081906001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091690635d3b1d309060a4016020604051808303816000875af1158015615162573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a9190615aca565b634e487b7160e01b600052601160045260246000fd5b6001600160801b038181168382160190808211156151bc576151bc615186565b5092915050565b6001600160e01b03198116811461123057600080fd5b6000602082840312156151eb57600080fd5b81356116db816151c3565b6001600160a01b038116811461123057600080fd5b6000806040838503121561521e57600080fd5b8235615229816151f6565b915060208301356001600160601b038116811461524557600080fd5b809150509250929050565b60005b8381101561526b578181015183820152602001615253565b50506000910152565b6000815180845261528c816020860160208601615250565b601f01601f19169290920160200192915050565b6020815260006116db6020830184615274565b6000602082840312156152c557600080fd5b5035919050565b600080604083850312156152df57600080fd5b82356152ea816151f6565b946020939093013593505050565b803561ffff8116811461530a57600080fd5b919050565b6000806040838503121561532257600080fd5b61532b836152f8565b91506020830135615245816151f6565b803560ff8116811461530a57600080fd5b6000806040838503121561535f57600080fd5b61532b8361533b565b60006020828403121561537a57600080fd5b6116db826152f8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156153c1576153c1615383565b604052919050565b600080604083850312156153dc57600080fd5b823591506020808401356001600160401b03808211156153fb57600080fd5b818601915086601f83011261540f57600080fd5b81358181111561542157615421615383565b8060051b9150615432848301615399565b818152918301840191848101908984111561544c57600080fd5b938501935b8385101561546a57843582529385019390850190615451565b8096505050505050509250929050565b60008060006060848603121561548f57600080fd5b833561549a816151f6565b925060208401356154aa816151f6565b929592945050506040919091013590565b600080604083850312156154ce57600080fd5b50508035926020909101359150565b6000602082840312156154ef57600080fd5b6116db8261533b565b634e487b7160e01b600052602160045260246000fd5b60058110611230576112306154f8565b60ff8816815260e081016155318861550e565b602082019790975260ff95909516604086015261ffff93841660608601529190921660808401526001600160401b0391821660a08401521660c090910152919050565b6000806040838503121561558757600080fd5b6152ea8361533b565b6000602082840312156155a257600080fd5b81356116db816151f6565b600080602083850312156155c057600080fd5b82356001600160401b03808211156155d757600080fd5b818501915085601f8301126155eb57600080fd5b8135818111156155fa57600080fd5b86602082850101111561560c57600080fd5b60209290920196919550909350505050565b6000806020838503121561563157600080fd5b82356001600160401b038082111561564857600080fd5b818501915085601f83011261565c57600080fd5b81358181111561566b57600080fd5b8660208260051b850101111561560c57600080fd5b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611a56576156eb838551615680565b92840192608092909201916001016156d8565b6001600160a01b03861681526001600160401b038516602082015261ffff8416604082015260ff8316606082015260a0810160048310615740576157406154f8565b8260808301529695505050505050565b6000806040838503121561576357600080fd5b823561532b816151f6565b6001600160a01b038716815261ffff8681166020830152858116604083015284811660608301528316608082015260c081016157a98361550e565b8260a0830152979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611a56578351835292840192918401916001016157d6565b801515811461123057600080fd5b60008060006060848603121561581557600080fd5b61581e8461533b565b9250602084013561582e816151f6565b9150604084013561583e816157f2565b809150509250925092565b80356001600160401b038116811461530a57600080fd5b60008060006060848603121561587557600080fd5b61587e846152f8565b925061588c6020850161533b565b915061589a60408501615849565b90509250925092565b6000806000606084860312156158b857600080fd5b83356158c3816151f6565b95602085013595506040909401359392505050565b600080604083850312156158eb57600080fd5b82356158f6816151f6565b91506020830135615245816157f2565b6020808252825182820181905260009190848201906040850190845b81811015611a5657835161ffff1683529284019291840191600101615922565b6000806000806080858703121561595857600080fd5b8435615963816151f6565b9350602085810135615974816151f6565b93506040860135925060608601356001600160401b038082111561599757600080fd5b818801915088601f8301126159ab57600080fd5b8135818111156159bd576159bd615383565b6159cf601f8201601f19168501615399565b915080825289848285010111156159e557600080fd5b808484018584013760008482840101525080935050505092959194509250565b60808101610f1a8284615680565b60008060408385031215615a2657600080fd5b615a2f8361533b565b9150615a3d60208401615849565b90509250929050565b60008060408385031215615a5957600080fd5b823560038110615a6857600080fd5b9150615a3d602084016152f8565b6020810160078310615a8a57615a8a6154f8565b91905290565b600181811c90821680615aa457607f821691505b602082108103615ac457634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215615adc57600080fd5b5051919050565b60ff8181168382160190811115610f1a57610f1a615186565b8082028115828204841417610f1a57610f1a615186565b634e487b7160e01b600052601260045260246000fd5b600082615b3857615b38615b13565b500490565b601f82111561106757600081815260208120601f850160051c81016020861015615b645750805b601f850160051c820191505b81811015612b2957828155600101615b70565b6001600160401b03831115615b9a57615b9a615383565b615bae83615ba88354615a90565b83615b3d565b6000601f841160018114615be25760008515615bca5750838201355b600019600387901b1c1916600186901b178355611a97565b600083815260209020601f19861690835b82811015615c135786850135825560209485019460019092019101615bf3565b5086821015615c305760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b634e487b7160e01b600052603260045260246000fd5b80820180821115610f1a57610f1a615186565b60008351615cac818460208801615250565b835190830190615cc0818360208801615250565b01949350505050565b600060208284031215615cdb57600080fd5b81516116db816157f2565b600082615cf557615cf5615b13565b500690565b81810381811115610f1a57610f1a615186565b61ffff8181168382160190808211156151bc576151bc615186565b60408101615d358461550e565b838252615d418361550e565b8260208301529392505050565b60006001600160781b0380841680615d6857615d68615b13565b92169190910492915050565b6001600160801b03818116838216028082169190828114615d9757615d97615186565b505092915050565b6001600160801b038281168282160390808211156151bc576151bc615186565b6001600160781b038181168382160190808211156151bc576151bc615186565b6001600160a01b039290921682526001600160801b0316602082015260400190565b61ffff8281168282160390808211156151bc576151bc615186565b60208101615a8a8361550e565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e5c90830184615274565b9695505050505050565b600060208284031215615e7857600080fd5b81516116db816151c356feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203e9b2ef83dc75ef1dcf7aac7a77ed0aec34a05e82fbb350ca5178223bd7f2ece64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990900000000000000000000000000000000000000000000000000000000000003178af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
-----Decoded View---------------
Arg [0] : vrfCoordinator (address): 0x271682DEB8C4E0901D1a1550aD2e64D568E69909
Arg [1] : vrfSubscriptionId (uint64): 791
Arg [2] : vrfKeyHash (bytes32): 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
Arg [3] : delegateRegistryAddress (address): 0x00000000000076A84feF008CDAbe6409d2FE638B
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000317
Arg [2] : 8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef
Arg [3] : 00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
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.