ETH Price: $3,464.97 (+1.47%)
Gas: 26 Gwei

Contract

0x52F1c81411CdCe3EB533B5985F654C3016a15EDA
 

Overview

ETH Balance

2.531897084756542888 ETH

Eth Value

$8,772.95 (@ $3,464.97/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...202239352024-07-03 5:36:3514 days ago1719984995IN
0x52F1c814...016a15EDA
0 ETH0.000105842.29558333
Mint202153182024-07-02 0:41:2315 days ago1719880883IN
0x52F1c814...016a15EDA
0.00005991 ETH0.000256312.79010911
Mint202153032024-07-02 0:38:2315 days ago1719880703IN
0x52F1c814...016a15EDA
0.0000488 ETH0.000365063.97401472
Mint202152802024-07-02 0:33:4715 days ago1719880427IN
0x52F1c814...016a15EDA
0.00003976 ETH0.000322772.96217682
Mint202060242024-06-30 17:34:2316 days ago1719768863IN
0x52F1c814...016a15EDA
0.0000346 ETH0.000329853.59071236
Mint202060132024-06-30 17:31:5916 days ago1719768719IN
0x52F1c814...016a15EDA
0.00002818 ETH0.000358323.90059671
Mint202059782024-06-30 17:24:4716 days ago1719768287IN
0x52F1c814...016a15EDA
0.00002296 ETH0.000315633.43588819
Mint202059732024-06-30 17:23:4716 days ago1719768227IN
0x52F1c814...016a15EDA
0.0000187 ETH0.000327493.56502479
Mint202059552024-06-30 17:20:1116 days ago1719768011IN
0x52F1c814...016a15EDA
0.00001523 ETH0.000311893.39517044
Mint202059452024-06-30 17:18:1116 days ago1719767891IN
0x52F1c814...016a15EDA
0.00001241 ETH0.000299653.26194564
Safe Transfer Fr...202014962024-06-30 2:23:4717 days ago1719714227IN
0x52F1c814...016a15EDA
0 ETH0.000134872.32581322
Mint200149352024-06-04 0:40:3543 days ago1717461635IN
0x52F1c814...016a15EDA
0.00003975 ETH0.000681846.2575684
Mint197476112024-04-27 15:38:3580 days ago1714232315IN
0x52F1c814...016a15EDA
0.00027037 ETH0.000212317.73740976
Mint197470302024-04-27 13:41:3581 days ago1714225295IN
0x52F1c814...016a15EDA
0.00022113 ETH0.00076046.97851712
Mint197470112024-04-27 13:37:4781 days ago1714225067IN
0x52F1c814...016a15EDA
0.00022116 ETH0.000193997.0696191
Mint196949182024-04-20 6:43:5988 days ago1713595439IN
0x52F1c814...016a15EDA
0.00026178 ETH0.000718617.82263296
Mint196949042024-04-20 6:41:1188 days ago1713595271IN
0x52F1c814...016a15EDA
0.00021324 ETH0.000734357.99395081
Mint196388552024-04-12 10:12:4796 days ago1712916767IN
0x52F1c814...016a15EDA
0.00031902 ETH0.0006942215.23225866
Mint196388482024-04-12 10:11:2396 days ago1712916683IN
0x52F1c814...016a15EDA
0.00031903 ETH0.0007510516.4791398
Safe Transfer Fr...195150702024-03-26 0:32:59113 days ago1711413179IN
0x52F1c814...016a15EDA
0 ETH0.0012476821.5151407
Set Approval For...191278092024-01-31 17:00:47167 days ago1706720447IN
0x52F1c814...016a15EDA
0 ETH0.0016889836.6302956
Mint191222742024-01-30 22:22:47168 days ago1706653367IN
0x52F1c814...016a15EDA
0.01070537 ETH0.0024652322.6243165
Mint191222712024-01-30 22:22:11168 days ago1706653331IN
0x52F1c814...016a15EDA
0.0107056 ETH0.0006544523.85045437
Mint190913172024-01-26 14:16:47173 days ago1706278607IN
0x52F1c814...016a15EDA
0.0108923 ETH0.0021462623.36354522
Mint190913132024-01-26 14:15:59173 days ago1706278559IN
0x52F1c814...016a15EDA
0.0088721 ETH0.0020850122.69677293
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
202153182024-07-02 0:41:2315 days ago1719880883
0x52F1c814...016a15EDA
0 ETH
202153032024-07-02 0:38:2315 days ago1719880703
0x52F1c814...016a15EDA
0 ETH
202152802024-07-02 0:33:4715 days ago1719880427
0x52F1c814...016a15EDA
0 ETH
202060242024-06-30 17:34:2316 days ago1719768863
0x52F1c814...016a15EDA
0 ETH
202060132024-06-30 17:31:5916 days ago1719768719
0x52F1c814...016a15EDA
0 ETH
202059782024-06-30 17:24:4716 days ago1719768287
0x52F1c814...016a15EDA
0 ETH
202059732024-06-30 17:23:4716 days ago1719768227
0x52F1c814...016a15EDA
0 ETH
202059552024-06-30 17:20:1116 days ago1719768011
0x52F1c814...016a15EDA
0 ETH
202059452024-06-30 17:18:1116 days ago1719767891
0x52F1c814...016a15EDA
0 ETH
200149352024-06-04 0:40:3543 days ago1717461635
0x52F1c814...016a15EDA
0 ETH
197470302024-04-27 13:41:3581 days ago1714225295
0x52F1c814...016a15EDA
0 ETH
196949182024-04-20 6:43:5988 days ago1713595439
0x52F1c814...016a15EDA
0 ETH
196949042024-04-20 6:41:1188 days ago1713595271
0x52F1c814...016a15EDA
0 ETH
191222742024-01-30 22:22:47168 days ago1706653367
0x52F1c814...016a15EDA
0.00000014 ETH
190913172024-01-26 14:16:47173 days ago1706278607
0x52F1c814...016a15EDA
0.00000014 ETH
190913132024-01-26 14:15:59173 days ago1706278559
0x52F1c814...016a15EDA
0.00000012 ETH
190913032024-01-26 14:13:59173 days ago1706278439
0x52F1c814...016a15EDA
0.00000004 ETH
190912472024-01-26 14:02:47173 days ago1706277767
0x52F1c814...016a15EDA
0.00000003 ETH
190912112024-01-26 13:55:35173 days ago1706277335
0x52F1c814...016a15EDA
0.00000003 ETH
190904332024-01-26 11:19:11173 days ago1706267951
0x52F1c814...016a15EDA
0.00000002 ETH
190904272024-01-26 11:17:59173 days ago1706267879
0x52F1c814...016a15EDA
0.00000002 ETH
190904252024-01-26 11:17:35173 days ago1706267855
0x52F1c814...016a15EDA
0.00000003 ETH
190904232024-01-26 11:17:11173 days ago1706267831
0x52F1c814...016a15EDA
0.00000002 ETH
190904172024-01-26 11:15:59173 days ago1706267759
0x52F1c814...016a15EDA
0.00000003 ETH
190903842024-01-26 11:08:59173 days ago1706267339
0x52F1c814...016a15EDA
0.00000002 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Mercurials

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 19 : Mercurials.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC721} from "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
import {Base64} from "openzeppelin-contracts/contracts/utils/Base64.sol";
import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol";
import {ReentrancyGuard} from "openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
import {LinearVRGDA} from "VRGDAs/LinearVRGDA.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {toDaysWadUnsafe} from "solmate/utils/SignedWadMath.sol";

