Overview
TokenID
636
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
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:
UwuNFT
Compiler Version
v0.8.24+commit.e11b9ed9
ZkSolc Version
v1.5.7
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.24; import {ERC721A} from "erc721a/contracts/ERC721A.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {SafeTransferLib} from "solady/src/utils/ext/zksync/SafeTransferLib.sol"; contract UwuNFT is ERC721A, Ownable, ReentrancyGuard { using Strings for uint256; error MaxPerWalletExceeded(); error MaxSupplyReached(); error TransfersNotEnabled(); error IncorrectValue(); error NotAllowed(); error InvalidPhase(); error IncorrectProof(); error PenguTokenNotSet(); error ArithmeticOverflow(); error MaxPhaseSupplyReached(); uint256 public constant MAX_SUPPLY = 2000; uint256 public constant ogMintSupply = 150; uint256 public constant wlMintSupply = 1250; uint256 public constant fcfsMintSupply = 200; uint256 public ethMintPrice = 0.0069 ether; uint256 public ogMintedCount = 0; uint256 public wlMintedCount = 0; uint256 public fcfsMintedCount = 0; uint8 private maxTokenOG = 3; uint8 private maxTokenWL = 2; uint8 private maxTokenFCFS = 2; uint8 private maxTokenPublic= 10; string internal _prefix; string internal _suffix; // Enum for mint phases enum MintPhase { CLOSED, WL, FCFS, PUBLIC } MintPhase public currentPhase = MintPhase.CLOSED; bool public transfersEnabled; bytes32 public ogMerkleRoot; bytes32 public wlMerkleRoot; bytes32 public fcfsMerkleRoot; string private baseURI; event MintPhaseChanged(MintPhase newPhase); event TokensMinted(address indexed to, uint256 quantity); event PricesUpdated(uint256 newEthPrice); constructor() ERC721A("UwUtter", "UwU") Ownable(msg.sender) { _mint(msg.sender, 400); } function _startTokenId() internal pure override returns (uint256) { return 1; } modifier onlyValidPhase(MintPhase phase) { if (currentPhase != phase) revert InvalidPhase(); _; } // function airdrop(address[] calldata recipients, uint256 tokensPerRecipient) public onlyOwner { require(recipients.length <= 100, "Too many recipients"); for (uint256 i = 0; i < recipients.length; i++) { require(recipients[i] != address(0), "Cannot airdrop to zero address"); _mint(recipients[i], tokensPerRecipient); } } // Mint Functions function ogMint(address to, uint64 quantity, bytes32[] memory _merkleProof) external payable onlyValidPhase(MintPhase.WL) { if (_totalMinted() + quantity > MAX_SUPPLY) revert MaxSupplyReached(); if (!MerkleProof.verify(_merkleProof, ogMerkleRoot, keccak256(abi.encodePacked(msg.sender)))) revert IncorrectProof(); if (ogMintedCount + quantity > ogMintSupply) revert MaxPhaseSupplyReached(); uint64 aux = _getAux(msg.sender); uint64 ogMinted = aux & 15; if (ogMinted + quantity > maxTokenOG) revert MaxPerWalletExceeded(); uint256 ethRequired = ethMintPrice * quantity; if (ethRequired / quantity != ethMintPrice) revert ArithmeticOverflow(); // Check for overflow if (msg.value != ethRequired) revert IncorrectValue(); ogMintedCount += quantity; _setAux(msg.sender, (aux & ~uint64(15)) | uint64((ogMinted + quantity) & 15)); _safeMint(_msgSender(), quantity); emit TokensMinted(to, quantity); } function wlMint(address to, uint64 quantity, bytes32[] memory _merkleProof) external payable onlyValidPhase(MintPhase.WL) { if (_totalMinted() + quantity > MAX_SUPPLY) revert MaxSupplyReached(); if (!MerkleProof.verify(_merkleProof, wlMerkleRoot, keccak256(abi.encodePacked(msg.sender)))) revert IncorrectProof(); if (wlMintedCount + quantity > wlMintSupply) revert MaxPhaseSupplyReached(); uint64 aux = _getAux(msg.sender); uint64 wlMinted = (aux >> 4) & 15; if (wlMinted + quantity > maxTokenWL) revert MaxPerWalletExceeded(); uint256 ethRequired = ethMintPrice * quantity; if (ethRequired / quantity != ethMintPrice) revert ArithmeticOverflow(); if (msg.value != ethRequired) revert IncorrectValue(); wlMintedCount += quantity; _setAux(msg.sender, (aux & ~(uint64(15) << 4)) | (((wlMinted + uint64(quantity)) & 15) << 4)); _safeMint(to, quantity); emit TokensMinted(to, quantity); } function fcfsMint(address to, uint64 quantity, bytes32[] memory _merkleProof) external payable onlyValidPhase(MintPhase.FCFS) { if (_totalMinted() + quantity > MAX_SUPPLY) revert MaxSupplyReached(); if (!MerkleProof.verify(_merkleProof, fcfsMerkleRoot, keccak256(abi.encodePacked(msg.sender)))) revert IncorrectProof(); if (fcfsMintedCount + quantity > fcfsMintSupply) revert MaxPhaseSupplyReached(); uint64 aux = _getAux(msg.sender); uint64 fcfsMinted = (aux >> 8) & 15; if (fcfsMinted + quantity > maxTokenFCFS) revert MaxPerWalletExceeded(); uint256 ethRequired = ethMintPrice * quantity; if (ethRequired / quantity != ethMintPrice) revert ArithmeticOverflow(); if (msg.value != ethRequired) revert IncorrectValue(); fcfsMintedCount += quantity; _setAux(msg.sender, (aux & ~(uint64(15) << 8)) | (((fcfsMinted + uint64(quantity)) & 15) << 8)); _safeMint(to, quantity); emit TokensMinted(to, quantity); } function publicMint(address to, uint64 quantity) external payable onlyValidPhase(MintPhase.PUBLIC) { if (_totalMinted() + quantity > MAX_SUPPLY) revert MaxSupplyReached(); uint64 aux = _getAux(msg.sender); uint64 publicMinted = (aux >> 12) & 15; if (publicMinted + quantity > maxTokenPublic) revert MaxPerWalletExceeded(); uint256 ethRequired = ethMintPrice * quantity; if (ethRequired / quantity != ethMintPrice) revert ArithmeticOverflow(); if (msg.value != ethRequired) revert IncorrectValue(); _setAux(msg.sender, (aux & ~(uint64(15) << 12)) | (((publicMinted + uint64(quantity)) & 15) << 12)); _safeMint(to, quantity); emit TokensMinted(to, quantity); } // Admin Operations function setPhase(MintPhase phase_) external onlyOwner { currentPhase = MintPhase(phase_); emit MintPhaseChanged(phase_); } function setRoot(bytes32 ogRoot_, bytes32 wlRoot_, bytes32 fcfsRoot_) external onlyOwner { if (ogRoot_ != ogMerkleRoot) { ogMerkleRoot = ogRoot_; } if (wlRoot_ != wlMerkleRoot) { wlMerkleRoot = wlRoot_; } if (fcfsRoot_ != fcfsMerkleRoot) { fcfsMerkleRoot = fcfsRoot_; } } function setMintPrice(uint256 mintPrice_) public onlyOwner { ethMintPrice = mintPrice_; emit PricesUpdated(ethMintPrice); } // Uri Manager function prefix() public view returns (string memory) { return _prefix; } function suffix() public view returns (string memory) { return _suffix; } function _buildUri(uint256 tokenId) internal view returns (string memory) { return string(abi.encodePacked(_prefix, tokenId.toString(), _suffix)); } function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); return _buildUri(tokenId); } function setPrefix(string calldata prefix_) public onlyOwner { _prefix = prefix_; } function setSuffix(string calldata suffix_) public onlyOwner { _suffix = suffix_; } // Transfers function setApprovalForAll(address operator_, bool approved_) public override { if (!transfersEnabled) { revert TransfersNotEnabled(); } super.setApprovalForAll(operator_, approved_); } function _beforeTokenTransfers(address from_, address to_, uint256 startTokenId_, uint256 quantity_) internal override { if (!transfersEnabled && from_ != address(0)) { revert TransfersNotEnabled(); } super._beforeTokenTransfers(from_, to_, startTokenId_, quantity_); } function setTransfersEnabled(bool enabled) external onlyOwner{ transfersEnabled = enabled; } // Add withdraw functions for both ETH and PENGU tokens function withdrawETH() external onlyOwner { SafeTransferLib.safeTransferETH(owner(), address(this).balance); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at, * consider using {ReentrancyGuardTransient} instead. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SafeCast} from "./math/SafeCast.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { using SafeCast for *; bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev The string being parsed contains characters that are not in scope of the given base. */ error StringsInvalidChar(); /** * @dev The string being parsed is not a properly formatted address. */ error StringsInvalidAddressFormat(); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; assembly ("memory-safe") { ptr := add(buffer, add(32, length)) } while (true) { ptr--; assembly ("memory-safe") { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal * representation, according to EIP-55. */ function toChecksumHexString(address addr) internal pure returns (string memory) { bytes memory buffer = bytes(toHexString(addr)); // hash the hex part of buffer (skip length + 2 bytes, length 40) uint256 hashValue; assembly ("memory-safe") { hashValue := shr(96, keccak256(add(buffer, 0x22), 40)) } for (uint256 i = 41; i > 1; --i) { // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f) if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) { // case shift by xoring with 0x20 buffer[i] ^= 0x20; } hashValue >>= 4; } return string(buffer); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } /** * @dev Parse a decimal string and returns the value as a `uint256`. * * Requirements: * - The string must be formatted as `[0-9]*` * - The result must fit into an `uint256` type */ function parseUint(string memory input) internal pure returns (uint256) { return parseUint(input, 0, bytes(input).length); } /** * @dev Variant of {parseUint} that parses a substring of `input` located between position `begin` (included) and * `end` (excluded). * * Requirements: * - The substring must be formatted as `[0-9]*` * - The result must fit into an `uint256` type */ function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) { (bool success, uint256 value) = tryParseUint(input, begin, end); if (!success) revert StringsInvalidChar(); return value; } /** * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character. * * NOTE: This function will revert if the result does not fit in a `uint256`. */ function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) { return _tryParseUintUncheckedBounds(input, 0, bytes(input).length); } /** * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid * character. * * NOTE: This function will revert if the result does not fit in a `uint256`. */ function tryParseUint( string memory input, uint256 begin, uint256 end ) internal pure returns (bool success, uint256 value) { if (end > bytes(input).length || begin > end) return (false, 0); return _tryParseUintUncheckedBounds(input, begin, end); } /** * @dev Implementation of {tryParseUint} that does not check bounds. Caller should make sure that * `begin <= end <= input.length`. Other inputs would result in undefined behavior. */ function _tryParseUintUncheckedBounds( string memory input, uint256 begin, uint256 end ) private pure returns (bool success, uint256 value) { bytes memory buffer = bytes(input); uint256 result = 0; for (uint256 i = begin; i < end; ++i) { uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i))); if (chr > 9) return (false, 0); result *= 10; result += chr; } return (true, result); } /** * @dev Parse a decimal string and returns the value as a `int256`. * * Requirements: * - The string must be formatted as `[-+]?[0-9]*` * - The result must fit in an `int256` type. */ function parseInt(string memory input) internal pure returns (int256) { return parseInt(input, 0, bytes(input).length); } /** * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and * `end` (excluded). * * Requirements: * - The substring must be formatted as `[-+]?[0-9]*` * - The result must fit in an `int256` type. */ function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) { (bool success, int256 value) = tryParseInt(input, begin, end); if (!success) revert StringsInvalidChar(); return value; } /** * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if * the result does not fit in a `int256`. * * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`. */ function tryParseInt(string memory input) internal pure returns (bool success, int256 value) { return _tryParseIntUncheckedBounds(input, 0, bytes(input).length); } uint256 private constant ABS_MIN_INT256 = 2 ** 255; /** * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid * character or if the result does not fit in a `int256`. * * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`. */ function tryParseInt( string memory input, uint256 begin, uint256 end ) internal pure returns (bool success, int256 value) { if (end > bytes(input).length || begin > end) return (false, 0); return _tryParseIntUncheckedBounds(input, begin, end); } /** * @dev Implementation of {tryParseInt} that does not check bounds. Caller should make sure that * `begin <= end <= input.length`. Other inputs would result in undefined behavior. */ function _tryParseIntUncheckedBounds( string memory input, uint256 begin, uint256 end ) private pure returns (bool success, int256 value) { bytes memory buffer = bytes(input); // Check presence of a negative sign. bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty bool positiveSign = sign == bytes1("+"); bool negativeSign = sign == bytes1("-"); uint256 offset = (positiveSign || negativeSign).toUint(); (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end); if (absSuccess && absValue < ABS_MIN_INT256) { return (true, negativeSign ? -int256(absValue) : int256(absValue)); } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) { return (true, type(int256).min); } else return (false, 0); } /** * @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as a `uint256`. * * Requirements: * - The string must be formatted as `(0x)?[0-9a-fA-F]*` * - The result must fit in an `uint256` type. */ function parseHexUint(string memory input) internal pure returns (uint256) { return parseHexUint(input, 0, bytes(input).length); } /** * @dev Variant of {parseHexUint} that parses a substring of `input` located between position `begin` (included) and * `end` (excluded). * * Requirements: * - The substring must be formatted as `(0x)?[0-9a-fA-F]*` * - The result must fit in an `uint256` type. */ function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) { (bool success, uint256 value) = tryParseHexUint(input, begin, end); if (!success) revert StringsInvalidChar(); return value; } /** * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character. * * NOTE: This function will revert if the result does not fit in a `uint256`. */ function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) { return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length); } /** * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an * invalid character. * * NOTE: This function will revert if the result does not fit in a `uint256`. */ function tryParseHexUint( string memory input, uint256 begin, uint256 end ) internal pure returns (bool success, uint256 value) { if (end > bytes(input).length || begin > end) return (false, 0); return _tryParseHexUintUncheckedBounds(input, begin, end); } /** * @dev Implementation of {tryParseHexUint} that does not check bounds. Caller should make sure that * `begin <= end <= input.length`. Other inputs would result in undefined behavior. */ function _tryParseHexUintUncheckedBounds( string memory input, uint256 begin, uint256 end ) private pure returns (bool success, uint256 value) { bytes memory buffer = bytes(input); // skip 0x prefix if present bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty uint256 offset = hasPrefix.toUint() * 2; uint256 result = 0; for (uint256 i = begin + offset; i < end; ++i) { uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i))); if (chr > 15) return (false, 0); result *= 16; unchecked { // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check). // This guaratees that adding a value < 16 will not cause an overflow, hence the unchecked. result += chr; } } return (true, result); } /** * @dev Parse a hexadecimal string (with or without "0x" prefix), and returns the value as an `address`. * * Requirements: * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}` */ function parseAddress(string memory input) internal pure returns (address) { return parseAddress(input, 0, bytes(input).length); } /** * @dev Variant of {parseAddress} that parses a substring of `input` located between position `begin` (included) and * `end` (excluded). * * Requirements: * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}` */ function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) { (bool success, address value) = tryParseAddress(input, begin, end); if (!success) revert StringsInvalidAddressFormat(); return value; } /** * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly * formatted address. See {parseAddress} requirements. */ function tryParseAddress(string memory input) internal pure returns (bool success, address value) { return tryParseAddress(input, 0, bytes(input).length); } /** * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly * formatted address. See {parseAddress} requirements. */ function tryParseAddress( string memory input, uint256 begin, uint256 end ) internal pure returns (bool success, address value) { if (end > bytes(input).length || begin > end) return (false, address(0)); bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2("0x"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty uint256 expectedLength = 40 + hasPrefix.toUint() * 2; // check that input is the correct length if (end - begin == expectedLength) { // length guarantees that this does not overflow, and value is at most type(uint160).max (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end); return (s, address(uint160(v))); } else { return (false, address(0)); } } function _tryParseChr(bytes1 chr) private pure returns (uint8) { uint8 value = uint8(chr); // Try to parse `chr`: // - Case 1: [0-9] // - Case 2: [a-f] // - Case 3: [A-F] // - otherwise not supported unchecked { if (value > 47 && value < 58) value -= 48; else if (value > 96 && value < 103) value -= 87; else if (value > 64 && value < 71) value -= 55; else return type(uint8).max; } return value; } /** * @dev Reads a bytes32 from a bytes array without bounds checking. * * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the * assembly block as such would prevent some optimizations. */ function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) { // This is not memory safe in the general case, but all calls to this private function are within bounds. assembly ("memory-safe") { value := mload(add(buffer, add(0x20, offset))) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {SingleUseETHVault} from "./SingleUseETHVault.sol"; /// @notice Library for force safe transferring ETH and ERC20s in ZKsync. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/SafeTransferLib.sol) library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev A single use ETH vault has been created for `to`, with `amount`. event SingleUseETHVaultCreated(address indexed to, uint256 amount, address vault); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The ERC20 `totalSupply` query has failed. error TotalSupplyQueryFailed(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 1000000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, 0x00, 0x00, 0x00, 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), 0x00, 0x00, 0x00, 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. /// If force transfer is used, returns the vault. Else returns `address(0)`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (address vault) { if (amount == uint256(0)) return address(0); // Early return if `amount` is zero. uint256 selfBalanceBefore = address(this).balance; /// @solidity memory-safe-assembly assembly { if lt(selfBalanceBefore, amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } pop(call(gasStipend, to, amount, 0x00, 0x00, 0x00, 0x00)) } if (address(this).balance == selfBalanceBefore) { vault = address(new SingleUseETHVault()); /// @solidity memory-safe-assembly assembly { mstore(0x00, shr(96, shl(96, to))) if iszero(call(gas(), vault, amount, 0x00, 0x20, 0x00, 0x00)) { revert(0x00, 0x00) } } emit SingleUseETHVaultCreated(to, amount, vault); } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. /// If force transfer is used, returns the vault. Else returns `address(0)`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal returns (address vault) { vault = forceSafeTransferETH(to, address(this).balance, gasStipend); } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. /// If force transfer is used, returns the vault. Else returns `address(0)`. function forceSafeTransferETH(address to, uint256 amount) internal returns (address vault) { vault = forceSafeTransferETH(to, amount, GAS_STIPEND_NO_GRIEF); } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. /// If force transfer is used, returns the vault. Else returns `address(0)`. function forceSafeTransferAllETH(address to) internal returns (address vault) { vault = forceSafeTransferETH(to, address(this).balance, GAS_STIPEND_NO_GRIEF); } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, 0x00, 0x00, 0x00, 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), 0x00, 0x00, 0x00, 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { success := lt(or(iszero(extcodesize(token)), returndatasize()), success) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, 0x00, 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) if iszero(and(eq(mload(0x00), 1), success)) { // Check the `extcodesize` again just in case the token selfdestructs lol. if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Returns the total supply of the `token`. /// Reverts if the token does not exist or does not implement `totalSupply()`. function totalSupply(address token) internal view returns (uint256 result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x18160ddd) // `totalSupply()`. if iszero( and(gt(returndatasize(), 0x1f), staticcall(gas(), token, 0x1c, 0x04, 0x00, 0x20)) ) { mstore(0x00, 0x54cd9435) // `TotalSupplyQueryFailed()`. revert(0x1c, 0x04) } result := mload(0x00) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MerkleProof.sol) // This file was procedurally generated from scripts/generate/templates/MerkleProof.js. pragma solidity ^0.8.20; import {Hashes} from "./Hashes.sol"; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. * * IMPORTANT: Consider memory side-effects when using custom hashing functions * that access memory in an unsafe way. * * NOTE: This library supports proof verification for merkle trees built using * custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving * leaf inclusion in trees built using non-commutative hashing functions requires * additional logic that is not supported by this library. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in memory with the default hashing function. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in memory with the default hashing function. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in memory with a custom hashing function. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processProof(proof, leaf, hasher) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in memory with a custom hashing function. */ function processProof( bytes32[] memory proof, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = hasher(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in calldata with the default hashing function. */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in calldata with the default hashing function. */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in calldata with a custom hashing function. */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processProofCalldata(proof, leaf, hasher) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in calldata with a custom hashing function. */ function processProofCalldata( bytes32[] calldata proof, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = hasher(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in memory with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProof}. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in memory with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = Hashes.commutativeKeccak256(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in memory with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProof}. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processMultiProof(proof, proofFlags, leaves, hasher) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in memory with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = hasher(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in calldata with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProofCalldata}. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in calldata with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = Hashes.commutativeKeccak256(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in calldata with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProofCalldata}. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in calldata with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = hasher(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol) pragma solidity ^0.8.20; import {Panic} from "../Panic.sol"; import {SafeCast} from "./SafeCast.sol"; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an success flag (no overflow). */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow). */ function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow). */ function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a success flag (no division by zero). */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero). */ function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant. * * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone. * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute * one branch when needed, making this function more expensive. */ function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) { unchecked { // branchless ternary works because: // b ^ (a ^ b) == a // b ^ 0 == b return b ^ ((a ^ b) * SafeCast.toUint(condition)); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return ternary(a > b, a, b); } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return ternary(a < b, a, b); } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. Panic.panic(Panic.DIVISION_BY_ZERO); } // The following calculation ensures accurate ceiling division without overflow. // Since a is non-zero, (a - 1) / b will not overflow. // The largest possible result occurs when (a - 1) / b is type(uint256).max, // but the largest value we can obtain is type(uint256).max - 1, which happens // when a = type(uint256).max and b = 1. unchecked { return SafeCast.toUint(a > 0) * ((a - 1) / b + 1); } } /** * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2²⁵⁶ + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0. if (denominator <= prod1) { Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW)); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv ≡ 1 mod 2⁴. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2⁸ inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶ inverse *= 2 - denominator * inverse; // inverse mod 2³² inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴ inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸ inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶ // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @dev Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0); } /** * @dev Calculate the modular multiplicative inverse of a number in Z/nZ. * * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0. * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible. * * If the input value is not inversible, 0 is returned. * * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}. */ function invMod(uint256 a, uint256 n) internal pure returns (uint256) { unchecked { if (n == 0) return 0; // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version) // Used to compute integers x and y such that: ax + ny = gcd(a, n). // When the gcd is 1, then the inverse of a modulo n exists and it's x. // ax + ny = 1 // ax = 1 + (-y)n // ax ≡ 1 (mod n) # x is the inverse of a modulo n // If the remainder is 0 the gcd is n right away. uint256 remainder = a % n; uint256 gcd = n; // Therefore the initial coefficients are: // ax + ny = gcd(a, n) = n // 0a + 1n = n int256 x = 0; int256 y = 1; while (remainder != 0) { uint256 quotient = gcd / remainder; (gcd, remainder) = ( // The old remainder is the next gcd to try. remainder, // Compute the next remainder. // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd // where gcd is at most n (capped to type(uint256).max) gcd - remainder * quotient ); (x, y) = ( // Increment the coefficient of a. y, // Decrement the coefficient of n. // Can overflow, but the result is casted to uint256 so that the // next value of y is "wrapped around" to a value between 0 and n - 1. x - y * int256(quotient) ); } if (gcd != 1) return 0; // No inverse exists. return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative. } } /** * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`. * * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that * `a**(p-2)` is the modular multiplicative inverse of a in Fp. * * NOTE: this function does NOT check that `p` is a prime greater than `2`. */ function invModPrime(uint256 a, uint256 p) internal view returns (uint256) { unchecked { return Math.modExp(a, p - 2, p); } } /** * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m) * * Requirements: * - modulus can't be zero * - underlying staticcall to precompile must succeed * * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make * sure the chain you're using it on supports the precompiled contract for modular exponentiation * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, * the underlying function will succeed given the lack of a revert, but the result may be incorrectly * interpreted as 0. */ function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) { (bool success, uint256 result) = tryModExp(b, e, m); if (!success) { Panic.panic(Panic.DIVISION_BY_ZERO); } return result; } /** * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m). * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying * to operate modulo 0 or if the underlying precompile reverted. * * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack * of a revert, but the result may be incorrectly interpreted as 0. */ function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) { if (m == 0) return (false, 0); assembly ("memory-safe") { let ptr := mload(0x40) // | Offset | Content | Content (Hex) | // |-----------|------------|--------------------------------------------------------------------| // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 | // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 | // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 | // | 0x60:0x7f | value of b | 0x<.............................................................b> | // | 0x80:0x9f | value of e | 0x<.............................................................e> | // | 0xa0:0xbf | value of m | 0x<.............................................................m> | mstore(ptr, 0x20) mstore(add(ptr, 0x20), 0x20) mstore(add(ptr, 0x40), 0x20) mstore(add(ptr, 0x60), b) mstore(add(ptr, 0x80), e) mstore(add(ptr, 0xa0), m) // Given the result < m, it's guaranteed to fit in 32 bytes, // so we can use the memory scratch space located at offset 0. success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20) result := mload(0x00) } } /** * @dev Variant of {modExp} that supports inputs of arbitrary length. */ function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) { (bool success, bytes memory result) = tryModExp(b, e, m); if (!success) { Panic.panic(Panic.DIVISION_BY_ZERO); } return result; } /** * @dev Variant of {tryModExp} that supports inputs of arbitrary length. */ function tryModExp( bytes memory b, bytes memory e, bytes memory m ) internal view returns (bool success, bytes memory result) { if (_zeroBytes(m)) return (false, new bytes(0)); uint256 mLen = m.length; // Encode call args in result and move the free memory pointer result = abi.encodePacked(b.length, e.length, mLen, b, e, m); assembly ("memory-safe") { let dataPtr := add(result, 0x20) // Write result on top of args to avoid allocating extra memory. success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen) // Overwrite the length. // result.length > returndatasize() is guaranteed because returndatasize() == m.length mstore(result, mLen) // Set the memory pointer after the returned data. mstore(0x40, add(dataPtr, mLen)) } } /** * @dev Returns whether the provided byte array is zero. */ function _zeroBytes(bytes memory byteArray) private pure returns (bool) { for (uint256 i = 0; i < byteArray.length; ++i) { if (byteArray[i] != 0) { return false; } } return true; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * This method is based on Newton's method for computing square roots; the algorithm is restricted to only * using integer operations. */ function sqrt(uint256 a) internal pure returns (uint256) { unchecked { // Take care of easy edge cases when a == 0 or a == 1 if (a <= 1) { return a; } // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between // the current value as `ε_n = | x_n - sqrt(a) |`. // // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is // bigger than any uint256. // // By noticing that // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)` // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar // to the msb function. uint256 aa = a; uint256 xn = 1; if (aa >= (1 << 128)) { aa >>= 128; xn <<= 64; } if (aa >= (1 << 64)) { aa >>= 64; xn <<= 32; } if (aa >= (1 << 32)) { aa >>= 32; xn <<= 16; } if (aa >= (1 << 16)) { aa >>= 16; xn <<= 8; } if (aa >= (1 << 8)) { aa >>= 8; xn <<= 4; } if (aa >= (1 << 4)) { aa >>= 4; xn <<= 2; } if (aa >= (1 << 2)) { xn <<= 1; } // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1). // // We can refine our estimation by noticing that the middle of that interval minimizes the error. // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2). // This is going to be our x_0 (and ε_0) xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2) // From here, Newton's method give us: // x_{n+1} = (x_n + a / x_n) / 2 // // One should note that: // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a // = ((x_n² + a) / (2 * x_n))² - a // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²) // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²) // = (x_n² - a)² / (2 * x_n)² // = ((x_n² - a) / (2 * x_n))² // ≥ 0 // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n // // This gives us the proof of quadratic convergence of the sequence: // ε_{n+1} = | x_{n+1} - sqrt(a) | // = | (x_n + a / x_n) / 2 - sqrt(a) | // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) | // = | (x_n - sqrt(a))² / (2 * x_n) | // = | ε_n² / (2 * x_n) | // = ε_n² / | (2 * x_n) | // // For the first iteration, we have a special case where x_0 is known: // ε_1 = ε_0² / | (2 * x_0) | // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2))) // ≤ 2**(2*e-4) / (3 * 2**(e-1)) // ≤ 2**(e-3) / 3 // ≤ 2**(e-3-log2(3)) // ≤ 2**(e-4.5) // // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n: // ε_{n+1} = ε_n² / | (2 * x_n) | // ≤ (2**(e-k))² / (2 * 2**(e-1)) // ≤ 2**(2*e-2*k) / 2**e // ≤ 2**(e-2*k) xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5 xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9 xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18 xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36 xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72 // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either // sqrt(a) or sqrt(a) + 1. return xn - SafeCast.toUint(xn > a / xn); } } /** * @dev Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; uint256 exp; unchecked { exp = 128 * SafeCast.toUint(value > (1 << 128) - 1); value >>= exp; result += exp; exp = 64 * SafeCast.toUint(value > (1 << 64) - 1); value >>= exp; result += exp; exp = 32 * SafeCast.toUint(value > (1 << 32) - 1); value >>= exp; result += exp; exp = 16 * SafeCast.toUint(value > (1 << 16) - 1); value >>= exp; result += exp; exp = 8 * SafeCast.toUint(value > (1 << 8) - 1); value >>= exp; result += exp; exp = 4 * SafeCast.toUint(value > (1 << 4) - 1); value >>= exp; result += exp; exp = 2 * SafeCast.toUint(value > (1 << 2) - 1); value >>= exp; result += exp; result += SafeCast.toUint(value > 1); } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; uint256 isGt; unchecked { isGt = SafeCast.toUint(value > (1 << 128) - 1); value >>= isGt * 128; result += isGt * 16; isGt = SafeCast.toUint(value > (1 << 64) - 1); value >>= isGt * 64; result += isGt * 8; isGt = SafeCast.toUint(value > (1 << 32) - 1); value >>= isGt * 32; result += isGt * 4; isGt = SafeCast.toUint(value > (1 << 16) - 1); value >>= isGt * 16; result += isGt * 2; result += SafeCast.toUint(value > (1 << 8) - 1); } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } /** * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump. */ function toUint(bool b) internal pure returns (uint256 u) { assembly ("memory-safe") { u := iszero(iszero(b)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; import {SafeCast} from "./SafeCast.sol"; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant. * * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone. * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute * one branch when needed, making this function more expensive. */ function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) { unchecked { // branchless ternary works because: // b ^ (a ^ b) == a // b ^ 0 == b return b ^ ((a ^ b) * int256(SafeCast.toUint(condition))); } } /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return ternary(a > b, a, b); } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return ternary(a < b, a, b); } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // Formula from the "Bit Twiddling Hacks" by Sean Eron Anderson. // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift, // taking advantage of the most significant (or "sign" bit) in two's complement representation. // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result, // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative). int256 mask = n >> 255; // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it. return uint256((n + mask) ^ mask); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol) pragma solidity ^0.8.20; /** * @dev Library of standard hash functions. * * _Available since v5.1._ */ library Hashes { /** * @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs. * * NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. */ function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) { return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly ("memory-safe") { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice A single-use vault that allows a designated caller to withdraw all ETH in it. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/SingleUseETHVault.sol) contract SingleUseETHVault { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Unable to withdraw all. error WithdrawAllFailed(); /// @dev Not authorized. error Unauthorized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* WITHDRAW ALL */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ fallback() external payable virtual { /// @solidity memory-safe-assembly assembly { mstore(0x40, 0) // Optimization trick to remove free memory pointer initialization. let owner := sload(0) // Initialization. if iszero(owner) { sstore(0, calldataload(0x00)) // Store the owner. return(0x00, 0x00) // Early return. } // Authorization check. if iszero(eq(caller(), owner)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } let to := calldataload(0x00) // If the calldata is less than 32 bytes, zero-left-pad it to 32 bytes. // Then use the rightmost 20 bytes of the word as the `to` address. // This allows for the calldata to be `abi.encode(to)` or `abi.encodePacked(to)`. to := shr(mul(lt(calldatasize(), 0x20), shl(3, sub(0x20, calldatasize()))), to) // If `to` is `address(0)`, set it to `msg.sender`. to := xor(mul(xor(to, caller()), iszero(to)), to) // Transfers the whole balance to `to`. if iszero(call(gas(), to, selfbalance(), 0x00, 0x00, 0x00, 0x00)) { mstore(0x00, 0x651aee10) // `WithdrawAllFailed()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol) pragma solidity ^0.8.20; /** * @dev Helper library for emitting standardized panic codes. * * ```solidity * contract Example { * using Panic for uint256; * * // Use any of the declared internal constants * function foo() { Panic.GENERIC.panic(); } * * // Alternatively * function foo() { Panic.panic(Panic.GENERIC); } * } * ``` * * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil]. * * _Available since v5.1._ */ // slither-disable-next-line unused-state library Panic { /// @dev generic / unspecified error uint256 internal constant GENERIC = 0x00; /// @dev used by the assert() builtin uint256 internal constant ASSERT = 0x01; /// @dev arithmetic underflow or overflow uint256 internal constant UNDER_OVERFLOW = 0x11; /// @dev division or modulo by zero uint256 internal constant DIVISION_BY_ZERO = 0x12; /// @dev enum conversion error uint256 internal constant ENUM_CONVERSION_ERROR = 0x21; /// @dev invalid encoding in storage uint256 internal constant STORAGE_ENCODING_ERROR = 0x22; /// @dev empty array pop uint256 internal constant EMPTY_ARRAY_POP = 0x31; /// @dev array out of bounds access uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32; /// @dev resource error (too large allocation or too large array) uint256 internal constant RESOURCE_ERROR = 0x41; /// @dev calling invalid internal function uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51; /// @dev Reverts with a panic code. Recommended to use with /// the internal constants with predefined codes. function panic(uint256 code) internal pure { assembly ("memory-safe") { mstore(0x00, 0x4e487b71) mstore(0x20, code) revert(0x1c, 0x24) } } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "mode": "3" }, "outputSelection": { "*": { "*": [ "abi", "metadata" ], "": [ "ast" ] } }, "detectMissingLibraries": false, "forceEVMLA": false, "enableEraVMExtensions": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ArithmeticOverflow","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"IncorrectProof","type":"error"},{"inputs":[],"name":"IncorrectValue","type":"error"},{"inputs":[],"name":"InvalidPhase","type":"error"},{"inputs":[],"name":"MaxPerWalletExceeded","type":"error"},{"inputs":[],"name":"MaxPhaseSupplyReached","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotAllowed","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PenguTokenNotSet","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"TransfersNotEnabled","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","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":false,"internalType":"enum UwuNFT.MintPhase","name":"newPhase","type":"uint8"}],"name":"MintPhaseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newEthPrice","type":"uint256"}],"name":"PricesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"TokensMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256","name":"tokensPerRecipient","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"enum UwuNFT.MintPhase","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fcfsMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"fcfsMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fcfsMintSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fcfsMintedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ogMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"ogMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"ogMintSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ogMintedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prefix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"uint256","name":"mintPrice_","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum UwuNFT.MintPhase","name":"phase_","type":"uint8"}],"name":"setPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"prefix_","type":"string"}],"name":"setPrefix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"ogRoot_","type":"bytes32"},{"internalType":"bytes32","name":"wlRoot_","type":"bytes32"},{"internalType":"bytes32","name":"fcfsRoot_","type":"bytes32"}],"name":"setRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"suffix_","type":"string"}],"name":"setSuffix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setTransfersEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"suffix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transfersEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wlMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"wlMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"wlMintSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wlMintedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
9c4d535b0000000000000000000000000000000000000000000000000000000000000000010004876c73a8db2aee61bc973cf71787dabe3b7cd53bb018fc23e98757f7b800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0003000000000002000900000000000200020000000103550000006004100270000003db0040019d0000008003000039000000400030043f0000000100200190000000210000c13d000003db04400197000000040040008c0000091c0000413d000000000201043b000000e002200270000003f50020009c000000550000213d000004130020009c000000680000213d000004220020009c000001360000a13d000004230020009c000001af0000213d000004270020009c0000033b0000613d000004280020009c000003620000613d000004290020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000001201000039000005bb0000013d0000000001000416000000000001004b0000091c0000c13d0000000701000039000000800010043f000003dc01000041000000a00010043f0000010001000039000000400010043f0000000301000039000000c00010043f000003dd02000041000000e00020043f0000000202000039000000000302041a000000010430019000000001033002700000007f0330618f0000001f0030008c00000000050000390000000105002039000000000054004b0000004f0000c13d000000200030008c000000430000413d000000000020043f000003de040000410000001f033000390000000503300270000003df0330009a000000000004041b0000000104400039000000000034004b0000003f0000413d000003e003000041000000000032041b000000000301041a000000010030019000000001023002700000007f0220618f0000001f0020008c00000000040000390000000104002039000000000343013f0000000100300190000000820000613d0000046801000041000000000010043f0000002201000039000000040010043f000004690100004100000f6800010430000003f60020009c000000990000213d000004050020009c0000015d0000a13d000004060020009c0000028d0000213d0000040a0020009c000003bb0000613d0000040b0020009c000003da0000613d0000040c0020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000009601000039000000800010043f000004300100004100000f670001042e000004140020009c0000016e0000a13d000004150020009c0000029e0000213d000004190020009c000004b30000613d0000041a0020009c000004b80000613d0000041b0020009c0000091c0000c13d000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000101043b0f660efd0000040f000003e401100197000000400200043d0000000000120435000003db0020009c000003db02008041000000400120021000000436011001c700000f670001042e000000200020008c0000008d0000413d000000000010043f000003e1030000410000001f022000390000000502200270000003e20220009a000000000003041b0000000103300039000000000023004b000000890000413d000003e302000041000000000021041b0000000101000039000000000010041b0000000001000411000000000001004b000000b90000c13d000003f301000041000001000010043f000001040000043f000003f40100004100000f6800010430000003f70020009c000001860000a13d000003f80020009c000002a90000213d000003fc0020009c000004bd0000613d000003fd0020009c000004d80000613d000003fe0020009c0000091c0000c13d000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000601043b000003e40060009c0000091c0000213d0000000801000039000000000201041a000003e4032001970000000005000411000000000053004b0000072b0000c13d000000000006004b000007570000c13d000003f301000041000000800010043f000000840000043f000004330100004100000f6800010430000003e4061001970000000801000039000000000201041a000003e503200197000000000363019f000000000031041b0000000001000414000003e405200197000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000303000039000003e704000041000800000006001d0f660f5c0000040f00000001002001900000091c0000613d00000009010000390000000102000039000000000021041b000003e8010000410000000a02000039000000000012041b0000000b01000039000000000001041b0000000c01000039000000000001041b0000000d01000039000000000001041b0000000e01000039000000000201041a000003e902200197000003ea022001c7000000000021041b0000001102000039000000000302041a0000047701300197000000000012041b000000000100041a000900000001001d0000000801000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000201041a000003ec0220009a000000000021041b000003ed0100004100000000001004430000000001000414000003db0010009c000003db01008041000000c001100210000003ee011001c70000800b020000390f660f610000040f00000001002001900000091e0000613d000000000101043b000700000001001d0000000901000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d0000000702000029000000a0022002100000000806000029000000000262019f000000000101043b000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef04000041000000000500001900000009070000290f660f5c0000040f00000001002001900000091c0000613d0000000901000029000701900010003d00000009070000290000000107700039000000070070006c0000074d0000613d0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef0400004100000000050000190000000806000029000900000007001d0f660f5c0000040f0000000100200190000001230000c13d0000091c0000013d0000042a0020009c000002b40000a13d0000042b0020009c000004df0000613d0000042c0020009c0000051e0000613d0000042d0020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000000203000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000004f0000c13d000000800010043f000000000004004b000007150000613d000000000030043f000000000001004b00000000020000190000071a0000613d000003de030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b000001550000413d0000071a0000013d0000040d0020009c000002cc0000a13d0000040e0020009c000005270000613d0000040f0020009c0000052c0000613d000004100020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000000801000039000000000101041a000003e401100197000000800010043f000004300100004100000f670001042e0000041c0020009c000002ef0000a13d0000041d0020009c0000056b0000613d0000041e0020009c0000058d0000613d0000041f0020009c0000091c0000c13d00000000010400190f660a930000040f000900000001001d000800000002001d000700000003001d000000400100043d000600000001001d0f660a610000040f000000060400002900000000000404350000000901000029000000080200002900000007030000290f660bc10000040f000000000100001900000f670001042e000003ff0020009c000003090000a13d000004000020009c000005940000613d000004010020009c000005b70000613d000004020020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000000801000039000000000101041a000003e4011001970000000002000411000000000021004b000007100000c13d00000437010000410000000000100443000000000100041000000004001004430000000001000414000003db0010009c000003db01008041000000c00110021000000438011001c70000800a020000390f660f610000040f00000001002001900000091e0000613d000000000301043b00000000010004140000000002000411000000040020008c0000070e0000613d000003db0010009c000003db01008041000000c001100210000000000003004b0000079b0000c13d0000079f0000013d000004240020009c000005bf0000613d000004250020009c000005dd0000613d000004260020009c0000091c0000c13d000000640040008c0000091c0000413d0000000402100370000000000202043b000800000002001d000003e40020009c0000091c0000213d0000002402100370000000000202043b000004420020009c0000091c0000213d0000004403100370000000000303043b000004420030009c0000091c0000213d0000002305300039000000000045004b0000091c0000813d0000000405300039000000000551034f000000000605043b000004420060009c0000097b0000213d00000005056002100000003f075000390000045607700197000004520070009c0000097b0000213d0000008007700039000000400070043f000000800060043f00000024033000390000000005350019000000000045004b0000091c0000213d000000000006004b000001e20000613d0000008004000039000000000631034f000000000606043b000000200440003900000000006404350000002003300039000000000053004b000001db0000413d0000001101000039000000000101041a000000ff0110018f000000030010008c000007300000213d000000010010008c000008890000c13d000704420020019b000000000100041a000000010110008a000000070010002a000008550000413d0000000702100029000000400100043d000007d00020008c0000051c0000213d0000001202000039000000000202041a000600000002001d00000014020000390000000002210436000000000300041100000060033002100000000000320435000004570010009c0000097b0000213d0000004003100039000000400030043f000003db0020009c000003db0200804100000040022002100000000001010433000003db0010009c000003db010080410000006001100210000000000121019f0000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f000003e6011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000800200043d000000000002004b000002300000613d0000000003000019000900000003001d0000000502300210000000a0022000390000000002020433000000000021004b0000021f0000813d000000000010043f000000200020043f0000000001000414000002220000013d000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b00000009030000290000000103300039000000800200043d000000000023004b000002150000413d000000060010006c000009f80000c13d0000000b01000039000000000101041a000000070010002a000008550000413d0000000701100029000900000001001d000000960010008c000009f50000213d0000000001000411000003e401100197000600000001001d000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a000000c001100270000400000001001d0000000f0110018f0000000701100029000500000001001d000004420010009c000008550000213d0000000e01000039000000000101041a000000ff0110018f000000050010006b0000094f0000213d0000000a01000039000000000201041a00000007012000b9000000000002004b0000025f0000613d00000000032100d9000000070030006c000008550000c13d000000070000006b0000096c0000613d00000007031000fa000000000023004b00000a5b0000c13d0000000002000416000000000012004b00000a5e0000c13d0000000b010000390000000902000029000000000021041b0000000601000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d00000004020000290000045f0220019700000005030000290000000f0330018f000000000223019f000000c002200210000000000101043b000000000301041a0000045a03300197000000000223019f000000000021041b000000000100041100000007020000290f660d9d0000040f000000400100043d00000007020000290000000000210435000003db0010009c000003db010080410000004001100210000000000200041400000a500000013d000004070020009c000005e80000613d000004080020009c000006020000613d000004090020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000001101000039000000000101041a0000ff00001001900000000001000039000000010100c039000000800010043f000004300100004100000f670001042e000004160020009c000006470000613d000004170020009c000006560000613d000004180020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000000b01000039000005bb0000013d000003f90020009c0000066b0000613d000003fa0020009c000006840000613d000003fb0020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000000d01000039000005bb0000013d0000042e0020009c000006a30000613d0000042f0020009c0000091c0000c13d000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000201043b00000472002001980000091c0000c13d00000001010000390000047302200197000004740020009c000007450000613d000004750020009c000007450000613d000004760020009c000007450000613d000000800000043f000004300100004100000f670001042e000004110020009c000006aa0000613d000004120020009c0000091c0000c13d0000000001000416000000000001004b0000091c0000c13d0000000f03000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000004f0000c13d000000800010043f000000000004004b000007150000613d000000000030043f000000000001004b00000000020000190000071a0000613d00000446030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b000002e70000413d0000071a0000013d000004200020009c000006e90000613d000004210020009c0000091c0000c13d000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000201043b000000000002004b0000000001000039000000010100c039000900000002001d000000000012004b0000091c0000c13d0f660f350000040f0000001101000039000000000201041a0000047802200197000000090000006b000001000220c1bf000000000021041b000000000100001900000f670001042e000004030020009c000006ee0000613d000004040020009c0000091c0000c13d000000440040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000402100370000000000302043b000004420030009c0000091c0000213d0000002302300039000000000042004b0000091c0000813d0000000402300039000000000521034f000000000505043b000500000005001d000004420050009c0000091c0000213d000400240030003d000000050300002900000005033002100000000403300029000000000043004b0000091c0000213d0000002403100370000000000303043b000300000003001d0000000803000039000000000303041a000003e4043001970000000003000411000000000034004b000007480000c13d0000000503000029000000640030008c000007bc0000a13d0000044d01000041000000800010043f0000002001000039000000840010043f0000001301000039000000a40010043f0000044f01000041000000c40010043f000004500100004100000f6800010430000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d00000080020000390000000401100370000000000301043b000000000003004b000007a90000613d000000000100041a000000000031004b000007a90000a13d000900000003001d000000000030043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a0000043b00100198000007a80000c13d0000000901000029000000000010043f0000000601000039000000200010043f000000400200003900000000010000190f660f470000040f000000000101041a0000007a0000013d000000440040008c0000091c0000413d0000000402100370000000000202043b000800000002001d000003e40020009c0000091c0000213d00000080020000390000002401100370000000000301043b000000000003004b0000073b0000613d000000000100041a000000000031004b0000073b0000a13d000700000003001d000000000030043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a0000043b00100198000007dd0000c13d000000000001004b000003980000c13d000900070000002d0000000901000029000000010110008a000900000001001d000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a000000000001004b000003850000613d000903e40010019b0000000002000411000000090020006c000008670000c13d0000000701000029000000000010043f0000000601000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d0000000802000029000003e406200197000000000101043b000000000201041a000003e502200197000000000262019f000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d0200003900000004030000390000046504000041000000090500002900000007070000290000070b0000013d0000000001000416000000000001004b0000091c0000c13d0000000303000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000004f0000c13d000000800010043f000000000004004b000007150000613d000000000030043f000000000001004b00000000020000190000071a0000613d000003e1030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b000003d20000413d0000071a0000013d000000640040008c0000091c0000413d0000000402100370000000000202043b000800000002001d000003e40020009c0000091c0000213d0000002402100370000000000202043b000004420020009c0000091c0000213d0000004403100370000000000303043b000004420030009c0000091c0000213d0000002305300039000000000045004b0000091c0000813d0000000405300039000000000551034f000000000605043b000004420060009c0000097b0000213d00000005056002100000003f075000390000045607700197000004520070009c0000097b0000213d0000008007700039000000400070043f000000800060043f00000024033000390000000005350019000000000045004b0000091c0000213d000000000006004b000004070000613d0000008004000039000000000631034f000000000606043b000000200440003900000000006404350000002003300039000000000053004b000004000000413d0000001101000039000000000101041a000000ff0110018f000000030010008c000007300000213d000000010010008c000008890000c13d000704420020019b000000000100041a000000010110008a000000070010002a000008550000413d0000000702100029000000400100043d000007d00020008c0000051c0000213d0000001302000039000000000202041a000600000002001d00000014020000390000000002210436000000000300041100000060033002100000000000320435000004570010009c0000097b0000213d0000004003100039000000400030043f000003db0020009c000003db0200804100000040022002100000000001010433000003db0010009c000003db010080410000006001100210000000000121019f0000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f000003e6011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000800200043d000000000002004b000004550000613d0000000003000019000900000003001d0000000502300210000000a0022000390000000002020433000000000021004b000004440000813d000000000010043f000000200020043f0000000001000414000004470000013d000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b00000009030000290000000103300039000000800200043d000000000023004b0000043a0000413d000000060010006c000009f80000c13d0000000c01000039000000000101041a000000070010002a000008550000413d0000000701100029000900000001001d000004e20010008c000009f50000213d0000000001000411000003e401100197000600000001001d000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a000400000001001d000000c4011002700000000f0110018f0000000701100029000500000001001d000004420010009c000008550000213d0000000e01000039000000000101041a0000000801100270000000ff0110018f000000050010006b0000094f0000213d0000000a01000039000000000201041a00000007012000b9000000000002004b000004850000613d00000000032100d9000000070030006c000008550000c13d000000070000006b0000096c0000613d00000007031000fa000000000023004b00000a5b0000c13d0000000002000416000000000012004b00000a5e0000c13d0000000c010000390000000902000029000000000021041b0000000601000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000040200002900000458022001970000000503000029000000c4033002100000045903300197000000000223019f000000000101043b000000000301041a0000045a03300197000000000232019f000000000021041b000000080100002900000007020000290f660d9d0000040f000000400100043d00000007020000290000000000210435000003db0010009c000003db010080410000004001100210000000000200041400000a500000013d0000000001000416000000000001004b0000091c0000c13d0000000c01000039000005bb0000013d0000000001000416000000000001004b0000091c0000c13d0000001301000039000005bb0000013d000000440040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000402100370000000000202043b000003e40020009c0000091c0000213d0000002401100370000000000101043b000900000001001d000003e40010009c0000091c0000213d000000000020043f0000000701000039000000200010043f000000400200003900000000010000190f660f470000040f00000009020000290f660aa50000040f000000000101041a000000ff001001900000000001000039000000010100c0390000007b0000013d0000000001000416000000000001004b0000091c0000c13d000000c801000039000000800010043f000004300100004100000f670001042e000000640040008c0000091c0000413d0000000402100370000000000202043b000800000002001d000003e40020009c0000091c0000213d0000002402100370000000000202043b000004420020009c0000091c0000213d0000004403100370000000000303043b000004420030009c0000091c0000213d0000002305300039000000000045004b0000091c0000813d0000000405300039000000000551034f000000000605043b0000046a0060009c0000097b0000813d00000005056002100000003f075000390000045607700197000004520070009c0000097b0000213d0000008007700039000000400070043f000000800060043f00000024033000390000000005350019000000000045004b0000091c0000213d000000000006004b0000050c0000613d0000008004000039000000000631034f000000000606043b000000200440003900000000006404350000002003300039000000000053004b000005050000413d0000001101000039000000000101041a000000ff0110018f000000040010008c000007300000813d000000020010008c000008890000c13d000704420020019b000000000100041a000000010110008a000000070010002a000008550000413d0000000702100029000000400100043d000007d00020008c000009720000a13d0000046302000041000007510000013d0000000001000416000000000001004b0000091c0000c13d0000001101000039000000000101041a000000ff0110018f000000030010008c000007450000a13d000007300000013d0000000001000416000000000001004b0000091c0000c13d0000001401000039000005bb0000013d000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000402100370000000000302043b000004420030009c0000091c0000213d0000002302300039000000000042004b0000091c0000813d0000000406300039000000000261034f000000000202043b000004420020009c0000091c0000213d00000024053000390000000003520019000000000043004b0000091c0000213d0000000803000039000000000303041a000003e4043001970000000003000411000000000034004b000007480000c13d0000000f03000039000000000703041a000000010070019000000001047002700000007f0440618f0000001f0040008c00000000080000390000000108002039000000000787013f00000001007001900000004f0000c13d000000200040008c000005630000413d000000000030043f0000001f0720003900000005077002700000045c0770009a000000200020008c00000446070040410000001f0440003900000005044002700000045c0440009a000000000047004b000005630000813d000000000007041b0000000107700039000000000047004b0000055f0000413d0000001f0020008c0000085b0000a13d000000000030043f00000479062001980000088c0000c13d00000446040000410000000007000019000008a10000013d000000640040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000004402100370000000000202043b0000002403100370000000000303043b0000000401100370000000000101043b0000000804000039000000000404041a000003e4054001970000000004000411000000000045004b000007360000c13d0000001204000039000000000504041a000000000051004b000005810000613d000000000014041b0000001301000039000000000401041a000000000043004b000005860000613d000000000031041b0000001401000039000000000301041a000000000032004b0000070e0000613d000000000021041b000000000100001900000f670001042e0000000001000416000000000001004b0000091c0000c13d000007d001000039000000800010043f000004300100004100000f670001042e000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000201043b000000000002004b000007b10000613d000000000100041a000000000021004b000007b10000a13d000900000002001d000000000020043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a0000043b00100198000007b00000c13d00000009010000290000043c0010009c000007e00000413d00000040020000390000043c0110012a000007e80000013d0000000001000416000000000001004b0000091c0000c13d0000000a01000039000000000101041a000000800010043f000004300100004100000f670001042e000000440040008c0000091c0000413d0000000402100370000000000202043b000900000002001d000003e40020009c0000091c0000213d0000002401100370000000000101043b000800000001001d000004420010009c0000091c0000213d0000001101000039000000000101041a000000ff0110018f000000030010008c000007300000213d000007b80000c13d000000000100041a000000010110008a0000000802000029000000000021001a000008550000413d0000000001210019000007d10010008c0000083d0000413d0000046301000041000000800010043f0000044b0100004100000f68000104300000000001000416000000000001004b0000091c0000c13d0000000101000039000000000101041a0000047a01100167000000000200041a0000000001120019000000800010043f000004300100004100000f670001042e000000440040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000402100370000000000202043b000900000002001d000003e40020009c0000091c0000213d0000002401100370000000000201043b000000000002004b0000000001000039000000010100c039000800000002001d000000000012004b0000091c0000c13d0000001101000039000000000101041a0000ff0000100190000007630000c13d0000045501000041000000800010043f0000044b0100004100000f6800010430000000840040008c0000091c0000413d0000000402100370000000000502043b000003e40050009c0000091c0000213d0000002402100370000000000202043b000003e40020009c0000091c0000213d0000006403100370000000000603043b000004420060009c0000091c0000213d0000002303600039000000000043004b0000091c0000813d0000000407600039000000000371034f000000000303043b000004420030009c0000097b0000213d0000001f0930003900000479099001970000003f099000390000047909900197000004520090009c0000097b0000213d0000008009900039000000400090043f000000800030043f00000000063600190000002406600039000000000046004b0000091c0000213d0000002004700039000000000641034f00000479073001980000001f0830018f000000a004700039000006310000613d000000a009000039000000000a06034f00000000ab0a043c0000000009b90436000000000049004b0000062d0000c13d000000000008004b0000063e0000613d000000000676034f0000000307800210000000000804043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f0000000000640435000000a00330003900000000000304350000004401100370000000000301043b000000800400003900000000010500190f660bc10000040f000000000100001900000f670001042e000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000101043b000003e40010009c0000091c0000213d000000000001004b0000073d0000c13d0000045e01000041000000800010043f0000044b0100004100000f68000104300000000001000416000000000001004b0000091c0000c13d0000000801000039000000000201041a000003e4032001970000000005000411000000000053004b0000072b0000c13d000003e502200197000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000303000039000003e70400004100000000060000190000070b0000013d000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000802000039000000000202041a000003e4032001970000000002000411000000000023004b000007100000c13d0000000401100370000000000101043b0000000a02000039000000000012041b000000800010043f0000000001000414000003db0010009c000003db01008041000000c00110021000000434011001c70000800d02000039000000010300003900000435040000410000070b0000013d0000000001000416000000000001004b0000091c0000c13d0000001003000039000000000203041a000000010420019000000001012002700000007f0110618f0000001f0010008c00000000050000390000000105002039000000000552013f00000001005001900000004f0000c13d000000800010043f000000000004004b000007150000613d000000000030043f000000000001004b00000000020000190000071a0000613d00000431030000410000000002000019000000000403041a000000a005200039000000000045043500000001033000390000002002200039000000000012004b0000069b0000413d0000071a0000013d0000000001000416000000000001004b0000091c0000c13d000004e201000039000000800010043f000004300100004100000f670001042e000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000402100370000000000302043b000004420030009c0000091c0000213d0000002302300039000000000042004b0000091c0000813d0000000406300039000000000261034f000000000202043b000004420020009c0000091c0000213d00000024053000390000000003520019000000000043004b0000091c0000213d0000000803000039000000000303041a000003e4043001970000000003000411000000000034004b000007480000c13d0000001003000039000000000703041a000000010070019000000001047002700000007f0440618f0000001f0040008c00000000080000390000000108002039000000000787013f00000001007001900000004f0000c13d000000200040008c000006e10000413d000000000030043f0000001f0720003900000005077002700000045d0770009a000000200020008c00000431070040410000001f0440003900000005044002700000045d0440009a000000000047004b000006e10000813d000000000007041b0000000107700039000000000047004b000006dd0000413d0000001f0020008c0000085b0000a13d000000000030043f0000047906200198000008970000c13d00000431040000410000000007000019000008a10000013d00000000010400190f660a930000040f0f660ab50000040f000000000100001900000f670001042e000000240040008c0000091c0000413d0000000002000416000000000002004b0000091c0000c13d0000000401100370000000000101043b000000030010008c0000091c0000213d0000000802000039000000000202041a000003e4032001970000000002000411000000000023004b000007100000c13d0000001102000039000000000302041a0000047703300197000000000313019f000000000032041b000000800010043f0000000001000414000003db0010009c000003db01008041000000c00110021000000434011001c70000800d02000039000000010300003900000451040000410f660f5c0000040f00000001002001900000091c0000613d000000000100001900000f670001042e0000043201000041000000800010043f000000840020043f000004330100004100000f68000104300000047702200197000000a00020043f000000000001004b00000020020000390000000002006039000000200220003900000080010000390f660a6c0000040f000000400100043d000900000001001d00000080020000390f660a7e0000040f00000009020000290000000001210049000003db0010009c000003db010080410000006001100210000003db0020009c000003db020080410000004002200210000000000121019f00000f670001042e0000043201000041000000800010043f000000840050043f000004330100004100000f68000104300000046801000041000000000010043f0000002101000039000000040010043f000004690100004100000f68000104300000043201000041000000800010043f000000840040043f000004330100004100000f68000104300000046601000041000007aa0000013d000000000010043f0000000501000039000000200010043f000000400200003900000000010000190f660f470000040f000000000101041a0000044201100197000000800010043f000004300100004100000f670001042e0000043201000041000000800010043f000000840030043f000004330100004100000f6800010430000000080000006b000007940000c13d000000400100043d000003f1020000410000000000210435000003db0010009c000003db010080410000004001100210000003f2011001c700000f6800010430000003e502200197000000000262019f000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000303000039000003e7040000410000070b0000013d0000000001000411000000000010043f0000000701000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b0000000902000029000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000201041a00000477022001970000000803000029000000000232019f000000000021041b000000400100043d0000000000310435000003db0010009c000003db0100804100000040011002100000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f00000453011001c70000800d0200003900000003030000390000045404000041000000000500041100000009060000290000070b0000013d0000000701000029000000000010041b000000200100003900000100001004430000012000000443000003f00100004100000f670001042e000003e6011001c70000800902000039000000000400041100000000050000190f660f5c0000040f0000006001100270000103db0010019d00000001002001900000070e0000c13d0000043901000041000000000010043f0000043a0100004100000f6800010430000000400200043d00000467010000410000000000120435000003db0020009c000003db020080410000004001200210000003f2011001c700000f6800010430000000400300043d00000447010000410000000000130435000003db0030009c000003db030080410000004001300210000003f2011001c700000f68000104300000046001000041000000800010043f0000044b0100004100000f6800010430000000000003004b0000070e0000613d0000000303000029000000010030008c00000000040000190000044804006041000200000004001d000000000003004b000008b20000c13d0000002002200039000000000121034f000000000101043b000003e40010009c0000091c0000213d000000000001004b000009810000c13d000000800100003900000044021000390000044c03000041000000000032043500000024021000390000001e0300003900000000003204350000044d020000410000000000210435000000040210003900000020030000390000000000320435000003db0010009c000003db0100804100000040011002100000044e011001c700000f6800010430000000400200043d0000046601000041000007aa0000013d0000043e0010009c0000043d0110212a000000000200003900000020020020390000043f0010009c00000010022081bf00000440011081970000043f0110812a000004410010009c00000008022080390000044201108197000004410110812a000027100010008c0000000402208039000003db01108197000027100110811a000000640010008c00000002022080390000ffff0110818f000000640110811a000000090010008c000000010220203900000479052001970000005f015000390000047906100197000000400300043d0000000001360019000000000061004b00000000060000390000000106004039000004420010009c0000097b0000213d00000001006001900000097b0000c13d000000400010043f00000001012000390000000001130436000000200650003900000479056001980000001f0460018f000008110000613d0000000005510019000000000600003100000002066003670000000007010019000000006806043c0000000007870436000000000057004b0000080d0000c13d000000000004004b000000000223001900000021022000390000000906000029000000090060008c0000000a4660011a0000000304400210000000010220008a00000000050204330000044305500197000004440440021f0000044504400197000000000454019f0000000000420435000008150000213d0000000f06000039000000000506041a000000010750019000000001025002700000007f0220618f0000001f0020008c00000000040000390000000104002039000000000445013f00000001004001900000004f0000c13d000000400400043d00000000090400190000002004400039000000000007004b0000091f0000613d000000000060043f000000000002004b000009210000613d000004460500004100000000060000190000000007460019000000000805041a000000000087043500000001055000390000002006600039000000000026004b000008350000413d000009210000013d0000000001000411000003e401100197000700000001001d000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a000500000001001d000000cc011002700000000f0110018f0000000801100029000600000001001d000004420010009c000009490000a13d0000046801000041000000000010043f0000001101000039000000040010043f000004690100004100000f6800010430000000000002004b0000000004000019000008610000613d0000002004600039000000000141034f000000000401043b00000003012002100000047a0110027f0000047a01100167000000000414016f0000000101200210000008ae0000013d0000000901000029000000000010043f0000000701000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b0000000002000411000003e402200197000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a000000ff001001900000039c0000c13d000000400100043d0000046402000041000007510000013d000000400100043d0000046002000041000007510000013d000004460400004100000000070000190000000008570019000000000881034f000000000808043b000000000084041b00000001044000390000002007700039000000000067004b0000088e0000413d000008a10000013d000004310400004100000000070000190000000008570019000000000881034f000000000808043b000000000084041b00000001044000390000002007700039000000000067004b000008990000413d000000000026004b000008ac0000813d0000000306200210000000f80660018f0000047a0660027f0000047a066001670000000005570019000000000151034f000000000101043b000000000161016f000000000014041b00000001010000390000000104200210000000000114019f000000000013041b000000000100001900000f670001042e000000030100002900010449001000d5000600000000001d000008bd0000013d0000000701000029000000000010041b00000006020000290000000102200039000600000002001d000000050020006c0000070e0000813d0000000601000029000000050110021000000004011000290000000201100367000000000101043b000800000001001d000003e40010009c0000091c0000213d0000000801000029000000000001004b000009fb0000613d000000000200041a000900000002001d000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000201041a0000000102200029000000000021041b000003ed0100004100000000001004430000000001000414000003db0010009c000003db01008041000000c001100210000003ee011001c70000800b020000390f660f610000040f00000001002001900000091e0000613d000000000101043b000700000001001d0000000901000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d0000000702000029000000a00220021000000002022001af0000000806000029000000000262019f000000000101043b000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef04000041000000000500001900000009070000290f660f5c0000040f00000001002001900000091c0000613d0000000902000029000700030020002d00000009070000290000000107700039000000070070006c000008b60000613d0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef0400004100000000050000190000000806000029000900000007001d0f660f5c0000040f00000001002001900000090a0000c13d000000000100001900000f6800010430000000000001042f0000047705500197000000000054043500000000024200190000000003030433000000000003004b0000092d0000613d000000000400001900000000052400190000000006140019000000000606043300000000006504350000002004400039000000000034004b000009260000413d000000000123001900000000000104350000001004000039000000000304041a000000010530019000000001023002700000007f0220618f0000001f0020008c00000000060000390000000106002039000000000663013f00000001006001900000004f0000c13d000000000005004b000009520000613d000000000040043f000000000002004b000009540000613d000004310300004100000000040000190000000005140019000000000603041a000000000065043500000001033000390000002004400039000000000024004b000009410000413d000009540000013d0000000e01000039000000000101041a0000001801100270000000ff0110018f000000060010006b000009610000a13d000000400100043d0000047002000041000007510000013d00000477033001970000000000310435000900000009001d00000000019100490000000002120019000000200120008a000000000019043500000000010900190f660a6c0000040f000000400100043d000800000001001d00000009020000290f660a7e0000040f0000000802000029000007220000013d0000000a01000039000000000201041a000000080400002900000000014200a9000000000002004b0000096a0000613d00000000032100d9000000000043004b000008550000c13d000000000004004b000009850000c13d0000046801000041000000000010043f0000001201000039000000040010043f000004690100004100000f68000104300000001402000039000000000302041a000600000003001d0000000002210436000000000300041100000060033002100000000000320435000004570010009c000009b70000a13d0000046801000041000000000010043f0000004101000039000000040010043f000004690100004100000f68000104300000044a01000041000000800010043f0000044b0100004100000f680001043000000008031000fa000000000023004b00000a5b0000c13d0000000002000416000000000012004b00000a5e0000c13d0000000701000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000050200002900000461022001970000000603000029000000cc033002100000046203300197000000000223019f000000000101043b000000000301041a0000045a03300197000000000232019f000000000021041b000000090100002900000008020000290f660d9d0000040f000000400100043d00000008020000290000000000210435000003db0010009c000003db0100804100000040011002100000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f00000453011001c70000800d0200003900000002030000390000045b0400004100000009050000290000070b0000013d0000004003100039000000400030043f000003db0020009c000003db0200804100000040022002100000000001010433000003db0010009c000003db010080410000006001100210000000000121019f0000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f000003e6011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000800200043d000000000002004b000009eb0000613d0000000003000019000900000003001d0000000502300210000000a0022000390000000002020433000000000021004b000009da0000813d000000000010043f000000200020043f0000000001000414000009dd0000013d000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b00000009030000290000000103300039000000800200043d000000000023004b000009d00000413d000000060010006c000009f80000c13d0000000d01000039000000000101041a000000070010002a000008550000413d0000000701100029000900000001001d000000c90010008c000009fd0000413d000000400100043d0000047102000041000007510000013d000000400100043d0000046b02000041000007510000013d000000400100043d000007cd0000013d0000000001000411000003e401100197000600000001001d000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d000000000101043b000000000101041a000400000001001d000000c8011002700000000f0110018f0000000701100029000500000001001d000004420010009c000008550000213d0000000e01000039000000000101041a0000001001100270000000ff0110018f000000050010006b0000094f0000213d0000000a01000039000000000201041a00000007012000b9000000000002004b00000a230000613d00000000032100d9000000070030006c000008550000c13d000000070000006b0000096c0000613d00000007031000fa000000000023004b00000a5b0000c13d0000000002000416000000000012004b00000a5e0000c13d0000000d010000390000000902000029000000000021041b0000000601000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f00000001002001900000091c0000613d00000004020000290000046e022001970000000503000029000000c8033002100000046f03300197000000000223019f000000000101043b000000000301041a0000045a03300197000000000232019f000000000021041b000000080100002900000007020000290f660d9d0000040f000000400100043d00000007020000290000000000210435000003db0010009c000003db0100804100000040011002100000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f0000000802000029000003e40520019700000453011001c70000800d0200003900000002030000390000045b040000410000070b0000013d000000400100043d0000046c02000041000007510000013d000000400100043d0000046d02000041000007510000013d0000047b0010009c00000a660000813d0000002001100039000000400010043f000000000001042d0000046801000041000000000010043f0000004101000039000000040010043f000004690100004100000f68000104300000001f0220003900000479022001970000000001120019000000000021004b00000000020000390000000102004039000004420010009c00000a780000213d000000010020019000000a780000c13d000000400010043f000000000001042d0000046801000041000000000010043f0000004101000039000000040010043f000004690100004100000f680001043000000020030000390000000004310436000000003202043400000000002404350000004001100039000000000002004b00000a8d0000613d000000000400001900000000051400190000000006430019000000000606043300000000006504350000002004400039000000000024004b00000a860000413d000000000312001900000000000304350000001f0220003900000479022001970000000001120019000000000001042d0000047c0010009c00000aa30000213d000000630010008c00000aa30000a13d00000002030003670000000401300370000000000101043b000003e40010009c00000aa30000213d0000002402300370000000000202043b000003e40020009c00000aa30000213d0000004403300370000000000303043b000000000001042d000000000100001900000f6800010430000003e402200197000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000ab30000613d000000000101043b000000000001042d000000000100001900000f68000104300007000000000002000300000002001d000500000001001d000600000003001d000000000003004b00000bac0000613d000000000100041a000000060010006c00000bac0000a13d0000000601000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b000000000101041a0000043b0010019800000bac0000c13d000000000001004b00000ae50000c13d0000000602000029000000010220008a000700000002001d000000000020043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b000000000101041a000000000001004b000000070200002900000ad20000613d0000000502000029000003e402200197000400000001001d000003e401100197000500000002001d000000000021004b00000baf0000c13d0000000601000029000000000010043f0000000601000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000301043b000000000403041a0000000001000411000003e4011001970000000502000029000000000021004b00000b250000613d000000000041004b00000b250000613d000700000001001d000100000004001d000200000003001d000000000020043f0000000701000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b0000000702000029000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b000000000101041a000000ff0010019000000005020000290000000203000029000000010400002900000bb90000613d0000000301000029000703e40010019c00000bb20000613d000000000002004b00000b2e0000613d0000001101000039000000000101041a0000ff000010019000000bb50000613d000000000004004b00000b310000613d000000000003041b000000000020043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b000000000201041a000000010220008a000000000021041b0000000701000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b000000000201041a0000000102200039000000000021041b000003ed0100004100000000001004430000000001000414000003db0010009c000003db01008041000000c001100210000003ee011001c70000800b020000390f660f610000040f000000010020019000000bb80000613d000000000101043b000300000001001d0000000601000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d0000000302000029000000a00220021000000007022001af00000448022001c7000000000101043b000000000021041b0000000401000029000004480010019800000b9b0000c13d00000006010000290000000101100039000300000001001d000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b000000000101041a000000000001004b00000b9b0000c13d000000000100041a000000030010006b00000b9b0000613d0000000301000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000baa0000613d000000000101043b0000000402000029000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef040000410000000505000029000000070600002900000006070000290f660f5c0000040f000000010020019000000baa0000613d000000000001042d000000000100001900000f6800010430000000400100043d000004660200004100000bbb0000013d000000400100043d0000047d0200004100000bbb0000013d000000400100043d0000047f0200004100000bbb0000013d000000400100043d000004550200004100000bbb0000013d000000000001042f000000400100043d0000047e020000410000000000210435000003db0010009c000003db010080410000004001100210000003f2011001c700000f6800010430000a000000000002000100000004001d000500000002001d000600000001001d000700000003001d000000000003004b00000d480000613d000000000100041a000000070010006c00000d480000a13d0000000701000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b000000000101041a0000043b0010019800000d480000c13d000000000001004b00000bf20000c13d0000000702000029000000010220008a000800000002001d000000000020043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b000000000101041a000000000001004b000000080200002900000bdf0000613d0000000602000029000003e402200197000300000001001d000003e401100197000800000002001d000000000021004b00000d4c0000c13d0000000701000029000000000010043f0000000601000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000301043b000000000403041a0000000001000411000003e402100197000400000002001d000000080020006c00000c310000613d000000040040006b00000c310000613d000200000004001d000600000003001d0000000801000029000000000010043f0000000701000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b0000000402000029000000000020043f000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b000000000101041a000000ff001001900000000603000029000000020400002900000d550000613d0000000501000029000003e40210019800000d4f0000613d000000080000006b00000c3a0000613d0000001101000039000000000101041a0000ff000010019000000d520000613d000600000002001d000000000004004b00000c3e0000613d000000000003041b0000000801000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b000000000201041a000000010220008a000000000021041b0000000601000029000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b000000000201041a0000000102200039000000000021041b000003ed0100004100000000001004430000000001000414000003db0010009c000003db01008041000000c001100210000003ee011001c70000800b020000390f660f610000040f000000010020019000000d4b0000613d000000000101043b000200000001001d0000000701000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d0000000202000029000000a0022002100000000606000029000000000262019f00000448022001c7000000000101043b000000000021041b0000000301000029000004480010019800000cac0000c13d00000007010000290000000101100039000200000001001d000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b000000000101041a000000000001004b000000060600002900000cac0000c13d000000000100041a000000020010006b00000cac0000613d0000000201000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000d460000613d000000000101043b0000000302000029000000000021041b00000006060000290000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef04000041000000080500002900000007070000290f660f5c0000040f000000010020019000000d460000613d00000480010000410000000000100443000000050100002900000004001004430000000001000414000003db0010009c000003db01008041000000c00110021000000438011001c700008002020000390f660f610000040f000000010020019000000d4b0000613d000000000101043b000000000001004b00000d450000613d0000000008000415000000400b00043d0000006401b00039000000800700003900000000007104350000004401b00039000000070200002900000000002104350000002401b0003900000008020000290000000000210435000004810100004100000000001b04350000000401b00039000000040200002900000000002104350000008403b00039000000010100002900000000210104340000000000130435000000a403b00039000000000001004b00000ce80000613d000000000400001900000000053400190000000006420019000000000606043300000000006504350000002004400039000000000014004b00000ce10000413d0000000002310019000000000002043500000000040004140000000602000029000000040020008c00000cf60000c13d00000000050004150000000a0550008a00000005055002100000000103000031000000200030008c0000002004000039000000000403401900000d2d0000013d000700000008001d000500000007001d0000001f011000390000047901100197000000a401100039000003db0010009c000003db010080410000006001100210000003db00b0009c000003db0300004100000000030b40190000004003300210000000000131019f000003db0040009c000003db04008041000000c003400210000000000113019f00080000000b001d0f660f5c0000040f000000080b0000290000006003100270000003db03300197000000200030008c000000200400003900000000040340190000001f0640018f000000200740019000000000057b001900000d190000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b00000d150000c13d000000000006004b00000d260000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000100000003001f0000000005000415000000090550008a0000000505500210000000010020019000000d580000613d00000007080000290000001f01400039000000600210018f0000000001b20019000000000021004b00000000020000390000000102004039000004420010009c00000d8e0000213d000000010020019000000d8e0000c13d000000400010043f000000200030008c00000d460000413d00000000010b0433000004720010019800000d460000c13d0000000502500270000000000201001f0000000002000415000000000228004900000000020000020000047301100197000004810010009c00000d860000c13d000000000001042d000000000100001900000f6800010430000000400100043d000004660200004100000d880000013d000000000001042f000000400100043d0000047d0200004100000d880000013d000000400100043d0000047f0200004100000d880000013d000000400100043d000004550200004100000d880000013d000000400100043d0000047e0200004100000d880000013d000000000003004b00000d5c0000c13d000000600200003900000d830000013d0000001f0230003900000482022001970000003f022000390000048304200197000000400200043d0000000004420019000000000024004b00000000050000390000000105004039000004420040009c00000d8e0000213d000000010050019000000d8e0000c13d000000400040043f0000001f0430018f00000000063204360000048405300198000500000006001d000000000356001900000d760000613d000000000601034f0000000507000029000000006806043c0000000007870436000000000037004b00000d720000c13d000000000004004b00000d830000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001304350000000001020433000000000001004b00000d940000c13d000000400100043d00000485020000410000000000210435000003db0010009c000003db010080410000004001100210000003f2011001c700000f68000104300000046801000041000000000010043f0000004101000039000000040010043f000004690100004100000f68000104300000000502000029000003db0020009c000003db020080410000004002200210000003db0010009c000003db010080410000006001100210000000000121019f00000f6800010430000c000000000002000000400300043d000700000003001d0000047b0030009c00000ef00000813d00000007040000290000002003400039000400000003001d000000400030043f0000000000040435000600000002001d000000000002004b00000ef70000613d000000000200041a000a00000002001d000500000001001d000003e401100197000900000001001d000000000010043f0000000501000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000e070000613d000000060200002900000449022000d1000000000101043b000000000301041a0000000002230019000000000021041b000003ed0100004100000000001004430000000001000414000003db0010009c000003db01008041000000c001100210000003ee011001c70000800b020000390f660f610000040f000000010020019000000ef60000613d000000000101043b000800000001001d0000000a01000029000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000e070000613d0000000802000029000000a0022002100000000603000029000000010030008c00000000030000190000044803006041000000000223019f0000000906000029000000000262019f000000000101043b000000000021041b0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef0400004100000000050000190000000a070000290f660f5c0000040f000000010020019000000e070000613d0000000a02000029000800060020002d0000000a070000290000000107700039000000080070006c00000e090000613d0000000001000414000003db0010009c000003db01008041000000c001100210000003e6011001c70000800d020000390000000403000039000003ef0400004100000000050000190000000906000029000a00000007001d0f660f5c0000040f000000010020019000000df50000c13d000000000100001900000f6800010430000000090000006b00000efa0000613d0000000801000029000000000010041b00000480010000410000000000100443000000050100002900000004001004430000000001000414000003db0010009c000003db01008041000000c00110021000000438011001c700008002020000390f660f610000040f000000010020019000000ef60000613d000000000101043b000000000001004b000000040600002900000eb80000613d0000000101000039000000000800041a000000060980006a0000008007000039000004810a0000410000000002000411000003e40b200197000100000007001d000200000008001d00030000000b001d000000000089004b000000000c000039000000010c004039000000010010019000000eb50000613d000000000d000415000000400e00043d0000006401e0003900000000007104350000000000ae04350000000401e000390000000000b104350000004401e0003900000000009104350000002401e000390000000000010435000000070100002900000000010104330000008402e000390000000000120435000000a402e00039000000000001004b00000e470000613d000000000300001900000000042300190000000005630019000000000505043300000000005404350000002003300039000000000013004b00000e400000413d0000000002210019000000000002043500000000040004140000000902000029000000040020008c00000e550000c13d00000000050004150000000c0550008a00000005055002100000000103000031000000200030008c0000002004000039000000000403401900000e930000013d00060000000d001d00080000000c001d000a00000009001d0000001f011000390000047901100197000000a401100039000003db0010009c000003db010080410000006001100210000003db00e0009c000003db0300004100000000030e40190000004003300210000000000131019f000003db0040009c000003db04008041000000c003400210000000000113019f00050000000e001d0f660f5c0000040f000000050e0000290000006003100270000003db03300197000000200030008c00000020040000390000000004034019000000200640019000000000056e001900000e780000613d000000000701034f00000000080e0019000000007907043c0000000008980436000000000058004b00000e740000c13d0000001f0740019000000e850000613d000000000661034f0000000307700210000000000805043300000000087801cf000000000878022f000000000606043b0000010007700089000000000676022f00000000067601cf000000000686019f0000000000650435000100000003001f00000000050004150000000b0550008a000000050550021000000001002001900000000a09000029000004810a000041000000030b000029000000080c000029000000060d00002900000eb90000613d0000000406000029000000800700003900000002080000290000001f01400039000000600210018f0000000001e20019000000000021004b00000000020000390000000102004039000004420010009c00000ef00000213d000000010020019000000ef00000c13d000000400010043f000000200030008c00000e070000413d00000000010e0433000004720010019800000e070000c13d00000001099000390000000502500270000000000201001f000000000200041500000000022d004900000000020000020000047301100197000004810010009c00000000010c001900000e280000613d000000400100043d00000485020000410000000000210435000003db0010009c000003db010080410000004001100210000003f2011001c700000f6800010430000000000100041a000000000081004b00000e070000c13d000000000001042d000000000003004b00000ebd0000c13d000000600200003900000ee40000013d0000001f0230003900000482022001970000003f022000390000048304200197000000400200043d0000000004420019000000000024004b00000000050000390000000105004039000004420040009c00000ef00000213d000000010050019000000ef00000c13d000000400040043f0000001f0430018f00000000063204360000048405300198000100000006001d000000000356001900000ed70000613d000000000601034f0000000107000029000000006806043c0000000007870436000000000037004b00000ed30000c13d000000000004004b00000ee40000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001304350000000001020433000000000001004b000000010200002900000ead0000613d000003db0020009c000003db020080410000004002200210000003db0010009c000003db010080410000006001100210000000000121019f00000f68000104300000046801000041000000000010043f0000004101000039000000040010043f000004690100004100000f6800010430000000000001042f000000400100043d0000044a0200004100000eaf0000013d000000400100043d000003f10200004100000eaf0000013d0001000000000002000000000001004b00000f2d0000613d000000000200041a000000000012004b00000f2d0000a13d000100000001001d000000000010043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000f2b0000613d000000000101043b000000000101041a0000043b00100198000000010200002900000f2d0000c13d000000000001004b00000f2a0000c13d000000010220008a000100000002001d000000000020043f0000000401000039000000200010043f0000000001000414000003db0010009c000003db01008041000000c001100210000003eb011001c700008010020000390f660f610000040f000000010020019000000f2b0000613d000000000101043b000000000101041a000000000001004b000000010200002900000f170000613d000000000001042d000000000100001900000f6800010430000000400100043d00000466020000410000000000210435000003db0010009c000003db010080410000004001100210000003f2011001c700000f68000104300000000801000039000000000101041a000003e4021001970000000001000411000000000012004b00000f3c0000c13d000000000001042d000000400200043d0000043203000041000000000032043500000004032000390000000000130435000003db0020009c000003db02008041000000400120021000000469011001c700000f6800010430000000000001042f000003db0010009c000003db010080410000004001100210000003db0020009c000003db020080410000006002200210000000000112019f0000000002000414000003db0020009c000003db02008041000000c002200210000000000112019f000003e6011001c700008010020000390f660f610000040f000000010020019000000f5a0000613d000000000101043b000000000001042d000000000100001900000f680001043000000f5f002104210000000102000039000000000001042d0000000002000019000000000001042d00000f64002104230000000102000039000000000001042d0000000002000019000000000001042d00000f660000043200000f670001042e00000f680001043000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff55775574746572000000000000000000000000000000000000000000000000005577550000000000000000000000000000000000000000000000000000000000405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5acebfa87805ed57dc1f0d489ce33be4c4577d74ccde357eeeee058a32c55c44a532557755747465720000000000000000000000000000000000000000000000000ec2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b3da8a5f161a6c3ff06a60736d0ed24d7963cc6a5c4fafd2fa1dae9bb908e07a55577550000000000000000000000000000000000000000000000000000000006000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e00000000000000000000000000000000000000000000000000018838370f34000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000a0202030200000000000000000000000000000000000040000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffe6ffffffffffffffe70796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d955391320200000200000000000000000000000000000004000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef00000002000000000000000000000000000000400000010000000000000000002e0763000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000001e4fbdf70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000010000000000000000000000000000000000000000000000000000000000000000000000000075d5ae9e00000000000000000000000000000000000000000000000000000000c03afb5800000000000000000000000000000000000000000000000000000000e985e9c400000000000000000000000000000000000000000000000000000000f4a0a52700000000000000000000000000000000000000000000000000000000f4a0a52800000000000000000000000000000000000000000000000000000000f7073c3a00000000000000000000000000000000000000000000000000000000fd9d5fd000000000000000000000000000000000000000000000000000000000e985e9c500000000000000000000000000000000000000000000000000000000ef43281500000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000c87b56dc00000000000000000000000000000000000000000000000000000000c87b56dd00000000000000000000000000000000000000000000000000000000c973db0b00000000000000000000000000000000000000000000000000000000e086e5ec00000000000000000000000000000000000000000000000000000000c03afb5900000000000000000000000000000000000000000000000000000000c204642c0000000000000000000000000000000000000000000000000000000095d89b4000000000000000000000000000000000000000000000000000000000a22cb46400000000000000000000000000000000000000000000000000000000a22cb46500000000000000000000000000000000000000000000000000000000b88d4fde00000000000000000000000000000000000000000000000000000000bef97c870000000000000000000000000000000000000000000000000000000095d89b410000000000000000000000000000000000000000000000000000000097e8d38500000000000000000000000000000000000000000000000000000000a15e9c3c000000000000000000000000000000000000000000000000000000007bb23e39000000000000000000000000000000000000000000000000000000007bb23e3a0000000000000000000000000000000000000000000000000000000085cb593b000000000000000000000000000000000000000000000000000000008da5cb5b0000000000000000000000000000000000000000000000000000000075d5ae9f0000000000000000000000000000000000000000000000000000000075dadb320000000000000000000000000000000000000000000000000000000023b872dc0000000000000000000000000000000000000000000000000000000045fac1d20000000000000000000000000000000000000000000000000000000070a082300000000000000000000000000000000000000000000000000000000070a0823100000000000000000000000000000000000000000000000000000000715018a6000000000000000000000000000000000000000000000000000000007515ab680000000000000000000000000000000000000000000000000000000045fac1d30000000000000000000000000000000000000000000000000000000054c06aee000000000000000000000000000000000000000000000000000000006352211e0000000000000000000000000000000000000000000000000000000026cca8a70000000000000000000000000000000000000000000000000000000026cca8a80000000000000000000000000000000000000000000000000000000032cb6b0c0000000000000000000000000000000000000000000000000000000042842e0e0000000000000000000000000000000000000000000000000000000023b872dd0000000000000000000000000000000000000000000000000000000026b9ce1300000000000000000000000000000000000000000000000000000000081812fb000000000000000000000000000000000000000000000000000000001138ebad000000000000000000000000000000000000000000000000000000001138ebae0000000000000000000000000000000000000000000000000000000018160ddd000000000000000000000000000000000000000000000000000000001ca53dbe00000000000000000000000000000000000000000000000000000000081812fc00000000000000000000000000000000000000000000000000000000095ea7b3000000000000000000000000000000000000000000000000000000000a302530000000000000000000000000000000000000000000000000000000000271662f000000000000000000000000000000000000000000000000000000000271663000000000000000000000000000000000000000000000000000000000055ad42e0000000000000000000000000000000000000000000000000000000006fdde03000000000000000000000000000000000000000000000000000000000124c34e0000000000000000000000000000000000000000000000000000000001ffc9a700000000000000000000000000000000000000200000008000000000000000001b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae672118cdaa70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000008000000000000000000200000000000000000000000000000000000020000000800000000000000000702ec30635253cae6d3600d38314e616495cf01545d34e549c49ebf6451dab3b00000000000000000000000000000000000000200000000000000000000000009cc7f708afc65944829bd487b90b72536b1951864fbfc14e125fc972a6507f39020000020000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000000000000b12d13eb00000000000000000000000000000000000000040000001c000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000000000000000000000000000000000000000004ee2d6d415b85acef810000000000000000000000000000000000000000000004ee2d6d415b85acef80ffffffff000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000000000000000000000000000ffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff30313233343536373839616263646566000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000008d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802a14c4b500000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001b562e8dd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000080000000000000000043616e6e6f742061697264726f7020746f207a65726f2061646472657373000008c379a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000546f6f206d616e7920726563697069656e74730000000000000000000000000000000000000000000000000000000000000000640000008000000000000000002757d185fc153b2591e9d55b19b9e625d6c548ff923105c32ac05fd515ffaa13000000000000000000000000000000000000000000000000ffffffffffffff7f020000000000000000000000000000000000002000000000000000000000000017307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c317bf21fee000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000000000000000000000000000000000000000000ffffffffffffffbfffffffffffffff0f00000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427372eef71ef43483d822203fd126296c5f8bfc62fd930b15bdbf4bf082a7e537fee497b8238be5e4f32f72d877ba0627e627848cb8a6504aa01d21a347d565198e8f4eb60400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fffffffffffffff09a36fd9c00000000000000000000000000000000000000000000000000000000ffffffffffff0fff000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000d05cb60900000000000000000000000000000000000000000000000000000000cfb3b942000000000000000000000000000000000000000000000000000000008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925df2d9b4200000000000000000000000000000000000000000000000000000000cf4700e4000000000000000000000000000000000000000000000000000000004e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000100000000000000000027b15500000000000000000000000000000000000000000000000000000000e47ec07400000000000000000000000000000000000000000000000000000000d2ade55600000000000000000000000000000000000000000000000000000000fffffffffffff0ff0000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000f560625a00000000000000000000000000000000000000000000000000000000873ac7e80000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000001ffc9a7000000000000000000000000000000000000000000000000000000005b5e139f0000000000000000000000000000000000000000000000000000000080ac58cd00000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000ffffffffffffffe07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa11481000000000000000000000000000000000000000000000000000000000059c896be00000000000000000000000000000000000000000000000000000000ea553b34000000000000000000000000000000000000000000000000000000001806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b83150b7a020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000003ffffffe000000000000000000000000000000000000000000000000000000000ffffffe0d1a57ed600000000000000000000000000000000000000000000000000000000b987c73fb4ff2ff7bcf5545442a11fe64fab1a24754181644273fb7c437d3143
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.