ERC-721
Overview
Max Total Supply
512 CONCRETE
Holders
160
Market
Volume (24H)
0.155 ETH
Min Price (24H)
$101.21 @ 0.055000 ETH
Max Price (24H)
$184.02 @ 0.100000 ETH
Other Info
Token Contract
Balance
4 CONCRETELoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Concrete
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT /* ᴅɪɪᴅ ᴀɴᴅ ʜɪɢɢs ᴘʀᴇsᴇɴᴛ __ .----.-----.-----.----.----.-----.| |_.-----. | __| _ | | __| _| -__|| _| -__| |____|_____|__|__|____|__| |_____||____|_____| */ pragma solidity ^0.8.20; import "erc721a/contracts/ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "solady/src/utils/SSTORE2.sol"; import "solady/src/utils/Base64.sol"; import "./NeuralNetwork.sol"; contract Concrete is ERC721A, Ownable(msg.sender), NeuralNetwork { struct Token { uint128 input; string hash; address[] image; string title; string description; bool unrevealed; } string prefix = "https://firebasestorage.googleapis.com/v0/b/higgsdotart.firebasestorage.app/o/generated_artwork%252F"; string suffix = ".png?alt=media"; uint startingPrice = 0.25 ether; uint settlingPrice = 0.1 ether; uint startTime = 1740682800; uint maxSupply = 512; mapping(uint256 => Token) public tokens; mapping(uint128 => bool) public inputTaken; constructor() ERC721A("Concrete", "CONCRETE") {} /////////////////////////////// /////// HELPERS /////// /////////////////////////////// function getPrice() public view returns (uint) { if (!mintStarted()) { return startingPrice; } uint hrs = (block.timestamp - startTime) / 7200; uint price = startingPrice - (hrs * 0.0025 ether); if (price < settlingPrice) { price = settlingPrice; } return price; } function mintStarted() public view returns (bool) { return block.timestamp >= startTime; } function setStartTime(uint newStartTime) external onlyOwner { startTime = newStartTime; } /////////////////////////////// /////// PUBLIC /////// /////////////////////////////// function mint(uint128 input) external payable { uint256 tokenId = _nextTokenId(); if (input == 0) { unchecked { input = uint128( uint256( keccak256(abi.encodePacked(block.timestamp, tokenId)) ) ); } } require(tokenId <= maxSupply, "Max supply reached"); require(mintStarted() || msg.sender == owner(), "Mint not started"); require( msg.value == getPrice() || msg.sender == owner(), "Invalid price" ); require(!inputTaken[input], "Input already taken"); inputTaken[input] = true; tokens[tokenId].input = input; _mint(msg.sender, 1); } function setUnrevealed(uint256 tokenId, bool unrevealed) external { require(ownerOf(tokenId) == msg.sender, "Not the owner"); tokens[tokenId].unrevealed = unrevealed; } /////////////////////////////// /////// TOKEN URI /////// /////////////////////////////// function setImage(uint256 tokenId, bytes[] calldata image) internal { // loop through the image array, appending a new byte array // to the chunks. This is because the contract storage limit // is 24576 but we actually get much further than that before // running out of gas in the block. for (uint8 i = 0; i < image.length; i++) { tokens[tokenId].image.push(SSTORE2.write(image[i])); } } function updateToken( uint256 tokenId, bytes[] calldata image, string calldata title, string calldata description, string calldata hash ) external onlyOwner { if (image.length > 0) { delete tokens[tokenId].image; setImage(tokenId, image); } if (bytes(title).length > 0) { tokens[tokenId].title = title; } if (bytes(description).length > 0) { tokens[tokenId].description = description; } if (bytes(hash).length != 32) { tokens[tokenId].hash = hash; } } function wrap( string memory imageUri, string memory mimetype ) internal pure returns (string memory) { return string( abi.encodePacked( '<svg viewBox="0 0 800 1200" width="800" height="1200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style>image {image-rendering: optimizeSpeed;image-rendering: -moz-crisp-edges;image-rendering: -o-crisp-edges;image-rendering: -webkit-optimize-contrast;image-rendering: optimize-contrast;image-rendering: crisp-edges;image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor;}</style></defs><image width="800px" height="1200px" href="data:image/', mimetype, ";base64,", imageUri, '" /><foreignObject width="800px" height="1200px"><div xmlns="http://www.w3.org/1999/xhtml" style="width:800px; height:1200px;"><img style="width:800px; height:1200px; image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; -ms-interpolation-mode: nearest-neighbor;" src="data:image/', mimetype, ";base64,", imageUri, '" /></div></foreignObject></svg>' ) ); } function render(uint128 input) internal view returns (bytes memory) { uint8[288] memory output = inference(input); bytes memory bmp = new bytes(0x344); // BMP Header bmp[0] = 0x42; // B bmp[1] = 0x4D; // M bmp[2] = 0x58; bmp[3] = 0x01; bmp[10] = 0x36; // Pixel array offset // DIB Header bmp[14] = 0x28; // DIB header size bmp[18] = 0x08; // Width: 8px bmp[22] = 0xF4; // Height: 12px bmp[23] = 0xFF; bmp[24] = 0xFF; bmp[25] = 0xFF; bmp[26] = 0x01; // Color planes bmp[28] = 0x18; // Bits per pixel (24) for (uint256 i = 0; i < 12; i++) { for (uint256 j = 0; j < 8; j++) { uint x = (i * 8 + j) * 3; bmp[0x36 + x] = bytes1(output[x + 2]); bmp[0x36 + x + 1] = bytes1(output[x + 1]); bmp[0x36 + x + 2] = bytes1(output[x]); } } return bmp; } function fingerprintSvg(uint128 input) public view returns (string memory) { return wrap(Base64.encode(render(input)), "bmp"); } function fingerprintUri(uint128 input) public view returns (string memory) { return string( abi.encodePacked( "data:image/svg+xml;base64,", Base64.encode(bytes(fingerprintSvg(input))) ) ); } function loadRawImage( uint256 tokenId ) internal view returns (bytes memory) { bytes memory data; for (uint8 i = 0; i < tokens[tokenId].image.length; i++) { data = abi.encodePacked( data, SSTORE2.read(tokens[tokenId].image[i]) ); } return data; } function loadImage(uint256 tokenId) internal view returns (string memory) { bytes memory data = loadRawImage(tokenId); return string( abi.encodePacked( "data:image/svg+xml;base64,", Base64.encode(bytes(wrap(Base64.encode(data), "png"))) ) ); } function getTokenImageUri( uint256 tokenId ) internal view returns (string memory) { if ( (tokens[tokenId].image.length == 0 && bytes(tokens[tokenId].hash).length == 0) || tokens[tokenId].unrevealed ) { return fingerprintUri(tokens[tokenId].input); } if (tokens[tokenId].image.length > 0) { return loadImage(tokenId); } return string(abi.encodePacked(prefix, tokens[tokenId].hash, suffix)); } function getTitle(uint256 tokenId) internal view returns (string memory) { if (bytes(tokens[tokenId].title).length > 0) { return tokens[tokenId].title; } return string(abi.encodePacked("Concrete #", Strings.toString(tokenId))); } function getDescription( uint256 tokenId ) internal view returns (string memory) { if (bytes(tokens[tokenId].description).length > 0) { return tokens[tokenId].description; } return ""; } function tokenURI( uint256 tokenId ) public view override returns (string memory) { return string( abi.encodePacked( 'data:application/json;utf8,{"image":"', getTokenImageUri(tokenId), '","name":"', getTitle(tokenId), '","description":"', getDescription(tokenId), '"}' ) ); } /////////////////////////////// /////// OWNER ONLY /////// /////////////////////////////// function setWeights( bytes calldata weights, uint256 index ) public onlyOwner { _setWeights(weights, index); } function withdraw() external onlyOwner { (bool s, ) = owner().call{value: (address(this).balance)}(""); require(s, "Withdraw failed."); } function _startTokenId() internal view virtual override returns (uint256) { return 1; } }
// 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.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); 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 overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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 division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds 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. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = 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^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 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^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @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; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @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; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @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.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { 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 Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), 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 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)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "solady/src/utils/SSTORE2.sol"; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * _______ .__ * * \ \ ____ __ ______________ | | * * / | \_/ __ \| | \_ __ \__ \ | | * * / | \ ___/| | /| | \// __ \| |__ * * \_______ /\___ |____/ |__| (____ |____/__ * * \ \/ _____/ |___ _ _____________| | __ * * / | \_/ __ \ __\ \/ \/ / _ \_ __ | |/ / * * / | \ ___/| | \ ( <_> | | \| < * * \____|__ /\___ |__| \/\_/ \____/|__| |__|_ \ * * \/ \/ \/ * * GAN-based neural network for image generation. * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* This contract implements a neural network for inference using fixed‐point math. Fixed point numbers are stored as int16 with 1 sign bit, 3 bits for the whole part, and 12 bits for the fractional part. That is, any number X is represented as X_int = X * 4096. All multiplications use a helper that divides by 4096 to "undo" the extra scaling. The network (in TensorFlow) is: noise = Input(shape=(16,)) x = Dense(3*2*256*3, use_bias=False)(noise) // output size: 4608 (=3*2*256*3) x = Reshape((6, 4, 192))(x) // 6*4*192 = 4608 x = BatchNormalization()(x) x = ReLU()(x) x = Conv2DTranspose(3, (3, 3), strides=(2, 2), // upsamples to (12, 8, 3) padding='same', use_bias=False, activation='tanh')(x) */ contract NeuralNetwork { // Scale factor for fixed-point arithmetic (2^12 = 4096) int constant SCALE = 4096; ////////////////////////////////////////////////////// // Fixed Point Math Helpers // ////////////////////////////////////////////////////// /// @notice Multiply two fixed-point numbers and scale back down. /// @param a Fixed-point operand. /// @param b Fixed-point operand. /// @return The product (in fixed point). function fixedMul(int a, int b) internal pure returns (int) { // Multiply and then divide by SCALE to account for the fixed-point representation. return (a * b) / SCALE; } /// @notice Divide two fixed-point numbers. /// @param a Numerator (in fixed point). /// @param b Denominator (in fixed point). /// @return The quotient (in fixed point). function fixedDiv(int a, int b) internal pure returns (int) { // Multiply numerator by SCALE then divide by denominator. return (a * SCALE) / b; } /// @notice Compute square root using the Babylonian method with convergence checking. /// @param x A fixed-point number (scaled by 4096). /// @return The fixed-point square root of x. function fixedSqrt(int x) internal pure returns (int) { // Handle non-positive input. if (x <= 0) { return 0; } int result = x; // Perform up to 20 iterations for increased accuracy. for (uint i = 0; i < 20; i++) { int newResult = (result + fixedDiv(x, result)) / 2; // If the difference is less than 1 (i.e. less than 1/4096 in real value), we've converged. if (abs(newResult - result) < 1) { return newResult; } result = newResult; } return result; } /// @notice Returns the absolute value of an integer. function abs(int a) internal pure returns (int) { return a >= 0 ? a : -a; } /// @notice Compute fixed-point tanh using a rational approximation. /// tanh(x) ≈ x * (27·SCALE + x²) / (27·SCALE + 9·x²) /// This approximation provides a smoother transition and reduces premature saturation. /// @param x The fixed-point input (int16). /// @return The fixed-point tanh of x. function tanhFixed(int16 x) internal pure returns (int16) { // Convert input to 256-bit for intermediate precision. int256 x256 = int256(x); // Compute x^2 in fixed-point: (x*x)/SCALE. int256 x2 = (x256 * x256) / SCALE; // Compute numerator: x * (27*SCALE + x2) int256 numerator = x256 * (27 * SCALE + x2); // Compute denominator: 27*SCALE + 9*x2. int256 denominator = 27 * SCALE + 9 * x2; // If denominator is 0 (shouldn't happen for reasonable x), return 0. if (denominator == 0) return 0; int256 result = numerator / denominator; // Optionally, saturate the output to the range [-SCALE, SCALE]. if (result > SCALE) result = SCALE; if (result < -SCALE) result = -SCALE; return int16(result); } ////////////////////////////////////////////////////// // Neural Network Layers // ////////////////////////////////////////////////////// /* Dense Layer: Performs a fully-connected layer without bias. In our network, the dense layer takes an input vector of size 16 and outputs 4608 numbers. The weights are stored in a flat array of length 16 * 4608. When indexing the weight matrix, we use the formula: weight[i, j] is stored at index (i * out_features + j). */ function dense( int16[16] memory input, int16[] memory weights, uint out_features ) internal pure returns (int16[] memory) { // Create an output vector of length 'out_features'. int16[] memory output = new int16[](out_features); // For each output neuron: for (uint j = 0; j < out_features; j++) { int acc = 0; // Accumulator for the weighted sum. // For each input feature: for (uint i = 0; i < 16; i++) { // The weight for (i, j) is at index: i * out_features + j. acc += fixedMul(input[i], weights[i * out_features + j]); } // Cast the accumulated sum back to int16. output[j] = int16(acc); } return output; } /* Reshape: In TensorFlow, a Reshape layer changes the shape of the data. Here, we simply reinterpret the flat dense output (length 4608) as a tensor of shape (6, 4, 192). No computation is needed; we just keep track of the dimensions. */ /* Batch Normalization (per-channel): Applies the transformation: x_norm = (x - mean) / sqrt(variance + epsilon) output = x_norm * gamma + beta Here, the normalization parameters are provided per channel (e.g., length 192). Given a flattened tensor with shape (height, width, channels), the channel index is computed as: channel = index % channels */ function batchNormalization( int16[] memory input, int16[] memory mean, int16[] memory variance, int16[] memory gamma, int16[] memory beta, int16 epsilon, uint in_channels ) internal pure returns (int16[] memory) { uint len = input.length; int16[] memory output = new int16[](len); uint spacial = len / in_channels; for (uint i = 0; i < spacial; i++) { for (uint j = 0; j < in_channels; j++) { uint index = i * in_channels + j; // Convert all values to int and ensure proper fixed-point scaling int x = int(input[index]); int m = int(mean[j]); int v = int(variance[j]); int g = int(gamma[j]); int b = int(beta[j]); // Subtract mean (both x and mean are already scaled by SCALE) int diff = x - m; // Calculate denominator: sqrt(variance + epsilon) int sqrtVal = fixedSqrt(v + int(epsilon)); // Normalize: (x - mean) / sqrt(variance + epsilon) // Since diff is scaled by SCALE, and sqrtVal is scaled by SCALE, // we need one fixedDiv here to maintain proper scaling int normalized = fixedDiv(diff, sqrtVal); // Apply gamma and beta: gamma * normalized + beta // gamma and normalized are both scaled, so use fixedMul int scaled = fixedMul(normalized, g) + b; output[index] = int16(scaled); } } return output; } /* ReLU Activation: Applies the ReLU function element-wise: ReLU(x) = max(0, x). */ function relu(int16[] memory input) internal pure returns (int16[] memory) { uint len = input.length; int16[] memory output = new int16[](len); for (uint i = 0; i < len; i++) { if (input[i] < 0) { output[i] = 0; } else { output[i] = input[i]; } } return output; } /* Conv2DTranspose (Deconvolution) Layer: This layer upsamples the input tensor. Our input is a tensor of shape (6, 4, 192) (flattened) and the layer uses a kernel of size (3, 3) with 'same' padding and strides (2, 2) to produce an output tensor of shape (12, 8, 3). The weights are stored in a flat array with shape: (kernel_height, kernel_width, out_channels, in_channels) with the index computed as: index = (((kh * kernel_width) + kw) * out_channels + oc) * in_channels + c. We then add each contribution from the input feature map (properly upsampled) to the output. Finally, we apply the tanh activation element-wise. */ function conv2dTranspose( int16[] memory input, uint in_height, uint in_width, uint in_channels, int16[] memory weights, uint kernel_height, uint kernel_width, uint out_channels, uint stride_height, uint stride_width ) internal pure returns (int16[] memory) { // Calculate the output spatial dimensions. uint out_height = in_height * stride_height; uint out_width = in_width * stride_width; // Initialize the output tensor with zeros (flattened). int16[] memory output = new int16[]( out_height * out_width * out_channels ); // For each spatial position and channel in the input: for (uint h = 0; h < in_height; h++) { for (uint w = 0; w < in_width; w++) { for (uint c = 0; c < in_channels; c++) { uint inputIndex = (h * in_width + w) * in_channels + c; int16 inputValue = input[inputIndex]; // Calculate the output position where this input contributes uint out_h_start = h * stride_height; uint out_w_start = w * stride_width; // Loop over each element in the kernel for (uint kh = 0; kh < kernel_height; kh++) { for (uint kw = 0; kw < kernel_width; kw++) { // Calculate output position including kernel offset uint out_h = out_h_start + kh; uint out_w = out_w_start + kw; // Check if output position is valid if (out_h < out_height && out_w < out_width) { for (uint oc = 0; oc < out_channels; oc++) { // Weight index calculation remains the same uint weightIndex = (((kh * kernel_width) + kw) * out_channels + oc) * in_channels + c; int16 weightVal = weights[weightIndex]; int prod = fixedMul(inputValue, weightVal); uint outputIndex = (out_h * out_width + out_w) * out_channels + oc; output[outputIndex] += int16(prod); } } } } } } } // After the convolution, apply tanh activation to every output element. for (uint i = 0; i < output.length; i++) { output[i] = tanhFixed(output[i]); } return output; } function _setWeights(bytes calldata weights, uint256 index) internal { if (index <= 8) { denseWeightsPointers[index] = SSTORE2.write(weights); } if (index == 9) { bnGammaPointer = SSTORE2.write(weights); } if (index == 10) { bnMeanPointer = SSTORE2.write(weights); } if (index == 11) { bnBetaPointer = SSTORE2.write(weights); } if (index == 12) { bnVariancePointer = SSTORE2.write(weights); } if (index == 13) { convWeightsPointer = SSTORE2.write(weights); } } function getWeights( address pointer ) internal view returns (int16[] memory) { bytes memory weightsBytes = SSTORE2.read(pointer); int16[] memory weights = new int16[](weightsBytes.length / 2); for (uint256 i = 0; i < weightsBytes.length; i += 2) { weights[i / 2] = int16( (uint16(uint8(weightsBytes[i])) << 8) | uint16(uint8(weightsBytes[i + 1])) ); } return weights; } function combineWeights( address[8] memory pointers ) internal view returns (int16[] memory) { uint256 i = 0; int16[] memory weights = new int16[](73728); for (uint256 j = 0; j < pointers.length; j++) { int16[] memory weights1 = getWeights(pointers[j]); for (uint256 k = 0; k < weights1.length; k++) { weights[i] = weights1[k]; i++; } } return weights; } function getInput( uint128 seed ) internal pure returns (int16[16] memory inp) { int16[16] memory input; for (uint256 i = 1; i <= 16; i++) { int16 val = int16(uint16((seed >> ((16 - i) * 8)) & 0xff)); input[i - 1] = (val - 128) * 64; } return input; } ////////////////////////////////////////////////////// // Inference Function // ////////////////////////////////////////////////////// /* The main inference function that runs the neural network. It takes a uint128 seed (expressed as 16 concatenated unsigned bytes, creates a noise vector of 16 fixed-point numbers as input and returns a flattened output tensor representing an image of shape (12, 8, 3). */ function inference( uint128 seed ) internal view returns (uint8[288] memory output) { int16[16] memory noise = getInput(seed); // Dense layer weights: shape (16, 4608) flattened. int16[] memory denseWeights = combineWeights(denseWeightsPointers); // Conv2DTranspose kernel weights: shape (3, 3, 3, 192) flattened. int16[] memory convWeights = getWeights(convWeightsPointer); // Batch normalization parameters: each is an array of length 192. int16[] memory bnMean = getWeights(bnMeanPointer); int16[] memory bnVariance = getWeights(bnVariancePointer); int16[] memory bnGamma = getWeights(bnGammaPointer); int16[] memory bnBeta = getWeights(bnBetaPointer); // --- 1. Dense Layer --- // Multiply the noise vector by the dense layer weights to obtain 4608 outputs. // denseWeights is assumed to be a flat array of size 16 * 4608. int16[] memory denseOut = dense(noise, denseWeights, 4608); // --- 2. Reshape --- // The dense output is reinterpreted as a tensor of shape (6, 4, 192). // Since our data is stored flat, no data movement is necessary. uint resHeight = 6; uint resWidth = 4; uint resChannels = 192; // --- 3. Batch Normalization --- // Normalize the activations using pre-computed parameters. int16[] memory bnOut = batchNormalization( denseOut, bnMean, bnVariance, bnGamma, bnBeta, bnEpsilon, resChannels ); // --- 4. ReLU Activation --- // Apply ReLU to introduce non-linearity. int16[] memory reluOut = relu(bnOut); // --- 5. Conv2DTranspose --- // Use a transposed convolution to upsample the feature map. // The layer uses a 3x3 kernel, stride (2,2), and produces an output of shape (12, 8, 3). uint inHeight = resHeight; uint inWidth = resWidth; uint inChannels = resChannels; uint kernelHeight = 3; uint kernelWidth = 3; uint outChannels = 3; uint strideHeight = 2; uint strideWidth = 2; int16[] memory convOut = conv2dTranspose( reluOut, inHeight, inWidth, inChannels, convWeights, kernelHeight, kernelWidth, outChannels, strideHeight, strideWidth ); // --- 6. Convert to RGB --- // Convert the output tensor to a flattened RGB image through a simple scale and clamp. for (uint i = 0; i < convOut.length; i++) { unchecked { int16 x = convOut[i]; int16 xFloat = x / 32; int16 val = xFloat + 128; if (val < 0) val = 0; if (val > 255) val = 255; output[i] = uint8(uint16(val)); } } // Return the final output (flattened tensor representing the image). return output; } ////////////////////////////////////////////////////// // Storage Variables for Weights/Parameters // ////////////////////////////////////////////////////// address[8] internal denseWeightsPointers; address internal bnGammaPointer; address internal bnMeanPointer; address internal bnBetaPointer; address internal bnVariancePointer; address internal convWeightsPointer; // A small constant to avoid division by zero in batch normalization. // Set as close as possible to the keras default. int16 internal bnEpsilon = 3; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * The `_sequentialUpTo()` function can be overriden to enable spot mints * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // The amount of tokens minted above `_sequentialUpTo()`. // We call these spot mints (i.e. non-sequential mints). uint256 private _spotMinted; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID for sequential mints. * * Override this function to change the starting token ID for sequential mints. * * Note: The value returned must never change after any tokens have been minted. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the maximum token ID (inclusive) for sequential mints. * * Override this function to return a value less than 2**256 - 1, * but greater than `_startTokenId()`, to enable spot (non-sequential) mints. * * Note: The value returned must never change after any tokens have been minted. */ function _sequentialUpTo() internal view virtual returns (uint256) { return type(uint256).max; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256 result) { // Counter underflow is impossible as `_burnCounter` cannot be incremented // more than `_currentIndex + _spotMinted - _startTokenId()` times. unchecked { // With spot minting, the intermediate `result` can be temporarily negative, // and the computation must be unchecked. result = _currentIndex - _burnCounter - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256 result) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { result = _currentIndex - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } /** * @dev Returns the total number of tokens that are spot-minted. */ function _totalSpotMinted() internal view virtual returns (uint256) { return _spotMinted; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Returns whether the ownership slot at `index` is initialized. * An uninitialized slot does not necessarily mean that the slot has no owner. */ function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) { return _packedOwnerships[index] != 0; } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * @dev Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = _packedOwnerships[tokenId]; if (tokenId > _sequentialUpTo()) { if (_packedOwnershipExists(packed)) return packed; _revert(OwnerQueryForNonexistentToken.selector); } // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = _packedOwnerships[--tokenId]; } if (packed == 0) continue; if (packed & _BITMASK_BURNED == 0) return packed; // Otherwise, the token is burned, and we must revert. // This handles the case of batch burned tokens, where only the burned bit // of the starting slot is set, and remaining slots are left uninitialized. _revert(OwnerQueryForNonexistentToken.selector); } } // Otherwise, the data exists and we can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. // If the token is not burned, return `packed`. Otherwise, revert. if (packed & _BITMASK_BURNED == 0) return packed; } _revert(OwnerQueryForNonexistentToken.selector); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool result) { if (_startTokenId() <= tokenId) { if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]); if (tokenId < _currentIndex) { uint256 packed; while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId; result = packed & _BITMASK_BURNED == 0; } } } /** * @dev Returns whether `packed` represents a token that exists. */ function _packedOwnershipExists(uint256 packed) private pure returns (bool result) { assembly { // The following is equivalent to `owner != address(0) && burned == false`. // Symbolically tested. result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED)) } } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS)); if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. from, // `from`. toMasked, // `to`. tokenId // `tokenId`. ) } if (toMasked == 0) _revert(TransferToZeroAddress.selector); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC721ReceiverImplementer.selector); } assembly { revert(add(32, reason), mload(reason)) } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) _revert(MintZeroQuantity.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); uint256 end = startTokenId + quantity; uint256 tokenId = startTokenId; if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); do { assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } // The `!=` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. } while (++tokenId != end); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) _revert(MintToZeroAddress.selector); if (quantity == 0) _revert(MintZeroQuantity.selector); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } while (index < end); // This prevents reentrancy to `_safeMint`. // It does not prevent reentrancy to `_safeMintSpot`. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } /** * @dev Mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * Emits a {Transfer} event for each mint. */ function _mintSpot(address to, uint256 tokenId) internal virtual { if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector); uint256 prevOwnershipPacked = _packedOwnerships[tokenId]; if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector); _beforeTokenTransfers(address(0), to, tokenId, 1); // Overflows are incredibly unrealistic. // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1. // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `true` (as `quantity == 1`). _packedOwnerships[tokenId] = _packOwnershipData( to, _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked) ); // Updates: // - `balance += 1`. // - `numberMinted += 1`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1; // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } ++_spotMinted; } _afterTokenTransfers(address(0), to, tokenId, 1); } /** * @dev Safely mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * See {_mintSpot}. * * Emits a {Transfer} event. */ function _safeMintSpot( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mintSpot(to, tokenId); unchecked { if (to.code.length != 0) { uint256 currentSpotMinted = _spotMinted; if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } // This prevents reentrancy to `_safeMintSpot`. // It does not prevent reentrancy to `_safeMint`. if (_spotMinted != currentSpotMinted) revert(); } } } /** * @dev Equivalent to `_safeMintSpot(to, tokenId, '')`. */ function _safeMintSpot(address to, uint256 tokenId) internal virtual { _safeMintSpot(to, tokenId, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck && _msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { _revert(ApprovalCallerNotOwnerNorApproved.selector); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); /** * `_sequentialUpTo()` must be greater than `_startTokenId()`. */ error SequentialUpToTooSmall(); /** * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`. */ error SequentialMintExceedsLimit(); /** * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`. */ error SpotMintTokenIdTooSmall(); /** * Cannot mint over a token that already exists. */ error TokenAlreadyExists(); /** * The feature is not compatible with spot mints. */ error NotCompatibleWithSpotMints(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library to encode strings in Base64. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol) /// @author Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos - <[email protected]>. library Base64 { /// @dev Encodes `data` using the base64 encoding described in RFC 4648. /// See: https://datatracker.ietf.org/doc/html/rfc4648 /// @param fileSafe Whether to replace '+' with '-' and '/' with '_'. /// @param noPadding Whether to strip away the padding. function encode(bytes memory data, bool fileSafe, bool noPadding) internal pure returns (string memory result) { /// @solidity memory-safe-assembly assembly { let dataLength := mload(data) if dataLength { // Multiply by 4/3 rounded up. // The `shl(2, ...)` is equivalent to multiplying by 4. let encodedLength := shl(2, div(add(dataLength, 2), 3)) // Set `result` to point to the start of the free memory. result := mload(0x40) // Store the table into the scratch space. // Offsetted by -1 byte so that the `mload` will load the character. // We will rewrite the free memory pointer at `0x40` later with // the allocated size. // The magic constant 0x0670 will turn "-_" into "+/". mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef") mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670))) // Skip the first slot, which stores the length. let ptr := add(result, 0x20) let end := add(ptr, encodedLength) let dataEnd := add(add(0x20, data), dataLength) let dataEndValue := mload(dataEnd) // Cache the value at the `dataEnd` slot. mstore(dataEnd, 0x00) // Zeroize the `dataEnd` slot to clear dirty bits. // Run over the input, 3 bytes at a time. for {} 1 {} { data := add(data, 3) // Advance 3 bytes. let input := mload(data) // Write 4 bytes. Optimized for fewer stack operations. mstore8(0, mload(and(shr(18, input), 0x3F))) mstore8(1, mload(and(shr(12, input), 0x3F))) mstore8(2, mload(and(shr(6, input), 0x3F))) mstore8(3, mload(and(input, 0x3F))) mstore(ptr, mload(0x00)) ptr := add(ptr, 4) // Advance 4 bytes. if iszero(lt(ptr, end)) { break } } mstore(dataEnd, dataEndValue) // Restore the cached value at `dataEnd`. mstore(0x40, add(end, 0x20)) // Allocate the memory. // Equivalent to `o = [0, 2, 1][dataLength % 3]`. let o := div(2, mod(dataLength, 3)) // Offset `ptr` and pad with '='. We can simply write over the end. mstore(sub(ptr, o), shl(240, 0x3d3d)) // Set `o` to zero if there is padding. o := mul(iszero(iszero(noPadding)), o) mstore(sub(ptr, o), 0) // Zeroize the slot after the string. mstore(result, sub(encodedLength, o)) // Store the length. } } } /// @dev Encodes `data` using the base64 encoding described in RFC 4648. /// Equivalent to `encode(data, false, false)`. function encode(bytes memory data) internal pure returns (string memory result) { result = encode(data, false, false); } /// @dev Encodes `data` using the base64 encoding described in RFC 4648. /// Equivalent to `encode(data, fileSafe, false)`. function encode(bytes memory data, bool fileSafe) internal pure returns (string memory result) { result = encode(data, fileSafe, false); } /// @dev Decodes base64 encoded `data`. /// /// Supports: /// - RFC 4648 (both standard and file-safe mode). /// - RFC 3501 (63: ','). /// /// Does not support: /// - Line breaks. /// /// Note: For performance reasons, /// this function will NOT revert on invalid `data` inputs. /// Outputs for invalid inputs will simply be undefined behaviour. /// It is the user's responsibility to ensure that the `data` /// is a valid base64 encoded string. function decode(string memory data) internal pure returns (bytes memory result) { /// @solidity memory-safe-assembly assembly { let dataLength := mload(data) if dataLength { let decodedLength := mul(shr(2, dataLength), 3) for {} 1 {} { // If padded. if iszero(and(dataLength, 3)) { let t := xor(mload(add(data, dataLength)), 0x3d3d) // forgefmt: disable-next-item decodedLength := sub( decodedLength, add(iszero(byte(30, t)), iszero(byte(31, t))) ) break } // If non-padded. decodedLength := add(decodedLength, sub(and(dataLength, 3), 1)) break } result := mload(0x40) // Write the length of the bytes. mstore(result, decodedLength) // Skip the first slot, which stores the length. let ptr := add(result, 0x20) let end := add(ptr, decodedLength) // Load the table into the scratch space. // Constants are optimized for smaller bytecode with zero gas overhead. // `m` also doubles as the mask of the upper 6 bits. let m := 0xfc000000fc00686c7074787c8084888c9094989ca0a4a8acb0b4b8bcc0c4c8cc mstore(0x5b, m) mstore(0x3b, 0x04080c1014181c2024282c3034383c4044484c5054585c6064) mstore(0x1a, 0xf8fcf800fcd0d4d8dce0e4e8ecf0f4) for {} 1 {} { // Read 4 bytes. data := add(data, 4) let input := mload(data) // Write 3 bytes. // forgefmt: disable-next-item mstore(ptr, or( and(m, mload(byte(28, input))), shr(6, or( and(m, mload(byte(29, input))), shr(6, or( and(m, mload(byte(30, input))), shr(6, mload(byte(31, input))) )) )) )) ptr := add(ptr, 3) if iszero(lt(ptr, end)) { break } } mstore(0x40, add(end, 0x20)) // Allocate the memory. mstore(end, 0) // Zeroize the slot after the bytes. mstore(0x60, 0) // Restore the zero slot. } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Read and write to persistent storage at a fraction of the cost. /// @author Solady (https://github.com/vectorized/solmady/blob/main/src/utils/SSTORE2.sol) /// @author Saw-mon-and-Natalie (https://github.com/Saw-mon-and-Natalie) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SSTORE2.sol) /// @author Modified from 0xSequence (https://github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol) library SSTORE2 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev We skip the first byte as it's a STOP opcode, /// which ensures the contract can't be called. uint256 internal constant DATA_OFFSET = 1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Unable to deploy the storage contract. error DeploymentFailed(); /// @dev The storage contract address is invalid. error InvalidPointer(); /// @dev Attempt to read outside of the storage contract's bytecode bounds. error ReadOutOfBounds(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* WRITE LOGIC */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Writes `data` into the bytecode of a storage contract and returns its address. function write(bytes memory data) internal returns (address pointer) { /// @solidity memory-safe-assembly assembly { let originalDataLength := mload(data) // Add 1 to data size since we are prefixing it with a STOP opcode. let dataSize := add(originalDataLength, DATA_OFFSET) /** * ------------------------------------------------------------------------------+ * Opcode | Mnemonic | Stack | Memory | * ------------------------------------------------------------------------------| * 61 dataSize | PUSH2 dataSize | dataSize | | * 80 | DUP1 | dataSize dataSize | | * 60 0xa | PUSH1 0xa | 0xa dataSize dataSize | | * 3D | RETURNDATASIZE | 0 0xa dataSize dataSize | | * 39 | CODECOPY | dataSize | [0..dataSize): code | * 3D | RETURNDATASIZE | 0 dataSize | [0..dataSize): code | * F3 | RETURN | | [0..dataSize): code | * 00 | STOP | | | * ------------------------------------------------------------------------------+ * @dev Prefix the bytecode with a STOP opcode to ensure it cannot be called. * Also PUSH2 is used since max contract size cap is 24,576 bytes which is less than 2 ** 16. */ mstore( // Do a out-of-gas revert if `dataSize` is more than 2 bytes. // The actual EVM limit may be smaller and may change over time. add(data, gt(dataSize, 0xffff)), // Left shift `dataSize` by 64 so that it lines up with the 0000 after PUSH2. or(0xfd61000080600a3d393df300, shl(0x40, dataSize)) ) // Deploy a new contract with the generated creation code. pointer := create(0, add(data, 0x15), add(dataSize, 0xa)) // If `pointer` is zero, revert. if iszero(pointer) { // Store the function selector of `DeploymentFailed()`. mstore(0x00, 0x30116425) // Revert with (offset, size). revert(0x1c, 0x04) } // Restore original length of the variable size `data`. mstore(data, originalDataLength) } } /// @dev Writes `data` into the bytecode of a storage contract with `salt` /// and returns its deterministic address. function writeDeterministic(bytes memory data, bytes32 salt) internal returns (address pointer) { /// @solidity memory-safe-assembly assembly { let originalDataLength := mload(data) let dataSize := add(originalDataLength, DATA_OFFSET) mstore( // Do a out-of-gas revert if `dataSize` is more than 2 bytes. // The actual EVM limit may be smaller and may change over time. add(data, gt(dataSize, 0xffff)), // Left shift `dataSize` by 64 so that it lines up with the 0000 after PUSH2. or(0xfd61000080600a3d393df300, shl(0x40, dataSize)) ) // Deploy a new contract with the generated creation code. pointer := create2(0, add(data, 0x15), add(dataSize, 0xa), salt) // If `pointer` is zero, revert. if iszero(pointer) { // Store the function selector of `DeploymentFailed()`. mstore(0x00, 0x30116425) // Revert with (offset, size). revert(0x1c, 0x04) } // Restore original length of the variable size `data`. mstore(data, originalDataLength) } } /// @dev Returns the initialization code hash of the storage contract for `data`. /// Used for mining vanity addresses with create2crunch. function initCodeHash(bytes memory data) internal pure returns (bytes32 hash) { /// @solidity memory-safe-assembly assembly { let originalDataLength := mload(data) let dataSize := add(originalDataLength, DATA_OFFSET) // Do a out-of-gas revert if `dataSize` is more than 2 bytes. // The actual EVM limit may be smaller and may change over time. returndatacopy(returndatasize(), returndatasize(), shr(16, dataSize)) mstore(data, or(0x61000080600a3d393df300, shl(0x40, dataSize))) hash := keccak256(add(data, 0x15), add(dataSize, 0xa)) // Restore original length of the variable size `data`. mstore(data, originalDataLength) } } /// @dev Returns the address of the storage contract for `data` /// deployed with `salt` by `deployer`. /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. function predictDeterministicAddress(bytes memory data, bytes32 salt, address deployer) internal pure returns (address predicted) { bytes32 hash = initCodeHash(data); /// @solidity memory-safe-assembly assembly { // Compute and store the bytecode hash. mstore8(0x00, 0xff) // Write the prefix. mstore(0x35, hash) mstore(0x01, shl(96, deployer)) mstore(0x15, salt) predicted := keccak256(0x00, 0x55) // Restore the part of the free memory pointer that has been overwritten. mstore(0x35, 0) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* READ LOGIC */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns all the `data` from the bytecode of the storage contract at `pointer`. function read(address pointer) internal view returns (bytes memory data) { /// @solidity memory-safe-assembly assembly { let pointerCodesize := extcodesize(pointer) if iszero(pointerCodesize) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } // Offset all indices by 1 to skip the STOP opcode. let size := sub(pointerCodesize, DATA_OFFSET) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. data := mload(0x40) mstore(0x40, add(data, and(add(size, 0x3f), 0xffe0))) mstore(data, size) mstore(add(add(data, 0x20), size), 0) // Zeroize the last slot. extcodecopy(pointer, add(data, 0x20), DATA_OFFSET, size) } } /// @dev Returns the `data` from the bytecode of the storage contract at `pointer`, /// from the byte at `start`, to the end of the data stored. function read(address pointer, uint256 start) internal view returns (bytes memory data) { /// @solidity memory-safe-assembly assembly { let pointerCodesize := extcodesize(pointer) if iszero(pointerCodesize) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } // If `!(pointer.code.size > start)`, reverts. // This also handles the case where `start + DATA_OFFSET` overflows. if iszero(gt(pointerCodesize, start)) { // Store the function selector of `ReadOutOfBounds()`. mstore(0x00, 0x84eb0dd1) // Revert with (offset, size). revert(0x1c, 0x04) } let size := sub(pointerCodesize, add(start, DATA_OFFSET)) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. data := mload(0x40) mstore(0x40, add(data, and(add(size, 0x3f), 0xffe0))) mstore(data, size) mstore(add(add(data, 0x20), size), 0) // Zeroize the last slot. extcodecopy(pointer, add(data, 0x20), add(start, DATA_OFFSET), size) } } /// @dev Returns the `data` from the bytecode of the storage contract at `pointer`, /// from the byte at `start`, to the byte at `end` (exclusive) of the data stored. function read(address pointer, uint256 start, uint256 end) internal view returns (bytes memory data) { /// @solidity memory-safe-assembly assembly { let pointerCodesize := extcodesize(pointer) if iszero(pointerCodesize) { // Store the function selector of `InvalidPointer()`. mstore(0x00, 0x11052bb4) // Revert with (offset, size). revert(0x1c, 0x04) } // If `!(pointer.code.size > end) || (start > end)`, revert. // This also handles the cases where // `end + DATA_OFFSET` or `start + DATA_OFFSET` overflows. if iszero( and( gt(pointerCodesize, end), // Within bounds. iszero(gt(start, end)) // Valid range. ) ) { // Store the function selector of `ReadOutOfBounds()`. mstore(0x00, 0x84eb0dd1) // Revert with (offset, size). revert(0x1c, 0x04) } let size := sub(end, start) // Get the pointer to the free memory and allocate // enough 32-byte words for the data and the length of the data, // then copy the code to the allocated memory. // Masking with 0xffe0 will suffice, since contract size is less than 16 bits. data := mload(0x40) mstore(0x40, add(data, and(add(size, 0x3f), 0xffe0))) mstore(data, size) mstore(add(add(data, 0x20), size), 0) // Zeroize the last slot. extcodecopy(pointer, add(data, 0x20), add(start, DATA_OFFSET), size) } } }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","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":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"input","type":"uint128"}],"name":"fingerprintSvg","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"input","type":"uint128"}],"name":"fingerprintUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"","type":"uint128"}],"name":"inputTaken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"input","type":"uint128"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintStarted","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":"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":"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":"newStartTime","type":"uint256"}],"name":"setStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"unrevealed","type":"bool"}],"name":"setUnrevealed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"weights","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"setWeights","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"uint128","name":"input","type":"uint128"},{"internalType":"string","name":"hash","type":"string"},{"internalType":"string","name":"title","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"bool","name":"unrevealed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes[]","name":"image","type":"bytes[]"},{"internalType":"string","name":"title","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"hash","type":"string"}],"name":"updateToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234620001f357620000146200020e565b602067436f6e637265746560c01b81830152620000306200020e565b67434f4e435245544560c01b82820152825190916001600160401b038211620001ed576200006b826200006560025462000232565b62000288565b80601f83116001146200015c57508190620000a49460009262000150575b50508160011b916000199060031b1c191617600255620004e7565b620000af6001600055565b33156200013757620000c133620005da565b6016805461ffff60a01b1916600360a01b179055620000df62000312565b620000e962000467565b620000fb6703782dace9d90000601955565b6200010d67016345785d8a0000601a55565b6200011b6367c0b630601b55565b62000127610200601c55565b604051613b379081620006248239f35b604051631e4fbdf760e01b815260006004820152602490fd5b01519050388062000089565b60026000529193601f1985167f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace936000905b828210620001d4575050916001939186620000a4979410620001ba575b505050811b01600255620004e7565b015160001960f88460031b161c19169055388080620001ab565b806001869782949787015181550196019401906200018e565b620001f8565b600080fd5b634e487b7160e01b600052604160045260246000fd5b60408051919082016001600160401b03811183821017620001ed5760405260088252565b90600182811c9216801562000264575b60208310146200024e57565b634e487b7160e01b600052602260045260246000fd5b91607f169162000242565b8181106200027b575050565b600081556001016200026f565b90601f821162000296575050565b620002c79160026000526020600020906020601f840160051c83019310620002c9575b601f0160051c01906200026f565b565b9091508190620002b9565b90601f8211620002e2575050565b620002c79160036000526020600020906020601f840160051c83019310620002c957601f0160051c01906200026f565b6200031f60175462000232565b601f811162000418575b5060c960179081556000527f68747470733a2f2f666972656261736573746f726167652e676f6f676c6561706000805160206200415b833981519152557f69732e636f6d2f76302f622f6869676773646f746172742e66697265626173657fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c16557f73746f726167652e6170702f6f2f67656e6572617465645f617274776f726b257fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c175563191a992360e11b7fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c1855565b60176000526200046090601f0160051c6000805160206200415b833981519152017fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c196200026f565b3862000329565b6200047460185462000232565b601f8111620004a5575b507f2e706e673f616c743d6d6564696100000000000000000000000000000000001c601855565b6018600052620004e090601f0160051c7fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e908101906200026f565b386200047e565b80519091906001600160401b038111620001ed5762000513816200050d60035462000232565b620002d4565b602080601f831160011462000552575081929360009262000546575b50508160011b916000199060031b1c191617600355565b0151905038806200052f565b6003600052601f198316949091907fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b926000905b878210620005c1575050836001959610620005a7575b505050811b01600355565b015160001960f88460031b161c191690553880806200059c565b8060018596829496860151815501950193019062000586565b600980546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a356fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a7146101e757806306fdde03146101e2578063081812fc146101dd578063095ea7b3146101d857806318160ddd146101d357806323b872dd146101ce578063276858c4146101c95780633ccfd60b146101c45780633e0a322d146101bf57806342842e0e146101ba5780634f64b2be146101b55780636352211e146101b057806369d3e20e146101ab5780636bd13045146101a657806370a08231146101a1578063715018a61461019c5780638da5cb5b1461019757806393ddc81e1461019257806395d89b411461018d57806398d5fdca14610188578063a22cb46514610183578063a9722cf31461017e578063b0970a1414610179578063b88d4fde14610174578063c87b56dd1461016f578063e985e9c51461016a578063ea1524df14610165578063ef18d6c4146101605763f2fde38b1461015b57600080fd5b6113e4565b6113cb565b61121d565b6111bb565b611079565b61101e565b610f9e565b610f7d565b610ee2565b610ebf565b610e18565b610de4565b610dbd565b610d61565b610ced565b610c50565b610a92565b610a41565b61099c565b6107e9565b6107c8565b610745565b61069c565b61065a565b6105fe565b610526565b61042e565b610349565b61021b565b7fffffffff0000000000000000000000000000000000000000000000000000000081160361021657565b600080fd5b346102165760203660031901126102165760207fffffffff0000000000000000000000000000000000000000000000000000000060043561025b816101ec565b167f01ffc9a70000000000000000000000000000000000000000000000000000000081149081156102c3575b8115610299575b506040519015158152f35b7f5b5e139f000000000000000000000000000000000000000000000000000000009150143861028e565b7f80ac58cd0000000000000000000000000000000000000000000000000000000081149150610287565b60005b8381106103005750506000910152565b81810151838201526020016102f0565b90602091610329815180928185528580860191016102ed565b601f01601f1916010190565b906020610346928181520190610310565b90565b346102165760008060031936011261042b57604051908060025461036c8161080c565b8085529160019180831690811561040157506001146103a6575b6103a285610396818703826108d4565b60405191829182610335565b0390f35b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106103e9575050508101602001610396826103a2610386565b805460208587018101919091529093019281016103ce565b8695506103a29693506020925061039694915060ff191682840152151560051b8201019293610386565b80fd5b34610216576020806003193601126102165760048035906000826001818111156104a1575b5050156104795750600052600681526001600160a01b0360406000205416604051908152f35b7fcf4700e4000000000000000000000000000000000000000000000000000000006000526000fd5b825482101561045357949392919081865b6104cc575b5050600160e01b919293945016153880610453565b8181528386526040812054925090826104f55780156104f0576000190190866104b2565b6114c7565b6104b7565b600435906001600160a01b038216820361021657565b602435906001600160a01b038216820361021657565b60403660031901126102165761053a6104fa565b6024356001600160a01b03918261055083613479565b168033036105a2575b600093838552600660205260408520921691826001600160a01b03198254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b80600052600760205260ff6105ce336040600020906001600160a01b0316600052602052604060002090565b5416610559577fcfb3b9420000000000000000000000000000000000000000000000000000000060005260046000fd5b34610216576000366003190112610216576000546001546040519103600019018152602090f35b6060906003190112610216576001600160a01b0390600435828116810361021657916024359081168103610216579060443590565b61066c61066636610625565b9161352a565b005b9181601f840112156102165782359167ffffffffffffffff8311610216576020838186019501011161021657565b346102165760a03660031901126102165760243567ffffffffffffffff808211610216573660238301121561021657816004013591818311610216573660248460051b8301011161021657604435828111610216576106ff90369060040161066e565b906064358481116102165761071890369060040161066e565b9290916084359586116102165761066c96610739602497369060040161066e565b979096016004356116de565b346102165760008060031936011261042b5761075f611483565b808080806001600160a01b036009541647905af161077b6129a9565b50156107845780f35b606460405162461bcd60e51b815260206004820152601060248201527f5769746864726177206661696c65642e000000000000000000000000000000006044820152fd5b34610216576020366003190112610216576107e1611483565b600435601b55005b61066c6107f536610625565b90604051926108038461085c565b600084526136cb565b90600182811c9216801561083c575b602083101461082657565b634e487b7160e01b600052602260045260246000fd5b91607f169161081b565b634e487b7160e01b600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761087857604052565b610846565b6040810190811067ffffffffffffffff82111761087857604052565b62240020810190811067ffffffffffffffff82111761087857604052565b610200810190811067ffffffffffffffff82111761087857604052565b90601f8019910116810190811067ffffffffffffffff82111761087857604052565b906040519182600082549261090a8461080c565b9081845260019485811690816000146109795750600114610936575b5050610934925003836108d4565b565b9093915060005260209081600020936000915b81831061096157505061093493508201013880610926565b85548884018501529485019487945091830191610949565b91505061093494506020925060ff191682840152151560051b8201013880610926565b3461021657602036600319011261021657600435600052601d60205260406000206001600160801b038154166109d4600183016108f6565b91610a356109e4600383016108f6565b91610a2760ff60056109f8600485016108f6565b9301541693610a19604051978897885260a0602089015260a0880190610310565b908682036040880152610310565b908482036060860152610310565b90151560808301520390f35b346102165760203660031901126102165760206001600160a01b03610a67600435613479565b16604051908152f35b6020906003190112610216576004356001600160801b03811681036102165790565b610b99610a9e36610a70565b6000546001600160801b03821615610bf2575b610b6690610ac3601c548211156115b2565b601b544210801590610bd0575b610ad9906115fd565b610ae161155a565b34148015610ba2575b610af390611648565b610b29610b24610b20610b19866001600160801b0316600052601e602052604060002090565b5460ff1690565b1590565b611693565b610b56610b49846001600160801b0316600052601e602052604060002090565b805460ff19166001179055565b600052601d602052604060002090565b906001600160801b03167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055565b61066c33613825565b50610af3610bc7610bbb6009546001600160a01b031690565b6001600160a01b031690565b33149050610aea565b50610ad9610be9610bbb6009546001600160a01b031690565b33149050610ad0565b9050610b66610c396040516020810190610c2a81610c1c8742869091604092825260208201520190565b03601f1981018352826108d4565b5190206001600160801b031690565b919050610ab1565b60243590811515820361021657565b3461021657604036600319011261021657600435610c6c610c41565b6001600160a01b03610c7d83613479565b163303610ca95761066c91600052601d60205260056040600020019060ff801983541691151516179055565b606460405162461bcd60e51b815260206004820152600d60248201527f4e6f7420746865206f776e6572000000000000000000000000000000000000006044820152fd5b34610216576020366003190112610216576001600160a01b03610d0e6104fa565b168015610d37576000526005602052602067ffffffffffffffff60406000205416604051908152f35b7f8f4eb6040000000000000000000000000000000000000000000000000000000060005260046000fd5b346102165760008060031936011261042b57610d7b611483565b806001600160a01b036009546001600160a01b03198116600955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102165760003660031901126102165760206001600160a01b0360095416604051908152f35b34610216576001600160801b03610dfa36610a70565b16600052601e602052602060ff604060002054166040519015158152f35b346102165760008060031936011261042b576040519080600354610e3b8161080c565b808552916001918083169081156104015750600114610e64576103a285610396818703826108d4565b9250600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410610ea7575050508101602001610396826103a2610386565b80546020858701810191909152909301928101610e8c565b34610216576000366003190112610216576020610eda61155a565b604051908152f35b3461021657604036600319011261021657610efb6104fa565b6001600160a01b03610f0b610c41565b91336000526007602052610f4b83610f3a836040600020906001600160a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051921515835216907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b34610216576000366003190112610216576020601b54421015604051908152f35b34610216576103a2610fb7610fb236610a70565b611a0e565b604051918291602083526020830190610310565b67ffffffffffffffff811161087857601f01601f191660200190565b929192610ff382610fcb565b9161100160405193846108d4565b829481845281830111610216578281602093846000960137010152565b6080366003190112610216576110326104fa565b61103a610510565b6064359167ffffffffffffffff831161021657366023840112156102165761106f61066c933690602481600401359101610fe7565b91604435916136cb565b34610216576020366003190112610216576103a260043561039661109c8261256a565b610c1c60606110b36110ad86612775565b9561295f565b6040519586947f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b22696d6160208701527f6765223a22000000000000000000000000000000000000000000000000000000604087015261111981518092602060458a0191016102ed565b85017f222c226e616d65223a22000000000000000000000000000000000000000000006045820152611155825180936020604f850191016102ed565b017f222c226465736372697074696f6e223a22000000000000000000000000000000604f82015261118f82518093602086850191016102ed565b01016002907f227d00000000000000000000000000000000000000000000000000000000000081520190565b3461021657604036600319011261021657602060ff6112116111db6104fa565b6001600160a01b036111eb610510565b9116600052600784526040600020906001600160a01b0316600052602052604060002090565b54166040519015158152f35b346102165760403660031901126102165760043567ffffffffffffffff81116102165761124e90369060040161066e565b90600d60243561125c611483565b600881111561138c575b6009811461135a575b600a8114611328575b600b81146112f6575b600c81146112c4575b1461129157005b6112a36112a89161066c933691610fe7565b613a79565b6001600160a01b03166001600160a01b03196016541617601655565b6112f16112d56112a3368787610fe7565b6001600160a01b03166001600160a01b03196015541617601555565b61128a565b6113236113076112a3368787610fe7565b6001600160a01b03166001600160a01b03196014541617601455565b611281565b6113556113396112a3368787610fe7565b6001600160a01b03166001600160a01b03196013541617601355565b611278565b61138761136b6112a3368787610fe7565b6001600160a01b03166001600160a01b03196012541617601255565b61126f565b6113c661139d6112a3368787610fe7565b6113a6836129d9565b90919082549060031b916001600160a01b03809116831b921b1916179055565b611266565b34610216576103a2610fb76113df36610a70565b612292565b34610216576020366003190112610216576113fd6104fa565b611405611483565b6001600160a01b0380911690811561145257600954826001600160a01b0319821617600955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60246040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152fd5b6001600160a01b0360095416330361149757565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b634e487b7160e01b600052601160045260246000fd5b6000198101919082116104f057565b908160031b91808304600814901517156104f057565b906003820291808304600314901517156104f057565b9060c082029180830460c014901517156104f057565b908160021b91808304600414901517156104f057565b908160011b91808304600214901517156104f057565b601b548042106115ab5742034281116104f057611c209004601954906608e1bc9bf04000908181029181830414901517156104f05781039081116104f057601a548082106115a6575090565b905090565b5060195490565b156115b957565b606460405162461bcd60e51b815260206004820152601260248201527f4d617820737570706c79207265616368656400000000000000000000000000006044820152fd5b1561160457565b606460405162461bcd60e51b815260206004820152601060248201527f4d696e74206e6f742073746172746564000000000000000000000000000000006044820152fd5b1561164f57565b606460405162461bcd60e51b815260206004820152600d60248201527f496e76616c6964207072696365000000000000000000000000000000000000006044820152fd5b1561169a57565b606460405162461bcd60e51b815260206004820152601360248201527f496e70757420616c72656164792074616b656e000000000000000000000000006044820152fd5b97969593916116eb611483565b80611771575b505080611750575b50508061172f575b50506020820361171057505050565b600161172961093494600052601d602052604060002090565b01611819565b61174991600461172987600052601d602052604060002090565b3880611701565b61176a91600361172989600052601d602052604060002090565b38806116f9565b61179a9189600052601d6020526002604060002001805460008255806117a1575b50508961194d565b38806116f1565b6117b6916000526020600020908101906117bd565b3880611792565b8181106117c8575050565b600081556001016117bd565b9190601f81116117e357505050565b610934926000526020600020906020601f840160051c8301931061180f575b601f0160051c01906117bd565b9091508190611802565b90929167ffffffffffffffff81116108785761183f81611839845461080c565b846117d4565b6000601f8211600114611879578192939460009261186e575b50508160011b916000199060031b1c1916179055565b013590503880611858565b601f1982169461188e84600052602060002090565b91805b8781106118c95750836001959697106118af575b505050811b019055565b0135600019600384901b60f8161c191690553880806118a5565b90926020600181928686013581550194019101611891565b60ff1660ff81146104f05760010190565b634e487b7160e01b600052603260045260246000fd5b80548210156119205760005260206000200190600090565b6118f2565b908154916801000000000000000083101561087857826113a691600161093495018155611908565b91909160005b8260ff8216106119635750505050565b81600052602090601d8252600260406000200191611fe08260051b16860135601e19873603018112156102165786019081359167ffffffffffffffff83116102165701928136038413610216576119c56112a36119d0956119cb943691610fe7565b90611925565b6118e1565b611953565b604051906119e28261087d565b600382527f626d7000000000000000000000000000000000000000000000000000000000006020830152565b611a1790612a75565b611a1f61212d565b906042611a2b8361215c565b53604d611a3783612169565b536058611a4383612179565b536001611a4f83612189565b536036611a5b83612199565b536028611a67836121a9565b53600880611a74846121b9565b5360f4611a80846121c9565b5360ff611a8c846121d9565b5360ff611a98846121e9565b5360ff611aa4846121f9565b536001611ab084612209565b536018611abc84612219565b5360005b600c8110611ae557505050611ad761034691613989565b611adf6119d5565b90611bf3565b60005b828110611afe5750611af99061223a565b611ac0565b80611b1c611b17611bd793611b12866114ec565b612273565b611502565b611b63611b3b611b34611b2e84612249565b89612280565b5160ff1690565b60f81b7fff000000000000000000000000000000000000000000000000000000000000001690565b611b7a611b6f83612257565b9160001a9189612229565b53611b8d611b3b611b34611b2e84612265565b611ba1611b6f611b9c84612257565b612265565b53611bd1611bc6611bc1611bbb611b3b611b34868c612280565b93612257565b612249565b9160001a9188612229565b5361223a565b611ae8565b90611bef602092828151948592016102ed565b0190565b611e8a91610c1c612104610346936120fe6040519687957f3c7376672076696577426f783d2230203020383030203132303022207769647460208801527f683d2238303022206865696768743d22313230302220786d6c6e733d2268747460408801527f703a2f2f7777772e77332e6f72672f323030302f7376672220786d6c6e733a7860608801527f6c696e6b3d22687474703a2f2f7777772e77332e6f72672f313939392f786c6960808801527f6e6b223e3c646566733e3c7374796c653e696d616765207b696d6167652d726560a08801527f6e646572696e673a206f7074696d697a6553706565643b696d6167652d72656e60c08801527f646572696e673a202d6d6f7a2d63726973702d65646765733b696d6167652d7260e08801527f656e646572696e673a202d6f2d63726973702d65646765733b696d6167652d726101008801527f656e646572696e673a202d7765626b69742d6f7074696d697a652d636f6e74726101208801527f6173743b696d6167652d72656e646572696e673a206f7074696d697a652d636f6101408801527f6e74726173743b696d6167652d72656e646572696e673a2063726973702d65646101608801527f6765733b696d6167652d72656e646572696e673a20706978656c617465643b2d6101808801527f6d732d696e746572706f6c6174696f6e2d6d6f64653a206e6561726573742d6e6101a08801527f65696768626f723b7d3c2f7374796c653e3c2f646566733e3c696d61676520776101c08801527f696474683d22383030707822206865696768743d2231323030707822206872656101e08801527f663d22646174613a696d6167652f0000000000000000000000000000000000006102008801526120fe611eb9611eb3611e8a61020e8b0185611bdc565b7f3b6261736536342c000000000000000000000000000000000000000000000000815260080190565b86611bdc565b7f22202f3e3c666f726569676e4f626a6563742077696474683d2238303070782281527f206865696768743d22313230307078223e3c64697620786d6c6e733d2268747460208201527f703a2f2f7777772e77332e6f72672f313939392f7868746d6c22207374796c6560408201527f3d2277696474683a38303070783b206865696768743a3132303070783b223e3c60608201527f696d67207374796c653d2277696474683a38303070783b206865696768743a3160808201527f32303070783b20696d6167652d72656e646572696e673a206f7074696d697a6560a08201527f53706565643b20696d6167652d72656e646572696e673a202d6d6f7a2d63726960c08201527f73702d65646765733b20696d6167652d72656e646572696e673a202d6f2d637260e08201527f6973702d65646765733b20696d6167652d72656e646572696e673a202d7765626101008201527f6b69742d6f7074696d697a652d636f6e74726173743b20696d6167652d72656e6101208201527f646572696e673a206f7074696d697a652d636f6e74726173743b20696d6167656101408201527f2d72656e646572696e673a2063726973702d65646765733b20696d6167652d726101608201527f656e646572696e673a20706978656c617465643b202d6d732d696e746572706f6101808201527f6c6174696f6e2d6d6f64653a206e6561726573742d6e65696768626f723b22206101a08201527f7372633d22646174613a696d6167652f000000000000000000000000000000006101c08201526101d00190565b90611bdc565b7f22202f3e3c2f6469763e3c2f666f726569676e4f626a6563743e3c2f7376673e815260200190565b60405190610380820182811067ffffffffffffffff821117610878576040526103448252610360366020840137565b8051156119205760200190565b8051600110156119205760210190565b8051600210156119205760220190565b8051600310156119205760230190565b8051600a101561192057602a0190565b8051600e101561192057602e0190565b8051601210156119205760320190565b8051601610156119205760360190565b8051601710156119205760370190565b8051601810156119205760380190565b8051601910156119205760390190565b8051601a101561192057603a0190565b8051601c101561192057603c0190565b908151811015611920570160200190565b60001981146104f05760010190565b90600282018092116104f057565b60360190816036116104f057565b90600182018092116104f057565b919082018092116104f057565b906101208110156119205760051b0190565b61229b90611a0e565b8051606091816122e5575b50506040517f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000602082015290610346908290610c1c90603a83016120fe565b90915060036002908082850104821b90604051927f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f52603f946106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f188652602085019184860193602085019360208a850101986004838b519660008d525b0192828451818160121c16516000538181600c1c1651600153818160061c165188531651855360005181520191868310156123a6576004908490612367565b50509350610c1c986040600096613d3d60f01b956103469b5201604052069004820352528152916122a6565b610346905461080c565b601754600092916123ec8261080c565b91600190818116908115612458575060011461240757505050565b909192935060176000527fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c15906000915b848310612445575050500190565b8181602092548587015201920191612437565b60ff191683525050811515909102019150565b6018546000929161247b8261080c565b91600190818116908115612458575060011461249657505050565b909192935060186000527fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e906000915b8483106124d4575050500190565b81816020925485870152019201916124c6565b6000929181546124f68161080c565b9260019180831690811561254f5750600114612513575b50505050565b90919293945060005260209081600020906000915b85831061253e575050505001903880808061250d565b805485840152918301918101612528565b60ff191684525050508115159091020191503880808061250d565b600261258082600052601d602052604060002090565b01541580612644575b801561261d575b6125f65760026125aa82600052601d602052604060002090565b01546125ed5761034660016125cc6125e893600052601d602052604060002090565b01610c1c6040519384926125e2602085016123dc565b906124e7565b61246b565b610346906126a3565b6113df61261061034692600052601d602052604060002090565b546001600160801b031690565b5061263f600561263783600052601d602052604060002090565b015460ff1690565b612590565b50612664600161265e83600052601d602052604060002090565b016123d2565b15612589565b604051906126778261087d565b600382527f706e6700000000000000000000000000000000000000000000000000000000006020830152565b600060605b826000526020601d8152604060028160002001805460ff861610156127175791610c1c61270b926120fe6126fe6126f96126e68a6127119a99611908565b90546001600160a01b039160031b1c1690565b613abd565b9151958694850190611bdc565b916118e1565b906126a8565b505050610c1c9250610346915061273b61273361274092613989565b611adf61266a565b613989565b6040517f646174613a696d6167652f7376672b786d6c3b6261736536342c0000000000006020820152928391603a83016120fe565b600090808252601d602052612790600360408420015461080c565b6129165780827a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008281811015612908575b50506d04ee2d6d415b85acef8100000000808410156128fb575b50662386f26fc10000808410156128ee575b506305f5e100808410156128e1575b50612710808410156128d4575b5060648310156128c6575b600a809310156128be575b906021916001928161282e8580940161292d565b9650860101905b61287b575b50506040517f436f6e63726574652023000000000000000000000000000000000000000000006020820152926103469250839150610c1c90602a83016120fe565b600019019083907f30313233343536373839616263646566000000000000000000000000000000008282061a8353049182156128b957919082612835565b61283a565b60010161281a565b91606460029104920161280f565b6004919304920138612804565b60089193049201386127f7565b60109193049201386127e8565b60209193049201386127d6565b0492506040905038806127bc565b6040826003926103469452601d60205220016108f6565b9061293782610fcb565b61294460405191826108d4565b8281528092612955601f1991610fcb565b0190602036910137565b80600052601d60205261297960046040600020015461080c565b612991575060405161298a8161085c565b6000815290565b600052601d60205261034660046040600020016108f6565b3d156129d4573d906129ba82610fcb565b916129c860405193846108d4565b82523d6000602084013e565b606090565b600881101561192057600a0190600090565b6040519061240080830183811067ffffffffffffffff82111761087857604052368337565b60405190600a6000835b60088210612a4257505050610100820182811067ffffffffffffffff82111761087857604052565b6001602081926001600160a01b03865416815201930191019091612a1a565b80518210156119205760209160051b010190565b612a86612a806129eb565b916133d4565b612a96612a91612a10565b613328565b612b3660165491612b31612b2c612ab56001600160a01b0386166132a7565b92612ad0612acb6013546001600160a01b031690565b6132a7565b96612ae6612acb6015546001600160a01b031690565b91612b1b612aff612acb6012546001600160a01b031690565b91612b15612acb6014546001600160a01b031690565b93612caf565b926001998a9960a01c8a0b94612df5565b612f95565b61301b565b60009081925b612b48575b5050505090565b8051831015612bca57612bb683612b83612b7a612b70612b69899887612a61565b5160010b90565b60209060010b0590565b60800160010b90565b8481870b12612bc3575b612bb19060ff908181890b13612bbc575b16612ba9838a612280565b9060ff169052565b61223a565b92612b3c565b5080612b9e565b5083612b8d565b612b41565b67ffffffffffffffff81116108785760051b60200190565b6040519062024020820182811067ffffffffffffffff82111761087857604052611200825262024000366020840137565b60405190612420820182811067ffffffffffffffff821117610878576040526101208252612400366020840137565b90612c5182612bcf565b612c5e60405191826108d4565b8281528092612955601f1991612bcf565b9060108110156119205760051b0190565b90816201b000019182126001166104f057565b919091600083820193841291129080158216911516176104f057565b91612cb8612be7565b9060005b61120080821015612d575760009081905b60108210612cf957505090612bb1612cf49260010b612cec8387612a61565b9060010b9052565b612cbc565b9091612d058389612c6f565b51828402918483048414851517156104f0578583018093116104f057612d45612d4b92612d38612b69612d51968d612a61565b90600191820b910b612dcb565b90612c93565b9261223a565b90612ccd565b50509250905090565b9081600c1b9180830561100014901517156104f057565b818102929160008212600160ff1b8214166104f05781840514901517156104f057565b8115612db557600160ff1b81146000198314166104f0570590565b634e487b7160e01b600052601260045260246000fd5b61100091612dd891612d77565b0590565b818103929160001380158285131691841216176104f057565b9092939194815192612e0684612c47565b9660c0809504956000805b888110612e25575050505050505050505090565b815b888110612e3d5750612e389061223a565b612e11565b80612e4783611518565b90612e5191612273565b8c8c612e5d838c612a61565b5160010b84612e6c818a612a61565b5160010b92612e7b828c612a61565b5160010b91612e8991612a61565b5160010b91612e98878d612a61565b5160010b93612ea691612ddc565b908c60010b612eb491612c93565b612ebd90612f14565b612ec691612f02565b90612ed091612dcb565b90612eda91612c93565b60010b91612ee791612a61565b90612ef4919060010b9052565b612efd9061223a565b612e27565b90612f0f61034692612d60565b612d9a565b6000808213156115a6578190805b60148210612f305750505090565b909192612f566002612f4e612f4884612f0f89612d60565b84612c93565b059182612ddc565b828112612f80576001905b12612f7957612f70909261223a565b90929192612f22565b9250505090565b600160ff1b81146104f0576001908303612f61565b8051612fa081612c47565b91600090815b838110612fb4575050505090565b80612fc2612fe39284612a61565b5184600191820b12600014612fe8575083612fdd8288612a61565b5261223a565b612fa6565b612ff28285612a61565b51900b612fdd8288612a61565b9060010b9060010b0190617fff198212617fff8313176104f057565b613023612c18565b9160005b6006811061306d5750505060005b81518110156130695780612bb161305a613055612b696130649587612a61565b613225565b612cec8386612a61565b613035565b5090565b60005b6004811061308757506130829061223a565b613027565b60005b60c081106130a1575061309c9061223a565b613070565b9095916130cd612b696130c784611b126130c28c611b12889d9c9b9d61152e565b611518565b86612a61565b936130d782611544565b976130e181611544565b9460005b60038082101561320b57908b929189898c8a8f6000985b868a1061311a575050505050505061311591925061223a565b6130e5565b896131288961312e93612273565b95612273565b92600c851080613201575b61315f575b5050505050509091926131509061223a565b92919089898c8f8f8c916130fc565b600195860b92508d60005b88811061317c575092508f955061313e565b80612bb188612cec8f6131e08f96611b12611b178e611b128f8f906131d48f6131fc9f6131da946131c86131ce93611b126131f59f8e611b12611b176130c293611b12612b699a611502565b90612a61565b60010b90565b90612dcb565b986114ec565b928d0b6131f0612b69858b612a61565b612fff565b9187612a61565b61316a565b5060088410613139565b5050985092909596945061322091935061223a565b61308a565b60010b6110009061324b8261323a8380612d77565b059161324583612c80565b90612d77565b90806009029060098205036104f05761326390612c80565b801561329f5761327291612d9a565b90808213613297575b50610fff1980821261328f575b5060010b90565b905038613288565b90503861327b565b505050600090565b6132b090613abd565b6132c181516001918291821c612c47565b926000915b6132d1575b50505090565b80518210156133235761ff006132e78383612229565b5160f01c166132fe6132f884612265565b83612229565b5160f81c17830b61331183851c86612a61565b52600282018092116104f057826132c6565b6132cb565b60405190600061333783610899565b62012000835262240000366020850137805b600882106133575750505090565b6133746001600160a01b0383600597949695971b870151166132a7565b916000915b83518310156133a957612d4b6133a391612bb1613399612b698789612a61565b612cec838a612a61565b91613379565b9394909592506133b9915061223a565b9091613349565b60010b60061b908160010b9182036104f057565b604051906133e1826108b7565b6102008092369037604051916133f6836108b7565b36833760019081805b6134095750505090565b6010808211613473578181039081116104f057613425906114ec565b6001600160801b038316901c60ff16830b607f1901617fff198112617fff8213176104f0578391612bb161345b61346d936133c0565b612cec613467846114dd565b89612c6f565b906133ff565b506132cb565b60019080821161350057613497816000526004602052604060002090565b549182156134b4575b5050600160e01b8116156103465780613500565b6000548210156135005790815b156134a057909150600019016134e1816000526004602052604060002090565b549182156134f9575050600160e01b81166135005790565b90816134c1565b7fdf2d9b420000000000000000000000000000000000000000000000000000000060005260046000fd5b91909161353682613479565b906001600160a01b038091169384828416036136c657600084815260066020526040902080546135756001600160a01b03881633908114908314171590565b61367d575b613673575b5061359d856001600160a01b03166000526005602052604060002090565b80546000190190556135c2816001600160a01b03166000526005602052604060002090565b8054600101905516928391600160e11b804260a01b8517176135ee866000526004602052604060002090565b55811615613629575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a41561362457565b61395f565b60018401613641816000526004602052604060002090565b541561364e575b506135f7565b60005481146136485761366b906000526004602052604060002090565b553880613648565b600090553861357f565b6136bc610b20610b19336136a48b6001600160a01b03166000526007602052604060002090565b906001600160a01b0316600052602052604060002090565b1561357a57613935565b61390b565b9291906136d982828661352a565b803b6136e55750505050565b6136ee9361373b565b156136fc573880808061250d565b7fd1a57ed60000000000000000000000000000000000000000000000000000000060005260046000fd5b908160209103126102165751610346816101ec565b91926020916137a09160006040519586809581947f150b7a02000000000000000000000000000000000000000000000000000000009a8b84523360048501526001600160a01b0380951660248501526044840152608060648401526084830190610310565b0393165af1600091816137f5575b506137cf576137bb6129a9565b8051156137ca57805190602001fd5b6136fc565b7fffffffff00000000000000000000000000000000000000000000000000000000161490565b61381791925060203d811161381e575b61380f81836108d4565b810190613726565b90386137ae565b503d613805565b60008054916138726001600160a01b03821691600160e11b4260a01b841717613858866000526004602052604060002090565b556001600160a01b03166000526005602052604060002090565b68010000000000000001815401905580156138e357600190818401939180805b61389e575b5050505055565b156138d2575b83818484877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4613892565b809201918483036138a45780613897565b6004827f2e076300000000000000000000000000000000000000000000000000000000008152fd5b7fa11481000000000000000000000000000000000000000000000000000000000060005260046000fd5b7f59c896be0000000000000000000000000000000000000000000000000000000060005260046000fd5b7fea553b340000000000000000000000000000000000000000000000000000000060005260046000fd5b80516060929181613998575050565b9092506003906002938285820104851b92604051957f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f52603f916106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18835260208801938689019460208601956020838901019182519660048660009b8c87525b01928284518d828260121c165190538181600c1c1651600153818160061c16518b53165188538b518152019189831015613a5b576004908790613a1d565b50509650613d3d60f01b956040925201604052069004820352528252565b9081516001810161ffff8160401b6bfd61000080600a3d393df300179111840152600b8101601584016000f0928315613aaf5752565b63301164256000526004601cfd5b90813b918215613af35760016000198401916000601f6040519661ffe0603e82011688016040528588528701015260208501903c565b6311052bb46000526004601cfdfea264697066735822122009e04b5ac195776ef44e7d5e79aed9e087c02e28c543b20356b7ec5e57cdda7e64736f6c63430008140033c624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c15
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a7146101e757806306fdde03146101e2578063081812fc146101dd578063095ea7b3146101d857806318160ddd146101d357806323b872dd146101ce578063276858c4146101c95780633ccfd60b146101c45780633e0a322d146101bf57806342842e0e146101ba5780634f64b2be146101b55780636352211e146101b057806369d3e20e146101ab5780636bd13045146101a657806370a08231146101a1578063715018a61461019c5780638da5cb5b1461019757806393ddc81e1461019257806395d89b411461018d57806398d5fdca14610188578063a22cb46514610183578063a9722cf31461017e578063b0970a1414610179578063b88d4fde14610174578063c87b56dd1461016f578063e985e9c51461016a578063ea1524df14610165578063ef18d6c4146101605763f2fde38b1461015b57600080fd5b6113e4565b6113cb565b61121d565b6111bb565b611079565b61101e565b610f9e565b610f7d565b610ee2565b610ebf565b610e18565b610de4565b610dbd565b610d61565b610ced565b610c50565b610a92565b610a41565b61099c565b6107e9565b6107c8565b610745565b61069c565b61065a565b6105fe565b610526565b61042e565b610349565b61021b565b7fffffffff0000000000000000000000000000000000000000000000000000000081160361021657565b600080fd5b346102165760203660031901126102165760207fffffffff0000000000000000000000000000000000000000000000000000000060043561025b816101ec565b167f01ffc9a70000000000000000000000000000000000000000000000000000000081149081156102c3575b8115610299575b506040519015158152f35b7f5b5e139f000000000000000000000000000000000000000000000000000000009150143861028e565b7f80ac58cd0000000000000000000000000000000000000000000000000000000081149150610287565b60005b8381106103005750506000910152565b81810151838201526020016102f0565b90602091610329815180928185528580860191016102ed565b601f01601f1916010190565b906020610346928181520190610310565b90565b346102165760008060031936011261042b57604051908060025461036c8161080c565b8085529160019180831690811561040157506001146103a6575b6103a285610396818703826108d4565b60405191829182610335565b0390f35b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106103e9575050508101602001610396826103a2610386565b805460208587018101919091529093019281016103ce565b8695506103a29693506020925061039694915060ff191682840152151560051b8201019293610386565b80fd5b34610216576020806003193601126102165760048035906000826001818111156104a1575b5050156104795750600052600681526001600160a01b0360406000205416604051908152f35b7fcf4700e4000000000000000000000000000000000000000000000000000000006000526000fd5b825482101561045357949392919081865b6104cc575b5050600160e01b919293945016153880610453565b8181528386526040812054925090826104f55780156104f0576000190190866104b2565b6114c7565b6104b7565b600435906001600160a01b038216820361021657565b602435906001600160a01b038216820361021657565b60403660031901126102165761053a6104fa565b6024356001600160a01b03918261055083613479565b168033036105a2575b600093838552600660205260408520921691826001600160a01b03198254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b80600052600760205260ff6105ce336040600020906001600160a01b0316600052602052604060002090565b5416610559577fcfb3b9420000000000000000000000000000000000000000000000000000000060005260046000fd5b34610216576000366003190112610216576000546001546040519103600019018152602090f35b6060906003190112610216576001600160a01b0390600435828116810361021657916024359081168103610216579060443590565b61066c61066636610625565b9161352a565b005b9181601f840112156102165782359167ffffffffffffffff8311610216576020838186019501011161021657565b346102165760a03660031901126102165760243567ffffffffffffffff808211610216573660238301121561021657816004013591818311610216573660248460051b8301011161021657604435828111610216576106ff90369060040161066e565b906064358481116102165761071890369060040161066e565b9290916084359586116102165761066c96610739602497369060040161066e565b979096016004356116de565b346102165760008060031936011261042b5761075f611483565b808080806001600160a01b036009541647905af161077b6129a9565b50156107845780f35b606460405162461bcd60e51b815260206004820152601060248201527f5769746864726177206661696c65642e000000000000000000000000000000006044820152fd5b34610216576020366003190112610216576107e1611483565b600435601b55005b61066c6107f536610625565b90604051926108038461085c565b600084526136cb565b90600182811c9216801561083c575b602083101461082657565b634e487b7160e01b600052602260045260246000fd5b91607f169161081b565b634e487b7160e01b600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761087857604052565b610846565b6040810190811067ffffffffffffffff82111761087857604052565b62240020810190811067ffffffffffffffff82111761087857604052565b610200810190811067ffffffffffffffff82111761087857604052565b90601f8019910116810190811067ffffffffffffffff82111761087857604052565b906040519182600082549261090a8461080c565b9081845260019485811690816000146109795750600114610936575b5050610934925003836108d4565b565b9093915060005260209081600020936000915b81831061096157505061093493508201013880610926565b85548884018501529485019487945091830191610949565b91505061093494506020925060ff191682840152151560051b8201013880610926565b3461021657602036600319011261021657600435600052601d60205260406000206001600160801b038154166109d4600183016108f6565b91610a356109e4600383016108f6565b91610a2760ff60056109f8600485016108f6565b9301541693610a19604051978897885260a0602089015260a0880190610310565b908682036040880152610310565b908482036060860152610310565b90151560808301520390f35b346102165760203660031901126102165760206001600160a01b03610a67600435613479565b16604051908152f35b6020906003190112610216576004356001600160801b03811681036102165790565b610b99610a9e36610a70565b6000546001600160801b03821615610bf2575b610b6690610ac3601c548211156115b2565b601b544210801590610bd0575b610ad9906115fd565b610ae161155a565b34148015610ba2575b610af390611648565b610b29610b24610b20610b19866001600160801b0316600052601e602052604060002090565b5460ff1690565b1590565b611693565b610b56610b49846001600160801b0316600052601e602052604060002090565b805460ff19166001179055565b600052601d602052604060002090565b906001600160801b03167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055565b61066c33613825565b50610af3610bc7610bbb6009546001600160a01b031690565b6001600160a01b031690565b33149050610aea565b50610ad9610be9610bbb6009546001600160a01b031690565b33149050610ad0565b9050610b66610c396040516020810190610c2a81610c1c8742869091604092825260208201520190565b03601f1981018352826108d4565b5190206001600160801b031690565b919050610ab1565b60243590811515820361021657565b3461021657604036600319011261021657600435610c6c610c41565b6001600160a01b03610c7d83613479565b163303610ca95761066c91600052601d60205260056040600020019060ff801983541691151516179055565b606460405162461bcd60e51b815260206004820152600d60248201527f4e6f7420746865206f776e6572000000000000000000000000000000000000006044820152fd5b34610216576020366003190112610216576001600160a01b03610d0e6104fa565b168015610d37576000526005602052602067ffffffffffffffff60406000205416604051908152f35b7f8f4eb6040000000000000000000000000000000000000000000000000000000060005260046000fd5b346102165760008060031936011261042b57610d7b611483565b806001600160a01b036009546001600160a01b03198116600955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102165760003660031901126102165760206001600160a01b0360095416604051908152f35b34610216576001600160801b03610dfa36610a70565b16600052601e602052602060ff604060002054166040519015158152f35b346102165760008060031936011261042b576040519080600354610e3b8161080c565b808552916001918083169081156104015750600114610e64576103a285610396818703826108d4565b9250600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410610ea7575050508101602001610396826103a2610386565b80546020858701810191909152909301928101610e8c565b34610216576000366003190112610216576020610eda61155a565b604051908152f35b3461021657604036600319011261021657610efb6104fa565b6001600160a01b03610f0b610c41565b91336000526007602052610f4b83610f3a836040600020906001600160a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051921515835216907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b34610216576000366003190112610216576020601b54421015604051908152f35b34610216576103a2610fb7610fb236610a70565b611a0e565b604051918291602083526020830190610310565b67ffffffffffffffff811161087857601f01601f191660200190565b929192610ff382610fcb565b9161100160405193846108d4565b829481845281830111610216578281602093846000960137010152565b6080366003190112610216576110326104fa565b61103a610510565b6064359167ffffffffffffffff831161021657366023840112156102165761106f61066c933690602481600401359101610fe7565b91604435916136cb565b34610216576020366003190112610216576103a260043561039661109c8261256a565b610c1c60606110b36110ad86612775565b9561295f565b6040519586947f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b22696d6160208701527f6765223a22000000000000000000000000000000000000000000000000000000604087015261111981518092602060458a0191016102ed565b85017f222c226e616d65223a22000000000000000000000000000000000000000000006045820152611155825180936020604f850191016102ed565b017f222c226465736372697074696f6e223a22000000000000000000000000000000604f82015261118f82518093602086850191016102ed565b01016002907f227d00000000000000000000000000000000000000000000000000000000000081520190565b3461021657604036600319011261021657602060ff6112116111db6104fa565b6001600160a01b036111eb610510565b9116600052600784526040600020906001600160a01b0316600052602052604060002090565b54166040519015158152f35b346102165760403660031901126102165760043567ffffffffffffffff81116102165761124e90369060040161066e565b90600d60243561125c611483565b600881111561138c575b6009811461135a575b600a8114611328575b600b81146112f6575b600c81146112c4575b1461129157005b6112a36112a89161066c933691610fe7565b613a79565b6001600160a01b03166001600160a01b03196016541617601655565b6112f16112d56112a3368787610fe7565b6001600160a01b03166001600160a01b03196015541617601555565b61128a565b6113236113076112a3368787610fe7565b6001600160a01b03166001600160a01b03196014541617601455565b611281565b6113556113396112a3368787610fe7565b6001600160a01b03166001600160a01b03196013541617601355565b611278565b61138761136b6112a3368787610fe7565b6001600160a01b03166001600160a01b03196012541617601255565b61126f565b6113c661139d6112a3368787610fe7565b6113a6836129d9565b90919082549060031b916001600160a01b03809116831b921b1916179055565b611266565b34610216576103a2610fb76113df36610a70565b612292565b34610216576020366003190112610216576113fd6104fa565b611405611483565b6001600160a01b0380911690811561145257600954826001600160a01b0319821617600955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60246040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152fd5b6001600160a01b0360095416330361149757565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b634e487b7160e01b600052601160045260246000fd5b6000198101919082116104f057565b908160031b91808304600814901517156104f057565b906003820291808304600314901517156104f057565b9060c082029180830460c014901517156104f057565b908160021b91808304600414901517156104f057565b908160011b91808304600214901517156104f057565b601b548042106115ab5742034281116104f057611c209004601954906608e1bc9bf04000908181029181830414901517156104f05781039081116104f057601a548082106115a6575090565b905090565b5060195490565b156115b957565b606460405162461bcd60e51b815260206004820152601260248201527f4d617820737570706c79207265616368656400000000000000000000000000006044820152fd5b1561160457565b606460405162461bcd60e51b815260206004820152601060248201527f4d696e74206e6f742073746172746564000000000000000000000000000000006044820152fd5b1561164f57565b606460405162461bcd60e51b815260206004820152600d60248201527f496e76616c6964207072696365000000000000000000000000000000000000006044820152fd5b1561169a57565b606460405162461bcd60e51b815260206004820152601360248201527f496e70757420616c72656164792074616b656e000000000000000000000000006044820152fd5b97969593916116eb611483565b80611771575b505080611750575b50508061172f575b50506020820361171057505050565b600161172961093494600052601d602052604060002090565b01611819565b61174991600461172987600052601d602052604060002090565b3880611701565b61176a91600361172989600052601d602052604060002090565b38806116f9565b61179a9189600052601d6020526002604060002001805460008255806117a1575b50508961194d565b38806116f1565b6117b6916000526020600020908101906117bd565b3880611792565b8181106117c8575050565b600081556001016117bd565b9190601f81116117e357505050565b610934926000526020600020906020601f840160051c8301931061180f575b601f0160051c01906117bd565b9091508190611802565b90929167ffffffffffffffff81116108785761183f81611839845461080c565b846117d4565b6000601f8211600114611879578192939460009261186e575b50508160011b916000199060031b1c1916179055565b013590503880611858565b601f1982169461188e84600052602060002090565b91805b8781106118c95750836001959697106118af575b505050811b019055565b0135600019600384901b60f8161c191690553880806118a5565b90926020600181928686013581550194019101611891565b60ff1660ff81146104f05760010190565b634e487b7160e01b600052603260045260246000fd5b80548210156119205760005260206000200190600090565b6118f2565b908154916801000000000000000083101561087857826113a691600161093495018155611908565b91909160005b8260ff8216106119635750505050565b81600052602090601d8252600260406000200191611fe08260051b16860135601e19873603018112156102165786019081359167ffffffffffffffff83116102165701928136038413610216576119c56112a36119d0956119cb943691610fe7565b90611925565b6118e1565b611953565b604051906119e28261087d565b600382527f626d7000000000000000000000000000000000000000000000000000000000006020830152565b611a1790612a75565b611a1f61212d565b906042611a2b8361215c565b53604d611a3783612169565b536058611a4383612179565b536001611a4f83612189565b536036611a5b83612199565b536028611a67836121a9565b53600880611a74846121b9565b5360f4611a80846121c9565b5360ff611a8c846121d9565b5360ff611a98846121e9565b5360ff611aa4846121f9565b536001611ab084612209565b536018611abc84612219565b5360005b600c8110611ae557505050611ad761034691613989565b611adf6119d5565b90611bf3565b60005b828110611afe5750611af99061223a565b611ac0565b80611b1c611b17611bd793611b12866114ec565b612273565b611502565b611b63611b3b611b34611b2e84612249565b89612280565b5160ff1690565b60f81b7fff000000000000000000000000000000000000000000000000000000000000001690565b611b7a611b6f83612257565b9160001a9189612229565b53611b8d611b3b611b34611b2e84612265565b611ba1611b6f611b9c84612257565b612265565b53611bd1611bc6611bc1611bbb611b3b611b34868c612280565b93612257565b612249565b9160001a9188612229565b5361223a565b611ae8565b90611bef602092828151948592016102ed565b0190565b611e8a91610c1c612104610346936120fe6040519687957f3c7376672076696577426f783d2230203020383030203132303022207769647460208801527f683d2238303022206865696768743d22313230302220786d6c6e733d2268747460408801527f703a2f2f7777772e77332e6f72672f323030302f7376672220786d6c6e733a7860608801527f6c696e6b3d22687474703a2f2f7777772e77332e6f72672f313939392f786c6960808801527f6e6b223e3c646566733e3c7374796c653e696d616765207b696d6167652d726560a08801527f6e646572696e673a206f7074696d697a6553706565643b696d6167652d72656e60c08801527f646572696e673a202d6d6f7a2d63726973702d65646765733b696d6167652d7260e08801527f656e646572696e673a202d6f2d63726973702d65646765733b696d6167652d726101008801527f656e646572696e673a202d7765626b69742d6f7074696d697a652d636f6e74726101208801527f6173743b696d6167652d72656e646572696e673a206f7074696d697a652d636f6101408801527f6e74726173743b696d6167652d72656e646572696e673a2063726973702d65646101608801527f6765733b696d6167652d72656e646572696e673a20706978656c617465643b2d6101808801527f6d732d696e746572706f6c6174696f6e2d6d6f64653a206e6561726573742d6e6101a08801527f65696768626f723b7d3c2f7374796c653e3c2f646566733e3c696d61676520776101c08801527f696474683d22383030707822206865696768743d2231323030707822206872656101e08801527f663d22646174613a696d6167652f0000000000000000000000000000000000006102008801526120fe611eb9611eb3611e8a61020e8b0185611bdc565b7f3b6261736536342c000000000000000000000000000000000000000000000000815260080190565b86611bdc565b7f22202f3e3c666f726569676e4f626a6563742077696474683d2238303070782281527f206865696768743d22313230307078223e3c64697620786d6c6e733d2268747460208201527f703a2f2f7777772e77332e6f72672f313939392f7868746d6c22207374796c6560408201527f3d2277696474683a38303070783b206865696768743a3132303070783b223e3c60608201527f696d67207374796c653d2277696474683a38303070783b206865696768743a3160808201527f32303070783b20696d6167652d72656e646572696e673a206f7074696d697a6560a08201527f53706565643b20696d6167652d72656e646572696e673a202d6d6f7a2d63726960c08201527f73702d65646765733b20696d6167652d72656e646572696e673a202d6f2d637260e08201527f6973702d65646765733b20696d6167652d72656e646572696e673a202d7765626101008201527f6b69742d6f7074696d697a652d636f6e74726173743b20696d6167652d72656e6101208201527f646572696e673a206f7074696d697a652d636f6e74726173743b20696d6167656101408201527f2d72656e646572696e673a2063726973702d65646765733b20696d6167652d726101608201527f656e646572696e673a20706978656c617465643b202d6d732d696e746572706f6101808201527f6c6174696f6e2d6d6f64653a206e6561726573742d6e65696768626f723b22206101a08201527f7372633d22646174613a696d6167652f000000000000000000000000000000006101c08201526101d00190565b90611bdc565b7f22202f3e3c2f6469763e3c2f666f726569676e4f626a6563743e3c2f7376673e815260200190565b60405190610380820182811067ffffffffffffffff821117610878576040526103448252610360366020840137565b8051156119205760200190565b8051600110156119205760210190565b8051600210156119205760220190565b8051600310156119205760230190565b8051600a101561192057602a0190565b8051600e101561192057602e0190565b8051601210156119205760320190565b8051601610156119205760360190565b8051601710156119205760370190565b8051601810156119205760380190565b8051601910156119205760390190565b8051601a101561192057603a0190565b8051601c101561192057603c0190565b908151811015611920570160200190565b60001981146104f05760010190565b90600282018092116104f057565b60360190816036116104f057565b90600182018092116104f057565b919082018092116104f057565b906101208110156119205760051b0190565b61229b90611a0e565b8051606091816122e5575b50506040517f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000602082015290610346908290610c1c90603a83016120fe565b90915060036002908082850104821b90604051927f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f52603f946106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f188652602085019184860193602085019360208a850101986004838b519660008d525b0192828451818160121c16516000538181600c1c1651600153818160061c165188531651855360005181520191868310156123a6576004908490612367565b50509350610c1c986040600096613d3d60f01b956103469b5201604052069004820352528152916122a6565b610346905461080c565b601754600092916123ec8261080c565b91600190818116908115612458575060011461240757505050565b909192935060176000527fc624b66cc0138b8fabc209247f72d758e1cf3343756d543badbf24212bed8c15906000915b848310612445575050500190565b8181602092548587015201920191612437565b60ff191683525050811515909102019150565b6018546000929161247b8261080c565b91600190818116908115612458575060011461249657505050565b909192935060186000527fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e906000915b8483106124d4575050500190565b81816020925485870152019201916124c6565b6000929181546124f68161080c565b9260019180831690811561254f5750600114612513575b50505050565b90919293945060005260209081600020906000915b85831061253e575050505001903880808061250d565b805485840152918301918101612528565b60ff191684525050508115159091020191503880808061250d565b600261258082600052601d602052604060002090565b01541580612644575b801561261d575b6125f65760026125aa82600052601d602052604060002090565b01546125ed5761034660016125cc6125e893600052601d602052604060002090565b01610c1c6040519384926125e2602085016123dc565b906124e7565b61246b565b610346906126a3565b6113df61261061034692600052601d602052604060002090565b546001600160801b031690565b5061263f600561263783600052601d602052604060002090565b015460ff1690565b612590565b50612664600161265e83600052601d602052604060002090565b016123d2565b15612589565b604051906126778261087d565b600382527f706e6700000000000000000000000000000000000000000000000000000000006020830152565b600060605b826000526020601d8152604060028160002001805460ff861610156127175791610c1c61270b926120fe6126fe6126f96126e68a6127119a99611908565b90546001600160a01b039160031b1c1690565b613abd565b9151958694850190611bdc565b916118e1565b906126a8565b505050610c1c9250610346915061273b61273361274092613989565b611adf61266a565b613989565b6040517f646174613a696d6167652f7376672b786d6c3b6261736536342c0000000000006020820152928391603a83016120fe565b600090808252601d602052612790600360408420015461080c565b6129165780827a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008281811015612908575b50506d04ee2d6d415b85acef8100000000808410156128fb575b50662386f26fc10000808410156128ee575b506305f5e100808410156128e1575b50612710808410156128d4575b5060648310156128c6575b600a809310156128be575b906021916001928161282e8580940161292d565b9650860101905b61287b575b50506040517f436f6e63726574652023000000000000000000000000000000000000000000006020820152926103469250839150610c1c90602a83016120fe565b600019019083907f30313233343536373839616263646566000000000000000000000000000000008282061a8353049182156128b957919082612835565b61283a565b60010161281a565b91606460029104920161280f565b6004919304920138612804565b60089193049201386127f7565b60109193049201386127e8565b60209193049201386127d6565b0492506040905038806127bc565b6040826003926103469452601d60205220016108f6565b9061293782610fcb565b61294460405191826108d4565b8281528092612955601f1991610fcb565b0190602036910137565b80600052601d60205261297960046040600020015461080c565b612991575060405161298a8161085c565b6000815290565b600052601d60205261034660046040600020016108f6565b3d156129d4573d906129ba82610fcb565b916129c860405193846108d4565b82523d6000602084013e565b606090565b600881101561192057600a0190600090565b6040519061240080830183811067ffffffffffffffff82111761087857604052368337565b60405190600a6000835b60088210612a4257505050610100820182811067ffffffffffffffff82111761087857604052565b6001602081926001600160a01b03865416815201930191019091612a1a565b80518210156119205760209160051b010190565b612a86612a806129eb565b916133d4565b612a96612a91612a10565b613328565b612b3660165491612b31612b2c612ab56001600160a01b0386166132a7565b92612ad0612acb6013546001600160a01b031690565b6132a7565b96612ae6612acb6015546001600160a01b031690565b91612b1b612aff612acb6012546001600160a01b031690565b91612b15612acb6014546001600160a01b031690565b93612caf565b926001998a9960a01c8a0b94612df5565b612f95565b61301b565b60009081925b612b48575b5050505090565b8051831015612bca57612bb683612b83612b7a612b70612b69899887612a61565b5160010b90565b60209060010b0590565b60800160010b90565b8481870b12612bc3575b612bb19060ff908181890b13612bbc575b16612ba9838a612280565b9060ff169052565b61223a565b92612b3c565b5080612b9e565b5083612b8d565b612b41565b67ffffffffffffffff81116108785760051b60200190565b6040519062024020820182811067ffffffffffffffff82111761087857604052611200825262024000366020840137565b60405190612420820182811067ffffffffffffffff821117610878576040526101208252612400366020840137565b90612c5182612bcf565b612c5e60405191826108d4565b8281528092612955601f1991612bcf565b9060108110156119205760051b0190565b90816201b000019182126001166104f057565b919091600083820193841291129080158216911516176104f057565b91612cb8612be7565b9060005b61120080821015612d575760009081905b60108210612cf957505090612bb1612cf49260010b612cec8387612a61565b9060010b9052565b612cbc565b9091612d058389612c6f565b51828402918483048414851517156104f0578583018093116104f057612d45612d4b92612d38612b69612d51968d612a61565b90600191820b910b612dcb565b90612c93565b9261223a565b90612ccd565b50509250905090565b9081600c1b9180830561100014901517156104f057565b818102929160008212600160ff1b8214166104f05781840514901517156104f057565b8115612db557600160ff1b81146000198314166104f0570590565b634e487b7160e01b600052601260045260246000fd5b61100091612dd891612d77565b0590565b818103929160001380158285131691841216176104f057565b9092939194815192612e0684612c47565b9660c0809504956000805b888110612e25575050505050505050505090565b815b888110612e3d5750612e389061223a565b612e11565b80612e4783611518565b90612e5191612273565b8c8c612e5d838c612a61565b5160010b84612e6c818a612a61565b5160010b92612e7b828c612a61565b5160010b91612e8991612a61565b5160010b91612e98878d612a61565b5160010b93612ea691612ddc565b908c60010b612eb491612c93565b612ebd90612f14565b612ec691612f02565b90612ed091612dcb565b90612eda91612c93565b60010b91612ee791612a61565b90612ef4919060010b9052565b612efd9061223a565b612e27565b90612f0f61034692612d60565b612d9a565b6000808213156115a6578190805b60148210612f305750505090565b909192612f566002612f4e612f4884612f0f89612d60565b84612c93565b059182612ddc565b828112612f80576001905b12612f7957612f70909261223a565b90929192612f22565b9250505090565b600160ff1b81146104f0576001908303612f61565b8051612fa081612c47565b91600090815b838110612fb4575050505090565b80612fc2612fe39284612a61565b5184600191820b12600014612fe8575083612fdd8288612a61565b5261223a565b612fa6565b612ff28285612a61565b51900b612fdd8288612a61565b9060010b9060010b0190617fff198212617fff8313176104f057565b613023612c18565b9160005b6006811061306d5750505060005b81518110156130695780612bb161305a613055612b696130649587612a61565b613225565b612cec8386612a61565b613035565b5090565b60005b6004811061308757506130829061223a565b613027565b60005b60c081106130a1575061309c9061223a565b613070565b9095916130cd612b696130c784611b126130c28c611b12889d9c9b9d61152e565b611518565b86612a61565b936130d782611544565b976130e181611544565b9460005b60038082101561320b57908b929189898c8a8f6000985b868a1061311a575050505050505061311591925061223a565b6130e5565b896131288961312e93612273565b95612273565b92600c851080613201575b61315f575b5050505050509091926131509061223a565b92919089898c8f8f8c916130fc565b600195860b92508d60005b88811061317c575092508f955061313e565b80612bb188612cec8f6131e08f96611b12611b178e611b128f8f906131d48f6131fc9f6131da946131c86131ce93611b126131f59f8e611b12611b176130c293611b12612b699a611502565b90612a61565b60010b90565b90612dcb565b986114ec565b928d0b6131f0612b69858b612a61565b612fff565b9187612a61565b61316a565b5060088410613139565b5050985092909596945061322091935061223a565b61308a565b60010b6110009061324b8261323a8380612d77565b059161324583612c80565b90612d77565b90806009029060098205036104f05761326390612c80565b801561329f5761327291612d9a565b90808213613297575b50610fff1980821261328f575b5060010b90565b905038613288565b90503861327b565b505050600090565b6132b090613abd565b6132c181516001918291821c612c47565b926000915b6132d1575b50505090565b80518210156133235761ff006132e78383612229565b5160f01c166132fe6132f884612265565b83612229565b5160f81c17830b61331183851c86612a61565b52600282018092116104f057826132c6565b6132cb565b60405190600061333783610899565b62012000835262240000366020850137805b600882106133575750505090565b6133746001600160a01b0383600597949695971b870151166132a7565b916000915b83518310156133a957612d4b6133a391612bb1613399612b698789612a61565b612cec838a612a61565b91613379565b9394909592506133b9915061223a565b9091613349565b60010b60061b908160010b9182036104f057565b604051906133e1826108b7565b6102008092369037604051916133f6836108b7565b36833760019081805b6134095750505090565b6010808211613473578181039081116104f057613425906114ec565b6001600160801b038316901c60ff16830b607f1901617fff198112617fff8213176104f0578391612bb161345b61346d936133c0565b612cec613467846114dd565b89612c6f565b906133ff565b506132cb565b60019080821161350057613497816000526004602052604060002090565b549182156134b4575b5050600160e01b8116156103465780613500565b6000548210156135005790815b156134a057909150600019016134e1816000526004602052604060002090565b549182156134f9575050600160e01b81166135005790565b90816134c1565b7fdf2d9b420000000000000000000000000000000000000000000000000000000060005260046000fd5b91909161353682613479565b906001600160a01b038091169384828416036136c657600084815260066020526040902080546135756001600160a01b03881633908114908314171590565b61367d575b613673575b5061359d856001600160a01b03166000526005602052604060002090565b80546000190190556135c2816001600160a01b03166000526005602052604060002090565b8054600101905516928391600160e11b804260a01b8517176135ee866000526004602052604060002090565b55811615613629575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a41561362457565b61395f565b60018401613641816000526004602052604060002090565b541561364e575b506135f7565b60005481146136485761366b906000526004602052604060002090565b553880613648565b600090553861357f565b6136bc610b20610b19336136a48b6001600160a01b03166000526007602052604060002090565b906001600160a01b0316600052602052604060002090565b1561357a57613935565b61390b565b9291906136d982828661352a565b803b6136e55750505050565b6136ee9361373b565b156136fc573880808061250d565b7fd1a57ed60000000000000000000000000000000000000000000000000000000060005260046000fd5b908160209103126102165751610346816101ec565b91926020916137a09160006040519586809581947f150b7a02000000000000000000000000000000000000000000000000000000009a8b84523360048501526001600160a01b0380951660248501526044840152608060648401526084830190610310565b0393165af1600091816137f5575b506137cf576137bb6129a9565b8051156137ca57805190602001fd5b6136fc565b7fffffffff00000000000000000000000000000000000000000000000000000000161490565b61381791925060203d811161381e575b61380f81836108d4565b810190613726565b90386137ae565b503d613805565b60008054916138726001600160a01b03821691600160e11b4260a01b841717613858866000526004602052604060002090565b556001600160a01b03166000526005602052604060002090565b68010000000000000001815401905580156138e357600190818401939180805b61389e575b5050505055565b156138d2575b83818484877fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4613892565b809201918483036138a45780613897565b6004827f2e076300000000000000000000000000000000000000000000000000000000008152fd5b7fa11481000000000000000000000000000000000000000000000000000000000060005260046000fd5b7f59c896be0000000000000000000000000000000000000000000000000000000060005260046000fd5b7fea553b340000000000000000000000000000000000000000000000000000000060005260046000fd5b80516060929181613998575050565b9092506003906002938285820104851b92604051957f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f52603f916106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18835260208801938689019460208601956020838901019182519660048660009b8c87525b01928284518d828260121c165190538181600c1c1651600153818160061c16518b53165188538b518152019189831015613a5b576004908790613a1d565b50509650613d3d60f01b956040925201604052069004820352528252565b9081516001810161ffff8160401b6bfd61000080600a3d393df300179111840152600b8101601584016000f0928315613aaf5752565b63301164256000526004601cfd5b90813b918215613af35760016000198401916000601f6040519661ffe0603e82011688016040528588528701015260208501903c565b6311052bb46000526004601cfdfea264697066735822122009e04b5ac195776ef44e7d5e79aed9e087c02e28c543b20356b7ec5e57cdda7e64736f6c63430008140033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.