/// @title Mercurials NFT
/// @author nvonpentz
/// @notice An on-chain generative art auction.
contract Mercurials is ERC721, LinearVRGDA, ReentrancyGuard {
    // ====================== TYPES ======================
    using Strings for uint256;

    // ============== PUBLIC STATE VARIABLES =============
    /// @notice The total number of tokens sold, also used as the next token ID
    uint256 public totalSold;

    /// @notice The time at which the auction started
    uint256 public immutable startTime = block.timestamp;

    /// @notice The seed used to generate the token's attributes
    mapping(uint256 => uint256) public seeds;

    // ==================== CONSTANTS ====================
    uint256 private constant BASE_FREQUENCY_MIN = 30;
    uint256 private constant BASE_FREQUENCY_MAX = 301;
    uint256 private constant NUM_OCTAVES_MIN = 1;
    uint256 private constant NUM_OCTAVES_MAX = 6;
    uint256 private constant SVG_SEED_MIN = 0;
    // Note: 65535 is the max value for the seed attribute of
    // the feTurbulence SVG element.
    uint256 private constant SVG_SEED_MAX = 65536;
    uint256 private constant SCALE_MIN = 0;
    uint256 private constant SCALE_MAX = 151;
    uint256 private constant SCALE_DELTA_MIN = 0;
    uint256 private constant SCALE_DELTA_MAX = 201;
    uint256 private constant SCALE_ANIMATION_MIN = 1;
    uint256 private constant SCALE_ANIMATION_MAX = 61;
    uint256 private constant KEY_TIME_MIN = 4;
    uint256 private constant KEY_TIME_MAX = 7;
    uint256 private constant HUE_ROTATE_ANIMATION_MIN = 1;
    uint256 private constant HUE_ROTATE_ANIMATION_MAX = 21;
    uint256 private constant K4_MIN = 0;
    uint256 private constant K4_MAX = 76;
    uint256 private constant INVERT_ELEVATION_MIN = 30;
    uint256 private constant INVERT_ELEVATION_MAX = 91;
    uint256 private constant INVERT_SURFACE_SCALE_MIN = 1;
    uint256 private constant INVERT_SURFACE_SCALE_MAX = 31;
    uint256 private constant STANDARD_ONE_DIFFUSE_CONSTANT_MIN = 1;
    uint256 private constant STANDARD_ONE_DIFFUSE_CONSTANT_MAX = 15;
    uint256 private constant STANDARD_TWO_ELEVATION_MIN = 0;
    uint256 private constant STANDARD_TWO_ELEVATION_MAX = 31;
    uint256 private constant STANDARD_TWO_SURFACE_SCALE_MIN = 1;
    uint256 private constant STANDARD_TWO_SURFACE_SCALE_MAX = 31;
    uint256 private constant ROTATION_MIN = 0;
    uint256 private constant ROTATION_MAX = 2;

    // ===================== EVENTS =====================
    event TokenMinted(
        uint256 indexed tokenId,
        address indexed owner,
        uint256 price
    );

    // ===================== ERRORS =====================
    error InvalidBlockHash();
    error InvalidTokenId();
    error InsufficientFunds();
    error TokenDoesNotExist();

    // ================== CONSTRUCTOR ===================
    // @notice Sets the VRGDA parameters, and the ERC721 name and symbol
    constructor()
        ERC721("Mercurials", "MERC")
        LinearVRGDA(
            // Target price, 0.00001 Ether
            0.00001e18,
            // Price decay percent, 5%
            0.05e18,
            // Per time unit, 0.25 tokens a day, or 1 token every four days
            0.25e18
        )
    {}

    // ============== EXTERNAL FUNCTIONS ================
    /// @notice Mints a new token
    /// @param tokenId The token ID to mint
    /// @param blockHash The hash of the parent block number rounded down
    /// to the nearest multiple of 5
    function mint(
        uint256 tokenId,
        bytes32 blockHash
    ) external payable nonReentrant {
        // Require that the user-supplied block hash matches the expected block hash
        // because otherwise the user would get an unexpected token.
        if (
            blockHash !=
            blockhash((block.number - 1) - ((block.number - 1) % 5))
        ) {
            revert InvalidBlockHash();
        }

        // Require that the user-supplied token ID matches the expected token ID
        // value because otherwise user would get an unexpected token.
        // Use totalSoldMemory memory variable to prevent multiple reads from state.
        uint256 totalSoldMemory = totalSold;
        if (tokenId != totalSoldMemory) {
            revert InvalidTokenId();
        }

        // Ensure enough funds were sent.
        uint256 price = getVRGDAPrice(
            toDaysWadUnsafe(block.timestamp - startTime),
            totalSoldMemory
        );
        if (msg.value < price) {
            revert InsufficientFunds();
        }

        // Mint the NFT.
        _mint(msg.sender, tokenId);
        emit TokenMinted(tokenId, msg.sender, price);
        totalSold += 1;
        seeds[tokenId] = generateSeed(tokenId);

        // Refund the user any ETH they spent over the current price of the NFT.
        if (msg.value > price) {
            SafeTransferLib.safeTransferETH(msg.sender, msg.value - price);
        }
    }

    /// @notice Returns information about the token up for auction.
    /// @dev This function should be called using the `pending` block tag.
    /// @dev The id and blockHash should be passed as arguments to the `mint` function.
    /// @return id The token ID of the next token
    /// @return uri The token URI of the next token
    /// @return price The price of the next token
    /// @return blockHash The hash of the parent block number rounded down to
    /// the nearest multiple of 5
    /// @return ttl The time to live, in blocks, of the next token
    function nextToken()
        external
        view
        returns (
            uint256 id,
            string memory uri,
            uint256 price,
            bytes32 blockHash,
            uint256 ttl
        )
    {
        // The ID of the next token will be also be the totalSold.
        id = totalSold;

        // Generate the token URI using the seed.
        uri = generateTokenUri(generateSeed(id), id);

        // Calculate the current price according to VRGDA rules.
        price = getVRGDAPrice(toDaysWadUnsafe(block.timestamp - startTime), id);

        // Calculate the block hash corresponding to the next token.
        blockHash = blockhash((block.number - 1) - ((block.number - 1) % 5));

        // Calculate the time to live of the token.
        ttl = 5 - ((block.number - 1) % 5);

        return (id, uri, price, blockHash, ttl);
    }

    // =============== PUBLIC FUNCTIONS =================
    // @notice Returns the token URI for a given token ID
    function tokenURI(
        uint256 tokenId
    ) public view override returns (string memory) {
        if (!_exists(tokenId)) {
            revert TokenDoesNotExist();
        }
        return generateTokenUri(seeds[tokenId], tokenId);
    }

    // =============== INTERNAL FUNCTIONS ================
    /// @notice Generates the seed for a given token ID
    /// @param tokenId The token ID to generate the seed for
    /// @return seed The seed for the given token ID
    function generateSeed(uint256 tokenId) internal view returns (uint256) {
        // Seed is calculated as the hash of the current token ID combined with the parent
        // block rounded down to the nearest 5. This ensures that the seed is
        // the same for 5 blocks.
        return
            uint256(
                keccak256(
                    abi.encodePacked(
                        blockhash(
                            (block.number - 1) - ((block.number - 1) % 5)
                        ),
                        tokenId
                    )
                )
            );
    }

    /// @notice Generates a pseudo-random number from min (inclusive) to max (exclusive)
    /// @dev Callers must ensure that min < max
    /// @param seed The seed to use for the random number (the same across multiple calls)
    /// @param nonce The nonce to use for the random number (different between calls)
    function generateRandom(
        uint256 min,
        uint256 max,
        uint256 seed,
        uint256 nonce
    ) internal pure returns (uint256 random, uint256) {
        uint256 rand = uint256(keccak256(abi.encodePacked(seed, nonce)));
        nonce++;
        return ((rand % (max - min)) + min, nonce);
    }

    /// @notice Generates a random value that is either true or false
    /// @param seed The seed to use for the random number (the same across multiple calls)
    /// @param nonce The nonce to use for the random number (different between calls)
    function generateRandomBool(
        uint256 seed,
        uint256 nonce
    ) internal pure returns (bool, uint256) {
        uint256 rand = uint256(keccak256(abi.encodePacked(seed, nonce)));
        nonce++;
        return (rand % 2 == 0, nonce);
    }

    /// @notice Returns a string representation of a signed integer
    function intToString(
        uint256 value,
        bool isNegative
    ) internal pure returns (string memory) {
        if (isNegative && value != 0) {
            return string.concat("-", value.toString());
        }
        return value.toString();
    }

    /// @notice Generates the opening svg tag, opening filter tag, and
    /// the feTurbulence element
    function generateSvgOpenAndFeTurbulenceElement(
        uint256 seed,
        uint256 nonce
    )
        internal
        pure
        returns (string memory element, string memory attributes, uint256)
    {
        // Generate a random value to use for the baseFrequency attribute.
        uint256 random;
        (random, nonce) = generateRandom(
            BASE_FREQUENCY_MIN,
            BASE_FREQUENCY_MAX,
            seed,
            nonce
        );
        string memory baseFrequency;
        if (random < 100) {
            baseFrequency = string.concat("0.00", random.toString());
        } else {
            baseFrequency = string.concat("0.0", random.toString());
        }

        // Generate a random value to use for the numOctaves attribute.
        string memory numOctaves;
        (random, nonce) = generateRandom(
            NUM_OCTAVES_MIN,
            NUM_OCTAVES_MAX,
            seed,
            nonce
        );
        numOctaves = random.toString();

        // Generate a random value to use for the seed attribute of the SVG.
        string memory seedForSvg;
        (random, nonce) = generateRandom(
            SVG_SEED_MIN,
            SVG_SEED_MAX,
            seed,
            nonce
        );
        seedForSvg = random.toString();

        // Create the SVG element
        element = string.concat(
            '<svg width="350" height="350" version="1.1" viewBox="0 0 350 350" xmlns="http://www.w3.org/2000/svg"><filter id="a"><feTurbulence baseFrequency="',
            baseFrequency,
            '" numOctaves="',
            numOctaves,
            '" seed="',
            seedForSvg,
            '" />'
        );

        // Create the attributes
        attributes = string.concat(
            '{ "trait_type": "Base Frequency", "value": "',
            baseFrequency,
            '" }, { "trait_type": "Octaves", "value": "',
            numOctaves,
            '" }, '
        );

        return (element, attributes, nonce);
    }

    /// @notice Generates the scale values for the feDisplacementMap SVG element
    function generateScale(
        uint256 seed,
        uint256 nonce
    ) internal pure returns (string memory scaleValues, uint256) {
        // Generate a random start value.
        uint256 start;
        bool startNegative;
        (start, nonce) = generateRandom(SCALE_MIN, SCALE_MAX, seed, nonce);
        (startNegative, nonce) = generateRandomBool(seed, nonce);

        // Generate a negative or positive delta value to add
        // to the start value to get the middle value.
        uint256 delta;
        bool deltaNegative;
        (delta, nonce) = generateRandom(
            SCALE_DELTA_MIN,
            SCALE_DELTA_MAX,
            seed,
            nonce
        );
        (deltaNegative, nonce) = generateRandomBool(seed, nonce);

        // Based on the start and delta values, add start and delta together to
        // get the middle value.
        uint256 end;
        bool endNegative;
        if (startNegative == deltaNegative) {
            end = start + delta;
            endNegative = startNegative;
        } else {
            if (start > delta) {
                end = start - delta;
                endNegative = startNegative;
            } else {
                end = delta - start;
                endNegative = deltaNegative;
            }
        }

        // Convert the start value to a string representation.
        string memory scaleStart = intToString(start, startNegative);

        // Concatenate the start, middle, and end values of the scale animation.
        scaleValues = string.concat(
            scaleStart,
            ";",
            intToString(end, endNegative),
            ";",
            scaleStart,
            ";"
        );

        return (scaleValues, nonce);
    }

    /// @notice Generates feDisplacementMap SVG element
    function generateFeDisplacementMapElement(
        uint256 seed,
        uint256 nonce
    )
        internal
        pure
        returns (string memory element, string memory attributes, uint256)
    {
        // Generate scale values for the animation.
        string memory scaleValues;
        (scaleValues, nonce) = generateScale(seed, nonce);

        // Generate a random value for the scale animation duration in seconds.
        uint256 random;
        (random, nonce) = generateRandom(
            SCALE_ANIMATION_MIN,
            SCALE_ANIMATION_MAX,
            seed,
            nonce
        );

        // Convert to string and append 's' to represent seconds in the SVG.
        string memory animationDuration = string.concat(random.toString(), "s");

        // Generate a random number to be the middle keyTime value.
        (random, nonce) = generateRandom(
            KEY_TIME_MIN,
            KEY_TIME_MAX,
            seed,
            nonce
        );
        string memory keyTime = string.concat("0.", random.toString());

        element = string.concat(
            '<feDisplacementMap><animate attributeName="scale" values="',
            scaleValues,
            '" keyTimes="0; ',
            keyTime,
            '; 1" dur="',
            animationDuration,
            '" repeatCount="indefinite" calcMode="spline" keySplines="0.3 0 0.7 1; 0.3 0 0.7 1"/></feDisplacementMap>'
        );

        attributes = string.concat(
            '{ "trait_type": "Scale", "value": "',
            scaleValues,
            '" }, { "trait_type": "Scale Animation", "value": "',
            animationDuration,
            '" }, { "trait_type": "Key Time", "value": "',
            keyTime,
            '" }, '
        );
        return (element, attributes, nonce);
    }

    /// @notice Generates the feColorMatrix element used for the rotation animation
    function generateFeColorMatrixElements(
        uint256 seed,
        uint256 nonce
    )
        internal
        pure
        returns (string memory element, string memory attributes, uint256)
    {
        // Generate a value to be the duration of the animation
        uint256 random;
        (random, nonce) = generateRandom(
            HUE_ROTATE_ANIMATION_MIN,
            HUE_ROTATE_ANIMATION_MAX,
            seed,
            nonce
        );
        string memory animationDuration = random.toString();

        // Create the feColorMatrix element with the <animate> element inside.
        element = string.concat(
            '<feColorMatrix type="hueRotate" result="b"><animate attributeName="values" from="0" to="360" dur="',
            animationDuration,
            's" repeatCount="indefinite"/></feColorMatrix><feColorMatrix type="matrix" result="c" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"/>'
        );

        // Save the animation duration.
        attributes = string.concat(
            '{ "trait_type": "Hue Rotate Animation", "value": "',
            animationDuration,
            's" }, '
        );

        return (element, attributes, nonce);
    }

    /// @notice Generates feComposite elements
    function generateFeCompositeElements(
        uint256 seed,
        uint256 nonce
    )
        internal
        pure
        returns (string memory elements, string memory attributes, uint256)
    {
        // Generate a random value for the k4 attribute.
        uint256 random;
        (random, nonce) = generateRandom(K4_MIN, K4_MAX, seed, nonce);
        string memory k4;
        if (random < 10) {
            k4 = string.concat("0.0", random.toString());
        } else {
            k4 = string.concat("0.", random.toString());
        }

        // Make k4 negative half the time.
        bool randomBool;
        (randomBool, nonce) = generateRandomBool(seed, nonce);
        if (randomBool && random != 0) {
            k4 = string.concat("-", k4);
        }

        // Randomly choose either "out" or "in" for the operator attribute.
        string memory operator;
        (randomBool, nonce) = generateRandomBool(seed, nonce);
        if (randomBool) {
            operator = "out";
        } else {
            operator = "in";
        }

        // Create the feComposite elements.
        elements = string.concat(
            '<feComposite in="b" in2="c" operator="',
            operator,
            '" result="d"/><feComposite in="d" in2="d" operator="arithmetic" k1="1" k2="1" k3="1" k4="',
            k4,
            '"/>'
        );

        // Create the attributes.
        attributes = string.concat(
            '{ "trait_type": "K4", "value": "',
            k4,
            '" }, { "trait_type": "Composite Operator", "value": "',
            operator,
            '" }, '
        );

        return (elements, attributes, nonce);
    }

    /// @notice Generates the feDiffuseLighting and feColorMatrix SVG elements.
    function generateLightingAndColorElements(
        uint256 seed,
        uint256 nonce
    )
        internal
        pure
        returns (string memory element, string memory attributes, uint256)
    {
        uint256 random;
        string memory elevation;
        string memory surfaceScale;
        string memory diffuseConstant;

        // Determine whether the colors should be inverted.
        bool invert;
        (invert, nonce) = generateRandomBool(seed, nonce);
        if (invert) {
            // Generate elevation.
            (random, nonce) = generateRandom(
                INVERT_ELEVATION_MIN,
                INVERT_ELEVATION_MAX,
                seed,
                nonce
            );
            elevation = random.toString();

            // Generate surface scale.
            (random, nonce) = generateRandom(
                INVERT_SURFACE_SCALE_MIN,
                INVERT_SURFACE_SCALE_MAX,
                seed,
                nonce
            );
            surfaceScale = random.toString();

            // Set diffuse constant.
            diffuseConstant = "1";
        } else {
            // Use two strategies for non-inverted case, randomly choose one.
            bool randomBool;
            (randomBool, nonce) = generateRandomBool(seed, nonce);
            if (randomBool) {
                // Strategy 1
                // Elevation is always 1.
                elevation = "1";

                // Surface scale is always 1.
                surfaceScale = "1";

                // Generate diffuse constant before and after the decimal.
                (random, nonce) = generateRandom(
                    STANDARD_ONE_DIFFUSE_CONSTANT_MIN,
                    STANDARD_ONE_DIFFUSE_CONSTANT_MAX,
                    seed,
                    nonce
                );
                diffuseConstant = random.toString();
                (random, nonce) = generateRandom(0, 100, seed, nonce);
                diffuseConstant = string.concat(
                    diffuseConstant,
                    ".",
                    random.toString()
                );
            } else {
                // Strategy 2
                // Generate elevation.
                (random, nonce) = generateRandom(
                    STANDARD_TWO_ELEVATION_MIN,
                    STANDARD_TWO_ELEVATION_MAX,
                    seed,
                    nonce
                );
                elevation = random.toString();

                // Generate surface scale.
                (random, nonce) = generateRandom(
                    STANDARD_TWO_SURFACE_SCALE_MIN,
                    STANDARD_TWO_SURFACE_SCALE_MAX,
                    seed,
                    nonce
                );
                surfaceScale = random.toString();

                // Diffuse constant is always 1.
                diffuseConstant = "1";
            }
        }

        // Create the feDiffuseLighting element.
        element = string.concat(
            '<feDiffuseLighting lighting-color="#fff" diffuseConstant="',
            diffuseConstant,
            '" surfaceScale="',
            surfaceScale,
            '"><feDistantLight elevation="',
            elevation,
            '"/></feDiffuseLighting>',
            invert
                ? '<feColorMatrix type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"/>'
                : ""
        );

        // Create the attributes.
        attributes = string.concat(
            '{ "trait_type": "Diffuse Constant", "value": "',
            diffuseConstant,
            '" }, { "trait_type": "Surface Scale", "value": "',
            surfaceScale,
            '" }, { "trait_type": "Elevation", "value": "',
            elevation,
            '" }, ',
            '{ "trait_type": "Inverted", "value": ',
            invert ? "true" : "false",
            " }, "
        );

        return (element, attributes, nonce);
    }

    /// @notice Generates the main rect element but also includes the closing filter
    /// and closing svg tags
    function generateRectAndSvgClose(
        uint256 seed,
        uint256 nonce
    )
        internal
        pure
        returns (string memory element, string memory attributes, uint256)
    {
        // Generate the rotation.
        uint256 rotation;
        (rotation, nonce) = generateRandom(
            ROTATION_MIN,
            ROTATION_MAX,
            seed,
            nonce
        );
        rotation = rotation * 90;
        element = string.concat(
            '</filter><rect width="350" height="350" filter="url(#a)" transform="rotate(',
            rotation.toString(),
            ' 175 175)"/></svg>'
        );

        attributes = string.concat(
            '{ "trait_type": "Rotation", "value": "',
            rotation.toString(),
            '" } ' // No comma here because this is the last attribute.
        );
        return (element, attributes, nonce);
    }

    function generateSvg(
        uint256 seed
    ) internal pure returns (string memory svg, string memory attributes) {
        // Nonce is used to generate random numbers and is incremented after
        // each use.
        uint256 nonce;

        // Use block scoping to avoid stack too deep errors.
        {
            // Generate the feTurbulence element.
            string memory svgOpenAndFeTurbulenceElement;
            string memory feTurbulenceAttributes;
            (
                svgOpenAndFeTurbulenceElement,
                feTurbulenceAttributes,
                nonce
            ) = generateSvgOpenAndFeTurbulenceElement(seed, nonce);

            // Generate the feDisplacementMap element.
            string memory feDisplacementMapElement;
            string memory feDisplacementMapAttributes;
            (
                feDisplacementMapElement,
                feDisplacementMapAttributes,
                nonce
            ) = generateFeDisplacementMapElement(seed, nonce);

            // Concatenate the two elements with the SVG opening tag, and filter tag.
            svg = string.concat(
                svgOpenAndFeTurbulenceElement,
                feDisplacementMapElement
            );

            // Concatenate the attributes.
            attributes = string.concat(
                feTurbulenceAttributes,
                feDisplacementMapAttributes
            );
        }

        // Generate the feColorMatrix element.
        string memory feColorMatrixElements;
        string memory feColorMatrixAttributes;
        (
            feColorMatrixElements,
            feColorMatrixAttributes,
            nonce
        ) = generateFeColorMatrixElements(seed, nonce);

        // Generate the feComposite elements.
        string memory feCompositeElements;
        string memory feCompositeAttributes;
        (
            feCompositeElements,
            feCompositeAttributes,
            nonce
        ) = generateFeCompositeElements(seed, nonce);

        // Generate the lighting and color elements.
        string memory lightingAndColorElements;
        string memory lightingAndColorAttributes;
        (
            lightingAndColorElements,
            lightingAndColorAttributes,
            nonce
        ) = generateLightingAndColorElements(seed, nonce);

        // Generate the rect and svg close elements.
        string memory rectAndSvgClose;
        string memory rectAttributes;
        (rectAndSvgClose, rectAttributes, nonce) = generateRectAndSvgClose(
            seed,
            nonce
        );

        // Concatenate all the SVG elements creating the complete SVG.
        svg = string.concat(
            svg,
            feColorMatrixElements,
            feCompositeElements,
            lightingAndColorElements,
            rectAndSvgClose
        );

        // Concatenate all the attributes.
        attributes = string.concat(
            attributes,
            feColorMatrixAttributes,
            feCompositeAttributes,
            lightingAndColorAttributes,
            rectAttributes
        );

        return (svg, attributes);
    }

    /// @notice Generates the token URI for a given token ID
    function generateTokenUri(
        uint256 seed,
        uint256 tokenId
    ) internal pure returns (string memory tokenUri) {
        // Generate the SVG markup.
        (string memory svg, string memory attributes) = generateSvg(seed);

        // Create the token URI by base64 encoding the SVG markup, creating the
        // JSON metadata, and then base64 encoding that as a data URI.
        tokenUri = string.concat(
            "data:application/json;base64,",
            Base64.encode(
                bytes(
                    string.concat(
                        '{ "name": "Mercurial #',
                        tokenId.toString(),
                        '", "description": "Abstract on-chain generative art", "image": "data:image/svg+xml;base64,',
                        Base64.encode(bytes(svg)),
                        '", "attributes": [ ',
                        attributes,
                        " ] }"
                    )
                )
            )
        );

        return tokenUri;
    }
}

