Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 828 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Vote | 537517 | 3 mins ago | IN | 0 ETH | 0.00000491 | ||||
Vote | 537033 | 11 mins ago | IN | 0 ETH | 0.0000042 | ||||
Vote | 537000 | 12 mins ago | IN | 0 ETH | 0.00000486 | ||||
Vote | 536877 | 14 mins ago | IN | 0 ETH | 0.00000425 | ||||
Vote | 536864 | 14 mins ago | IN | 0 ETH | 0.0000049 | ||||
Vote | 536645 | 18 mins ago | IN | 0 ETH | 0.00000461 | ||||
Vote | 536631 | 18 mins ago | IN | 0 ETH | 0.00000556 | ||||
Vote | 536105 | 27 mins ago | IN | 0 ETH | 0.00000491 | ||||
Vote | 536007 | 28 mins ago | IN | 0 ETH | 0.00000559 | ||||
Vote | 535989 | 29 mins ago | IN | 0 ETH | 0.00000577 | ||||
Vote | 535215 | 42 mins ago | IN | 0 ETH | 0.00000595 | ||||
Vote | 535177 | 43 mins ago | IN | 0 ETH | 0.00000656 | ||||
Vote | 534326 | 57 mins ago | IN | 0 ETH | 0.00000448 | ||||
Vote | 534303 | 57 mins ago | IN | 0 ETH | 0.00000515 | ||||
Vote | 534010 | 1 hr ago | IN | 0 ETH | 0.00000613 | ||||
Vote | 533992 | 1 hr ago | IN | 0 ETH | 0.00000646 | ||||
Vote | 533988 | 1 hr ago | IN | 0 ETH | 0.0000058 | ||||
Vote | 533818 | 1 hr ago | IN | 0 ETH | 0.00000472 | ||||
Vote | 533799 | 1 hr ago | IN | 0 ETH | 0.0000058 | ||||
Vote | 533408 | 1 hr ago | IN | 0 ETH | 0.00000487 | ||||
Vote | 533381 | 1 hr ago | IN | 0 ETH | 0.00000648 | ||||
Vote | 531760 | 1 hr ago | IN | 0 ETH | 0.00000487 | ||||
Vote | 531577 | 1 hr ago | IN | 0 ETH | 0.00000645 | ||||
Vote | 530834 | 1 hr ago | IN | 0 ETH | 0.00000549 | ||||
Vote | 530689 | 1 hr ago | IN | 0 ETH | 0.00000472 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
475528 | 17 hrs ago | Contract Creation | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
BearishHonoraries
Compiler Version
v0.8.28+commit.7893614a
ZkSolc Version
v1.5.10
Optimization Enabled:
Yes with Mode 3
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; import "erc721a/contracts/ERC721A.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; import "erc721a/contracts/extensions/ERC721ABurnable.sol"; import {Ownable} from "solady/src/auth/Ownable.sol"; import {LibString} from "solady/src/utils/LibString.sol"; /** * @title BEARISH Honoraries * @notice Airdropped to the community for their contributions to the project. BUT also burned based on number of votes. * @author @bearish_af */ contract BearishHonoraries is ERC721A, ERC721AQueryable, ERC721ABurnable, Ownable { string public baseURI; struct Vote { uint256 numVotes; uint256 requiredVotes; } mapping(uint256 => Vote) public votes; mapping(uint256 => mapping(address => bool)) public voted; mapping(uint256 => address) public burnedBy; uint256 public burnThreshold; error AlreadyVoted(); error NotEnoughVotes(); error TokenDoesNotExist(); constructor( string memory baseURI_ ) ERC721A("Bearish Honoraries", "BEARISH") { _initializeOwner(msg.sender); baseURI = baseURI_; } /** * @notice Mint honorary NFTs * @dev Only owner can mint */ function mint() external onlyOwner { _mint(msg.sender, 1); votes[totalSupply()].requiredVotes = 300; } /** * @notice Burn a token * @dev Only burns if the number of votes is greater than or equal to the required votes. Trustless. * @param tokenId The token ID to burn */ function votedBurn(uint256 tokenId) external { if (votes[tokenId].numVotes < votes[tokenId].requiredVotes) revert NotEnoughVotes(); burnedBy[tokenId] = msg.sender; _burn(tokenId); } /** * @notice Force burn a token * @param tokenId The token ID to burn */ function forceBurn(uint256 tokenId) external onlyOwner { burnedBy[tokenId] = msg.sender; _burn(tokenId); } /** * @notice Get the starting token ID * @return The starting token ID */ function _startTokenId() internal pure override returns (uint256) { return 1; } /** * @notice Set the base URI for the token metadata * @param newBaseURI The new base URI */ function setBaseURI(string memory newBaseURI) external onlyOwner { baseURI = newBaseURI; } /** * @notice Get the required votes for a token * @param tokenId The token ID * @return The required votes */ function requiredVotes(uint256 tokenId) public view returns (uint256) { return votes[tokenId].requiredVotes; } /** * @notice Get the number of votes for a token * @param tokenId The token ID * @return The number of votes */ function numVotes(uint256 tokenId) public view returns (uint256) { return votes[tokenId].numVotes; } /** * @notice Vote for a token * @param tokenId The token ID */ function vote(uint256 tokenId) external { if (voted[tokenId][msg.sender]) revert AlreadyVoted(); if (!_exists(tokenId)) revert TokenDoesNotExist(); voted[tokenId][msg.sender] = true; votes[tokenId].numVotes++; } /** * @notice Set the required votes for a token * @param tokenId The token ID * @param newRequiredVotes The new required votes */ function setRequiredVotes( uint256 tokenId, uint256 newRequiredVotes ) external onlyOwner { if (!_exists(tokenId)) revert TokenDoesNotExist(); votes[tokenId].requiredVotes = newRequiredVotes; } /** * @notice Get the token URI * @param tokenId The token ID * @return The token URI */ function tokenURI( uint256 tokenId ) public view virtual override(ERC721A, IERC721A) returns (string memory) { if (!_exists(tokenId)) revert TokenDoesNotExist(); return string(abi.encodePacked(baseURI, LibString.toString(tokenId))); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * The `_sequentialUpTo()` function can be overriden to enable spot mints * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // The amount of tokens minted above `_sequentialUpTo()`. // We call these spot mints (i.e. non-sequential mints). uint256 private _spotMinted; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID for sequential mints. * * Override this function to change the starting token ID for sequential mints. * * Note: The value returned must never change after any tokens have been minted. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the maximum token ID (inclusive) for sequential mints. * * Override this function to return a value less than 2**256 - 1, * but greater than `_startTokenId()`, to enable spot (non-sequential) mints. * * Note: The value returned must never change after any tokens have been minted. */ function _sequentialUpTo() internal view virtual returns (uint256) { return type(uint256).max; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256 result) { // Counter underflow is impossible as `_burnCounter` cannot be incremented // more than `_currentIndex + _spotMinted - _startTokenId()` times. unchecked { // With spot minting, the intermediate `result` can be temporarily negative, // and the computation must be unchecked. result = _currentIndex - _burnCounter - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256 result) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { result = _currentIndex - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } /** * @dev Returns the total number of tokens that are spot-minted. */ function _totalSpotMinted() internal view virtual returns (uint256) { return _spotMinted; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Returns whether the ownership slot at `index` is initialized. * An uninitialized slot does not necessarily mean that the slot has no owner. */ function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) { return _packedOwnerships[index] != 0; } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * @dev Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = _packedOwnerships[tokenId]; if (tokenId > _sequentialUpTo()) { if (_packedOwnershipExists(packed)) return packed; _revert(OwnerQueryForNonexistentToken.selector); } // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = _packedOwnerships[--tokenId]; } if (packed == 0) continue; if (packed & _BITMASK_BURNED == 0) return packed; // Otherwise, the token is burned, and we must revert. // This handles the case of batch burned tokens, where only the burned bit // of the starting slot is set, and remaining slots are left uninitialized. _revert(OwnerQueryForNonexistentToken.selector); } } // Otherwise, the data exists and we can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. // If the token is not burned, return `packed`. Otherwise, revert. if (packed & _BITMASK_BURNED == 0) return packed; } _revert(OwnerQueryForNonexistentToken.selector); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool result) { if (_startTokenId() <= tokenId) { if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]); if (tokenId < _currentIndex) { uint256 packed; while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId; result = packed & _BITMASK_BURNED == 0; } } } /** * @dev Returns whether `packed` represents a token that exists. */ function _packedOwnershipExists(uint256 packed) private pure returns (bool result) { assembly { // The following is equivalent to `owner != address(0) && burned == false`. // Symbolically tested. result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED)) } } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS)); if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. from, // `from`. toMasked, // `to`. tokenId // `tokenId`. ) } if (toMasked == 0) _revert(TransferToZeroAddress.selector); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC721ReceiverImplementer.selector); } assembly { revert(add(32, reason), mload(reason)) } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) _revert(MintZeroQuantity.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); uint256 end = startTokenId + quantity; uint256 tokenId = startTokenId; if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); do { assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } // The `!=` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. } while (++tokenId != end); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) _revert(MintToZeroAddress.selector); if (quantity == 0) _revert(MintZeroQuantity.selector); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } while (index < end); // This prevents reentrancy to `_safeMint`. // It does not prevent reentrancy to `_safeMintSpot`. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } /** * @dev Mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * Emits a {Transfer} event for each mint. */ function _mintSpot(address to, uint256 tokenId) internal virtual { if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector); uint256 prevOwnershipPacked = _packedOwnerships[tokenId]; if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector); _beforeTokenTransfers(address(0), to, tokenId, 1); // Overflows are incredibly unrealistic. // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1. // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `true` (as `quantity == 1`). _packedOwnerships[tokenId] = _packOwnershipData( to, _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked) ); // Updates: // - `balance += 1`. // - `numberMinted += 1`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1; // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } ++_spotMinted; } _afterTokenTransfers(address(0), to, tokenId, 1); } /** * @dev Safely mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * See {_mintSpot}. * * Emits a {Transfer} event. */ function _safeMintSpot( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mintSpot(to, tokenId); unchecked { if (to.code.length != 0) { uint256 currentSpotMinted = _spotMinted; if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } // This prevents reentrancy to `_safeMintSpot`. // It does not prevent reentrancy to `_safeMint`. if (_spotMinted != currentSpotMinted) revert(); } } } /** * @dev Equivalent to `_safeMintSpot(to, tokenId, '')`. */ function _safeMintSpot(address to, uint256 tokenId) internal virtual { _safeMintSpot(to, tokenId, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck && _msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { _revert(ApprovalCallerNotOwnerNorApproved.selector); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721ABurnable.sol'; import '../ERC721A.sol'; /** * @title ERC721ABurnable. * * @dev ERC721A token that can be irreversibly burned (destroyed). */ abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual override { _burn(tokenId, true); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory ownership) { unchecked { if (tokenId >= _startTokenId()) { if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId); if (tokenId < _nextTokenId()) { // If the `tokenId` is within bounds, // scan backwards for the initialized ownership slot. while (!_ownershipIsInitialized(tokenId)) --tokenId; return _ownershipAt(tokenId); } } } } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { TokenOwnership[] memory ownerships; uint256 i = tokenIds.length; assembly { // Grab the free memory pointer. ownerships := mload(0x40) // Store the length. mstore(ownerships, i) // Allocate one word for the length, // `tokenIds.length` words for the pointers. i := shl(5, i) // Multiply `i` by 32. mstore(0x40, add(add(ownerships, 0x20), i)) } while (i != 0) { uint256 tokenId; assembly { i := sub(i, 0x20) tokenId := calldataload(add(tokenIds.offset, i)) } TokenOwnership memory ownership = explicitOwnershipOf(tokenId); assembly { // Store the pointer of `ownership` in the `ownerships` array. mstore(add(add(ownerships, 0x20), i), ownership) } } return ownerships; } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { return _tokensOfOwnerIn(owner, start, stop); } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { // If spot mints are enabled, full-range scan is disabled. if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector); uint256 start = _startTokenId(); uint256 stop = _nextTokenId(); uint256[] memory tokenIds; if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop); return tokenIds; } /** * @dev Helper function for returning an array of token IDs owned by `owner`. * * Note that this function is optimized for smaller bytecode size over runtime gas, * since it is meant to be called off-chain. */ function _tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) private view returns (uint256[] memory tokenIds) { unchecked { if (start >= stop) _revert(InvalidQueryRange.selector); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) start = _startTokenId(); uint256 nextTokenId = _nextTokenId(); // If spot mints are enabled, scan all the way until the specified `stop`. uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId; // Set `stop = min(stop, stopLimit)`. if (stop >= stopLimit) stop = stopLimit; // Number of tokens to scan. uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength` to zero if the range contains no tokens. if (start >= stop) tokenIdsMaxLength = 0; // If there are one or more tokens to scan. if (tokenIdsMaxLength != 0) { // Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`. if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start; uint256 m; // Start of available memory. assembly { // Grab the free memory pointer. tokenIds := mload(0x40) // Allocate one word for the length, and `tokenIdsMaxLength` words // for the data. `shl(5, x)` is equivalent to `mul(32, x)`. m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1))) mstore(0x40, m) } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), // initialize `currOwnershipAddr`. // `ownership.address` will not be zero, // as `start` is clamped to the valid token ID range. if (!ownership.burned) currOwnershipAddr = ownership.addr; uint256 tokenIdsIdx; // Use a do-while, which is slightly more efficient for this case, // as the array will at least contain one element. do { if (_sequentialUpTo() != type(uint256).max) { // Skip the remaining unused sequential slots. if (start == nextTokenId) start = _sequentialUpTo() + 1; // Reset `currOwnershipAddr`, as each spot-minted token is a batch of one. if (start > _sequentialUpTo()) currOwnershipAddr = address(0); } ownership = _ownershipAt(start); // This implicitly allocates memory. assembly { switch mload(add(ownership, 0x40)) // if `ownership.burned == false`. case 0 { // if `ownership.addr != address(0)`. // The `addr` already has it's upper 96 bits clearned, // since it is written to memory with regular Solidity. if mload(ownership) { currOwnershipAddr := mload(ownership) } // if `currOwnershipAddr == owner`. // The `shl(96, x)` is to make the comparison agnostic to any // dirty upper 96 bits in `owner`. if iszero(shl(96, xor(currOwnershipAddr, owner))) { tokenIdsIdx := add(tokenIdsIdx, 1) mstore(add(tokenIds, shl(5, tokenIdsIdx)), start) } } // Otherwise, reset `currOwnershipAddr`. // This handles the case of batch burned tokens // (burned bit of first slot set, remaining slots left uninitialized). default { currOwnershipAddr := 0 } start := add(start, 1) // Free temporary memory implicitly allocated for ownership // to avoid quadratic memory expansion costs. mstore(0x40, m) } } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength)); // Store the length of the array. assembly { mstore(tokenIds, tokenIdsIdx) } } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {LibBytes} from "./LibBytes.sol"; /// @notice Library for converting numbers into strings and other string operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) /// /// @dev Note: /// For performance and bytecode compactness, most of the string operations are restricted to /// byte strings (7-bit ASCII), except where otherwise specified. /// Usage of byte string operations on charsets with runes spanning two or more bytes /// can lead to undefined behavior. library LibString { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRUCTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Goated string storage struct that totally MOGs, no cap, fr. /// Uses less gas and bytecode than Solidity's native string storage. It's meta af. /// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. struct StringStorage { bytes32 _spacer; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The length of the output is too small to contain all the hex digits. error HexLengthInsufficient(); /// @dev The length of the string is more than 32 bytes. error TooBigForSmallString(); /// @dev The input string must be a 7-bit ASCII. error StringNot7BitASCII(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the string. uint256 internal constant NOT_FOUND = type(uint256).max; /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant ALPHANUMERIC_7_BIT_ASCII = 0x7fffffe07fffffe03ff000000000000; /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant LETTERS_7_BIT_ASCII = 0x7fffffe07fffffe0000000000000000; /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyz'. uint128 internal constant LOWERCASE_7_BIT_ASCII = 0x7fffffe000000000000000000000000; /// @dev Lookup for 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. uint128 internal constant UPPERCASE_7_BIT_ASCII = 0x7fffffe0000000000000000; /// @dev Lookup for '0123456789'. uint128 internal constant DIGITS_7_BIT_ASCII = 0x3ff000000000000; /// @dev Lookup for '0123456789abcdefABCDEF'. uint128 internal constant HEXDIGITS_7_BIT_ASCII = 0x7e0000007e03ff000000000000; /// @dev Lookup for '01234567'. uint128 internal constant OCTDIGITS_7_BIT_ASCII = 0xff000000000000; /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'. uint128 internal constant PRINTABLE_7_BIT_ASCII = 0x7fffffffffffffffffffffff00003e00; /// @dev Lookup for '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'. uint128 internal constant PUNCTUATION_7_BIT_ASCII = 0x78000001f8000001fc00fffe00000000; /// @dev Lookup for ' \t\n\r\x0b\x0c'. uint128 internal constant WHITESPACE_7_BIT_ASCII = 0x100003e00; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRING STORAGE OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sets the value of the string storage `$` to `s`. function set(StringStorage storage $, string memory s) internal { LibBytes.set(bytesStorage($), bytes(s)); } /// @dev Sets the value of the string storage `$` to `s`. function setCalldata(StringStorage storage $, string calldata s) internal { LibBytes.setCalldata(bytesStorage($), bytes(s)); } /// @dev Sets the value of the string storage `$` to the empty string. function clear(StringStorage storage $) internal { delete $._spacer; } /// @dev Returns whether the value stored is `$` is the empty string "". function isEmpty(StringStorage storage $) internal view returns (bool) { return uint256($._spacer) & 0xff == uint256(0); } /// @dev Returns the length of the value stored in `$`. function length(StringStorage storage $) internal view returns (uint256) { return LibBytes.length(bytesStorage($)); } /// @dev Returns the value stored in `$`. function get(StringStorage storage $) internal view returns (string memory) { return string(LibBytes.get(bytesStorage($))); } /// @dev Helper to cast `$` to a `BytesStorage`. function bytesStorage(StringStorage storage $) internal pure returns (LibBytes.BytesStorage storage casted) { /// @solidity memory-safe-assembly assembly { casted.slot := $.slot } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* DECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the base 10 decimal representation of `value`. function toString(uint256 value) internal pure returns (string memory result) { /// @solidity memory-safe-assembly 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. result := add(mload(0x40), 0x80) mstore(0x40, add(result, 0x20)) // Allocate memory. mstore(result, 0) // Zeroize the slot after the string. let end := result // Cache the end of the memory to calculate the length later. let w := not(0) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { result := add(result, w) // `sub(result, 1)`. // Store the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(result, add(48, mod(temp, 10))) temp := div(temp, 10) // Keep dividing `temp` until zero. if iszero(temp) { break } } let n := sub(end, result) result := sub(result, 0x20) // Move the pointer 32 bytes back to make room for the length. mstore(result, n) // Store the length. } } /// @dev Returns the base 10 decimal representation of `value`. function toString(int256 value) internal pure returns (string memory result) { if (value >= 0) return toString(uint256(value)); unchecked { result = toString(~uint256(value) + 1); } /// @solidity memory-safe-assembly assembly { // We still have some spare memory space on the left, // as we have allocated 3 words (96 bytes) for up to 78 digits. let n := mload(result) // Load the string length. mstore(result, 0x2d) // Store the '-' character. result := sub(result, 1) // Move back the string pointer by a byte. mstore(result, add(n, 1)) // Update the string length. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HEXADECIMAL OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `byteCount` bytes. /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, /// giving a total length of `byteCount * 2 + 2` bytes. /// Reverts if `byteCount` is too small for the output to contain all the digits. function toHexString(uint256 value, uint256 byteCount) internal pure returns (string memory result) { result = toHexStringNoPrefix(value, byteCount); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`, /// left-padded to an input length of `byteCount` bytes. /// The output is not prefixed with "0x" and is encoded using 2 hexadecimal digits per byte, /// giving a total length of `byteCount * 2` bytes. /// Reverts if `byteCount` is too small for the output to contain all the digits. function toHexStringNoPrefix(uint256 value, uint256 byteCount) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, `byteCount * 2` bytes // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length. // We add 0x20 to the total and round down to a multiple of 0x20. // (0x20 + 0x20 + 0x02 + 0x20) = 0x62. result := add(mload(0x40), and(add(shl(1, byteCount), 0x42), not(0x1f))) mstore(0x40, add(result, 0x20)) // Allocate memory. mstore(result, 0) // Zeroize the slot after the string. let end := result // Cache the end to calculate the length later. // Store "0123456789abcdef" in scratch space. mstore(0x0f, 0x30313233343536373839616263646566) let start := sub(result, add(byteCount, byteCount)) let w := not(1) // Tsk. let temp := value // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for {} 1 {} { result := add(result, w) // `sub(result, 2)`. mstore8(add(result, 1), mload(and(temp, 15))) mstore8(result, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(xor(result, start)) { break } } if temp { mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. revert(0x1c, 0x04) } let n := sub(end, result) result := sub(result, 0x20) mstore(result, n) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2 + 2` bytes. function toHexString(uint256 value) internal pure returns (string memory result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x". /// The output excludes leading "0" from the `toHexString` output. /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`. function toMinimalHexString(uint256 value) internal pure returns (string memory result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. let n := add(mload(result), 2) // Compute the length. mstore(add(result, o), 0x3078) // Store the "0x" prefix, accounting for leading zero. result := sub(add(result, o), 2) // Move the pointer, accounting for leading zero. mstore(result, sub(n, o)) // Store the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output excludes leading "0" from the `toHexStringNoPrefix` output. /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`. function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. let n := mload(result) // Get the length. result := add(result, o) // Move the pointer, accounting for leading zero. mstore(result, sub(n, o)) // Store the length, accounting for leading zero. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. /// As address are 20 bytes long, the output will left-padded to have /// a length of `20 * 2` bytes. function toHexStringNoPrefix(uint256 value) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x40 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. result := add(mload(0x40), 0x80) mstore(0x40, add(result, 0x20)) // Allocate memory. mstore(result, 0) // Zeroize the slot after the string. let end := result // Cache the end to calculate the length later. mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. let w := not(1) // Tsk. // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let temp := value } 1 {} { result := add(result, w) // `sub(result, 2)`. mstore8(add(result, 1), mload(and(temp, 15))) mstore8(result, mload(and(shr(4, temp), 15))) temp := shr(8, temp) if iszero(temp) { break } } let n := sub(end, result) result := sub(result, 0x20) mstore(result, n) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte, /// and the alphabets are capitalized conditionally according to /// https://eips.ethereum.org/EIPS/eip-55 function toHexStringChecksummed(address value) internal pure returns (string memory result) { result = toHexString(value); /// @solidity memory-safe-assembly assembly { let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` let o := add(result, 0x22) let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... ` let t := shl(240, 136) // `0b10001000 << 240` for { let i := 0 } 1 {} { mstore(add(i, i), mul(t, byte(i, hashed))) i := add(i, 1) if eq(i, 20) { break } } mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask))))) o := add(o, 0x20) mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask))))) } } /// @dev Returns the hexadecimal representation of `value`. /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. function toHexString(address value) internal pure returns (string memory result) { result = toHexStringNoPrefix(value); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store the length. } } /// @dev Returns the hexadecimal representation of `value`. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(address value) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) // Allocate memory. // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, // 0x02 bytes for the prefix, and 0x28 bytes for the digits. // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80. mstore(0x40, add(result, 0x80)) mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. result := add(result, 2) mstore(result, 40) // Store the length. let o := add(result, 0x20) mstore(add(o, 40), 0) // Zeroize the slot after the string. value := shl(96, value) // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. for { let i := 0 } 1 {} { let p := add(o, add(i, i)) let temp := byte(i, value) mstore8(add(p, 1), mload(and(temp, 15))) mstore8(p, mload(shr(4, temp))) i := add(i, 1) if eq(i, 20) { break } } } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexString(bytes memory raw) internal pure returns (string memory result) { result = toHexStringNoPrefix(raw); /// @solidity memory-safe-assembly assembly { let n := add(mload(result), 2) // Compute the length. mstore(result, 0x3078) // Store the "0x" prefix. result := sub(result, 2) // Move the pointer. mstore(result, n) // Store the length. } } /// @dev Returns the hex encoded string from the raw bytes. /// The output is encoded using 2 hexadecimal digits per byte. function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let n := mload(raw) result := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. mstore(result, add(n, n)) // Store the length of the output. mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. let o := add(result, 0x20) let end := add(raw, n) for {} iszero(eq(raw, end)) {} { raw := add(raw, 1) mstore8(add(o, 1), mload(and(mload(raw), 15))) mstore8(o, mload(and(shr(4, mload(raw)), 15))) o := add(o, 2) } mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate memory. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* RUNE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the number of UTF characters in the string. function runeCount(string memory s) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { mstore(0x00, div(not(0), 255)) mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506) let o := add(s, 0x20) let end := add(o, mload(s)) for { result := 1 } 1 { result := add(result, 1) } { o := add(o, byte(0, mload(shr(250, mload(o))))) if iszero(lt(o, end)) { break } } } } } /// @dev Returns if this string is a 7-bit ASCII string. /// (i.e. all characters codes are in [0..127]) function is7BitASCII(string memory s) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 let mask := shl(7, div(not(0), 255)) let n := mload(s) if n { let o := add(s, 0x20) let end := add(o, n) let last := mload(end) mstore(end, 0) for {} 1 {} { if and(mask, mload(o)) { result := 0 break } o := add(o, 0x20) if iszero(lt(o, end)) { break } } mstore(end, last) } } } /// @dev Returns if this string is a 7-bit ASCII string, /// AND all characters are in the `allowed` lookup. /// Note: If `s` is empty, returns true regardless of `allowed`. function is7BitASCII(string memory s, uint128 allowed) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 if mload(s) { let allowed_ := shr(128, shl(128, allowed)) let o := add(s, 0x20) for { let end := add(o, mload(s)) } 1 {} { result := and(result, shr(byte(0, mload(o)), allowed_)) o := add(o, 1) if iszero(and(result, lt(o, end))) { break } } } } } /// @dev Converts the bytes in the 7-bit ASCII string `s` to /// an allowed lookup for use in `is7BitASCII(s, allowed)`. /// To save runtime gas, you can cache the result in an immutable variable. function to7BitASCIIAllowedLookup(string memory s) internal pure returns (uint128 result) { /// @solidity memory-safe-assembly assembly { if mload(s) { let o := add(s, 0x20) for { let end := add(o, mload(s)) } 1 {} { result := or(result, shl(byte(0, mload(o)), 1)) o := add(o, 1) if iszero(lt(o, end)) { break } } if shr(128, result) { mstore(0x00, 0xc9807e0d) // `StringNot7BitASCII()`. revert(0x1c, 0x04) } } } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTE STRING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance and bytecode compactness, byte string operations are restricted // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets. // Usage of byte string operations on charsets with runes spanning two or more bytes // can lead to undefined behavior. /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. function replace(string memory subject, string memory needle, string memory replacement) internal pure returns (string memory) { return string(LibBytes.replace(bytes(subject), bytes(needle), bytes(replacement))); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(string memory subject, string memory needle, uint256 from) internal pure returns (uint256) { return LibBytes.indexOf(bytes(subject), bytes(needle), from); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(string memory subject, string memory needle) internal pure returns (uint256) { return LibBytes.indexOf(bytes(subject), bytes(needle), 0); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(string memory subject, string memory needle, uint256 from) internal pure returns (uint256) { return LibBytes.lastIndexOf(bytes(subject), bytes(needle), from); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(string memory subject, string memory needle) internal pure returns (uint256) { return LibBytes.lastIndexOf(bytes(subject), bytes(needle), type(uint256).max); } /// @dev Returns true if `needle` is found in `subject`, false otherwise. function contains(string memory subject, string memory needle) internal pure returns (bool) { return LibBytes.contains(bytes(subject), bytes(needle)); } /// @dev Returns whether `subject` starts with `needle`. function startsWith(string memory subject, string memory needle) internal pure returns (bool) { return LibBytes.startsWith(bytes(subject), bytes(needle)); } /// @dev Returns whether `subject` ends with `needle`. function endsWith(string memory subject, string memory needle) internal pure returns (bool) { return LibBytes.endsWith(bytes(subject), bytes(needle)); } /// @dev Returns `subject` repeated `times`. function repeat(string memory subject, uint256 times) internal pure returns (string memory) { return string(LibBytes.repeat(bytes(subject), times)); } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. function slice(string memory subject, uint256 start, uint256 end) internal pure returns (string memory) { return string(LibBytes.slice(bytes(subject), start, end)); } /// @dev Returns a copy of `subject` sliced from `start` to the end of the string. /// `start` is a byte offset. function slice(string memory subject, uint256 start) internal pure returns (string memory) { return string(LibBytes.slice(bytes(subject), start, type(uint256).max)); } /// @dev Returns all the indices of `needle` in `subject`. /// The indices are byte offsets. function indicesOf(string memory subject, string memory needle) internal pure returns (uint256[] memory) { return LibBytes.indicesOf(bytes(subject), bytes(needle)); } /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string. function split(string memory subject, string memory delimiter) internal pure returns (string[] memory result) { bytes[] memory a = LibBytes.split(bytes(subject), bytes(delimiter)); /// @solidity memory-safe-assembly assembly { result := a } } /// @dev Returns a concatenated string of `a` and `b`. /// Cheaper than `string.concat()` and does not de-align the free memory pointer. function concat(string memory a, string memory b) internal pure returns (string memory) { return string(LibBytes.concat(bytes(a), bytes(b))); } /// @dev Returns a copy of the string in either lowercase or UPPERCASE. /// WARNING! This function is only compatible with 7-bit ASCII strings. function toCase(string memory subject, bool toUpper) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let n := mload(subject) if n { result := mload(0x40) let o := add(result, 0x20) let d := sub(subject, result) let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) for { let end := add(o, n) } 1 {} { let b := byte(0, mload(add(d, o))) mstore8(o, xor(and(shr(b, flags), 0x20), b)) o := add(o, 1) if eq(o, end) { break } } mstore(result, n) // Store the length. mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate memory. } } } /// @dev Returns a string from a small bytes32 string. /// `s` must be null-terminated, or behavior will be undefined. function fromSmallString(bytes32 s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let n := 0 for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'. mstore(result, n) // Store the length. let o := add(result, 0x20) mstore(o, s) // Store the bytes of the string. mstore(add(o, n), 0) // Zeroize the slot after the string. mstore(0x40, add(result, 0x40)) // Allocate memory. } } /// @dev Returns the small string, with all bytes after the first null byte zeroized. function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'. mstore(0x00, s) mstore(result, 0x00) result := mload(0x00) } } /// @dev Returns the string as a normalized null-terminated small string. function toSmallString(string memory s) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := mload(s) if iszero(lt(result, 33)) { mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`. revert(0x1c, 0x04) } result := shl(shl(3, sub(32, result)), mload(add(s, result))) } } /// @dev Returns a lowercased copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function lower(string memory subject) internal pure returns (string memory result) { result = toCase(subject, false); } /// @dev Returns an UPPERCASED copy of the string. /// WARNING! This function is only compatible with 7-bit ASCII strings. function upper(string memory subject) internal pure returns (string memory result) { result = toCase(subject, true); } /// @dev Escapes the string to be used within HTML tags. function escapeHTML(string memory s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let end := add(s, mload(s)) let o := add(result, 0x20) // Store the bytes of the packed offsets and strides into the scratch space. // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6. mstore(0x1f, 0x900094) mstore(0x08, 0xc0000000a6ab) // Store ""&'<>" into the scratch space. mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b)) for {} iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) // Not in `["\"","'","&","<",">"]`. if iszero(and(shl(c, 1), 0x500000c400000000)) { mstore8(o, c) o := add(o, 1) continue } let t := shr(248, mload(c)) mstore(o, mload(and(t, 0x1f))) o := add(o, shr(5, t)) } mstore(o, 0) // Zeroize the slot after the string. mstore(result, sub(o, add(result, 0x20))) // Store the length. mstore(0x40, add(o, 0x20)) // Allocate memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes. function escapeJSON(string memory s, bool addDoubleQuotes) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let o := add(result, 0x20) if addDoubleQuotes { mstore8(o, 34) o := add(1, o) } // Store "\\u0000" in scratch space. // Store "0123456789abcdef" in scratch space. // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`. // into the scratch space. mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672) // Bitmask for detecting `["\"","\\"]`. let e := or(shl(0x22, 1), shl(0x5c, 1)) for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) if iszero(lt(c, 0x20)) { if iszero(and(shl(c, 1), e)) { // Not in `["\"","\\"]`. mstore8(o, c) o := add(o, 1) continue } mstore8(o, 0x5c) // "\\". mstore8(add(o, 1), c) o := add(o, 2) continue } if iszero(and(shl(c, 1), 0x3700)) { // Not in `["\b","\t","\n","\f","\d"]`. mstore8(0x1d, mload(shr(4, c))) // Hex value. mstore8(0x1e, mload(and(c, 15))) // Hex value. mstore(o, mload(0x19)) // "\\u00XX". o := add(o, 6) continue } mstore8(o, 0x5c) // "\\". mstore8(add(o, 1), mload(add(c, 8))) o := add(o, 2) } if addDoubleQuotes { mstore8(o, 34) o := add(1, o) } mstore(o, 0) // Zeroize the slot after the string. mstore(result, sub(o, add(result, 0x20))) // Store the length. mstore(0x40, add(o, 0x20)) // Allocate memory. } } /// @dev Escapes the string to be used within double-quotes in a JSON. function escapeJSON(string memory s) internal pure returns (string memory result) { result = escapeJSON(s, false); } /// @dev Encodes `s` so that it can be safely used in a URI, /// just like `encodeURIComponent` in JavaScript. /// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent /// See: https://datatracker.ietf.org/doc/html/rfc2396 /// See: https://datatracker.ietf.org/doc/html/rfc3986 function encodeURIComponent(string memory s) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) // Store "0123456789ABCDEF" in scratch space. // Uppercased to be consistent with JavaScript's implementation. mstore(0x0f, 0x30313233343536373839414243444546) let o := add(result, 0x20) for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { s := add(s, 1) let c := and(mload(s), 0xff) // If not in `[0-9A-Z-a-z-_.!~*'()]`. if iszero(and(1, shr(c, 0x47fffffe87fffffe03ff678200000000))) { mstore8(o, 0x25) // '%'. mstore8(add(o, 1), mload(and(shr(4, c), 15))) mstore8(add(o, 2), mload(and(c, 15))) o := add(o, 3) continue } mstore8(o, c) o := add(o, 1) } mstore(result, sub(o, add(result, 0x20))) // Store the length. mstore(o, 0) // Zeroize the slot after the string. mstore(0x40, add(o, 0x20)) // Allocate memory. } } /// @dev Returns whether `a` equals `b`. function eq(string memory a, string memory b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) } } /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string. function eqs(string memory a, bytes32 b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // These should be evaluated on compile time, as far as possible. let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. let x := not(or(m, or(b, add(m, and(b, m))))) let r := shl(7, iszero(iszero(shr(128, x)))) r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) } } /// @dev Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. function cmp(string memory a, string memory b) internal pure returns (int256) { return LibBytes.cmp(bytes(a), bytes(b)); } /// @dev Packs a single string with its length into a single word. /// Returns `bytes32(0)` if the length is zero or greater than 31. function packOne(string memory a) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { // We don't need to zero right pad the string, // since this is our own custom non-standard packing scheme. result := mul( // Load the length and the bytes. mload(add(a, 0x1f)), // `length != 0 && length < 32`. Abuses underflow. // Assumes that the length is valid and within the block gas limit. lt(sub(mload(a), 1), 0x1f) ) } } /// @dev Unpacks a string packed using {packOne}. /// Returns the empty string if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packOne}, the output behavior is undefined. function unpackOne(bytes32 packed) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) // Grab the free memory pointer. mstore(0x40, add(result, 0x40)) // Allocate 2 words (1 for the length, 1 for the bytes). mstore(result, 0) // Zeroize the length slot. mstore(add(result, 0x1f), packed) // Store the length and bytes. mstore(add(add(result, 0x20), mload(result)), 0) // Right pad with zeroes. } } /// @dev Packs two strings with their lengths into a single word. /// Returns `bytes32(0)` if combined length is zero or greater than 30. function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { let aLen := mload(a) // We don't need to zero right pad the strings, // since this is our own custom non-standard packing scheme. result := mul( or( // Load the length and the bytes of `a` and `b`. shl(shl(3, sub(0x1f, aLen)), mload(add(a, aLen))), mload(sub(add(b, 0x1e), aLen))), // `totalLen != 0 && totalLen < 31`. Abuses underflow. // Assumes that the lengths are valid and within the block gas limit. lt(sub(add(aLen, mload(b)), 1), 0x1e) ) } } /// @dev Unpacks strings packed using {packTwo}. /// Returns the empty strings if `packed` is `bytes32(0)`. /// If `packed` is not an output of {packTwo}, the output behavior is undefined. function unpackTwo(bytes32 packed) internal pure returns (string memory resultA, string memory resultB) { /// @solidity memory-safe-assembly assembly { resultA := mload(0x40) // Grab the free memory pointer. resultB := add(resultA, 0x40) // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words. mstore(0x40, add(resultB, 0x40)) // Zeroize the length slots. mstore(resultA, 0) mstore(resultB, 0) // Store the lengths and bytes. mstore(add(resultA, 0x1f), packed) mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA)))) // Right pad with zeroes. mstore(add(add(resultA, 0x20), mload(resultA)), 0) mstore(add(add(resultB, 0x20), mload(resultB)), 0) } } /// @dev Directly returns `a` without copying. function directReturn(string memory a) internal pure { assembly { // Assumes that the string does not start from the scratch space. let retStart := sub(a, 0x20) let retUnpaddedSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the string is produced // by a method that doesn't zero right pad. mstore(add(retStart, retUnpaddedSize), 0) mstore(retStart, 0x20) // Store the return offset. // End the transaction, returning the string. return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); /** * `_sequentialUpTo()` must be greater than `_startTokenId()`. */ error SequentialUpToTooSmall(); /** * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`. */ error SequentialMintExceedsLimit(); /** * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`. */ error SpotMintTokenIdTooSmall(); /** * Cannot mint over a token that already exists. */ error TokenAlreadyExists(); /** * The feature is not compatible with spot mints. */ error NotCompatibleWithSpotMints(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721ABurnable. */ interface IERC721ABurnable is IERC721A { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) external; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for byte related operations. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBytes.sol) library LibBytes { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STRUCTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Goated bytes storage struct that totally MOGs, no cap, fr. /// Uses less gas and bytecode than Solidity's native bytes storage. It's meta af. /// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. struct BytesStorage { bytes32 _spacer; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The constant returned when the `search` is not found in the bytes. uint256 internal constant NOT_FOUND = type(uint256).max; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTE STORAGE OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sets the value of the bytes storage `$` to `s`. function set(BytesStorage storage $, bytes memory s) internal { /// @solidity memory-safe-assembly assembly { let n := mload(s) let packed := or(0xff, shl(8, n)) for { let i := 0 } 1 {} { if iszero(gt(n, 0xfe)) { i := 0x1f packed := or(n, shl(8, mload(add(s, i)))) if iszero(gt(n, i)) { break } } let o := add(s, 0x20) mstore(0x00, $.slot) for { let p := keccak256(0x00, 0x20) } 1 {} { sstore(add(p, shr(5, i)), mload(add(o, i))) i := add(i, 0x20) if iszero(lt(i, n)) { break } } break } sstore($.slot, packed) } } /// @dev Sets the value of the bytes storage `$` to `s`. function setCalldata(BytesStorage storage $, bytes calldata s) internal { /// @solidity memory-safe-assembly assembly { let packed := or(0xff, shl(8, s.length)) for { let i := 0 } 1 {} { if iszero(gt(s.length, 0xfe)) { i := 0x1f packed := or(s.length, shl(8, shr(8, calldataload(s.offset)))) if iszero(gt(s.length, i)) { break } } mstore(0x00, $.slot) for { let p := keccak256(0x00, 0x20) } 1 {} { sstore(add(p, shr(5, i)), calldataload(add(s.offset, i))) i := add(i, 0x20) if iszero(lt(i, s.length)) { break } } break } sstore($.slot, packed) } } /// @dev Sets the value of the bytes storage `$` to the empty bytes. function clear(BytesStorage storage $) internal { delete $._spacer; } /// @dev Returns whether the value stored is `$` is the empty bytes "". function isEmpty(BytesStorage storage $) internal view returns (bool) { return uint256($._spacer) & 0xff == uint256(0); } /// @dev Returns the length of the value stored in `$`. function length(BytesStorage storage $) internal view returns (uint256 result) { result = uint256($._spacer); /// @solidity memory-safe-assembly assembly { let n := and(0xff, result) result := or(mul(shr(8, result), eq(0xff, n)), mul(n, iszero(eq(0xff, n)))) } } /// @dev Returns the value stored in `$`. function get(BytesStorage storage $) internal view returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let o := add(result, 0x20) let packed := sload($.slot) let n := shr(8, packed) for { let i := 0 } 1 {} { if iszero(eq(or(packed, 0xff), packed)) { mstore(o, packed) n := and(0xff, packed) i := 0x1f if iszero(gt(n, i)) { break } } mstore(0x00, $.slot) for { let p := keccak256(0x00, 0x20) } 1 {} { mstore(add(o, i), sload(add(p, shr(5, i)))) i := add(i, 0x20) if iszero(lt(i, n)) { break } } break } mstore(result, n) // Store the length of the memory. mstore(add(o, n), 0) // Zeroize the slot after the bytes. mstore(0x40, add(add(o, n), 0x20)) // Allocate memory. } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* BYTES OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. function replace(bytes memory subject, bytes memory needle, bytes memory replacement) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let needleLen := mload(needle) let replacementLen := mload(replacement) let d := sub(result, subject) // Memory difference. let i := add(subject, 0x20) // Subject bytes pointer. mstore(0x00, add(i, mload(subject))) // End of subject. if iszero(gt(needleLen, mload(subject))) { let subjectSearchEnd := add(sub(mload(0x00), needleLen), 1) let h := 0 // The hash of `needle`. if iszero(lt(needleLen, 0x20)) { h := keccak256(add(needle, 0x20), needleLen) } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(needleLen, 0x1f))) } 1 {} { let t := mload(i) // Whether the first `needleLen % 32` bytes of `subject` and `needle` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(i, needleLen), h)) { mstore(add(i, d), t) i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } continue } } // Copy the `replacement` one word at a time. for { let j := 0 } 1 {} { mstore(add(add(i, d), j), mload(add(add(replacement, 0x20), j))) j := add(j, 0x20) if iszero(lt(j, replacementLen)) { break } } d := sub(add(d, replacementLen), needleLen) if needleLen { i := add(i, needleLen) if iszero(lt(i, subjectSearchEnd)) { break } continue } } mstore(add(i, d), t) i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } } } let end := mload(0x00) let n := add(sub(d, add(result, 0x20)), end) // Copy the rest of the bytes one word at a time. for {} lt(i, end) { i := add(i, 0x20) } { mstore(add(i, d), mload(i)) } let o := add(i, d) mstore(o, 0) // Zeroize the slot after the bytes. mstore(0x40, add(o, 0x20)) // Allocate memory. mstore(result, n) // Store the length. } } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(bytes memory subject, bytes memory needle, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := not(0) // Initialize to `NOT_FOUND`. for { let subjectLen := mload(subject) } 1 {} { if iszero(mload(needle)) { result := from if iszero(gt(from, subjectLen)) { break } result := subjectLen break } let needleLen := mload(needle) let subjectStart := add(subject, 0x20) subject := add(subjectStart, from) let end := add(sub(add(subjectStart, subjectLen), needleLen), 1) let m := shl(3, sub(0x20, and(needleLen, 0x1f))) let s := mload(add(needle, 0x20)) if iszero(and(lt(subject, end), lt(from, subjectLen))) { break } if iszero(lt(needleLen, 0x20)) { for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { if iszero(shr(m, xor(mload(subject), s))) { if eq(keccak256(subject, needleLen), h) { result := sub(subject, subjectStart) break } } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } for {} 1 {} { if iszero(shr(m, xor(mload(subject), s))) { result := sub(subject, subjectStart) break } subject := add(subject, 1) if iszero(lt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from left to right. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function indexOf(bytes memory subject, bytes memory needle) internal pure returns (uint256) { return indexOf(subject, needle, 0); } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left, starting from `from`. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(bytes memory subject, bytes memory needle, uint256 from) internal pure returns (uint256 result) { /// @solidity memory-safe-assembly assembly { for {} 1 {} { result := not(0) // Initialize to `NOT_FOUND`. let needleLen := mload(needle) if gt(needleLen, mload(subject)) { break } let w := result let fromMax := sub(mload(subject), needleLen) if iszero(gt(fromMax, from)) { from := fromMax } let end := add(add(subject, 0x20), w) subject := add(add(subject, 0x20), from) if iszero(gt(subject, end)) { break } // As this function is not too often used, // we shall simply use keccak256 for smaller bytecode size. for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { if eq(keccak256(subject, needleLen), h) { result := sub(subject, add(end, 1)) break } subject := add(subject, w) // `sub(subject, 1)`. if iszero(gt(subject, end)) { break } } break } } } /// @dev Returns the byte index of the first location of `needle` in `subject`, /// needleing from right to left. /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. function lastIndexOf(bytes memory subject, bytes memory needle) internal pure returns (uint256) { return lastIndexOf(subject, needle, type(uint256).max); } /// @dev Returns true if `needle` is found in `subject`, false otherwise. function contains(bytes memory subject, bytes memory needle) internal pure returns (bool) { return indexOf(subject, needle) != NOT_FOUND; } /// @dev Returns whether `subject` starts with `needle`. function startsWith(bytes memory subject, bytes memory needle) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let n := mload(needle) // Just using keccak256 directly is actually cheaper. let t := eq(keccak256(add(subject, 0x20), n), keccak256(add(needle, 0x20), n)) result := lt(gt(n, mload(subject)), t) } } /// @dev Returns whether `subject` ends with `needle`. function endsWith(bytes memory subject, bytes memory needle) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { let n := mload(needle) let notInRange := gt(n, mload(subject)) // `subject + 0x20 + max(subject.length - needle.length, 0)`. let t := add(add(subject, 0x20), mul(iszero(notInRange), sub(mload(subject), n))) // Just using keccak256 directly is actually cheaper. result := gt(eq(keccak256(t, n), keccak256(add(needle, 0x20), n)), notInRange) } } /// @dev Returns `subject` repeated `times`. function repeat(bytes memory subject, uint256 times) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { let l := mload(subject) // Subject length. if iszero(or(iszero(times), iszero(l))) { result := mload(0x40) subject := add(subject, 0x20) let o := add(result, 0x20) for {} 1 {} { // Copy the `subject` one word at a time. for { let j := 0 } 1 {} { mstore(add(o, j), mload(add(subject, j))) j := add(j, 0x20) if iszero(lt(j, l)) { break } } o := add(o, l) times := sub(times, 1) if iszero(times) { break } } mstore(o, 0) // Zeroize the slot after the bytes. mstore(0x40, add(o, 0x20)) // Allocate memory. mstore(result, sub(o, add(result, 0x20))) // Store the length. } } } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. function slice(bytes memory subject, uint256 start, uint256 end) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { let l := mload(subject) // Subject length. if iszero(gt(l, end)) { end := l } if iszero(gt(l, start)) { start := l } if lt(start, end) { result := mload(0x40) let n := sub(end, start) let i := add(subject, start) let w := not(0x1f) // Copy the `subject` one word at a time, backwards. for { let j := and(add(n, 0x1f), w) } 1 {} { mstore(add(result, j), mload(add(i, j))) j := add(j, w) // `sub(j, 0x20)`. if iszero(j) { break } } let o := add(add(result, 0x20), n) mstore(o, 0) // Zeroize the slot after the bytes. mstore(0x40, add(o, 0x20)) // Allocate memory. mstore(result, n) // Store the length. } } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. /// `start` is a byte offset. function slice(bytes memory subject, uint256 start) internal pure returns (bytes memory result) { result = slice(subject, start, type(uint256).max); } /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). /// `start` and `end` are byte offsets. Faster than Solidity's native slicing. function sliceCalldata(bytes calldata subject, uint256 start, uint256 end) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { end := xor(end, mul(xor(end, subject.length), lt(subject.length, end))) start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) result.offset := add(subject.offset, start) result.length := mul(lt(start, end), sub(end, start)) } } /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. /// `start` is a byte offset. Faster than Solidity's native slicing. function sliceCalldata(bytes calldata subject, uint256 start) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) result.offset := add(subject.offset, start) result.length := mul(lt(start, subject.length), sub(subject.length, start)) } } /// @dev Reduces the size of `subject` to `n`. /// If `n` is greater than the size of `subject`, this will be a no-op. function truncate(bytes memory subject, uint256 n) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := subject mstore(mul(lt(n, mload(result)), result), n) } } /// @dev Returns a copy of `subject`, with the length reduced to `n`. /// If `n` is greater than the size of `subject`, this will be a no-op. function truncatedCalldata(bytes calldata subject, uint256 n) internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { result.offset := subject.offset result.length := xor(n, mul(xor(n, subject.length), lt(subject.length, n))) } } /// @dev Returns all the indices of `needle` in `subject`. /// The indices are byte offsets. function indicesOf(bytes memory subject, bytes memory needle) internal pure returns (uint256[] memory result) { /// @solidity memory-safe-assembly assembly { let searchLen := mload(needle) if iszero(gt(searchLen, mload(subject))) { result := mload(0x40) let i := add(subject, 0x20) let o := add(result, 0x20) let subjectSearchEnd := add(sub(add(i, mload(subject)), searchLen), 1) let h := 0 // The hash of `needle`. if iszero(lt(searchLen, 0x20)) { h := keccak256(add(needle, 0x20), searchLen) } let s := mload(add(needle, 0x20)) for { let m := shl(3, sub(0x20, and(searchLen, 0x1f))) } 1 {} { let t := mload(i) // Whether the first `searchLen % 32` bytes of `subject` and `needle` matches. if iszero(shr(m, xor(t, s))) { if h { if iszero(eq(keccak256(i, searchLen), h)) { i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } continue } } mstore(o, sub(i, add(subject, 0x20))) // Append to `result`. o := add(o, 0x20) i := add(i, searchLen) // Advance `i` by `searchLen`. if searchLen { if iszero(lt(i, subjectSearchEnd)) { break } continue } } i := add(i, 1) if iszero(lt(i, subjectSearchEnd)) { break } } mstore(result, shr(5, sub(o, add(result, 0x20)))) // Store the length of `result`. // Allocate memory for result. // We allocate one more word, so this array can be recycled for {split}. mstore(0x40, add(o, 0x20)) } } } /// @dev Returns a arrays of bytess based on the `delimiter` inside of the `subject` bytes. function split(bytes memory subject, bytes memory delimiter) internal pure returns (bytes[] memory result) { uint256[] memory indices = indicesOf(subject, delimiter); /// @solidity memory-safe-assembly assembly { let w := not(0x1f) let indexPtr := add(indices, 0x20) let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1))) mstore(add(indicesEnd, w), mload(subject)) mstore(indices, add(mload(indices), 1)) for { let prevIndex := 0 } 1 {} { let index := mload(indexPtr) mstore(indexPtr, 0x60) if iszero(eq(index, prevIndex)) { let element := mload(0x40) let l := sub(index, prevIndex) mstore(element, l) // Store the length of the element. // Copy the `subject` one word at a time, backwards. for { let o := and(add(l, 0x1f), w) } 1 {} { mstore(add(element, o), mload(add(add(subject, prevIndex), o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } mstore(add(add(element, 0x20), l), 0) // Zeroize the slot after the bytes. // Allocate memory for the length and the bytes, rounded up to a multiple of 32. mstore(0x40, add(element, and(add(l, 0x3f), w))) mstore(indexPtr, element) // Store the `element` into the array. } prevIndex := add(index, mload(delimiter)) indexPtr := add(indexPtr, 0x20) if iszero(lt(indexPtr, indicesEnd)) { break } } result := indices if iszero(mload(delimiter)) { result := add(indices, 0x20) mstore(result, sub(mload(indices), 2)) } } } /// @dev Returns a concatenated bytes of `a` and `b`. /// Cheaper than `bytes.concat()` and does not de-align the free memory pointer. function concat(bytes memory a, bytes memory b) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { result := mload(0x40) let w := not(0x1f) let aLen := mload(a) // Copy `a` one word at a time, backwards. for { let o := and(add(aLen, 0x20), w) } 1 {} { mstore(add(result, o), mload(add(a, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let bLen := mload(b) let output := add(result, aLen) // Copy `b` one word at a time, backwards. for { let o := and(add(bLen, 0x20), w) } 1 {} { mstore(add(output, o), mload(add(b, o))) o := add(o, w) // `sub(o, 0x20)`. if iszero(o) { break } } let totalLen := add(aLen, bLen) let last := add(add(result, 0x20), totalLen) mstore(last, 0) // Zeroize the slot after the bytes. mstore(result, totalLen) // Store the length. mstore(0x40, add(last, 0x20)) // Allocate memory. } } /// @dev Returns whether `a` equals `b`. function eq(bytes memory a, bytes memory b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) } } /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small bytes. function eqs(bytes memory a, bytes32 b) internal pure returns (bool result) { /// @solidity memory-safe-assembly assembly { // These should be evaluated on compile time, as far as possible. let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. let x := not(or(m, or(b, add(m, and(b, m))))) let r := shl(7, iszero(iszero(shr(128, x)))) r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) // forgefmt: disable-next-item result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) } } /// @dev Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. function cmp(bytes memory a, bytes memory b) internal pure returns (int256 result) { /// @solidity memory-safe-assembly assembly { let aLen := mload(a) let bLen := mload(b) let n := and(xor(aLen, mul(xor(aLen, bLen), lt(bLen, aLen))), not(0x1f)) if n { for { let i := 0x20 } 1 {} { let x := mload(add(a, i)) let y := mload(add(b, i)) if iszero(or(xor(x, y), eq(i, n))) { i := add(i, 0x20) continue } result := sub(gt(x, y), lt(x, y)) break } } // forgefmt: disable-next-item if iszero(result) { let l := 0x201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201 let x := and(mload(add(add(a, 0x20), n)), shl(shl(3, byte(sub(aLen, n), l)), not(0))) let y := and(mload(add(add(b, 0x20), n)), shl(shl(3, byte(sub(bLen, n), l)), not(0))) result := sub(gt(x, y), lt(x, y)) if iszero(result) { result := sub(gt(aLen, bLen), lt(aLen, bLen)) } } } } /// @dev Directly returns `a` without copying. function directReturn(bytes memory a) internal pure { assembly { // Assumes that the bytes does not start from the scratch space. let retStart := sub(a, 0x20) let retUnpaddedSize := add(mload(a), 0x40) // Right pad with zeroes. Just in case the bytes is produced // by a method that doesn't zero right pad. mstore(add(retStart, retUnpaddedSize), 0) mstore(retStart, 0x20) // Store the return offset. // End the transaction, returning the bytes. return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) } } /// @dev Directly returns `a` with minimal copying. function directReturn(bytes[] memory a) internal pure { assembly { let n := mload(a) // `a.length`. let o := add(a, 0x20) // Start of elements in `a`. let u := a // Highest memory slot. let w := not(0x1f) for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { let c := add(o, shl(5, i)) // Location of pointer to `a[i]`. let s := mload(c) // `a[i]`. let l := mload(s) // `a[i].length`. let r := and(l, 0x1f) // `a[i].length % 32`. let z := add(0x20, and(l, w)) // Offset of last word in `a[i]` from `s`. // If `s` comes before `o`, or `s` is not zero right padded. if iszero(lt(lt(s, o), or(iszero(r), iszero(shl(shl(3, r), mload(add(s, z))))))) { let m := mload(0x40) mstore(m, l) // Copy `a[i].length`. for {} 1 {} { mstore(add(m, z), mload(add(s, z))) // Copy `a[i]`, backwards. z := add(z, w) // `sub(z, 0x20)`. if iszero(z) { break } } let e := add(add(m, 0x20), l) mstore(e, 0) // Zeroize the slot after the copied bytes. mstore(0x40, add(e, 0x20)) // Allocate memory. s := m } mstore(c, sub(s, o)) // Convert to calldata offset. let t := add(l, add(s, 0x20)) if iszero(lt(t, u)) { u := t } } let retStart := add(a, w) // Assumes `a` doesn't start from scratch space. mstore(retStart, 0x20) // Store the return offset. return(retStart, add(0x40, sub(u, retStart))) // End the transaction. } } /// @dev Returns the word at `offset`, without any bounds checks. /// To load an address, you can use `address(bytes20(load(a, offset)))`. function load(bytes memory a, uint256 offset) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := mload(add(add(a, 0x20), offset)) } } /// @dev Returns the word at `offset`, without any bounds checks. /// To load an address, you can use `address(bytes20(loadCalldata(a, offset)))`. function loadCalldata(bytes calldata a, uint256 offset) internal pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := calldataload(add(a.offset, offset)) } } /// @dev Returns empty calldata bytes. For silencing the compiler. function emptyCalldata() internal pure returns (bytes calldata result) { /// @solidity memory-safe-assembly assembly { result.length := 0 } } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "mode": "3", "runs": 200 }, "outputSelection": { "*": { "*": [ "abi" ] } }, "detectMissingLibraries": false, "forceEVMLA": false, "enableEraVMExtensions": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AlreadyVoted","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"NotEnoughVotes","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"burnedBy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","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":"ownership","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"forceBurn","outputs":[],"stateMutability":"nonpayable","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":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"numVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","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":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"requiredVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"newRequiredVotes","type":"uint256"}],"name":"setRequiredVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"voted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"votedBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"votes","outputs":[{"internalType":"uint256","name":"numVotes","type":"uint256"},{"internalType":"uint256","name":"requiredVotes","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100048dcc7156203e4ee2689ade2d448e71e624cc386e311ed8cfd0315d5d3f000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002b68747470733a2f2f626561726973682e61662f6170692f6d657461646174612f686f6e6f7261726965732f000000000000000000000000000000000000000000
Deployed Bytecode
0x0001000000000002000800000000000200000000000103550000008004000039000000400040043f000000600310027000000403033001970000000100200190000000260000c13d000000040030008c000000450000413d000000000201043b000000e002200270000004140020009c000000600000a13d000004150020009c0000007a0000213d000004230020009c000000c60000213d0000042a0020009c000001e70000a13d0000042b0020009c000003200000613d0000042c0020009c0000032a0000613d0000042d0020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b0000040f0010009c000000450000213d10090cac0000040f000004720000013d0000000002000416000000000002004b000000450000c13d0000001f0230003900000404022001970000008002200039000000400020043f0000001f0530018f00000405063001980000008002600039000000360000613d000000000701034f000000007807043c0000000004840436000000000024004b000000320000c13d000000000005004b000000430000613d000000000161034f0000000304500210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000120435000000200030008c000000470000813d00000000010000190000100b00010430000000800200043d000004060020009c000000450000213d0000001f01200039000000000031004b000000000400001900000407040080410000040701100197000000000001004b00000000050000190000040705004041000004070010009c000000000504c019000000000005004b000000450000c13d00000080012000390000000001010433000004060010009c000001710000a13d0000046401000041000000000010043f0000004101000039000000040010043f00000465010000410000100b00010430000004300020009c000000950000a13d000004310020009c000000ed0000213d000004380020009c000001ff0000a13d000004390020009c000003490000613d0000043a0020009c0000035a0000613d0000043b0020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000000000010043f0000000c01000039000000200010043f0000004002000039000000000100001910090fea0000040f000004550000013d000004160020009c0000015a0000213d0000041d0020009c0000021d0000a13d0000041e0020009c000003cd0000613d0000041f0020009c000004100000613d000004200020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b10090e7f0000040f000000400200043d000800000002001d10090b870000040f0000000801000029000004030010009c0000040301008041000000400110021000000458011001c70000100a0001042e0000043e0020009c000001cd0000a13d0000043f0020009c0000027e0000a13d000004400020009c0000042d0000613d000004410020009c000004380000613d000004420020009c000000450000c13d0000044a010000410000000c0010043f0000000001000411000000000010043f0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f0000000100200190000008630000613d000000000101043b000800000001001d0000000001000414000004030010009c0000040301008041000000c0011002100000044e011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b00000008020000290000046e0220009a000000000021041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000002030000390000046f04000041000004900000013d000004240020009c000002c50000a13d000004250020009c0000043d0000613d000004260020009c000004510000613d000004270020009c000000450000c13d0000000001000416000000000001004b000000450000c13d0000000303000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000061e0000c13d000000800010043f000000000004004b000006350000613d000000000030043f000000000001004b00000000020000190000063a0000613d0000045b030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b000000e50000413d0000063a0000013d000004320020009c000002d80000a13d000004330020009c0000045a0000613d000004340020009c000004790000613d000004350020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000402100370000000000502043b000004060050009c000000450000213d0000002302500039000000000032004b000000450000813d0000000406500039000000000261034f000000000202043b000004060020009c0000005a0000213d0000001f072000390000047e077001970000003f077000390000047e077001970000045a0070009c0000005a0000213d00000024055000390000008007700039000000400070043f000000800020043f0000000005520019000000000035004b000000450000213d0000002003600039000000000331034f0000047e052001980000001f0620018f000000a0015000390000011f0000613d000000a007000039000000000803034f000000008908043c0000000007970436000000000017004b0000011b0000c13d000000000006004b0000012c0000613d000000000353034f0000000305600210000000000601043300000000065601cf000000000656022f000000000303043b0000010005500089000000000353022f00000000035301cf000000000363019f0000000000310435000000a00120003900000000000104350000041001000041000000000101041a0000000002000411000000000012004b000005b70000c13d000000800200043d000004060020009c0000005a0000213d0000000901000039000000000501041a000000010050019000000001035002700000007f0330618f0000001f0030008c00000000060000390000000106002039000000000565013f00000001005001900000061e0000c13d000000200030008c000001520000413d000000000010043f0000001f052000390000000505500270000004620550009a000000200020008c00000457050040410000001f033000390000000503300270000004620330009a000000000035004b000001520000813d000000000005041b0000000105500039000000000035004b0000014e0000413d0000001f0020008c000009bf0000a13d000000000010043f0000047e0420019800000aa10000c13d000000a005000039000004570300004100000aaf0000013d000004170020009c000002e40000a13d000004180020009c000004960000613d000004190020009c000004c50000613d0000041a0020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b0000040f0010009c000000450000213d0000044a020000410000000c0020043f000000000010043f0000000c0100003900000020020000390000058e0000013d0000001f041000390000047e044001970000003f044000390000047e04400197000000400600043d0000000004460019000000000064004b00000000050000390000000105004039000004060040009c0000005a0000213d00000001005001900000005a0000c13d0000008003300039000000400040043f000800000006001d0000000004160436000700000004001d000000a0022000390000000004210019000000000034004b000000450000213d000000000001004b0000000706000029000001920000613d000000000300001900000000043600190000000005230019000000000505043300000000005404350000002003300039000000000013004b0000018b0000413d000000080110002900000020011000390000000000010435000000400200043d000004080020009c0000005a0000213d0000004001200039000000400010043f0000001201000039000000000412043600000409010000410000000000140435000000400900043d000004080090009c0000005a0000213d0000004001900039000000400010043f0000000701000039000000000a1904360000040a0100004100000000001a04350000000003020433000004060030009c0000005a0000213d0000000201000039000000000501041a000000010650019000000001055002700000007f0550618f0000001f0050008c00000000070000390000000107002039000000000076004b0000061e0000c13d000000200050008c000001c50000413d000000000010043f0000001f0630003900000005066002700000040b0660009a000000200030008c0000040c060040410000001f0550003900000005055002700000040b0550009a000000000056004b000001c50000813d000000000006041b0000000106600039000000000056004b000001c10000413d0000001f0030008c000007020000a13d000000000010043f0000047e063001980000077e0000c13d00000020050000390000040c040000410000078a0000013d000004450020009c000002f90000213d000004480020009c000004d60000613d000004490020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000201043b0000047700200198000000450000c13d00000001010000390000047802200197000004790020009c000005900000613d0000047a0020009c000005900000613d0000047b0020009c000000000100c019000000800010043f0000044b010000410000100a0001042e0000042e0020009c000005190000613d0000042f0020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000000000010043f0000000a01000039000000200010043f0000004002000039000000000100001910090fea0000040f0000000102100039000000000202041a000000000101041a000000800010043f000000a00020043f0000045f010000410000100a0001042e0000043c0020009c000005570000613d0000043d0020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000800000001001d10090edd0000040f0000000801000029000000000010043f0000000c01000039000000200010043f0000004002000039000000000100001910090fea0000040f00000000020004110000040f02200197000000000301041a0000046703300197000000000223019f000000000021041b000000080100002910090f1b0000040f00000000010000190000100a0001042e000004210020009c000005820000613d000004220020009c000000450000c13d000000640030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000402100370000000000202043b000400000002001d0000040f0020009c000000450000213d0000004402100370000000000202043b0000002401100370000000000301043b000000000023004b0000064b0000813d000000000100041a000000000012004b0000000002018019000300000002001d000000010030008c000000010300a0390000000401000029000000000001004b000006a30000613d000700000003001d000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000100600000003d000000000101043b0000000703000029000000030230006b00000ac00000a13d000000000101041a000004060110019800000ac00000613d000000000012004b0000000002018019000200000002001d0000000501200210000000400200043d000100000002001d00000000012100190000002001100039000000400010043f000600000001001d0000045a0010009c0000005a0000213d00000006020000290000008001200039000000400010043f0000006001200039000000000001043500000040012000390000000000010435000000200120003900000000000104350000000000020435000000000100041a000000000031004b0000000001000019000009220000a13d0000000701000029000800000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000009cc0000c13d0000000801000029000000010110008a0000026a0000013d000004430020009c000005930000613d000004440020009c000000450000c13d0000000001000416000000000001004b000000450000c13d0000041001000041000000000101041a0000000002000411000000000012004b000005b70000c13d000000000100041a000800000001001d0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f0000000100200190000008630000613d000000000101043b000700000001001d0000000801000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d00000000020004110000040f022001970000000703000029000000a003300210000000000323019f0000046c033001c7000000000101043b000000000031041b000000000020043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a000004710220009a000000000021041b0000000001000411000000000001004b000007d90000c13d0000047201000041000000000010043f0000045d010000410000100b00010430000004280020009c000005a20000613d000004290020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000000000010043f0000000a01000039000000200010043f0000004002000039000000000100001910090fea0000040f0000000101100039000002e00000013d000004360020009c000005bb0000613d000004370020009c000000450000c13d0000000001000416000000000001004b000000450000c13d0000000d01000039000000000101041a000000800010043f0000044b010000410000100a0001042e0000041b0020009c000005e80000613d0000041c0020009c000000450000c13d000000440030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000402100370000000000202043b0000040f0020009c000000450000213d0000002401100370000000000101043b000800000001001d0000040f0010009c000000450000213d000000000020043f0000000701000039000004680000013d000004460020009c000006100000613d000004470020009c000000450000c13d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000201043b000000000002004b000006b60000613d000000000100041a000000000021004b000006b60000a13d000700000002001d000800000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000006ab0000c13d0000000802000029000000000002004b000000010220008a0000030a0000c13d0000060a0000013d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b10090ee70000040f0000040f01100197000004720000013d0000000001000416000000000001004b000000450000c13d0000000903000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000061e0000c13d000000800010043f000000000004004b000006350000613d000000000030043f000000000001004b00000000020000190000063a0000613d00000457030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b000003410000413d0000063a0000013d000000000103001910090b0b0000040f000800000001001d000700000002001d000600000003001d000000400100043d000500000001001d000000200200003910090b3d0000040f0000000504000029000000000004043500000008010000290000000702000029000000060300002910090cc40000040f00000000010000190000100a0001042e000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000000000001004b0000059e0000613d000700000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a000000000002004b0000038c0000c13d000000000100041a0000000702000029000000000021004b0000059e0000a13d0000000001020019000000010110008a000800000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a000000000002004b0000000801000029000003790000613d000004540020019800000007010000290000059e0000c13d000800000002001d000000000010043f0000000601000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d00000008020000290000040f02200197000000000101043b000600000001001d000000000301041a00000000010004110000040f01100197000000000021004b000500000002001d000007f20000613d000000000031004b000007f20000613d000400000001001d000300000003001d000000000020043f0000000701000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b0000000402000029000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000ff0010019000000005020000290000000303000029000007f20000c13d0000046901000041000000000010043f0000045d010000410000100b00010430000000440030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000402100370000000000202043b000800000002001d0000040f0020009c000000450000213d0000002401100370000000000201043b000000000002004b0000000001000039000000010100c039000700000002001d000000000012004b000000450000c13d0000000001000411000000000010043f0000000701000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b0000000802000029000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a0000047f022001970000000703000029000000000232019f000000000021041b000000400100043d0000000000310435000004030010009c000004030100804100000040011002100000000002000414000004030020009c0000040302008041000000c002200210000000000112019f0000040e011001c70000800d020000390000000303000039000004590400004100000000050004110000000806000029000004910000013d000000840030008c000000450000413d0000000402100370000000000202043b000800000002001d0000040f0020009c000000450000213d0000002402100370000000000202043b000700000002001d0000040f0020009c000000450000213d0000006402100370000000000402043b000004060040009c000000450000213d0000002302400039000000000032004b000000450000813d0000000402400039000000000221034f000000000202043b0000004401100370000000000101043b000600000001001d000000240140003910090b4f0000040f0000000004010019000003540000013d0000000001000416000000000001004b000000450000c13d0000000101000039000000000101041a0000048001100167000000000200041a0000000001120019000000800010043f0000044b010000410000100a0001042e000000000103001910090b0b0000040f10090ba90000040f00000000010000190000100a0001042e000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000300000001001d0000040f0010009c000000450000213d000000000100041a000000000001004b0000064b0000613d00020001001000940000069f0000c13d00000080010000390000006002000039000800000001001d10090b9a0000040f000006410000013d0000000001000416000000000001004b000000450000c13d0000041001000041000000000101041a0000040f01100197000000800010043f0000044b010000410000100a0001042e000000440030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000002402100370000000000202043b000800000002001d0000040f0020009c000000450000213d0000000401100370000000000101043b000000000010043f0000000b01000039000000200010043f0000004002000039000000000100001910090fea0000040f000000080200002910090b2d0000040f000000000101041a000000ff001001900000000001000039000000010100c039000000400200043d0000000000120435000004030020009c0000040302008041000000400120021000000452011001c70000100a0001042e0000044a010000410000000c0010043f0000000001000411000000000010043f0000000001000414000004030010009c0000040301008041000000c0011002100000044e011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000001041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000002030000390000046604000041000000000500041110090fff0000040f0000000100200190000000450000613d00000000010000190000100a0001042e000000240030008c000000450000413d0000000401100370000000000101043b000800000001001d0000040f0010009c000000450000213d0000041001000041000000000101041a0000000002000411000000000012004b000005b70000c13d0000044a010000410000000c0010043f0000000801000029000000000010043f0000000001000414000004030010009c0000040301008041000000c0011002100000044e011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000600000001001d000000000101041a000700000001001d0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f0000000100200190000008630000613d000000000101043b000000070010006c000007ec0000a13d0000045101000041000000000010043f0000044d010000410000100b00010430000000240030008c000000450000413d0000000401100370000000000101043b0000040f0010009c000000450000213d0000041002000041000000000202041a0000000003000411000000000023004b000005b70000c13d000000000001004b000007ef0000c13d0000044c01000041000000000010043f0000044d010000410000100b00010430000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000700000001001d000000000010043f0000000b01000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b00000000020004110000040f02200197000600000002001d000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000ff00100190000006a70000c13d0000000702000029000000000002004b000009020000613d000000000100041a000000000021004b000009020000a13d000800000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000008cf0000c13d0000000802000029000000000002004b000000010220008a000005030000c13d0000060a0000013d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000402100370000000000202043b000004060020009c000000450000213d0000002304200039000000000034004b000000450000813d000700040020003d0000000704100360000000000404043b000004060040009c000000450000213d000000050540021000000000025200190000002402200039000000000032004b000000450000213d0000000006050019000000800040043f000000a002500039000000400020043f000000000004004b0000070d0000c13d00000020010000390000000001120436000000800300043d00000000003104350000004001200039000000000003004b000006420000613d000000800400003900000000050000190000002004400039000000000604043300000000870604340000040f07700197000000000771043600000000080804330000040608800197000000000087043500000040076000390000000007070433000000000007004b0000000007000039000000010700c039000000400810003900000000007804350000006006600039000000000606043300000461066001970000006007100039000000000067043500000080011000390000000105500039000000000035004b0000053e0000413d000006420000013d000000440030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000002402100370000000000202043b000700000002001d0000000401100370000000000301043b0000041001000041000000000101041a0000000002000411000000000012004b000005b70000c13d000000000003004b000009020000613d000000000100041a000000000031004b000009020000a13d000600000003001d000800000003001d000000000030043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000007700000c13d0000000803000029000000000003004b000000010330008a0000056c0000c13d0000060a0000013d000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000000000010043f0000000a01000039000000200010043f0000004002000039000000000100001910090fea0000040f000000000101041a000000800010043f0000044b010000410000100a0001042e000000440030008c000000450000413d0000000402100370000000000202043b000700000002001d0000040f0020009c000000450000213d0000002401100370000000000101043b000000000001004b0000064f0000c13d0000047501000041000000000010043f0000045d010000410000100b000104300000041001000041000000000101041a0000000005000411000000000015004b000005b70000c13d0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000003030000390000041204000041000000000600001910090fff0000040f0000000100200190000000450000613d0000041001000041000000000001041b00000000010000190000100a0001042e0000047001000041000000000010043f0000044d010000410000100b00010430000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000101043b000800000001001d000000000010043f0000000a01000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000700000001001d0000000801000029000000000010043f0000000a01000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b0000000101100039000000000101041a000000070010006b0000020c0000813d0000046801000041000000000010043f0000045d010000410000100b00010430000000240030008c000000450000413d0000000002000416000000000002004b000000450000c13d0000000401100370000000000201043b000000000002004b000009020000613d000000000100041a000000000021004b000009020000a13d000700000002001d000800000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000006ba0000c13d0000000802000029000000000002004b000000010220008a000005f50000c13d0000046401000041000000000010043f0000001101000039000000040010043f00000465010000410000100b000104300000000001000416000000000001004b000000450000c13d0000000203000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f0000000100500190000006240000613d0000046401000041000000000010043f0000002201000039000000040010043f00000465010000410000100b00010430000000800010043f000000000004004b000006350000613d000000000030043f000000000001004b00000000020000190000063a0000613d0000040c030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b0000062d0000413d0000063a0000013d0000047f02200197000000a00020043f000000000001004b000000200200003900000000020060390000002002200039000000800100003910090b3d0000040f000000400100043d000800000001001d000000800200003910090af60000040f00000008020000290000000001210049000004030010009c00000403010080410000006001100210000004030020009c00000403020080410000004002200210000000000121019f0000100a0001042e0000045c01000041000000000010043f0000045d010000410000100b00010430000600000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000006770000c13d000000000100041a0000000602000029000000000021004b0000059e0000a13d000000010220008a000800000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b0000000802000029000006640000613d00000454001001980000059e0000c13d0008040f0010019b0000000002000411000000080020006c000008930000c13d0000000601000029000000000010043f0000000601000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d00000007020000290000040f06200197000000000101043b000000000201041a0000046702200197000000000262019f000000000021041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d02000039000000040300003900000474040000410000000805000029000000060700002910090fff0000040f0000000100200190000004940000c13d000000450000013d000100000001001d0000000301000029000000000001004b000006ee0000c13d0000045e01000041000000000010043f0000045d010000410000100b000104300000047c01000041000000000010043f0000045d010000410000100b0001043000000454001001980000000701000029000006b60000c13d000000000010043f0000000601000039000000200010043f0000004002000039000000000100001910090fea0000040f000000000101041a000003280000013d0000047601000041000000000010043f0000045d010000410000100b0001043000000454001001980000000706000029000009020000c13d000000400200043d000000a001200039000000400010043f000000800120003900000000000104350000000003010019000000090060008c0000000a1660011a000000f804100210000000010130008a00000000050104330000045505500197000000000445019f00000456044001c70000000000410435000006c20000213d00000000023200490000008104200039000000210230008a00000000004204350000000906000039000000000506041a000000010750019000000001035002700000007f0330618f0000001f0030008c00000000040000390000000104002039000000000445013f00000001004001900000061e0000c13d000000400400043d00000000090400190000002004400039000000000007004b000009060000613d000000000060043f000000000003004b000009080000613d000004570500004100000000060000190000000007460019000000000805041a000000000087043500000001055000390000002006600039000000000036004b000006e60000413d000009080000013d000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000400300043d000000000101043b000000000101041a0000040601100198000008640000c13d000000000103001900000060020000390000044e0000013d000000000003004b0000000002000019000007960000613d0000000302300210000004800220027f00000480022001670000000004040433000000000224016f0000000103300210000000000232019f000007960000013d000004600040009c0000005a0000213d0000000703600029000000000331034f000000000403043b0000008003200039000000400030043f0000006003200039000000000003043500000040032000390000000000030435000000200320003900000000000304350000000000020435000000000004004b000007650000613d000000000300041a000000000043004b000007650000a13d000600000006001d000800000004001d000000000040043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b000007350000c13d0000000804000029000000010440008a000007210000013d000000400100043d0000045a0010009c00000008030000290000005a0000213d0000008002100039000000400020043f0000006002100039000000000002043500000040021000390000000000020435000000200210003900000000000204350000000000010435000000000030043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000400200043d0000045a0020009c00000006060000290000005a0000213d000000000301034f0000000001000367000000000303043b000000000303041a0000008004200039000000400040043f0000006004200039000000e805300270000000000054043500000454003001980000000004000039000000010400c039000000400520003900000000004504350000040f043001970000000004420436000000a00330027000000406033001970000000000340435000000200460008c00000080036000390000000000230435000000400200043d000005350000613d0000000703400029000000000331034f0000045a0020009c0000000006040019000007110000a13d0000005a0000013d00000454001001980000000601000029000009020000c13d000000000010043f0000000a01000039000000200010043f0000004002000039000000000100001910090fea0000040f00000001011000390000000702000029000000000021041b00000000010000190000100a0001042e0000040c040000410000002005000039000000010760008a00000005077002700000040d0770009a00000000082500190000000008080433000000000084041b00000020055000390000000104400039000000000074004b000007830000c13d000000000036004b000007940000813d0000000306300210000000f80660018f000004800660027f000004800660016700000000022500190000000002020433000000000262016f000000000024041b000000010230021000000001022001bf000000000021041b0000000004090433000004060040009c0000005a0000213d0000000303000039000000000103041a000000010010019000000001051002700000007f0550618f0000001f0050008c00000000020000390000000102002039000000000121013f00000001001001900000061e0000c13d00030000000a001d000400000009001d000500000005001d000000200050008c000600000004001d000007c70000413d000000000030043f0000000001000414000004030010009c0000040301008041000000c0011002100000040e011001c70000801002000039100910040000040f0000000100200190000000450000613d00000006040000290000001f024000390000000502200270000000200040008c0000000002004019000000000301043b00000005010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b0000000303000039000007c70000813d000000000002041b0000000102200039000000000012004b000007c30000413d000000200040008c000008c20000413d000000000030043f0000000001000414000004030010009c0000040301008041000000c0011002100000040e011001c70000801002000039100910040000040f0000000100200190000000450000613d000000200200008a0000000602200180000000000101043b000009fd0000c13d000000200300003900000a0a0000013d00000000010000190000000100100190000008b60000c13d0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000004030000390000046d0400004100000000050000190000000006000411000000080700002910090fff0000040f00000001002001900000000101000039000007da0000c13d000000450000013d0000000601000029000000000001041b000000080100002910090fd30000040f00000000010000190000100a0001042e000000000003004b000007f60000613d0000000601000029000000000001041b000000000020043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a0000046a0220009a000000000021041b0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f0000000100200190000008630000613d000000000101043b000600000001001d0000000701000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d0000000602000029000000a00220021000000005022001af0000046b022001c7000000000101043b000000000021041b00000008010000290000046c001001980000084f0000c13d00000007010000290000000101100039000600000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b0000084f0000c13d000000000100041a000000060010006b0000084f0000613d0000000601000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b0000000802000029000000000021041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000004030000390000046d0400004100000005050000290000000006000019000000070700002910090fff0000040f0000000100200190000000450000613d0000000101000039000000000201041a0000000102200039000000000021041b00000000010000190000100a0001042e000000000001042f000000020010006b00000000020100190000000202004029000200000002001d0000000501200210000500000003001d00000000011300190000002001100039000000400010043f000600000001001d0000045a0010009c0000005a0000213d00000006020000290000008001200039000000400010043f0000006001200039000000000001043500000040012000390000000000010435000000200120003900000000000104350000000000020435000000000100041a000000020010008c00000000010000190000096f0000413d0000000101000039000800000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000000001004b00000a700000c13d0000000801000029000000010110008a0000087f0000013d0000000801000029000000000010043f0000000701000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b00000000020004110000040f02200197000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000101041a000000ff001001900000067d0000c13d0000047301000041000000000010043f0000045d010000410000100b0001043000000008020000290000000101200039000000000010041b0000000101000039000000000101041a000000000112004910090b1d0000040f00000001011000390000012c02000039000000000021041b00000000010000190000100a0001042e000000060000006b000000000100001900000a180000613d00000006030000290000000301300210000004800110027f000004800110016700000003020000290000000002020433000000000112016f0000000102300210000000000121019f00000a180000013d00000454001001980000000701000029000009020000c13d000000000010043f0000000b01000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b0000000602000029000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a0000047f0220019700000001022001bf000000000021041b0000000701000029000000000010043f0000000a01000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000000101043b000000000201041a000000010220003a0000060a0000613d00000aba0000013d0000047d01000041000000000010043f0000045d010000410000100b000104300000047f05500197000000000054043500000000034300190000000002020433000000000002004b000009140000613d000000000400001900000000053400190000000006140019000000000606043300000000006504350000002004400039000000000024004b0000090d0000413d00000000013200190000000000010435000800000009001d0000000002910049000000200120008a0000000000190435000000000109001910090b3d0000040f000000400100043d000700000001001d000000080200002910090af60000040f0000000702000029000006420000013d000800000001001d000500000000001d000000000100001900000007050000290000092c0000013d000800000000001d0000000601000029000000400010043f000000010550003900000001010000390000000100100190000009330000613d000000030050006c00000abd0000613d0000000502000029000000020020006c00000abd0000613d000000400100043d0000045a0010009c0000005a0000213d0000008002100039000000400020043f0000006002100039000000000002043500000040021000390000000000020435000000200210003900000000000204350000000000010435000700000005001d000000000050043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000400200043d0000045a0020009c00000007050000290000005a0000213d000000000101043b000000000101041a0000006003200039000000e8041002700000000000430435000000400320003900000454001001980000000004000039000000010400c0390000000000430435000000a0031002700000040603300197000000200420003900000000003404350000040f011001970000000000120435000009270000c13d000000000001004b00000000020100190000000802006029000800000002001d000000040120014f0000040f00100198000009280000c13d00000005010000290000000101100039000500000001001d000000050110021000000001011000290000000000510435000009280000013d000700000001001d0000000105000039000400000000001d000000000100001900000005020000290000097b0000013d000700000000001d00000005020000290000000601000029000000400010043f000000010550003900000001010000390000000100100190000009820000613d000000010050006c00000ad00000613d0000000403000029000000020030006c00000ad00000613d000000400100043d0000045a0010009c0000005a0000213d0000008002100039000000400020043f0000006002100039000000000002043500000040021000390000000000020435000000200210003900000000000204350000000000010435000800000005001d000000000050043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000400200043d0000045a0020009c00000008050000290000005a0000213d000000000101043b000000000101041a0000006003200039000000e8041002700000000000430435000000400320003900000454001001980000000004000039000000010400c0390000000000430435000000a0031002700000040603300197000000200420003900000000003404350000040f011001970000000000120435000009750000c13d000000000001004b00000000020100190000000702006029000700000002001d000000030120014f0000040f001001980000000502000029000009770000c13d00000004010000290000000101100039000400000001001d000000050110021000000000012100190000000000510435000009770000013d000000000002004b0000000003000019000009c30000613d000000a00300043d0000000304200210000004800440027f0000048004400167000000000443016f0000000103200210000000000234019f000000000021041b00000000010000190000100a0001042e000000400100043d0000045a0010009c0000005a0000213d0000008002100039000000400020043f00000060021000390000000000020435000000400210003900000000000204350000002002100039000000000002043500000000000104350000000801000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000400200043d0000045a0020009c0000005a0000213d000000000101043b000000000101041a0000008003200039000000400030043f0000006003200039000000e8041002700000000000430435000000400320003900000454001001980000000004000039000000010400c0390000000000430435000000a0031002700000040603300197000000200420003900000000003404350000040f011001970000000000120435000800000000001d000800000001601d000009230000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000040600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000a030000c13d000000060020006c00000a150000813d00000006020000290000000302200210000000f80220018f000004800220027f000004800220016700000004033000290000000003030433000000000223016f000000000021041b0000000601000029000000010110021000000001011001bf0000000303000039000000000013041b0000000101000039000600000001001d000000000010041b00000000010004110000040f061001970000041001000041000000000061041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d020000390000041204000041000000000500001910090fff0000040f0000000100200190000000450000613d00000008010000290000000001010433000500000001001d000004060010009c0000005a0000213d0000000901000039000000000101041a000000010010019000000001021002700000007f0220618f000400000002001d0000001f0020008c00000000020000390000000102002039000000000121013f00000001001001900000061e0000c13d0000000401000029000000200010008c00000a5c0000413d0000000901000039000000000010043f0000000001000414000004030010009c0000040301008041000000c0011002100000040e011001c70000801002000039100910040000040f0000000100200190000000450000613d00000005030000290000001f023000390000000502200270000000200030008c0000000002004019000000000301043b00000004010000290000001f01100039000000050110027000000000011300190000000002230019000000000012004b00000a5c0000813d000000000002041b0000000102200039000000000012004b00000a580000413d0000000501000029000000200010008c00000ac40000413d0000000901000039000000000010043f0000000001000414000004030010009c0000040301008041000000c0011002100000040e011001c70000801002000039100910040000040f0000000100200190000000450000613d000000200200008a0000000502200180000000000101043b00000ad40000c13d000000200300003900000ae10000013d000000400100043d0000045a0010009c0000005a0000213d0000008002100039000000400020043f00000060021000390000000000020435000000400210003900000000000204350000002002100039000000000002043500000000000104350000000801000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f0000000100200190000000450000613d000000400200043d0000045a0020009c0000005a0000213d000000000101043b000000000101041a0000008003200039000000400030043f0000006003200039000000e8041002700000000000430435000000400320003900000454001001980000000004000039000000010400c0390000000000430435000000a0031002700000040603300197000000200420003900000000003404350000040f011001970000000000120435000700000000001d000700000001601d000009700000013d00000457030000410000002006000039000000010540008a0000000505500270000004630550009a000000000706001900000080066000390000000006060433000000000063041b00000020067000390000000103300039000000000053004b00000aa60000c13d000000a005700039000000000024004b00000ab80000813d0000000304200210000000f80440018f000004800440027f00000480044001670000000005050433000000000445016f000000000043041b000000010420021000000001024001bf000000000021041b00000000010000190000100a0001042e000000010100002900000005020000290000000000210435000000400100043d000800000001001d00000001020000290000044f0000013d000000050000006b000000000100001900000aef0000613d00000005030000290000000301300210000004800110027f000004800110016700000007020000290000000002020433000000000112016f000600010030021800000aee0000013d00000004010000290000000000120435000000400100043d0000044e0000013d000000010320008a0000000503300270000000000431001900000020030000390000000104400039000000080600002900000000056300190000000005050433000000000051041b00000020033000390000000101100039000000000041004b00000ada0000c13d000000050020006c00000aec0000813d00000005020000290000000302200210000000f80220018f000004800220027f000004800220016700000008033000290000000003030433000000000223016f000000000021041b0000000501000029000000010110021000000006011001af0000000902000039000000000012041b00000020010000390000010000100443000001200000044300000413010000410000100a0001042e00000020030000390000000004310436000000003202043400000000002404350000004001100039000000000002004b00000b050000613d000000000400001900000000051400190000000006430019000000000606043300000000006504350000002004400039000000000024004b00000afe0000413d000000000312001900000000000304350000001f022000390000047e022001970000000001120019000000000001042d000004810010009c00000b1b0000213d000000630010008c00000b1b0000a13d00000000030003670000000401300370000000000101043b0000040f0010009c00000b1b0000213d0000002402300370000000000202043b0000040f0020009c00000b1b0000213d0000004403300370000000000303043b000000000001042d00000000010000190000100b00010430000000000010043f0000000a01000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000b2b0000613d000000000101043b000000000001042d00000000010000190000100b000104300000040f02200197000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000b3b0000613d000000000101043b000000000001042d00000000010000190000100b000104300000001f022000390000047e022001970000000001120019000000000021004b00000000020000390000000102004039000004060010009c00000b490000213d000000010020019000000b490000c13d000000400010043f000000000001042d0000046401000041000000000010043f0000004101000039000000040010043f00000465010000410000100b00010430000004820020009c00000b7f0000813d00000000040100190000001f012000390000047e011001970000003f011000390000047e05100197000000400100043d0000000005510019000000000015004b00000000070000390000000107004039000004060050009c00000b7f0000213d000000010070019000000b7f0000c13d000000400050043f00000000052104360000000007420019000000000037004b00000b850000213d0000047e062001980000001f0720018f0000000004400367000000000365001900000b6f0000613d000000000804034f0000000009050019000000008a08043c0000000009a90436000000000039004b00000b6b0000c13d000000000007004b00000b7c0000613d000000000464034f0000000306700210000000000703043300000000076701cf000000000767022f000000000404043b0000010006600089000000000464022f00000000046401cf000000000474019f000000000043043500000000022500190000000000020435000000000001042d0000046401000041000000000010043f0000004101000039000000040010043f00000465010000410000100b0001043000000000010000190000100b0001043000000000430104340000040f03300197000000000332043600000000040404330000040604400197000000000043043500000040031000390000000003030433000000000003004b0000000003000039000000010300c0390000004004200039000000000034043500000060022000390000006001100039000000000101043300000461011001970000000000120435000000000001042d00000020030000390000000004310436000000000302043300000000003404350000004001100039000000000003004b00000ba80000613d00000000040000190000002002200039000000000502043300000000015104360000000104400039000000000034004b00000ba20000413d000000000001042d0007000000000002000300000002001d000500000001001d000600000003001d000000000003004b00000c9b0000613d0000000601000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b000000000101041a000000000001004b00000bd70000c13d000000000100041a000000060010006c00000c9b0000a13d0000000602000029000000010220008a000700000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b000000000101041a000000000001004b000000070200002900000bc40000613d000004540010019800000c9b0000c13d00000005020000290000040f02200197000400000001001d0000040f01100197000700000002001d000000000021004b00000c9f0000c13d0000000601000029000000000010043f0000000601000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000201043b000000000302041a00000000010004110000040f04100197000000070040006c00000c180000613d000000000034004b00000c180000613d000500000004001d000100000003001d000200000002001d0000000701000029000000000010043f0000000701000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b0000000502000029000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b000000000101041a000000ff001001900000000202000029000000010300002900000ca80000613d000000000003004b00000c1b0000613d000000000002041b0000000701000029000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b000000000201041a000000010220008a000000000021041b00000003010000290000040f01100197000500000001001d000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b000000000201041a0000000102200039000000000021041b0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f000000010020019000000ca30000613d000000000101043b000300000001001d0000000601000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d0000000302000029000000a00220021000000005022001af0000046c022001c7000000000101043b000000000021041b00000004010000290000046c0010019800000c880000c13d00000006010000290000000101100039000300000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b000000000101041a000000000001004b00000c880000c13d000000000100041a000000030010006b00000c880000613d0000000301000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000c990000613d000000000101043b0000000402000029000000000021041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000004030000390000046d0400004100000007050000290000000506000029000000060700002910090fff0000040f000000010020019000000c990000613d000000050000006b00000ca40000613d000000000001042d00000000010000190000100b000104300000047501000041000000000010043f0000045d010000410000100b000104300000048301000041000000000010043f0000045d010000410000100b00010430000000000001042f0000048401000041000000000010043f0000045d010000410000100b000104300000046901000041000000000010043f0000045d010000410000100b000104300000040f0110019800000cbe0000613d000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000cc20000613d000000000101043b000000000101041a0000040601100197000000000001042d0000045e01000041000000000010043f0000045d010000410000100b0001043000000000010000190000100b000104300008000000000002000100000004001d000500000002001d000600000001001d000700000003001d000000000003004b00000e2d0000613d0000000701000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b000000000101041a000000000001004b00000cf30000c13d000000000100041a000000070010006c00000e2d0000a13d0000000702000029000000010220008a000800000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b000000000101041a000000000001004b000000080200002900000ce00000613d000004540010019800000e2d0000c13d00000006020000290000040f02200197000300000001001d0000040f01100197000800000002001d000000000021004b00000e320000c13d0000000701000029000000000010043f0000000601000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000301043b000000000403041a00000000010004110000040f02100197000400000002001d000000080020006c00000d340000613d000000040040006b00000d340000613d000200000004001d000600000003001d0000000801000029000000000010043f0000000701000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b0000000402000029000000000020043f000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b000000000101041a000000ff001001900000000603000029000000020400002900000e3e0000613d000000000004004b00000d370000613d000000000003041b0000000801000029000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b000000000201041a000000010220008a000000000021041b00000005010000290000040f01100197000600000001001d000000000010043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b000000000201041a0000000102200039000000000021041b0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f000000010020019000000e310000613d000000000101043b000200000001001d0000000701000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d0000000202000029000000a00220021000000006022001af0000046c022001c7000000000101043b000000000021041b00000003010000290000046c0010019800000da40000c13d00000007010000290000000101100039000200000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b000000000101041a000000000001004b00000da40000c13d000000000100041a000000020010006b00000da40000613d0000000201000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000e2b0000613d000000000101043b0000000302000029000000000021041b0000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000004030000390000046d0400004100000008050000290000000606000029000000070700002910090fff0000040f000000010020019000000e2b0000613d000000060000006b00000e360000613d00000485010000410000000000100443000000050100002900000004001004430000000001000414000004030010009c0000040301008041000000c00110021000000486011001c70000800202000039100910040000040f000000010020019000000e310000613d000000000101043b000000000001004b00000e2a0000613d000000400700043d00000064017000390000008002000039000500000002001d0000000000210435000000440170003900000007020000290000000000210435000000240170003900000008020000290000000000210435000004870100004100000000001704350000000401700039000000040200002900000000002104350000008402700039000000010100002900000000310104340000000000120435000000a402700039000000000001004b00000de30000613d000000000400001900000000052400190000000006430019000000000606043300000000006504350000002004400039000000000014004b00000ddc0000413d0000001f031000390000047e0330019700000000012100190000000000010435000000a401300039000004030010009c00000403010080410000006001100210000004030070009c000004030200004100000000020740190000004002200210000000000121019f0000000002000414000004030020009c0000040302008041000000c002200210000000000112019f0000000602000029000800000007001d10090fff0000040f000000080b00002900000060031002700000040303300197000000200030008c000000200400003900000000040340190000001f0640018f000000200740019000000000057b001900000e080000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b00000e040000c13d000000000006004b00000e150000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000010020019000000e3a0000613d0000001f01400039000000600210018f0000000001b20019000000000021004b00000000020000390000000102004039000004060010009c00000e700000213d000000010020019000000e700000c13d000000400010043f000000200030008c00000e2b0000413d00000000010b0433000004770010019800000e2b0000c13d0000047801100197000004870010009c00000e6c0000c13d000000000001042d00000000010000190000100b000104300000047501000041000000000010043f0000045d010000410000100b00010430000000000001042f0000048301000041000000000010043f0000045d010000410000100b000104300000048401000041000000000010043f0000045d010000410000100b00010430000000000003004b00000e420000c13d000000600200003900000e690000013d0000046901000041000000000010043f0000045d010000410000100b000104300000001f0230003900000404022001970000003f022000390000048804200197000000400200043d0000000004420019000000000024004b00000000050000390000000105004039000004060040009c00000e700000213d000000010050019000000e700000c13d000000400040043f0000001f0430018f00000000063204360000040505300198000500000006001d000000000356001900000e5c0000613d000000000601034f0000000507000029000000006806043c0000000007870436000000000037004b00000e580000c13d000000000004004b00000e690000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001304350000000001020433000000000001004b00000e760000c13d0000048901000041000000000010043f0000045d010000410000100b000104300000046401000041000000000010043f0000004101000039000000040010043f00000465010000410000100b000104300000000502000029000004030020009c00000403020080410000004002200210000004030010009c00000403010080410000006001100210000000000121019f0000100b0001043000010000000000020000000003010019000000400100043d0000048a0010009c00000ed70000813d0000008002100039000000400020043f0000006002100039000000000002043500000040021000390000000000020435000000200210003900000000000204350000000000010435000000000003004b00000ed40000613d000000000200041a000000000032004b00000ed40000a13d000100000003001d000000000030043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000ed50000613d000000000101043b000000000101041a000000000001004b00000ea60000c13d0000000103000029000000010330008a00000e920000013d000000400100043d0000045a0010009c000000010300002900000ed70000213d0000008002100039000000400020043f0000006002100039000000000002043500000040021000390000000000020435000000200210003900000000000204350000000000010435000000000030043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000ed50000613d000000000301034f000000400100043d0000045a0010009c00000ed70000213d000000000203043b000000000202041a0000008003100039000000400030043f0000006003100039000000e804200270000000000043043500000454002001980000000003000039000000010300c039000000400410003900000000003404350000040f032001970000000003310436000000a00220027000000406022001970000000000230435000000000001042d00000000010000190000100b000104300000046401000041000000000010043f0000004101000039000000040010043f00000465010000410000100b000104300000041001000041000000000101041a0000000002000411000000000012004b00000ee30000c13d000000000001042d0000047001000041000000000010043f0000044d010000410000100b000104300001000000000002000000000001004b00000f170000613d000100000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000f150000613d000000000101043b000000000101041a000000000001004b00000f120000c13d000000000100041a0000000102000029000000000021004b00000f170000a13d000000010220008a000100000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000f150000613d000000000101043b000000000101041a000000000001004b000000010200002900000eff0000613d000004540010019800000f170000c13d000000000001042d00000000010000190000100b000104300000047501000041000000000010043f0000045d010000410000100b000104300004000000000002000000000001004b00000fce0000613d000300000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d000000000101043b000000000101041a000000000001004b00000f460000c13d000000000100041a0000000302000029000000000021004b00000fce0000a13d000000010220008a000400000002001d000000000020043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d000000000101043b000000000101041a000000000001004b000000040200002900000f330000613d000400000001001d0000045400100198000000030100002900000fce0000c13d000000000010043f0000000601000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d00000004020000290000040f03200197000000000101043b000000000201041a000000000002004b00000f5d0000613d000000000001041b000200000003001d000000000030043f0000000501000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d000000000101043b000000000201041a0000046a0220009a000000000021041b0000044f0100004100000000001004430000000001000414000004030010009c0000040301008041000000c00110021000000450011001c70000800b02000039100910040000040f000000010020019000000fd20000613d000000000101043b000100000001001d0000000301000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d0000000102000029000000a0022002100000000205000029000000000225019f0000046b022001c7000000000101043b000000000021041b00000004010000290000046c0010019800000fba0000c13d00000003010000290000000101100039000100000001001d000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d000000000101043b000000000101041a000000000001004b000000020500002900000fba0000c13d000000000100041a000000010010006b00000fba0000613d0000000101000029000000000010043f0000000401000039000000200010043f0000000001000414000004030010009c0000040301008041000000c00110021000000453011001c70000801002000039100910040000040f000000010020019000000fcc0000613d000000000101043b0000000402000029000000000021041b00000002050000290000000001000414000004030010009c0000040301008041000000c00110021000000411011001c70000800d0200003900000004030000390000046d040000410000000006000019000000030700002910090fff0000040f000000010020019000000fcc0000613d0000000101000039000000000201041a0000000102200039000000000021041b000000000001042d00000000010000190000100b000104300000047501000041000000000010043f0000045d010000410000100b00010430000000000001042f00010000000000020000041002000041000000000502041a00000000020004140000040f06100197000004030020009c0000040302008041000000c00120021000000411011001c70000800d0200003900000003030000390000041204000041000100000006001d10090fff0000040f000000010020019000000fe70000613d00000410010000410000000102000029000000000021041b000000000001042d00000000010000190000100b00010430000000000001042f000004030010009c00000403010080410000004001100210000004030020009c00000403020080410000006002200210000000000112019f0000000002000414000004030020009c0000040302008041000000c002200210000000000112019f00000411011001c70000801002000039100910040000040f000000010020019000000ffd0000613d000000000101043b000000000001042d00000000010000190000100b0001043000001002002104210000000102000039000000000001042d0000000002000019000000000001042d00001007002104230000000102000039000000000001042d0000000002000019000000000001042d00001009000004320000100a0001042e0000100b0001043000000000000000000000000000000000000000000000000000000000ffffffff00000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000000ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffbf4265617269736820486f6e6f72617269657300000000000000000000000000004245415249534800000000000000000000000000000000000000000000000000bfa87805ed57dc1f0d489ce33be4c4577d74ccde357eeeee058a32c55c44a532405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acebfa87805ed57dc1f0d489ce33be4c4577d74ccde357eeeee058a32c55c44a5310200000000000000000000000000000000000020000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392702000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e00000000200000000000000000000000000000040000001000000000000000000000000000000000000000000000000000000000000000000000000005bbb21760000000000000000000000000000000000000000000000000000000097087ce500000000000000000000000000000000000000000000000000000000c87b56dc00000000000000000000000000000000000000000000000000000000f04e283d00000000000000000000000000000000000000000000000000000000f04e283e00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000fee81cf400000000000000000000000000000000000000000000000000000000c87b56dd00000000000000000000000000000000000000000000000000000000e985e9c500000000000000000000000000000000000000000000000000000000a22cb46400000000000000000000000000000000000000000000000000000000a22cb46500000000000000000000000000000000000000000000000000000000b88d4fde00000000000000000000000000000000000000000000000000000000c23dc68f0000000000000000000000000000000000000000000000000000000097087ce60000000000000000000000000000000000000000000000000000000099a2557a00000000000000000000000000000000000000000000000000000000715018a5000000000000000000000000000000000000000000000000000000008462151b000000000000000000000000000000000000000000000000000000008462151c000000000000000000000000000000000000000000000000000000008da5cb5b0000000000000000000000000000000000000000000000000000000095d89b4100000000000000000000000000000000000000000000000000000000715018a6000000000000000000000000000000000000000000000000000000007a16f3f2000000000000000000000000000000000000000000000000000000006352211d000000000000000000000000000000000000000000000000000000006352211e000000000000000000000000000000000000000000000000000000006c0360eb0000000000000000000000000000000000000000000000000000000070a08231000000000000000000000000000000000000000000000000000000005bbb2177000000000000000000000000000000000000000000000000000000005df8133000000000000000000000000000000000000000000000000000000000287d50c4000000000000000000000000000000000000000000000000000000004cee79e3000000000000000000000000000000000000000000000000000000005277b4ad000000000000000000000000000000000000000000000000000000005277b4ae0000000000000000000000000000000000000000000000000000000054d1f13d0000000000000000000000000000000000000000000000000000000055f804b3000000000000000000000000000000000000000000000000000000004cee79e4000000000000000000000000000000000000000000000000000000004f6d38d00000000000000000000000000000000000000000000000000000000042842e0d0000000000000000000000000000000000000000000000000000000042842e0e0000000000000000000000000000000000000000000000000000000042966c680000000000000000000000000000000000000000000000000000000043470a8900000000000000000000000000000000000000000000000000000000287d50c50000000000000000000000000000000000000000000000000000000031c10da300000000000000000000000000000000000000000000000000000000095ea7b20000000000000000000000000000000000000000000000000000000018160ddc0000000000000000000000000000000000000000000000000000000018160ddd0000000000000000000000000000000000000000000000000000000023b872dd000000000000000000000000000000000000000000000000000000002569296200000000000000000000000000000000000000000000000000000000095ea7b3000000000000000000000000000000000000000000000000000000001249c58b0000000000000000000000000000000000000000000000000000000006fdde020000000000000000000000000000000000000000000000000000000006fdde0300000000000000000000000000000000000000000000000000000000081812fc000000000000000000000000000000000000000000000000000000000121b93f0000000000000000000000000000000000000000000000000000000001ffc9a700000000000000000000000000000000000000000000000000000000389a75e10000000000000000000000000000000000000020000000800000000000000000000000000000000000000000000000000000000000000000000000007448fbae00000000000000000000000000000000000000040000001c000000000000000002000000000000000000000000000000000000200000000c0000000000000000796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d955391320200000200000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000006f5e881800000000000000000000000000000000000000200000000000000000000000000200000000000000000000000000000000000040000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff30000000000000000000000000000000000000000000000000000000000000006e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af000000000000000000000000000000000000008000000000000000000000000017307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31000000000000000000000000000000000000000000000000ffffffffffffff7fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b32c1995a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000008f4eb60400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000080000000000000000000000000000000000000000000000000000000000000000007fffffffffffff60000000000000000000000000000000000000000000000000000000000ffffff91eabfe8e493f369f48e58fdf2609ff8809506ce57440a6f25fddc25308a385191eabfe8e493f369f48e58fdf2609ff8809506ce57440a6f25fddc25308a38504e487b71000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000fa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92ffffffffffffffffffffffff00000000000000000000000000000000000000000b7b8dc60000000000000000000000000000000000000000000000000000000059c896be00000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000100000003000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd5d00dbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d0000000000000000000000000000000000000000000000000000000082b42900fffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffff2e07630000000000000000000000000000000000000000000000000000000000cfb3b942000000000000000000000000000000000000000000000000000000008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925df2d9b4200000000000000000000000000000000000000000000000000000000cf4700e40000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000001ffc9a7000000000000000000000000000000000000000000000000000000005b5e139f0000000000000000000000000000000000000000000000000000000080ac58cd000000000000000000000000000000000000000000000000000000007c9a1cf900000000000000000000000000000000000000000000000000000000ceea21b600000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000010000000000000000a114810000000000000000000000000000000000000000000000000000000000ea553b34000000000000000000000000000000000000000000000000000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b830200000200000000000000000000000000000024000000000000000000000000150b7a020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ffffffe0d1a57ed600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff800000000000000000000000000000000000000000000000000000000000000000c97a0b45e67cf481022992b10212a3a37fd42ab6b3f3582a03581442dd6f3304
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002b68747470733a2f2f626561726973682e61662f6170692f6d657461646174612f686f6e6f7261726965732f000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : baseURI_ (string): https://bearish.af/api/metadata/honoraries/
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 000000000000000000000000000000000000000000000000000000000000002b
Arg [2] : 68747470733a2f2f626561726973682e61662f6170692f6d657461646174612f
Arg [3] : 686f6e6f7261726965732f000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.