File 2 of 19 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @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, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

File 3 of 19 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 4 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 5 of 19 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 6 of 19 : LinearVRGDA.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import {unsafeWadDiv} from "solmate/utils/SignedWadMath.sol";

import {VRGDA} from "./VRGDA.sol";

/// @title Linear Variable Rate Gradual Dutch Auction
/// @author transmissions11 <[email protected]>
/// @author FrankieIsLost <[email protected]>
/// @notice VRGDA with a linear issuance curve.
abstract contract LinearVRGDA is VRGDA {
    /*//////////////////////////////////////////////////////////////
                           PRICING PARAMETERS
    //////////////////////////////////////////////////////////////*/

    /// @dev The total number of tokens to target selling every full unit of time.
    /// @dev Represented as an 18 decimal fixed point number.
    int256 internal immutable perTimeUnit;

    /// @notice Sets pricing parameters for the VRGDA.
    /// @param _targetPrice The target price for a token if sold on pace, scaled by 1e18.
    /// @param _priceDecayPercent The percent price decays per unit of time with no sales, scaled by 1e18.
    /// @param _perTimeUnit The number of tokens to target selling in 1 full unit of time, scaled by 1e18.
    constructor(
        int256 _targetPrice,
        int256 _priceDecayPercent,
        int256 _perTimeUnit
    ) VRGDA(_targetPrice, _priceDecayPercent) {
        perTimeUnit = _perTimeUnit;
    }

    /*//////////////////////////////////////////////////////////////
                              PRICING LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @dev Given a number of tokens sold, return the target time that number of tokens should be sold by.
    /// @param sold A number of tokens sold, scaled by 1e18, to get the corresponding target sale time for.
    /// @return The target time the tokens should be sold by, scaled by 1e18, where the time is
    /// relative, such that 0 means the tokens should be sold immediately when the VRGDA begins.
    function getTargetSaleTime(int256 sold) public view virtual override returns (int256) {
        return unsafeWadDiv(sold, perTimeUnit);
    }
}

File 7 of 19 : SafeTransferLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

File 8 of 19 : SignedWadMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/// @notice Signed 18 decimal fixed point (wad) arithmetic library.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SignedWadMath.sol)
/// @author Modified from Remco Bloemen (https://xn--2-umb.com/22/exp-ln/index.html)

/// @dev Will not revert on overflow, only use where overflow is not possible.
function toWadUnsafe(uint256 x) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 1e18.
        r := mul(x, 1000000000000000000)
    }
}

/// @dev Takes an integer amount of seconds and converts it to a wad amount of days.
/// @dev Will not revert on overflow, only use where overflow is not possible.
/// @dev Not meant for negative second amounts, it assumes x is positive.
function toDaysWadUnsafe(uint256 x) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 1e18 and then divide it by 86400.
        r := div(mul(x, 1000000000000000000), 86400)
    }
}

/// @dev Takes a wad amount of days and converts it to an integer amount of seconds.
/// @dev Will not revert on overflow, only use where overflow is not possible.
/// @dev Not meant for negative day amounts, it assumes x is positive.
function fromDaysWadUnsafe(int256 x) pure returns (uint256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 86400 and then divide it by 1e18.
        r := div(mul(x, 86400), 1000000000000000000)
    }
}

/// @dev Will not revert on overflow, only use where overflow is not possible.
function unsafeWadMul(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by y and divide by 1e18.
        r := sdiv(mul(x, y), 1000000000000000000)
    }
}

/// @dev Will return 0 instead of reverting if y is zero and will
/// not revert on overflow, only use where overflow is not possible.
function unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Multiply x by 1e18 and divide it by y.
        r := sdiv(mul(x, 1000000000000000000), y)
    }
}

function wadMul(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Store x * y in r for now.
        r := mul(x, y)

        // Equivalent to require(x == 0 || (x * y) / x == y)
        if iszero(or(iszero(x), eq(sdiv(r, x), y))) {
            revert(0, 0)
        }

        // Scale the result down by 1e18.
        r := sdiv(r, 1000000000000000000)
    }
}

function wadDiv(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Store x * 1e18 in r for now.
        r := mul(x, 1000000000000000000)

        // Equivalent to require(y != 0 && ((x * 1e18) / 1e18 == x))
        if iszero(and(iszero(iszero(y)), eq(sdiv(r, 1000000000000000000), x))) {
            revert(0, 0)
        }

        // Divide r by y.
        r := sdiv(r, y)
    }
}

/// @dev Will not work with negative bases, only use when x is positive.
function wadPow(int256 x, int256 y) pure returns (int256) {
    // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)
    return wadExp((wadLn(x) * y) / 1e18); // Using ln(x) means x must be greater than 0.
}

function wadExp(int256 x) pure returns (int256 r) {
    unchecked {
        // When the result is < 0.5 we return zero. This happens when
        // x <= floor(log(0.5e18) * 1e18) ~ -42e18
        if (x <= -42139678854452767551) return 0;

        // When the result is > (2**255 - 1) / 1e18 we can not represent it as an
        // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.
        if (x >= 135305999368893231589) revert("EXP_OVERFLOW");

        // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96
        // for more intermediate precision and a binary basis. This base conversion
        // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.
        x = (x << 78) / 5**18;

        // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers
        // of two such that exp(x) = exp(x') * 2**k, where k is an integer.
        // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).
        int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;
        x = x - k * 54916777467707473351141471128;

        // k is in the range [-61, 195].

        // Evaluate using a (6, 7)-term rational approximation.
        // p is made monic, we'll multiply by a scale factor later.
        int256 y = x + 1346386616545796478920950773328;
        y = ((y * x) >> 96) + 57155421227552351082224309758442;
        int256 p = y + x - 94201549194550492254356042504812;
        p = ((p * y) >> 96) + 28719021644029726153956944680412240;
        p = p * x + (4385272521454847904659076985693276 << 96);

        // We leave p in 2**192 basis so we don't need to scale it back up for the division.
        int256 q = x - 2855989394907223263936484059900;
        q = ((q * x) >> 96) + 50020603652535783019961831881945;
        q = ((q * x) >> 96) - 533845033583426703283633433725380;
        q = ((q * x) >> 96) + 3604857256930695427073651918091429;
        q = ((q * x) >> 96) - 14423608567350463180887372962807573;
        q = ((q * x) >> 96) + 26449188498355588339934803723976023;

        /// @solidity memory-safe-assembly
        assembly {
            // Div in assembly because solidity adds a zero check despite the unchecked.
            // The q polynomial won't have zeros in the domain as all its roots are complex.
            // No scaling is necessary because p is already 2**96 too large.
            r := sdiv(p, q)
        }

        // r should be in the range (0.09, 0.25) * 2**96.

        // We now need to multiply r by:
        // * the scale factor s = ~6.031367120.
        // * the 2**k factor from the range reduction.
        // * the 1e18 / 2**96 factor for base conversion.
        // We do this all at once, with an intermediate result in 2**213
        // basis, so the final right shift is always by a positive amount.
        r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));
    }
}

function wadLn(int256 x) pure returns (int256 r) {
    unchecked {
        require(x > 0, "UNDEFINED");

        // We want to convert x from 10**18 fixed point to 2**96 fixed point.
        // We do this by multiplying by 2**96 / 10**18. But since
        // ln(x * C) = ln(x) + ln(C), we can simply do nothing here
        // and add ln(2**96 / 10**18) at the end.

        /// @solidity memory-safe-assembly
        assembly {
            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))
            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))
            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
            r := or(r, shl(4, lt(0xffff, shr(r, x))))
            r := or(r, shl(3, lt(0xff, shr(r, x))))
            r := or(r, shl(2, lt(0xf, shr(r, x))))
            r := or(r, shl(1, lt(0x3, shr(r, x))))
            r := or(r, lt(0x1, shr(r, x)))
        }

        // Reduce range of x to (1, 2) * 2**96
        // ln(2^k * x) = k * ln(2) + ln(x)
        int256 k = r - 96;
        x <<= uint256(159 - k);
        x = int256(uint256(x) >> 159);

        // Evaluate using a (8, 8)-term rational approximation.
        // p is made monic, we will multiply by a scale factor later.
        int256 p = x + 3273285459638523848632254066296;
        p = ((p * x) >> 96) + 24828157081833163892658089445524;
        p = ((p * x) >> 96) + 43456485725739037958740375743393;
        p = ((p * x) >> 96) - 11111509109440967052023855526967;
        p = ((p * x) >> 96) - 45023709667254063763336534515857;
        p = ((p * x) >> 96) - 14706773417378608786704636184526;
        p = p * x - (795164235651350426258249787498 << 96);

        // We leave p in 2**192 basis so we don't need to scale it back up for the division.
        // q is monic by convention.
        int256 q = x + 5573035233440673466300451813936;
        q = ((q * x) >> 96) + 71694874799317883764090561454958;
        q = ((q * x) >> 96) + 283447036172924575727196451306956;
        q = ((q * x) >> 96) + 401686690394027663651624208769553;
        q = ((q * x) >> 96) + 204048457590392012362485061816622;
        q = ((q * x) >> 96) + 31853899698501571402653359427138;
        q = ((q * x) >> 96) + 909429971244387300277376558375;
        /// @solidity memory-safe-assembly
        assembly {
            // Div in assembly because solidity adds a zero check despite the unchecked.
            // The q polynomial is known not to have zeros in the domain.
            // No scaling required because p is already 2**96 too large.
            r := sdiv(p, q)
        }

        // r is in the range (0, 0.125) * 2**96

        // Finalization, we need to:
        // * multiply by the scale factor s = 5.549…
        // * add ln(2**96 / 10**18)
        // * add k * ln(2)
        // * multiply by 10**18 / 2**96 = 5**18 >> 78

        // mul s * 5e18 * 2**96, base is now 5**18 * 2**192
        r *= 1677202110996718588342820967067443963516166;
        // add ln(2) * k * 5e18 * 2**192
        r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;
        // add ln(2**96 / 10**18) * 5e18 * 2**192
        r += 600920179829731861736702779321621459595472258049074101567377883020018308;
        // base conversion: mul 2**18 / 2**192
        r >>= 174;
    }
}

/// @dev Will return 0 instead of reverting if y is zero.
function unsafeDiv(int256 x, int256 y) pure returns (int256 r) {
    /// @solidity memory-safe-assembly
    assembly {
        // Divide x by y.
        r := sdiv(x, y)
    }
}

File 9 of 19 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 10 of 19 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 11 of 19 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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);
}

File 12 of 19 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 13 of 19 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 14 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 15 of 19 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 16 of 19 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 17 of 19 : VRGDA.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import {wadExp, wadLn, wadMul, unsafeWadMul, toWadUnsafe} from "solmate/utils/SignedWadMath.sol";

/// @title Variable Rate Gradual Dutch Auction
/// @author transmissions11 <[email protected]>
/// @author FrankieIsLost <[email protected]>
/// @notice Sell tokens roughly according to an issuance schedule.
abstract contract VRGDA {
    /*//////////////////////////////////////////////////////////////
                            VRGDA PARAMETERS
    //////////////////////////////////////////////////////////////*/

    /// @notice Target price for a token, to be scaled according to sales pace.
    /// @dev Represented as an 18 decimal fixed point number.
    int256 public immutable targetPrice;

    /// @dev Precomputed constant that allows us to rewrite a pow() as an exp().
    /// @dev Represented as an 18 decimal fixed point number.
    int256 internal immutable decayConstant;

    /// @notice Sets target price and per time unit price decay for the VRGDA.
    /// @param _targetPrice The target price for a token if sold on pace, scaled by 1e18.
    /// @param _priceDecayPercent The percent price decays per unit of time with no sales, scaled by 1e18.
    constructor(int256 _targetPrice, int256 _priceDecayPercent) {
        targetPrice = _targetPrice;

        decayConstant = wadLn(1e18 - _priceDecayPercent);

        // The decay constant must be negative for VRGDAs to work.
        require(decayConstant < 0, "NON_NEGATIVE_DECAY_CONSTANT");
    }

    /*//////////////////////////////////////////////////////////////
                              PRICING LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @notice Calculate the price of a token according to the VRGDA formula.
    /// @param timeSinceStart Time passed since the VRGDA began, scaled by 1e18.
    /// @param sold The total number of tokens that have been sold so far.
    /// @return The price of a token according to VRGDA, scaled by 1e18.
    function getVRGDAPrice(int256 timeSinceStart, uint256 sold) public view virtual returns (uint256) {
        unchecked {
            // prettier-ignore
            return uint256(wadMul(targetPrice, wadExp(unsafeWadMul(decayConstant,
                // Theoretically calling toWadUnsafe with sold can silently overflow but under
                // any reasonable circumstance it will never be large enough. We use sold + 1 as
                // the VRGDA formula's n param represents the nth token and sold is the n-1th token.
                timeSinceStart - getTargetSaleTime(toWadUnsafe(sold + 1))
            ))));
        }
    }

    /// @dev Given a number of tokens sold, return the target time that number of tokens should be sold by.
    /// @param sold A number of tokens sold, scaled by 1e18, to get the corresponding target sale time for.
    /// @return The target time the tokens should be sold by, scaled by 1e18, where the time is
    /// relative, such that 0 means the tokens should be sold immediately when the VRGDA begins.
    function getTargetSaleTime(int256 sold) public view virtual returns (int256);
}

File 18 of 19 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

File 19 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Settings
{
  "remappings": [
    "VRGDAs/=lib/VRGDAs/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidBlockHash","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","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":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"TokenMinted","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"sold","type":"int256"}],"name":"getTargetSaleTime","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"timeSinceStart","type":"int256"},{"internalType":"uint256","name":"sold","type":"uint256"}],"name":"getVRGDAPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextToken","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"internalType":"uint256","name":"ttl","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"seeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040524260e0523480156200001657600080fd5b506509184e72a00066b1a2bc2ec500006703782dace9d9000082826040518060400160405280600a8152602001694d657263757269616c7360b01b815250604051806040016040528060048152602001634d45524360e01b8152508160009081620000829190620003f1565b506001620000918282620003f1565b5050506080829052620000b7620000b182670de0b6b3a7640000620004bd565b62000123565b60a0819052600013620001115760405162461bcd60e51b815260206004820152601b60248201527f4e4f4e5f4e454741544956455f44454341595f434f4e5354414e54000000000060448201526064015b60405180910390fd5b505060c05250506001600655620004f3565b6000808213620001625760405162461bcd60e51b815260206004820152600960248201526815539111519253915160ba1b604482015260640162000108565b5060606001600160801b03821160071b82811c6001600160401b031060061b1782811c63ffffffff1060051b1782811c61ffff1060041b1782811c60ff10600390811b90911783811c600f1060021b1783811c909110600190811b90911783811c90911017609f81810383019390931b90921c6c465772b2bbbb5f824b15207a3081018102821d6d0388eaa27412d5aca026815d636e018102821d6d0df99ac502031bf953eff472fdcc018102821d6d13cdffb29d51d99322bdff5f2211018102821d6d0a0f742023def783a307a986912e018102821d6d01920d8043ca89b5239253284e42018102821d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7882018202831d6d0139601a2efabe717e604cbb4894018202831d6d02247f7a7b6594320649aa03aba1018202831d6c8c3f38e95a6b1ff2ab1c3b343619018202831d6d02384773bdf1ac5676facced60901901820290921d6cb9a025d814b29c212b8b1a07cd19010260016c0504a838426634cdd8738f543560611b03190105711340daa0d5f769dba1915cef59f0815a550602605f19919091017d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302017d57115e47018c7177eebf7cd370a3356a1b7863008a5ae8028c72b88642840160ae1d90565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200037757607f821691505b6020821081036200039857634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003ec57600081815260208120601f850160051c81016020861015620003c75750805b601f850160051c820191505b81811015620003e857828155600101620003d3565b5050505b505050565b81516001600160401b038111156200040d576200040d6200034c565b62000425816200041e845462000362565b846200039e565b602080601f8311600181146200045d5760008415620004445750858301515b600019600386901b1c1916600185901b178555620003e8565b600085815260208120601f198616915b828110156200048e578886015182559484019460019091019084016200046d565b5085821015620004ad5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8181036000831280158383131683831282161715620004ec57634e487b7160e01b600052601160045260246000fd5b5092915050565b60805160a05160c05160e0516143d16200054260003960008181610300015281816108c70152610c5201526000610b2c01526000610e400152600081816103e50152610e1901526143d16000f3fe60806040526004361061016a5760003560e01c806378e97925116100cb578063b88d4fde1161007f578063e985e9c511610059578063e985e9c514610407578063f0503e801461045d578063f466d4ab1461048a57600080fd5b8063b88d4fde14610393578063c87b56dd146103b3578063dc38679c146103d357600080fd5b80639499ac54116100b05780639499ac541461033857806395d89b411461035e578063a22cb4651461037357600080fd5b806378e97925146102ee5780639106d7ba1461032257600080fd5b806323b872dd116101225780636352211e116101075780636352211e146102805780636d9d33b7146102a057806370a08231146102ce57600080fd5b806323b872dd1461024057806342842e0e1461026057600080fd5b8063081812fc11610153578063081812fc146101c6578063095ea7b31461020b5780631801fbe51461022d57600080fd5b806301ffc9a71461016f57806306fdde03146101a4575b600080fd5b34801561017b57600080fd5b5061018f61018a366004612c0c565b6104aa565b60405190151581526020015b60405180910390f35b3480156101b057600080fd5b506101b961058f565b60405161019b9190612c97565b3480156101d257600080fd5b506101e66101e1366004612caa565b610621565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b34801561021757600080fd5b5061022b610226366004612cec565b610655565b005b61022b61023b366004612d16565b610811565b34801561024c57600080fd5b5061022b61025b366004612d38565b6109e0565b34801561026c57600080fd5b5061022b61027b366004612d38565b610a81565b34801561028c57600080fd5b506101e661029b366004612caa565b610a9c565b3480156102ac57600080fd5b506102c06102bb366004612caa565b610b28565b60405190815260200161019b565b3480156102da57600080fd5b506102c06102e9366004612d74565b610b5c565b3480156102fa57600080fd5b506102c07f000000000000000000000000000000000000000000000000000000000000000081565b34801561032e57600080fd5b506102c060075481565b34801561034457600080fd5b5061034d610c2a565b60405161019b959493929190612d8f565b34801561036a57600080fd5b506101b9610cd9565b34801561037f57600080fd5b5061022b61038e366004612dc5565b610ce8565b34801561039f57600080fd5b5061022b6103ae366004612e30565b610cf3565b3480156103bf57600080fd5b506101b96103ce366004612caa565b610d9b565b3480156103df57600080fd5b506102c07f000000000000000000000000000000000000000000000000000000000000000081565b34801561041357600080fd5b5061018f610422366004612f2a565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561046957600080fd5b506102c0610478366004612caa565b60086020526000908152604090205481565b34801561049657600080fd5b506102c06104a5366004612d16565b610e12565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061053d57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061058957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60606000805461059e90612f5d565b80601f01602080910402602001604051908101604052809291908181526020018280546105ca90612f5d565b80156106175780601f106105ec57610100808354040283529160200191610617565b820191906000526020600020905b8154815290600101906020018083116105fa57829003601f168201915b5050505050905090565b600061062c82610e97565b5060009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b600061066082610a9c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff82161480610776575073ffffffffffffffffffffffffffffffffffffffff8116600090815260056020908152604080832033845290915290205460ff165b610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610719565b61080c8383610f25565b505050565b610819610fc5565b6005610826600143612fdf565b6108309190613021565b61083b600143612fdf565b6108459190612fdf565b40811461087e576040517f3e068cb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007548281146108ba576040517f3f6cc76800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006109076109016108ec7f000000000000000000000000000000000000000000000000000000000000000042612fdf565b62015180670de0b6b3a7640000919091020490565b83610e12565b905080341015610943576040517f356680b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61094d3385611038565b604051818152339085907f2d03118aa776f7008445f6ca8490a6782ede2db364d741513555ba656ab1879f9060200160405180910390a36001600760008282546109979190613035565b909155506109a690508461125d565b600085815260086020526040902055348110156109d0576109d0336109cb8334612fdf565b6112da565b50506109dc6001600655565b5050565b6109ea338261134f565b610a76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610719565b61080c83838361140f565b61080c83838360405180602001604052806000815250610cf3565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610719565b60007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000830205610589565b600073ffffffffffffffffffffffffffffffffffffffff8216610c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610719565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b600754606060008080610c45610c3f8661125d565b8661170a565b9350610c7d610c776108ec7f000000000000000000000000000000000000000000000000000000000000000042612fdf565b86610e12565b92506005610c8c600143612fdf565b610c969190613021565b610ca1600143612fdf565b610cab9190612fdf565b4091506005610cbb600143612fdf565b610cc59190613021565b610cd0906005612fdf565b90509091929394565b60606001805461059e90612f5d565b6109dc338383611781565b610cfd338361134f565b610d89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610719565b610d95848484846118ae565b50505050565b60008181526002602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16610df9576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260086020526040902054610589908361170a565b6000610e907f0000000000000000000000000000000000000000000000000000000000000000610e8b610e867f0000000000000000000000000000000000000000000000000000000000000000610e75670de0b6b3a76400006001890102610b28565b8803670de0b6b3a764000091020590565b611951565b611b90565b9392505050565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610719565b50565b600081815260046020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091558190610f7f82610a9c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600260065403611031576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610719565b6002600655565b73ffffffffffffffffffffffffffffffffffffffff82166110b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610719565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1615611141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610719565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16156111cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610719565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260036020908152604080832080546001019055848352600290915280822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600561126c600143612fdf565b6112769190613021565b611281600143612fdf565b61128b9190612fdf565b60408051914060208301528101839052606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012092915050565b600080600080600085875af190508061080c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610719565b60008061135b83610a9c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806113c9575073ffffffffffffffffffffffffffffffffffffffff80821660009081526005602090815260408083209388168352929052205460ff165b8061140757508373ffffffffffffffffffffffffffffffffffffffff166113ef84610621565b73ffffffffffffffffffffffffffffffffffffffff16145b949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1661142f82610a9c565b73ffffffffffffffffffffffffffffffffffffffff16146114d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610719565b73ffffffffffffffffffffffffffffffffffffffff8216611574576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610719565b8273ffffffffffffffffffffffffffffffffffffffff1661159482610a9c565b73ffffffffffffffffffffffffffffffffffffffff1614611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610719565b600081815260046020908152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915573ffffffffffffffffffffffffffffffffffffffff8781168086526003855283862080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b606060008061171885611bb5565b9150915061175861172885611ce2565b61173184611da0565b8360405160200161174493929190613064565b604051602081830303815290604052611da0565b604051602001611768919061319a565b6040516020818303038152906040529250505092915050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611816576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610719565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6118b984848461140f565b6118c584848484611ef3565b610d95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610719565b60007ffffffffffffffffffffffffffffffffffffffffffffffffdb731c958f34d94c1821361198257506000919050565b680755bf798b4a1bf1e582126119f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4558505f4f564552464c4f5700000000000000000000000000000000000000006044820152606401610719565b6503782dace9d9604e83901b059150600060606bb17217f7d1cf79abc9e3b39884821b056b80000000000000000000000001901d6bb17217f7d1cf79abc9e3b39881029093037fffffffffffffffffffffffffffffffffffffffdbf3ccf1604d263450f02a550481018102606090811d6d0277594991cfc85f6e2461837cd9018202811d7fffffffffffffffffffffffffffffffffffffe5adedaa1cb095af9e4da10e363c018202811d6db1bbb201f443cf962f1a1d3db4a5018202811d7ffffffffffffffffffffffffffffffffffffd38dc772608b0ae56cce01296c0eb018202811d6e05180bb14799ab47a8a8cb2a527d57016d02d16720577bd19bf614176fe9ea6c10fe68e7fd37d0007b713f765084018402831d9081019084017ffffffffffffffffffffffffffffffffffffffe2c69812cf03b0763fd454a8f7e010290911d6e0587f503bb6ea29d25fcb7401964500190910279d835ebba824c98fb31b83b2ca45c000000000000000000000000010574029d9dc38563c32e5c2f6dc192ee70ef65f9978af30260c3939093039290921c92915050565b8181028215838205831417611ba457600080fd5b670de0b6b3a7640000900592915050565b6060806000606080611bc786846120e6565b94509092509050606080611bdb8886612218565b6040519097509193509150611bf690859084906020016131df565b60405160208183030381529060405296508281604051602001611c1a9291906131df565b604051602081830303815290604052955050505050606080611c3c86846122e6565b94509092509050606080611c508886612377565b96509092509050606080611c648a886124f5565b98509092509050606080611c788c8a61280c565b604051909b509193509150611c99908c908a9089908890879060200161320e565b6040516020818303038152906040529a508987868584604051602001611cc395949392919061320e565b6040516020818303038152906040529950505050505050505050915091565b60606000611cef836128ac565b600101905060008167ffffffffffffffff811115611d0f57611d0f612e01565b6040519080825280601f01601f191660200182016040528015611d39576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084611d4357509392505050565b60608151600003611dbf57505060408051602081019091526000815290565b600060405180606001604052806040815260200161435c6040913990506000600384516002611dee9190613035565b611df89190613279565b611e0390600461328d565b67ffffffffffffffff811115611e1b57611e1b612e01565b6040519080825280601f01601f191660200182016040528015611e45576020820181803683370190505b509050600182016020820185865187015b80821015611eb1576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250611e56565b5050600386510660018114611ecd5760028114611ee057611ee8565b603d6001830353603d6002830353611ee8565b603d60018303535b509195945050505050565b600073ffffffffffffffffffffffffffffffffffffffff84163b156120db576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290611f6a9033908990889088906004016132a4565b6020604051808303816000875af1925050508015611fc3575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611fc0918101906132ed565b60015b612090573d808015611ff1576040519150601f19603f3d011682016040523d82523d6000602084013e611ff6565b606091505b508051600003612088576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610719565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611407565b506001949350505050565b6060806000806120fb601e61012d888861298e565b95509050606060648210156121395761211382611ce2565b604051602001612123919061330a565b6040516020818303038152906040529050612164565b61214282611ce2565b604051602001612152919061334f565b60405160208183030381529060405290505b6060612174600160068a8a61298e565b9750925061218183611ce2565b905060606121956000620100008b8b61298e565b985093506121a284611ce2565b90508282826040516020016121b993929190613394565b604051602081830303815290604052965082826040516020016121dd929190613518565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190529699969850505050505050565b606080600060606122298686612a21565b95509050600061223d6001603d898961298e565b96509050600061224c82611ce2565b60405160200161225c919061360f565b604051602081830303815290604052905061227b600460078a8a61298e565b97509150600061228a83611ce2565b60405160200161229a9190613650565b60405160208183030381529060405290508381836040516020016122c093929190613695565b60405160208183030381529060405296508382826040516020016121dd93929190613817565b6060806000806122fa60016015888861298e565b95509050600061230982611ce2565b90508060405160200161231c9190613973565b60405160208183030381529060405294508060405160200161233e9190613ae9565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152919052949794965050505050565b60608060008061238b6000604c888861298e565b955090506060600a8210156123c9576123a382611ce2565b6040516020016123b3919061334f565b60405160208183030381529060405290506123f4565b6123d282611ce2565b6040516020016123e29190613650565b60405160208183030381529060405290505b60006124008888612b17565b9750905080801561241057508215155b1561243857816040516020016124269190613b7b565b60405160208183030381529060405291505b60606124448989612b17565b985091508115612488575060408051808201909152600381527f6f7574000000000000000000000000000000000000000000000000000000000060208201526124be565b5060408051808201909152600281527f696e00000000000000000000000000000000000000000000000000000000000060208201525b80836040516020016124d1929190613bc0565b604051602081830303815290604052965082816040516020016121dd929190613cdd565b6060806000806060806060600061250c8a8a612b17565b99509050801561258d57612524601e605b8c8c61298e565b9950945061253185611ce2565b93506125416001601f8c8c61298e565b9950945061254e85611ce2565b92506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525091506126e8565b60006125998b8b612b17565b9a5090508015612673576040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525094506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525093506126216001600f8d8d61298e565b9a50955061262e86611ce2565b925061263e600060648d8d61298e565b9a5095508261264c87611ce2565b60405160200161265d929190613daf565b60405160208183030381529060405292506126e6565b6126816000601f8d8d61298e565b9a50955061268e86611ce2565b945061269e6001601f8d8d61298e565b9a5095506126ab86611ce2565b93506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525092505b505b81838583612705576040518060200160405280600081525061271f565b60405180608001604052806052815260200161430a605291395b6040516020016127329493929190613e07565b604051602081830303815290604052975081838583612786576040518060400160405280600581526020017f66616c73650000000000000000000000000000000000000000000000000000008152506127bd565b6040518060400160405280600481526020017f74727565000000000000000000000000000000000000000000000000000000008152505b6040516020016127d09493929190613f2c565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152919052979a97995050505050505050565b60608060008061282060006002888861298e565b9550905061282f81605a61328d565b905061283a81611ce2565b60405160200161284a9190614108565b604051602081830303815290604052935061286481611ce2565b60405160200161287491906141c0565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190529396939550505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106128f5577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310612921576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061293f57662386f26fc10000830492506010015b6305f5e1008310612957576305f5e100830492506008015b612710831061296b57612710830492506004015b6064831061297d576064830492506002015b600a83106105895760010192915050565b600080600084846040516020016129af929190918252602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209050836129f181614252565b9450879050612a008188612fdf565b612a0a9083613021565b612a149190613035565b9793965092945050505050565b60606000806000612a3660006097888861298e565b95509150612a448686612b17565b95509050600080612a588160c98a8a61298e565b97509150612a668888612b17565b9750905060008082151585151503612a8c57612a828487613035565b9150849050612aae565b83861115612a9e57612a828487612fdf565b612aa88685612fdf565b91508290505b6000612aba8787612b93565b905080612ac78484612b93565b82604051602001612ada9392919061428a565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190529b999a50505050505050505050565b60008060008484604051602001612b38929190918252602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120905083612b7a81614252565b9450612b899050600282613021565b1595939450505050565b6060818015612ba157508215155b15612bd557612baf83611ce2565b604051602001612bbf9190613b7b565b6040516020818303038152906040529050610589565b610e9083611ce2565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610f2257600080fd5b600060208284031215612c1e57600080fd5b8135610e9081612bde565b60005b83811015612c44578181015183820152602001612c2c565b50506000910152565b60008151808452612c65816020860160208601612c29565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610e906020830184612c4d565b600060208284031215612cbc57600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114612ce757600080fd5b919050565b60008060408385031215612cff57600080fd5b612d0883612cc3565b946020939093013593505050565b60008060408385031215612d2957600080fd5b50508035926020909101359150565b600080600060608486031215612d4d57600080fd5b612d5684612cc3565b9250612d6460208501612cc3565b9150604084013590509250925092565b600060208284031215612d8657600080fd5b610e9082612cc3565b85815260a060208201526000612da860a0830187612c4d565b604083019590955250606081019290925260809091015292915050565b60008060408385031215612dd857600080fd5b612de183612cc3565b915060208301358015158114612df657600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060008060808587031215612e4657600080fd5b612e4f85612cc3565b9350612e5d60208601612cc3565b925060408501359150606085013567ffffffffffffffff80821115612e8157600080fd5b818701915087601f830112612e9557600080fd5b813581811115612ea757612ea7612e01565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715612eed57612eed612e01565b816040528281528a6020848701011115612f0657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215612f3d57600080fd5b612f4683612cc3565b9150612f5460208401612cc3565b90509250929050565b600181811c90821680612f7157607f821691505b602082108103612faa577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561058957610589612fb0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261303057613030612ff2565b500690565b8082018082111561058957610589612fb0565b6000815161305a818560208601612c29565b9290920192915050565b7f7b20226e616d65223a20224d657263757269616c20230000000000000000000081526000845161309c816016850160208901612c29565b7f222c20226465736372697074696f6e223a20224162737472616374206f6e2d636016918401918201527f6861696e2067656e6572617469766520617274222c2022696d616765223a202260368201527f646174613a696d6167652f7376672b786d6c3b6261736536342c00000000000060568201528451613125816070840160208901612c29565b7f222c202261747472696275746573223a205b2000000000000000000000000000607092909101918201528351613163816083840160208801612c29565b7f205d207d000000000000000000000000000000000000000000000000000000006083929091019182015260870195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516131d281601d850160208701612c29565b91909101601d0192915050565b600083516131f1818460208801612c29565b835190830190613205818360208801612c29565b01949350505050565b60008651613220818460208b01612c29565b865190830190613234818360208b01612c29565b8651910190613247818360208a01612c29565b855191019061325a818360208901612c29565b845191019061326d818360208801612c29565b01979650505050505050565b60008261328857613288612ff2565b500490565b808202811582820484141761058957610589612fb0565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526132e36080830184612c4d565b9695505050505050565b6000602082840312156132ff57600080fd5b8151610e9081612bde565b7f302e303000000000000000000000000000000000000000000000000000000000815260008251613342816004850160208701612c29565b9190910160040192915050565b7f302e300000000000000000000000000000000000000000000000000000000000815260008251613387816003850160208701612c29565b9190910160030192915050565b7f3c7376672077696474683d2233353022206865696768743d223335302220766581527f7273696f6e3d22312e31222076696577426f783d22302030203335302033353060208201527f2220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f60408201527f737667223e3c66696c7465722069643d2261223e3c666554757262756c656e6360608201527f6520626173654672657175656e63793d22000000000000000000000000000000608082015260008451613464816091850160208901612c29565b7f22206e756d4f6374617665733d2200000000000000000000000000000000000060919184019182015284516134a181609f840160208901612c29565b7f2220736565643d22000000000000000000000000000000000000000000000000609f929091019182015283516134df8160a7840160208801612c29565b0161350c60a782017f22202f3e000000000000000000000000000000000000000000000000000000009052565b60ab0195945050505050565b7f7b202274726169745f74797065223a202242617365204672657175656e63792281527f2c202276616c7565223a2022000000000000000000000000000000000000000060208201526000835161357681602c850160208801612c29565b7f22207d2c207b202274726169745f74797065223a20224f637461766573222c20602c918401918201527f2276616c7565223a202200000000000000000000000000000000000000000000604c82015283516135d9816056840160208801612c29565b7f22207d2c2000000000000000000000000000000000000000000000000000000060569290910191820152605b01949350505050565b60008251613621818460208701612c29565b7f7300000000000000000000000000000000000000000000000000000000000000920191825250600101919050565b7f302e000000000000000000000000000000000000000000000000000000000000815260008251613688816002850160208701612c29565b9190910160020192915050565b7f3c6665446973706c6163656d656e744d61703e3c616e696d617465206174747281527f69627574654e616d653d227363616c65222076616c7565733d220000000000006020820152600084516136f381603a850160208901612c29565b7f22206b657954696d65733d22303b200000000000000000000000000000000000603a918401918201528451613730816049840160208901612c29565b7f3b203122206475723d220000000000000000000000000000000000000000000060499290910191820152835161376e816053840160208801612c29565b7f2220726570656174436f756e743d22696e646566696e697465222063616c634d605392909101918201527f6f64653d2273706c696e6522206b657953706c696e65733d22302e332030203060738201527f2e3720313b20302e33203020302e372031222f3e3c2f6665446973706c61636560938201527f6d656e744d61703e00000000000000000000000000000000000000000000000060b382015260bb0195945050505050565b7f7b202274726169745f74797065223a20225363616c65222c202276616c75652281527f3a20220000000000000000000000000000000000000000000000000000000000602082015260008451613875816023850160208901612c29565b7f22207d2c207b202274726169745f74797065223a20225363616c6520416e696d6023918401918201527f6174696f6e222c202276616c7565223a20220000000000000000000000000000604382015284516138d8816055840160208901612c29565b7f22207d2c207b202274726169745f74797065223a20224b65792054696d65222c605592909101918201527f202276616c7565223a20220000000000000000000000000000000000000000006075820152835161393c816080840160208801612c29565b7f22207d2c200000000000000000000000000000000000000000000000000000006080929091019182015260850195945050505050565b7f3c6665436f6c6f724d617472697820747970653d22687565526f74617465222081527f726573756c743d2262223e3c616e696d617465206174747269627574654e616d60208201527f653d2276616c756573222066726f6d3d22302220746f3d22333630222064757260408201527f3d22000000000000000000000000000000000000000000000000000000000000606082015260008251613a1d816062850160208701612c29565b7f732220726570656174436f756e743d22696e646566696e697465222f3e3c2f6660629390910192830152507f65436f6c6f724d61747269783e3c6665436f6c6f724d6174726978207479706560828201527f3d226d61747269782220726573756c743d2263222076616c7565733d2230203060a28201527f203020302030203020302030203020302030203020302030203020312030203060c28201527f20302030222f3e0000000000000000000000000000000000000000000000000060e282015260e901919050565b7f7b202274726169745f74797065223a202248756520526f7461746520416e696d81527f6174696f6e222c202276616c7565223a20220000000000000000000000000000602082015260008251613b47816032850160208701612c29565b7f7322207d2c2000000000000000000000000000000000000000000000000000006032939091019283015250603801919050565b7f2d00000000000000000000000000000000000000000000000000000000000000815260008251613bb3816001850160208701612c29565b9190910160010192915050565b7f3c6665436f6d706f7369746520696e3d22622220696e323d226322206f70657281527f61746f723d220000000000000000000000000000000000000000000000000000602082015260008351613c1e816026850160208801612c29565b7f2220726573756c743d2264222f3e3c6665436f6d706f7369746520696e3d22646026918401918201527f2220696e323d226422206f70657261746f723d2261726974686d65746963222060468201527f6b313d223122206b323d223122206b333d223122206b343d220000000000000060668201528351613ca781607f840160208801612c29565b7f222f3e0000000000000000000000000000000000000000000000000000000000607f9290910191820152608201949350505050565b7f7b202274726169745f74797065223a20224b34222c202276616c7565223a2022815260008351613d15816020850160208801612c29565b80830190507f22207d2c207b202274726169745f74797065223a2022436f6d706f736974652060208201527f4f70657261746f72222c202276616c7565223a2022000000000000000000000060408201528351613d79816055840160208801612c29565b7f22207d2c2000000000000000000000000000000000000000000000000000000060559290910191820152605a01949350505050565b60008351613dc1818460208801612c29565b7f2e000000000000000000000000000000000000000000000000000000000000009083019081528351613dfb816001840160208801612c29565b01600101949350505050565b7f3c6665446966667573654c69676874696e67206c69676874696e672d636f6c6f81527f723d2223666666222064696666757365436f6e7374616e743d22000000000000602082015260008551613e6581603a850160208a01612c29565b7f2220737572666163655363616c653d2200000000000000000000000000000000603a918401918201528551613ea281604a840160208a01612c29565b7f223e3c666544697374616e744c6967687420656c65766174696f6e3d22000000604a92909101918201528451613ee0816067840160208901612c29565b7f222f3e3c2f6665446966667573654c69676874696e673e000000000000000000606792909101918201528351613f1e81607e840160208801612c29565b01607e019695505050505050565b7f7b202274726169745f74797065223a20224469666675736520436f6e7374616e81527f74222c202276616c7565223a2022000000000000000000000000000000000000602082015260008551613f8a81602e850160208a01612c29565b7f22207d2c207b202274726169745f74797065223a202253757266616365205363602e918401918201527f616c65222c202276616c7565223a202200000000000000000000000000000000604e8201528551613fed81605e840160208a01612c29565b7f22207d2c207b202274726169745f74797065223a2022456c65766174696f6e22605e92909101918201527f2c202276616c7565223a20220000000000000000000000000000000000000000607e820152845161405181608a840160208901612c29565b0161407e608a82017f22207d2c200000000000000000000000000000000000000000000000000000009052565b7f7b202274726169745f74797065223a2022496e766572746564222c202276616c608f8201527f7565223a2000000000000000000000000000000000000000000000000000000060af8201526140d760b4820185613048565b7f207d2c20000000000000000000000000000000000000000000000000000000008152600401979650505050505050565b7f3c2f66696c7465723e3c726563742077696474683d223335302220686569676881527f743d22333530222066696c7465723d2275726c2823612922207472616e73666f60208201527f726d3d22726f746174652800000000000000000000000000000000000000000060408201526000825161418c81604b850160208701612c29565b7f203137352031373529222f3e3c2f7376673e0000000000000000000000000000604b939091019283015250605d01919050565b7f7b202274726169745f74797065223a2022526f746174696f6e222c202276616c81527f7565223a2022000000000000000000000000000000000000000000000000000060208201526000825161421e816026850160208701612c29565b7f22207d20000000000000000000000000000000000000000000000000000000006026939091019283015250602a01919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361428357614283612fb0565b5060010190565b6000845161429c818460208901612c29565b80830190507f3b0000000000000000000000000000000000000000000000000000000000000080825285516142d8816001850160208a01612c29565b6001920191820181905284516142f5816002850160208901612c29565b60029201918201526003019594505050505056fe3c6665436f6c6f724d617472697820747970653d226d6174726978222076616c7565733d222d3120302030203020312030202d3120302030203120302030202d312030203120302030203020312030222f3e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122049e40dd70e658d694e633862a9b5b1866a434ab8fcedd5a85837f02f95cb44ce64736f6c63430008140033

Deployed Bytecode

0x60806040526004361061016a5760003560e01c806378e97925116100cb578063b88d4fde1161007f578063e985e9c511610059578063e985e9c514610407578063f0503e801461045d578063f466d4ab1461048a57600080fd5b8063b88d4fde14610393578063c87b56dd146103b3578063dc38679c146103d357600080fd5b80639499ac54116100b05780639499ac541461033857806395d89b411461035e578063a22cb4651461037357600080fd5b806378e97925146102ee5780639106d7ba1461032257600080fd5b806323b872dd116101225780636352211e116101075780636352211e146102805780636d9d33b7146102a057806370a08231146102ce57600080fd5b806323b872dd1461024057806342842e0e1461026057600080fd5b8063081812fc11610153578063081812fc146101c6578063095ea7b31461020b5780631801fbe51461022d57600080fd5b806301ffc9a71461016f57806306fdde03146101a4575b600080fd5b34801561017b57600080fd5b5061018f61018a366004612c0c565b6104aa565b60405190151581526020015b60405180910390f35b3480156101b057600080fd5b506101b961058f565b60405161019b9190612c97565b3480156101d257600080fd5b506101e66101e1366004612caa565b610621565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b34801561021757600080fd5b5061022b610226366004612cec565b610655565b005b61022b61023b366004612d16565b610811565b34801561024c57600080fd5b5061022b61025b366004612d38565b6109e0565b34801561026c57600080fd5b5061022b61027b366004612d38565b610a81565b34801561028c57600080fd5b506101e661029b366004612caa565b610a9c565b3480156102ac57600080fd5b506102c06102bb366004612caa565b610b28565b60405190815260200161019b565b3480156102da57600080fd5b506102c06102e9366004612d74565b610b5c565b3480156102fa57600080fd5b506102c07f00000000000000000000000000000000000000000000000000000000649226cf81565b34801561032e57600080fd5b506102c060075481565b34801561034457600080fd5b5061034d610c2a565b60405161019b959493929190612d8f565b34801561036a57600080fd5b506101b9610cd9565b34801561037f57600080fd5b5061022b61038e366004612dc5565b610ce8565b34801561039f57600080fd5b5061022b6103ae366004612e30565b610cf3565b3480156103bf57600080fd5b506101b96103ce366004612caa565b610d9b565b3480156103df57600080fd5b506102c07f000000000000000000000000000000000000000000000000000009184e72a00081565b34801561041357600080fd5b5061018f610422366004612f2a565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561046957600080fd5b506102c0610478366004612caa565b60086020526000908152604090205481565b34801561049657600080fd5b506102c06104a5366004612d16565b610e12565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061053d57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061058957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60606000805461059e90612f5d565b80601f01602080910402602001604051908101604052809291908181526020018280546105ca90612f5d565b80156106175780601f106105ec57610100808354040283529160200191610617565b820191906000526020600020905b8154815290600101906020018083116105fa57829003601f168201915b5050505050905090565b600061062c82610e97565b5060009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b600061066082610a9c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff82161480610776575073ffffffffffffffffffffffffffffffffffffffff8116600090815260056020908152604080832033845290915290205460ff165b610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610719565b61080c8383610f25565b505050565b610819610fc5565b6005610826600143612fdf565b6108309190613021565b61083b600143612fdf565b6108459190612fdf565b40811461087e576040517f3e068cb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007548281146108ba576040517f3f6cc76800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006109076109016108ec7f00000000000000000000000000000000000000000000000000000000649226cf42612fdf565b62015180670de0b6b3a7640000919091020490565b83610e12565b905080341015610943576040517f356680b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61094d3385611038565b604051818152339085907f2d03118aa776f7008445f6ca8490a6782ede2db364d741513555ba656ab1879f9060200160405180910390a36001600760008282546109979190613035565b909155506109a690508461125d565b600085815260086020526040902055348110156109d0576109d0336109cb8334612fdf565b6112da565b50506109dc6001600655565b5050565b6109ea338261134f565b610a76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610719565b61080c83838361140f565b61080c83838360405180602001604052806000815250610cf3565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610719565b60007f00000000000000000000000000000000000000000000000003782dace9d90000670de0b6b3a7640000830205610589565b600073ffffffffffffffffffffffffffffffffffffffff8216610c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610719565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b600754606060008080610c45610c3f8661125d565b8661170a565b9350610c7d610c776108ec7f00000000000000000000000000000000000000000000000000000000649226cf42612fdf565b86610e12565b92506005610c8c600143612fdf565b610c969190613021565b610ca1600143612fdf565b610cab9190612fdf565b4091506005610cbb600143612fdf565b610cc59190613021565b610cd0906005612fdf565b90509091929394565b60606001805461059e90612f5d565b6109dc338383611781565b610cfd338361134f565b610d89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610719565b610d95848484846118ae565b50505050565b60008181526002602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16610df9576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260086020526040902054610589908361170a565b6000610e907f000000000000000000000000000000000000000000000000000009184e72a000610e8b610e867fffffffffffffffffffffffffffffffffffffffffffffffffff49c50540aba6ba610e75670de0b6b3a76400006001890102610b28565b8803670de0b6b3a764000091020590565b611951565b611b90565b9392505050565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610719565b50565b600081815260046020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091558190610f7f82610a9c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600260065403611031576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610719565b6002600655565b73ffffffffffffffffffffffffffffffffffffffff82166110b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610719565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1615611141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610719565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16156111cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610719565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260036020908152604080832080546001019055848352600290915280822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600561126c600143612fdf565b6112769190613021565b611281600143612fdf565b61128b9190612fdf565b60408051914060208301528101839052606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012092915050565b600080600080600085875af190508061080c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152606401610719565b60008061135b83610a9c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806113c9575073ffffffffffffffffffffffffffffffffffffffff80821660009081526005602090815260408083209388168352929052205460ff165b8061140757508373ffffffffffffffffffffffffffffffffffffffff166113ef84610621565b73ffffffffffffffffffffffffffffffffffffffff16145b949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1661142f82610a9c565b73ffffffffffffffffffffffffffffffffffffffff16146114d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610719565b73ffffffffffffffffffffffffffffffffffffffff8216611574576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610719565b8273ffffffffffffffffffffffffffffffffffffffff1661159482610a9c565b73ffffffffffffffffffffffffffffffffffffffff1614611637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610719565b600081815260046020908152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915573ffffffffffffffffffffffffffffffffffffffff8781168086526003855283862080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b606060008061171885611bb5565b9150915061175861172885611ce2565b61173184611da0565b8360405160200161174493929190613064565b604051602081830303815290604052611da0565b604051602001611768919061319a565b6040516020818303038152906040529250505092915050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611816576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610719565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6118b984848461140f565b6118c584848484611ef3565b610d95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610719565b60007ffffffffffffffffffffffffffffffffffffffffffffffffdb731c958f34d94c1821361198257506000919050565b680755bf798b4a1bf1e582126119f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4558505f4f564552464c4f5700000000000000000000000000000000000000006044820152606401610719565b6503782dace9d9604e83901b059150600060606bb17217f7d1cf79abc9e3b39884821b056b80000000000000000000000001901d6bb17217f7d1cf79abc9e3b39881029093037fffffffffffffffffffffffffffffffffffffffdbf3ccf1604d263450f02a550481018102606090811d6d0277594991cfc85f6e2461837cd9018202811d7fffffffffffffffffffffffffffffffffffffe5adedaa1cb095af9e4da10e363c018202811d6db1bbb201f443cf962f1a1d3db4a5018202811d7ffffffffffffffffffffffffffffffffffffd38dc772608b0ae56cce01296c0eb018202811d6e05180bb14799ab47a8a8cb2a527d57016d02d16720577bd19bf614176fe9ea6c10fe68e7fd37d0007b713f765084018402831d9081019084017ffffffffffffffffffffffffffffffffffffffe2c69812cf03b0763fd454a8f7e010290911d6e0587f503bb6ea29d25fcb7401964500190910279d835ebba824c98fb31b83b2ca45c000000000000000000000000010574029d9dc38563c32e5c2f6dc192ee70ef65f9978af30260c3939093039290921c92915050565b8181028215838205831417611ba457600080fd5b670de0b6b3a7640000900592915050565b6060806000606080611bc786846120e6565b94509092509050606080611bdb8886612218565b6040519097509193509150611bf690859084906020016131df565b60405160208183030381529060405296508281604051602001611c1a9291906131df565b604051602081830303815290604052955050505050606080611c3c86846122e6565b94509092509050606080611c508886612377565b96509092509050606080611c648a886124f5565b98509092509050606080611c788c8a61280c565b604051909b509193509150611c99908c908a9089908890879060200161320e565b6040516020818303038152906040529a508987868584604051602001611cc395949392919061320e565b6040516020818303038152906040529950505050505050505050915091565b60606000611cef836128ac565b600101905060008167ffffffffffffffff811115611d0f57611d0f612e01565b6040519080825280601f01601f191660200182016040528015611d39576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084611d4357509392505050565b60608151600003611dbf57505060408051602081019091526000815290565b600060405180606001604052806040815260200161435c6040913990506000600384516002611dee9190613035565b611df89190613279565b611e0390600461328d565b67ffffffffffffffff811115611e1b57611e1b612e01565b6040519080825280601f01601f191660200182016040528015611e45576020820181803683370190505b509050600182016020820185865187015b80821015611eb1576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250611e56565b5050600386510660018114611ecd5760028114611ee057611ee8565b603d6001830353603d6002830353611ee8565b603d60018303535b509195945050505050565b600073ffffffffffffffffffffffffffffffffffffffff84163b156120db576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290611f6a9033908990889088906004016132a4565b6020604051808303816000875af1925050508015611fc3575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611fc0918101906132ed565b60015b612090573d808015611ff1576040519150601f19603f3d011682016040523d82523d6000602084013e611ff6565b606091505b508051600003612088576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610719565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611407565b506001949350505050565b6060806000806120fb601e61012d888861298e565b95509050606060648210156121395761211382611ce2565b604051602001612123919061330a565b6040516020818303038152906040529050612164565b61214282611ce2565b604051602001612152919061334f565b60405160208183030381529060405290505b6060612174600160068a8a61298e565b9750925061218183611ce2565b905060606121956000620100008b8b61298e565b985093506121a284611ce2565b90508282826040516020016121b993929190613394565b604051602081830303815290604052965082826040516020016121dd929190613518565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190529699969850505050505050565b606080600060606122298686612a21565b95509050600061223d6001603d898961298e565b96509050600061224c82611ce2565b60405160200161225c919061360f565b604051602081830303815290604052905061227b600460078a8a61298e565b97509150600061228a83611ce2565b60405160200161229a9190613650565b60405160208183030381529060405290508381836040516020016122c093929190613695565b60405160208183030381529060405296508382826040516020016121dd93929190613817565b6060806000806122fa60016015888861298e565b95509050600061230982611ce2565b90508060405160200161231c9190613973565b60405160208183030381529060405294508060405160200161233e9190613ae9565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152919052949794965050505050565b60608060008061238b6000604c888861298e565b955090506060600a8210156123c9576123a382611ce2565b6040516020016123b3919061334f565b60405160208183030381529060405290506123f4565b6123d282611ce2565b6040516020016123e29190613650565b60405160208183030381529060405290505b60006124008888612b17565b9750905080801561241057508215155b1561243857816040516020016124269190613b7b565b60405160208183030381529060405291505b60606124448989612b17565b985091508115612488575060408051808201909152600381527f6f7574000000000000000000000000000000000000000000000000000000000060208201526124be565b5060408051808201909152600281527f696e00000000000000000000000000000000000000000000000000000000000060208201525b80836040516020016124d1929190613bc0565b604051602081830303815290604052965082816040516020016121dd929190613cdd565b6060806000806060806060600061250c8a8a612b17565b99509050801561258d57612524601e605b8c8c61298e565b9950945061253185611ce2565b93506125416001601f8c8c61298e565b9950945061254e85611ce2565b92506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525091506126e8565b60006125998b8b612b17565b9a5090508015612673576040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525094506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525093506126216001600f8d8d61298e565b9a50955061262e86611ce2565b925061263e600060648d8d61298e565b9a5095508261264c87611ce2565b60405160200161265d929190613daf565b60405160208183030381529060405292506126e6565b6126816000601f8d8d61298e565b9a50955061268e86611ce2565b945061269e6001601f8d8d61298e565b9a5095506126ab86611ce2565b93506040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525092505b505b81838583612705576040518060200160405280600081525061271f565b60405180608001604052806052815260200161430a605291395b6040516020016127329493929190613e07565b604051602081830303815290604052975081838583612786576040518060400160405280600581526020017f66616c73650000000000000000000000000000000000000000000000000000008152506127bd565b6040518060400160405280600481526020017f74727565000000000000000000000000000000000000000000000000000000008152505b6040516020016127d09493929190613f2c565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018152919052979a97995050505050505050565b60608060008061282060006002888861298e565b9550905061282f81605a61328d565b905061283a81611ce2565b60405160200161284a9190614108565b604051602081830303815290604052935061286481611ce2565b60405160200161287491906141c0565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190529396939550505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000083106128f5577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310612921576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061293f57662386f26fc10000830492506010015b6305f5e1008310612957576305f5e100830492506008015b612710831061296b57612710830492506004015b6064831061297d576064830492506002015b600a83106105895760010192915050565b600080600084846040516020016129af929190918252602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209050836129f181614252565b9450879050612a008188612fdf565b612a0a9083613021565b612a149190613035565b9793965092945050505050565b60606000806000612a3660006097888861298e565b95509150612a448686612b17565b95509050600080612a588160c98a8a61298e565b97509150612a668888612b17565b9750905060008082151585151503612a8c57612a828487613035565b9150849050612aae565b83861115612a9e57612a828487612fdf565b612aa88685612fdf565b91508290505b6000612aba8787612b93565b905080612ac78484612b93565b82604051602001612ada9392919061428a565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00181529190529b999a50505050505050505050565b60008060008484604051602001612b38929190918252602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120905083612b7a81614252565b9450612b899050600282613021565b1595939450505050565b6060818015612ba157508215155b15612bd557612baf83611ce2565b604051602001612bbf9190613b7b565b6040516020818303038152906040529050610589565b610e9083611ce2565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610f2257600080fd5b600060208284031215612c1e57600080fd5b8135610e9081612bde565b60005b83811015612c44578181015183820152602001612c2c565b50506000910152565b60008151808452612c65816020860160208601612c29565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610e906020830184612c4d565b600060208284031215612cbc57600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114612ce757600080fd5b919050565b60008060408385031215612cff57600080fd5b612d0883612cc3565b946020939093013593505050565b60008060408385031215612d2957600080fd5b50508035926020909101359150565b600080600060608486031215612d4d57600080fd5b612d5684612cc3565b9250612d6460208501612cc3565b9150604084013590509250925092565b600060208284031215612d8657600080fd5b610e9082612cc3565b85815260a060208201526000612da860a0830187612c4d565b604083019590955250606081019290925260809091015292915050565b60008060408385031215612dd857600080fd5b612de183612cc3565b915060208301358015158114612df657600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060008060808587031215612e4657600080fd5b612e4f85612cc3565b9350612e5d60208601612cc3565b925060408501359150606085013567ffffffffffffffff80821115612e8157600080fd5b818701915087601f830112612e9557600080fd5b813581811115612ea757612ea7612e01565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715612eed57612eed612e01565b816040528281528a6020848701011115612f0657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215612f3d57600080fd5b612f4683612cc3565b9150612f5460208401612cc3565b90509250929050565b600181811c90821680612f7157607f821691505b602082108103612faa577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561058957610589612fb0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261303057613030612ff2565b500690565b8082018082111561058957610589612fb0565b6000815161305a818560208601612c29565b9290920192915050565b7f7b20226e616d65223a20224d657263757269616c20230000000000000000000081526000845161309c816016850160208901612c29565b7f222c20226465736372697074696f6e223a20224162737472616374206f6e2d636016918401918201527f6861696e2067656e6572617469766520617274222c2022696d616765223a202260368201527f646174613a696d6167652f7376672b786d6c3b6261736536342c00000000000060568201528451613125816070840160208901612c29565b7f222c202261747472696275746573223a205b2000000000000000000000000000607092909101918201528351613163816083840160208801612c29565b7f205d207d000000000000000000000000000000000000000000000000000000006083929091019182015260870195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516131d281601d850160208701612c29565b91909101601d0192915050565b600083516131f1818460208801612c29565b835190830190613205818360208801612c29565b01949350505050565b60008651613220818460208b01612c29565b865190830190613234818360208b01612c29565b8651910190613247818360208a01612c29565b855191019061325a818360208901612c29565b845191019061326d818360208801612c29565b01979650505050505050565b60008261328857613288612ff2565b500490565b808202811582820484141761058957610589612fb0565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526132e36080830184612c4d565b9695505050505050565b6000602082840312156132ff57600080fd5b8151610e9081612bde565b7f302e303000000000000000000000000000000000000000000000000000000000815260008251613342816004850160208701612c29565b9190910160040192915050565b7f302e300000000000000000000000000000000000000000000000000000000000815260008251613387816003850160208701612c29565b9190910160030192915050565b7f3c7376672077696474683d2233353022206865696768743d223335302220766581527f7273696f6e3d22312e31222076696577426f783d22302030203335302033353060208201527f2220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f60408201527f737667223e3c66696c7465722069643d2261223e3c666554757262756c656e6360608201527f6520626173654672657175656e63793d22000000000000000000000000000000608082015260008451613464816091850160208901612c29565b7f22206e756d4f6374617665733d2200000000000000000000000000000000000060919184019182015284516134a181609f840160208901612c29565b7f2220736565643d22000000000000000000000000000000000000000000000000609f929091019182015283516134df8160a7840160208801612c29565b0161350c60a782017f22202f3e000000000000000000000000000000000000000000000000000000009052565b60ab0195945050505050565b7f7b202274726169745f74797065223a202242617365204672657175656e63792281527f2c202276616c7565223a2022000000000000000000000000000000000000000060208201526000835161357681602c850160208801612c29565b7f22207d2c207b202274726169745f74797065223a20224f637461766573222c20602c918401918201527f2276616c7565223a202200000000000000000000000000000000000000000000604c82015283516135d9816056840160208801612c29565b7f22207d2c2000000000000000000000000000000000000000000000000000000060569290910191820152605b01949350505050565b60008251613621818460208701612c29565b7f7300000000000000000000000000000000000000000000000000000000000000920191825250600101919050565b7f302e000000000000000000000000000000000000000000000000000000000000815260008251613688816002850160208701612c29565b9190910160020192915050565b7f3c6665446973706c6163656d656e744d61703e3c616e696d617465206174747281527f69627574654e616d653d227363616c65222076616c7565733d220000000000006020820152600084516136f381603a850160208901612c29565b7f22206b657954696d65733d22303b200000000000000000000000000000000000603a918401918201528451613730816049840160208901612c29565b7f3b203122206475723d220000000000000000000000000000000000000000000060499290910191820152835161376e816053840160208801612c29565b7f2220726570656174436f756e743d22696e646566696e697465222063616c634d605392909101918201527f6f64653d2273706c696e6522206b657953706c696e65733d22302e332030203060738201527f2e3720313b20302e33203020302e372031222f3e3c2f6665446973706c61636560938201527f6d656e744d61703e00000000000000000000000000000000000000000000000060b382015260bb0195945050505050565b7f7b202274726169745f74797065223a20225363616c65222c202276616c75652281527f3a20220000000000000000000000000000000000000000000000000000000000602082015260008451613875816023850160208901612c29565b7f22207d2c207b202274726169745f74797065223a20225363616c6520416e696d6023918401918201527f6174696f6e222c202276616c7565223a20220000000000000000000000000000604382015284516138d8816055840160208901612c29565b7f22207d2c207b202274726169745f74797065223a20224b65792054696d65222c605592909101918201527f202276616c7565223a20220000000000000000000000000000000000000000006075820152835161393c816080840160208801612c29565b7f22207d2c200000000000000000000000000000000000000000000000000000006080929091019182015260850195945050505050565b7f3c6665436f6c6f724d617472697820747970653d22687565526f74617465222081527f726573756c743d2262223e3c616e696d617465206174747269627574654e616d60208201527f653d2276616c756573222066726f6d3d22302220746f3d22333630222064757260408201527f3d22000000000000000000000000000000000000000000000000000000000000606082015260008251613a1d816062850160208701612c29565b7f732220726570656174436f756e743d22696e646566696e697465222f3e3c2f6660629390910192830152507f65436f6c6f724d61747269783e3c6665436f6c6f724d6174726978207479706560828201527f3d226d61747269782220726573756c743d2263222076616c7565733d2230203060a28201527f203020302030203020302030203020302030203020302030203020312030203060c28201527f20302030222f3e0000000000000000000000000000000000000000000000000060e282015260e901919050565b7f7b202274726169745f74797065223a202248756520526f7461746520416e696d81527f6174696f6e222c202276616c7565223a20220000000000000000000000000000602082015260008251613b47816032850160208701612c29565b7f7322207d2c2000000000000000000000000000000000000000000000000000006032939091019283015250603801919050565b7f2d00000000000000000000000000000000000000000000000000000000000000815260008251613bb3816001850160208701612c29565b9190910160010192915050565b7f3c6665436f6d706f7369746520696e3d22622220696e323d226322206f70657281527f61746f723d220000000000000000000000000000000000000000000000000000602082015260008351613c1e816026850160208801612c29565b7f2220726573756c743d2264222f3e3c6665436f6d706f7369746520696e3d22646026918401918201527f2220696e323d226422206f70657261746f723d2261726974686d65746963222060468201527f6b313d223122206b323d223122206b333d223122206b343d220000000000000060668201528351613ca781607f840160208801612c29565b7f222f3e0000000000000000000000000000000000000000000000000000000000607f9290910191820152608201949350505050565b7f7b202274726169745f74797065223a20224b34222c202276616c7565223a2022815260008351613d15816020850160208801612c29565b80830190507f22207d2c207b202274726169745f74797065223a2022436f6d706f736974652060208201527f4f70657261746f72222c202276616c7565223a2022000000000000000000000060408201528351613d79816055840160208801612c29565b7f22207d2c2000000000000000000000000000000000000000000000000000000060559290910191820152605a01949350505050565b60008351613dc1818460208801612c29565b7f2e000000000000000000000000000000000000000000000000000000000000009083019081528351613dfb816001840160208801612c29565b01600101949350505050565b7f3c6665446966667573654c69676874696e67206c69676874696e672d636f6c6f81527f723d2223666666222064696666757365436f6e7374616e743d22000000000000602082015260008551613e6581603a850160208a01612c29565b7f2220737572666163655363616c653d2200000000000000000000000000000000603a918401918201528551613ea281604a840160208a01612c29565b7f223e3c666544697374616e744c6967687420656c65766174696f6e3d22000000604a92909101918201528451613ee0816067840160208901612c29565b7f222f3e3c2f6665446966667573654c69676874696e673e000000000000000000606792909101918201528351613f1e81607e840160208801612c29565b01607e019695505050505050565b7f7b202274726169745f74797065223a20224469666675736520436f6e7374616e81527f74222c202276616c7565223a2022000000000000000000000000000000000000602082015260008551613f8a81602e850160208a01612c29565b7f22207d2c207b202274726169745f74797065223a202253757266616365205363602e918401918201527f616c65222c202276616c7565223a202200000000000000000000000000000000604e8201528551613fed81605e840160208a01612c29565b7f22207d2c207b202274726169745f74797065223a2022456c65766174696f6e22605e92909101918201527f2c202276616c7565223a20220000000000000000000000000000000000000000607e820152845161405181608a840160208901612c29565b0161407e608a82017f22207d2c200000000000000000000000000000000000000000000000000000009052565b7f7b202274726169745f74797065223a2022496e766572746564222c202276616c608f8201527f7565223a2000000000000000000000000000000000000000000000000000000060af8201526140d760b4820185613048565b7f207d2c20000000000000000000000000000000000000000000000000000000008152600401979650505050505050565b7f3c2f66696c7465723e3c726563742077696474683d223335302220686569676881527f743d22333530222066696c7465723d2275726c2823612922207472616e73666f60208201527f726d3d22726f746174652800000000000000000000000000000000000000000060408201526000825161418c81604b850160208701612c29565b7f203137352031373529222f3e3c2f7376673e0000000000000000000000000000604b939091019283015250605d01919050565b7f7b202274726169745f74797065223a2022526f746174696f6e222c202276616c81527f7565223a2022000000000000000000000000000000000000000000000000000060208201526000825161421e816026850160208701612c29565b7f22207d20000000000000000000000000000000000000000000000000000000006026939091019283015250602a01919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361428357614283612fb0565b5060010190565b6000845161429c818460208901612c29565b80830190507f3b0000000000000000000000000000000000000000000000000000000000000080825285516142d8816001850160208a01612c29565b6001920191820181905284516142f5816002850160208901612c29565b60029201918201526003019594505050505056fe3c6665436f6c6f724d617472697820747970653d226d6174726978222076616c7565733d222d3120302030203020312030202d3120302030203120302030202d312030203120302030203020312030222f3e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122049e40dd70e658d694e633862a9b5b1866a434ab8fcedd5a85837f02f95cb44ce64736f6c63430008140033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.