POL Price: $0.595091 (-2.86%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TheGeneratesConfigurer

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, Audited
File 1 of 10 : TheGeneratesConfigurer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { TheGeneratesImplementation } from "./extensions/TheGeneratesImplementation.sol";

import { ConfigStructs } from "./types/DataTypes.sol";

import { IContractMetadata } from "./interfaces/IContractMetadata.sol";

import { ITheGenerates } from "./interfaces/ITheGenerates.sol";

import { IERC173 } from "./interfaces/IERC173.sol";

/*

$$$$$$$\            $$\         $$\            $$$$$$\    $$\                     $$\ $$\                     
$$  __$$\           $$ |        $$ |          $$  __$$\   $$ |                    $$ |\__|                    
$$ |  $$ | $$$$$$\  $$ |  $$\ $$$$$$\         $$ /  \__|$$$$$$\   $$\   $$\  $$$$$$$ |$$\  $$$$$$\   $$$$$$$\ 
$$$$$$$  |$$  __$$\ $$ | $$  |\_$$  _|        \$$$$$$\  \_$$  _|  $$ |  $$ |$$  __$$ |$$ |$$  __$$\ $$  _____|
$$  __$$< $$$$$$$$ |$$$$$$  /   $$ |           \____$$\   $$ |    f$$ |  $$ |$$ /  $$ |$$ |$$ /  $$ |\$$$$$$\  
$$ |  $$ |$$   ____|$$  _$$<    $$ |$$\       $$\   $$ |  $$ |$$\ $$ |  $$ |$$ |  $$ |$$ |$$ |  $$ | \____$$\ 
$$ |  $$ |\$$$$$$$\ $$ | \$$\   \$$$$  |      \$$$$$$  |  \$$$$  |\$$$$$$  |\$$$$$$$ |$$ |\$$$$$$  |$$$$$$$  |
\__|  \__| \_______|\__|  \__|   \____/        \______/    \____/  \______/  \_______|\__| \______/ \_______/   

*/

/**
 * @title  TheGeneratesConfigurer
 * @author decapitator (0xdecapitator.eth)
 * @notice A helper contract to configure TheGenerates parameters.
 */
contract TheGeneratesConfigurer is TheGeneratesImplementation {
    /**
     * @notice Revert with an error if the sender is not the owner
     *         of the token contract.
     */
    error Unauthorized();

    /**
     * @dev Reverts if the sender is not the owner of the token.
     *
     *      This is used as a function instead of a modifier
     *      to save contract space when used multiple times.
     */
    function _onlyOwner(address token) internal view {
        if (msg.sender != IERC173(token).owner()) {
            revert Unauthorized();
        }
    }

    /**
     * @notice Configure multiple properties at a time.
     *
     *         Only the owner of the token can use this function.
     *
     *         Note: The individual configure methods should be used
     *         to unset or reset any properties to zero, as this method
     *         will ignore zero-value properties in the config struct.
     *
     * @param token  TheGenerates contract address.
     * @param config The configuration struct.
     */
    function multiConfigure(
        address token,
        ConfigStructs.MultiConfigureStruct calldata config
    ) external {
        // Ensure the sender is the owner of the token.
        _onlyOwner(token);

        if (config.maxSupply != 0) {
            IContractMetadata(token).setMaxSupply(config.maxSupply);
        }
        if (bytes(config.baseURI).length != 0) {
            IContractMetadata(token).setBaseURI(config.baseURI);
        }
        if (bytes(config.contractURI).length != 0) {
            IContractMetadata(token).setContractURI(config.contractURI);
        }
        if (config.provenanceHash != bytes32(0)) {
            IContractMetadata(token).setProvenanceHash(config.provenanceHash);
        }
        if (
            _cast(config.royaltyReceiver != address(0)) &
                _cast(config.royaltyBps != 0) ==
            1
        ) {
            IContractMetadata(token).setDefaultRoyalty(
                config.royaltyReceiver,
                config.royaltyBps
            );
        }

        if (
            _cast(config.publicDrop.startTime != 0) &
                _cast(config.publicDrop.endTime != 0) ==
            1
        ) {
            ITheGenerates(address(token)).updatePublicDrop(config.publicDrop);
        }
        if (config.merkleRoot != bytes32(0)) {
            ITheGenerates(address(token)).updateAllowList(config.merkleRoot);
        }
        if (_cast(config.unseenPayout.payoutAddress != address(0)) == 1) {
            ITheGenerates(address(token)).updateUnseenPayout(
                config.unseenPayout
            );
        }
        if (config.allowedSigner != address(0)) {
            ITheGenerates(address(token)).updateSigner(config.allowedSigner);
        }
        if (config.paymentToken != address(0)) {
            ITheGenerates(address(token)).updatePaymentToken(
                config.paymentToken
            );
        }
        if (config.mintQuantity != 0) {
            ITheGenerates(token).multiConfigureMint(
                config.mintRecipient,
                config.mintQuantity
            );
        }
    }
}

/*

$$\   $$\                                                   
$$ |  $$ |                                                  
$$ |  $$ |$$$$$$$\   $$$$$$$\  $$$$$$\   $$$$$$\  $$$$$$$\  
$$ |  $$ |$$  __$$\ $$  _____|$$  __$$\ $$  __$$\ $$  __$$\ 
$$ |  $$ |$$ |  $$ |\$$$$$$\  $$$$$$$$ |$$$$$$$$ |$$ |  $$ |
$$ |  $$ |$$ |  $$ | \____$$\ $$   ____|$$   ____|$$ |  $$ |
\$$$$$$  |$$ |  $$ |$$$$$$$  |\$$$$$$$\ \$$$$$$$\ $$ |  $$ |
 \______/ \__|  \__|\_______/  \_______| \_______|\__|  \__|  
                           
*/

File 2 of 10 : TheGeneratesImplementation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { TheGeneratesStorage } from "../lib/TheGeneratesStorage.sol";

import { ConfigStructs } from "../types/DataTypes.sol";

import { ErrorsAndEvents } from "../lib/ErrorsAndEvents.sol";

import { ITheGenerates } from "../interfaces/ITheGenerates.sol";

import { ECDSA } from "solady/src/utils/ECDSA.sol";

import { SafeTransferLib } from "solady/src/utils/SafeTransferLib.sol";

/**
 * @title  TheGeneratesImplementation
 * @author decapitator (0xdecapitator.eth)
 * @notice A helper contract that contains the implementation logic for
 *         TheGenerates, to help reduce contract size
 *         on the token contract itself.
 */
contract TheGeneratesImplementation is ErrorsAndEvents {
    using TheGeneratesStorage for TheGeneratesStorage.Layout;

    /// @notice The original address of this contract, to ensure that it can
    ///         only be called into with delegatecall.
    address internal immutable _originalImplementation = address(this);

    /// @notice Internal constants for EIP-712: Typed structured
    ///         data hashing and signing
    bytes32 internal constant _SIGNED_MINT_TYPEHASH =
        // prettier-ignore
        keccak256(
            "SignedMint("
                "address minter,"
                "MintParams mintParams,"
                "uint256 salt"
            ")"
            "MintParams("
                "uint256 startPrice,"
                "uint256 endPrice,"
                "uint256 startTime,"
                "uint256 endTime,"
                "uint256 maxTokenSupplyForStage,"
                "uint256 dropStageIndex"
            ")"
        );
    bytes32 internal constant _MINT_PARAMS_TYPEHASH =
        // prettier-ignore
        keccak256(
            "MintParams("
                "uint256 startPrice,"
                "uint256 endPrice,"
                "uint256 startTime,"
                "uint256 endTime,"
                "uint256 maxTokenSupplyForStage,"
                "uint256 dropStageIndex"
            ")"
        );
    bytes32 internal constant _EIP_712_DOMAIN_TYPEHASH =
        // prettier-ignore
        keccak256(
            "EIP712Domain("
                "string name,"
                "string version,"
                "uint256 chainId,"
                "address verifyingContract"
            ")"
        );
    bytes32 internal constant _NAME_HASH = keccak256("TheGenerates");
    bytes32 internal constant _VERSION_HASH = keccak256("1.0");

    /**
     * @notice Constant for an unlimited `maxTokenSupplyForStage`.
     *         Used in `mintPublic` where no `maxTokenSupplyForStage`
     *         is stored in the `PublicDrop` struct.
     */
    uint256 internal constant _UNLIMITED_MAX_TOKEN_SUPPLY_FOR_STAGE =
        type(uint256).max;

    /**
     * @notice Constant for a public mint's `dropStageIndex`.
     *         Used in `mintPublic` where no `dropStageIndex`
     *         is stored in the `PublicDrop` struct.
     */
    uint256 internal constant _PUBLIC_DROP_STAGE_INDEX = 0;

    /**
     * @dev Constructor for contract deployment.
     */
    constructor() payable {}

    /**
     * @notice The fallback function is used as a dispatcher for
     *         TheGenerates methods.
     *
     */
    fallback(bytes calldata) external returns (bytes memory output) {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        // Get the function selector.
        bytes4 selector = msg.sig;

        // Get the rest of the msg data after the selector.
        bytes calldata data = msg.data[4:];

        if (selector == ITheGenerates.getPublicDrop.selector) {
            // Return the public drop.
            return abi.encode(TheGeneratesStorage.layout()._publicDrop);
        } else if (selector == ITheGenerates.getUnseenPayout.selector) {
            // Return unseen payout.
            return abi.encode(TheGeneratesStorage.layout()._unseenPayout);
        } else if (selector == ITheGenerates.getPaymentToken.selector) {
            // Return payment token.
            return abi.encode(TheGeneratesStorage.layout()._uncn);
        } else if (selector == ITheGenerates.getAllowListMerkleRoot.selector) {
            // Return the allowed merkle root.
            return
                abi.encode(TheGeneratesStorage.layout()._allowListMerkleRoot);
        } else if (selector == ITheGenerates.getSigner.selector) {
            // Return the allowed signer.
            return abi.encode(TheGeneratesStorage.layout()._allowedSigner);
        } else if (selector == ITheGenerates.getDigestIsUsed.selector) {
            // Get the digest.
            bytes32 digest = bytes32(data[0:32]);

            // Return if the digest is used.
            return
                abi.encode(TheGeneratesStorage.layout()._usedDigests[digest]);
        } else {
            // Revert if the function selector is not supported.
            revert UnsupportedFunctionSelector(selector);
        }
    }

    /**
     * @dev Creates an order with the required mint payment.
     *
     * @param context             Context of the order
     *                            containing the mint parameters.
     *
     * @return minter             Address of the minter.
     * @return quantity           Quantity to be minted.
     */
    function mint(
        bytes calldata context
    ) external returns (address minter, uint256 quantity) {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        // check for correct context length. Minimum is 53 bytes
        // (substandard byte, minter, quantity)
        if (context.length < 53) {
            revert InvalidExtraDataEncoding();
        }

        quantity = uint256(bytes32(context[21:53]));

        if (quantity == 0) revert QuantityNotSet();

        // Derive the substandard version.
        uint8 substandard = uint8(context[0]);

        if (substandard > 2) {
            revert InvalidSubstandard(substandard);
        }

        // All substandards have minter as first param.
        minter = address(bytes20(context[1:21]));

        // If the minter is the zero address, set it to the caller.
        if (minter == address(0)) {
            minter = msg.sender;
        }

        if (substandard == 0) {
            // 0: Public mint
            _mintPublic(minter, quantity);
        } else if (substandard == 1) {
            // 1: Allow list mint
            ConfigStructs.MintParams memory mintParams = abi.decode(
                context[53:245],
                (ConfigStructs.MintParams)
            );
            // Instead of putting the proof in memory, pass context and offset
            // to use it directly from calldata.
            _mintAllowList(minter, quantity, mintParams, context, 245);
        } else {
            // substandard == 2
            // 2: Signed mint
            ConfigStructs.MintParams memory mintParams = abi.decode(
                context[53:245],
                (ConfigStructs.MintParams)
            );
            uint256 salt = uint256(bytes32(context[245:277]));
            bytes32 signatureR = bytes32(context[277:309]);
            bytes32 signatureVS = bytes32(context[309:341]);
            _mintSigned(
                minter,
                quantity,
                mintParams,
                salt,
                signatureR,
                signatureVS
            );
        }
    }

    /**
     * @notice Mint a public drop stage.
     *
     * @param minter   The minter address.
     * @param quantity The amount to mint.
     */
    function _mintPublic(address minter, uint256 quantity) internal {
        // Get the public drop.
        ConfigStructs.PublicDrop memory publicDrop = TheGeneratesStorage
            .layout()
            ._publicDrop;

        // Check that the stage is active and calculate the current price.
        uint256 currentPrice = _currentPrice(
            publicDrop.startTime,
            publicDrop.endTime,
            publicDrop.startPrice,
            publicDrop.endPrice
        );

        // Validate the mint parameters.
        _validateMint(
            minter,
            quantity,
            currentPrice,
            _UNLIMITED_MAX_TOKEN_SUPPLY_FOR_STAGE,
            _PUBLIC_DROP_STAGE_INDEX
        );
    }

    /**
     * @notice Mint an allow list drop stage.
     *
     * @param minter       The minter address.
     * @param quantity     The amount to mint.
     * @param mintParams   The mint parameters.
     * @param context      The context of the order.
     * @param proofOffsetInContext The offset of the proof in the context.
     */
    function _mintAllowList(
        address minter,
        uint256 quantity,
        ConfigStructs.MintParams memory mintParams,
        bytes calldata context,
        uint256 proofOffsetInContext
    ) internal {
        // Verify the proof.
        if (
            !_verifyProof(
                context,
                proofOffsetInContext,
                TheGeneratesStorage.layout()._allowListMerkleRoot,
                keccak256(abi.encode(minter, mintParams))
            )
        ) {
            revert InvalidProof();
        }

        // Check that the stage is active and calculate the current price.
        uint256 currentPrice = _currentPrice(
            mintParams.startTime,
            mintParams.endTime,
            mintParams.startPrice,
            mintParams.endPrice
        );

        // Validate the mint parameters.
        _validateMint(
            minter,
            quantity,
            currentPrice,
            mintParams.maxTokenSupplyForStage,
            mintParams.dropStageIndex
        );
    }

    /**
     * @notice Mint with a server-side signature.
     *         Note that a signature can only be used once.
     *
     * @param minter       The minter address.
     * @param quantity     The amount to mint.
     * @param mintParams   The mint parameters.
     * @param salt         The salt for the signed mint.
     * @param signatureR   The server-side signature `r` value.
     * @param signatureVS  The server-side signature `vs` value.
     */
    function _mintSigned(
        address minter,
        uint256 quantity,
        ConfigStructs.MintParams memory mintParams,
        uint256 salt,
        bytes32 signatureR,
        bytes32 signatureVS
    ) internal {
        // Get the digest to verify the EIP-712 signature.
        bytes32 digest = _getDigest(minter, mintParams, salt);

        // Ensure the digest has not already been used.
        if (TheGeneratesStorage.layout()._usedDigests[digest]) {
            revert SignatureAlreadyUsed();
        } else {
            // Mark the digest as used.
            TheGeneratesStorage.layout()._usedDigests[digest] = true;
        }

        // Check that the stage is active and calculate the current price.
        uint256 currentPrice = _currentPrice(
            mintParams.startTime,
            mintParams.endTime,
            mintParams.startPrice,
            mintParams.endPrice
        );

        // Validate the mint parameters.
        _validateMint(
            minter,
            quantity,
            currentPrice,
            mintParams.maxTokenSupplyForStage,
            mintParams.dropStageIndex
        );

        // Use the recover method to see what address was used to create
        // the signature on this data.
        // Note that if the digest doesn't exactly match what was signed we'll
        // get a random recovered address.
        address recoveredAddress = ECDSA.recover(
            digest,
            signatureR,
            signatureVS
        );
        if (TheGeneratesStorage.layout()._allowedSigner != recoveredAddress) {
            revert ECDSA.InvalidSignature();
        }
    }

    /**
     * @dev Validates a mint, reverting if the mint is invalid.
     *
     * @param minter                   The minter address.
     * @param quantity                 The amount to mint.
     * @param currentPrice             The current price.
     * @param maxTokenSupplyForStage   The maximum token supply for the stage.
     * @param dropStageIndex           The drop stage index.
     */
    function _validateMint(
        address minter,
        uint256 quantity,
        uint256 currentPrice,
        uint256 maxTokenSupplyForStage,
        uint256 dropStageIndex
    ) internal {
        // Check the number of mints are availabl.
        _checkMintQuantity(quantity, maxTokenSupplyForStage);

        // Process mint payment.
        _processPayment(quantity, currentPrice);

        emit TheGeneratesMint(minter, dropStageIndex);
    }

    /**
     * @dev Internal view function to derive the current price of a stage
     *      based on the the starting price and ending price. If the start
     *      and end prices differ, the current price will be interpolated on
     *      a linear basis.
     *
     *      Since this function is only used for consideration items, it will
     *      round up.
     *
     * @param startTime  The starting time of the stage.
     * @param endTime    The end time of the stage.
     * @param startPrice The starting price of the stage.
     * @param endPrice   The ending price of the stage.
     *
     * @return price The current price.
     */
    function _currentPrice(
        uint256 startTime,
        uint256 endTime,
        uint256 startPrice,
        uint256 endPrice
    ) internal view returns (uint256 price) {
        // Check that the drop stage has started and not ended.
        // This ensures that the startTime is not greater than the current
        // block timestamp and endTime is greater than the current block
        // timestamp. If this condition is not upheld `duration`, `elapsed`,
        // and `remaining` variables will underflow.
        _checkActive(startTime, endTime);

        // Return the price if startPrice == endPrice.
        if (startPrice == endPrice) {
            return endPrice;
        }

        // Declare variables to derive in the subsequent unchecked scope.
        uint256 duration;
        uint256 elapsed;
        uint256 remaining;

        // Skip underflow checks as startTime <= block.timestamp < endTime.
        unchecked {
            // Derive the duration for the stage and place it on the stack.
            duration = endTime - startTime;

            // Derive time elapsed since the stage started & place on stack.
            elapsed = block.timestamp - startTime;

            // Derive time remaining until stage expires and place on stack.
            remaining = duration - elapsed;
        }

        // Aggregate new amounts weighted by time with rounding factor.
        uint256 totalBeforeDivision = ((startPrice * remaining) +
            (endPrice * elapsed));

        // Use assembly to combine operations and skip divide-by-zero check.
        assembly {
            // Multiply by iszero(iszero(totalBeforeDivision)) to ensure
            // amount is set to zero if totalBeforeDivision is zero,
            // as intermediate overflow can occur if it is zero.
            price := mul(
                iszero(iszero(totalBeforeDivision)),
                // Subtract 1 from the numerator and add 1 to the result
                // to get the proper rounding direction to round up.
                // Division is performed with no zero check as duration
                // cannot be zero as long as startTime < endTime.
                add(div(sub(totalBeforeDivision, 1), duration), 1)
            )
        }
    }

    /**
     * @notice Check that the drop stage is active.
     *
     * @param startTime The drop stage start time.
     * @param endTime   The drop stage end time.
     */
    function _checkActive(uint256 startTime, uint256 endTime) internal view {
        // Define a variable if the drop stage is inactive.
        bool inactive;

        // startTime <= block.timestamp < endTime
        assembly {
            inactive := or(
                iszero(gt(endTime, timestamp())),
                gt(startTime, timestamp())
            )
        }

        // Revert if the drop stage is not active.
        if (inactive) {
            revert NotActive(block.timestamp, startTime, endTime);
        }
    }

    /**
     * @notice Check that the wallet is allowed to mint the desired quantity.
     *
     * @param quantity                 The number of tokens to mint.
     * @param maxTokenSupplyForStage   The max token supply for the drop stage.
     */
    function _checkMintQuantity(
        uint256 quantity,
        uint256 maxTokenSupplyForStage
    ) internal view {
        // Get the mint stats from the token contract.
        (uint256 totalMinted, uint256 maxSupply) = ITheGenerates(address(this))
            .getMintStats();

        // Ensure mint quantity doesn't exceed maxSupply.
        if (quantity + totalMinted > maxSupply) {
            revert MintQuantityExceedsMaxSupply(
                quantity + totalMinted,
                maxSupply
            );
        }

        // Ensure mint quantity doesn't exceed maxTokenSupplyForStage.
        if (quantity + totalMinted > maxTokenSupplyForStage) {
            revert MintQuantityExceedsMaxTokenSupplyForStage(
                quantity + totalMinted,
                maxTokenSupplyForStage
            );
        }
    }

    /**
     * @notice Derive the required consideration items for the mint,
     *         includes the fee recipient and creator payout.
     *
     * @param quantity     The number of tokens to mint.
     * @param currentPrice The current price of each token.
     */
    function _processPayment(uint256 quantity, uint256 currentPrice) internal {
        // If the mint price is zero, return early.
        if (currentPrice == 0) {
            return;
        }
        // Put the total mint price on the stack.
        uint256 totalPrice = quantity * currentPrice;

        // Put the creator payouts on the stack.
        TheGeneratesStorage.Layout storage layout = TheGeneratesStorage
            .layout();

        if (layout._unseenPayout.payoutAddress == address(0)) {
            revert UnseenPayoutNotSet();
        }

        if (layout._uncn == address(0)) {
            revert PaymentTokenNotSet();
        }

        SafeTransferLib.safeTransferFrom(
            layout._uncn,
            msg.sender,
            layout._unseenPayout.payoutAddress,
            totalPrice
        );
    }

    /**
     * @dev Internal view function to derive the EIP-712 domain separator.
     *
     * @return The derived domain separator.
     */
    function _deriveDomainSeparator() internal view returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    _EIP_712_DOMAIN_TYPEHASH,
                    _NAME_HASH,
                    _VERSION_HASH,
                    block.chainid,
                    address(this)
                )
            );
    }

    /**
     * @notice Implementation function to update the public drop data and
     *         emit an event.
     *
     *         Do not use this method directly.
     *
     * @param publicDrop The public drop data.
     */
    function updatePublicDrop(
        ConfigStructs.PublicDrop calldata publicDrop
    ) external {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        // Revert if the startTime is past the endTime.
        if (publicDrop.startTime >= publicDrop.endTime) {
            revert InvalidStartAndEndTime(
                publicDrop.startTime,
                publicDrop.endTime
            );
        }

        // Set the public drop data.
        TheGeneratesStorage.layout()._publicDrop = publicDrop;

        // Emit an event with the update.
        emit PublicDropUpdated(publicDrop);
    }

    /**
     * @notice Implementation function to update the allow list merkle root
     *         for the nft contract and emit an event.
     *
     *         Do not use this method directly.
     *
     * @param merkleRoot The allow list data.
     */
    function updateAllowList(bytes32 merkleRoot) external {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        // Put the previous root on the stack to use for the event.
        bytes32 prevRoot = TheGeneratesStorage.layout()._allowListMerkleRoot;

        // Update the merkle root.
        TheGeneratesStorage.layout()._allowListMerkleRoot = merkleRoot;

        // Emit an event with the update.
        emit AllowListUpdated(prevRoot, merkleRoot);
    }

    /**
     * @notice Updates the creator payout and emits an event.
     *         The basis points at max of 1_000. (used for rent fees only)
     *
     * @param unseenPayout The creator payout address and basis points.
     */
    function updateUnseenPayout(
        ConfigStructs.UnseenPayout calldata unseenPayout
    ) external {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        // Reset the creator payout.
        delete TheGeneratesStorage.layout()._unseenPayout;

        // Get the creator payout.
        ConfigStructs.UnseenPayout memory _unseenPayout = unseenPayout;

        // Ensure the creator payout address is not the zero address.
        if (_unseenPayout.payoutAddress == address(0)) {
            revert UnseenPayoutAddressCannotBeZeroAddress();
        }

        // Ensure fee basis points does not exceed 10%.
        if (_unseenPayout.basisPoints > 1_000) {
            revert InvalidBasisPoints(_unseenPayout.basisPoints);
        }

        // Push to storage.
        TheGeneratesStorage.layout()._unseenPayout = _unseenPayout;

        // Emit an event with the update.
        emit UnseenPayoutUpdated(unseenPayout);
    }

    /**
     * @notice Updates the allowed server-side signer and emits an event.
     *
     * @param signer  The signer to update.
     */
    function updateSigner(address signer) external {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        if (signer == address(0)) {
            revert SignerCannotBeZeroAddress();
        }

        if (signer == TheGeneratesStorage.layout()._allowedSigner) {
            revert DuplicateSigner();
        }

        TheGeneratesStorage.layout()._allowedSigner = signer;

        // Emit an event with the update.
        emit SignerUpdated(signer);
    }

    /**
     * @notice Updates the payment token.
     *
     * @param paymentToken  The payment token to update.
     */
    function updatePaymentToken(address paymentToken) external {
        // Ensure this contract is only called into with delegatecall.
        _onlyDelegateCalled();

        if (paymentToken == address(0)) {
            revert PaymentTokenCannotBeZeroAddress();
        }

        if (paymentToken == TheGeneratesStorage.layout()._uncn) {
            revert DuplicatePaymentToken();
        }

        TheGeneratesStorage.layout()._uncn = paymentToken;

        // Emit an event with the update.
        emit PaymentTokenUpdated(paymentToken);
    }

    /**
     * @notice Verify an EIP-712 signature by recreating the data structure
     *         that we signed on the client side, and then using that to recover
     *         the address that signed the signature for this data.
     *
     * @param minter       The mint recipient.
     * @param mintParams   The mint params.
     * @param salt         The salt for the signed mint.
     */
    function _getDigest(
        address minter,
        ConfigStructs.MintParams memory mintParams,
        uint256 salt
    ) internal view returns (bytes32 digest) {
        bytes32 mintParamsHashStruct = keccak256(
            abi.encode(
                _MINT_PARAMS_TYPEHASH,
                mintParams.startPrice,
                mintParams.endPrice,
                mintParams.startTime,
                mintParams.endTime,
                mintParams.maxTokenSupplyForStage,
                mintParams.dropStageIndex
            )
        );
        digest = keccak256(
            bytes.concat(
                bytes2(0x1901),
                _deriveDomainSeparator(),
                keccak256(
                    abi.encode(
                        _SIGNED_MINT_TYPEHASH,
                        minter,
                        mintParamsHashStruct,
                        salt
                    )
                )
            )
        );
    }

    /**
     * @dev Returns whether `leaf` exists in the Merkle tree with `root`,
     *      given `proof`.
     *
     *      Original function from solady called `verifyCalldata`, modified
     *      to use an offset from the context calldata to avoid expanding
     *      memory.
     */
    function _verifyProof(
        bytes calldata context,
        uint256 proofOffsetInContext,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool isValid) {
        /// @solidity memory-safe-assembly
        assembly {
            if sub(context.length, proofOffsetInContext) {
                // Initialize `offset` to the offset of `proof` in the calldata.
                let offset := add(context.offset, proofOffsetInContext)
                let end := add(
                    offset,
                    sub(context.length, proofOffsetInContext)
                )
                // Iterate over proof elements to compute root hash.
                // prettier-ignore
                for {} 1 {} {
                    // Slot of `leaf` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(leaf, calldataload(offset)))
                    // Store elements to hash contiguously in scratch space.
                    // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
                    mstore(scratch, leaf)
                    mstore(xor(scratch, 0x20), calldataload(offset))
                    // Reuse `leaf` to store the hash to reduce stack operations.
                    leaf := keccak256(0x00, 0x40)
                    offset := add(offset, 0x20)
                    if iszero(lt(offset, end)) { break }
                }
            }
            isValid := eq(leaf, root)
        }
    }

    /**
     * @dev Internal view function to revert if this implementation contract is
     *      called without delegatecall.
     */
    function _onlyDelegateCalled() internal view {
        if (address(this) == _originalImplementation) {
            revert OnlyDelegateCalled();
        }
    }

    /**
     * @dev Internal pure function to cast a `bool` value to a `uint256` value.
     *
     * @param b The `bool` value to cast.
     *
     * @return u The `uint256` value.
     */
    function _cast(bool b) internal pure returns (uint256 u) {
        assembly {
            u := b
        }
    }
}

File 3 of 10 : IContractMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

interface IContractMetadata {
    /**
     * @notice Returns the base URI for token metadata.
     */
    function baseURI() external view returns (string memory);

    /**
     * @notice Returns the contract URI.
     */
    function contractURI() external view returns (string memory);

    /**
     * @notice Returns the provenance hash.
     *         The provenance hash is used for random reveals, which
     *         is a hash of the ordered metadata to show it is unmodified
     *         after mint has started.
     */
    function provenanceHash() external view returns (bytes32);
    /**
     * @notice Sets the max supply and emits an event.
     *
     * @param newMaxSupply The new max supply to set.
     */
    function setMaxSupply(uint256 newMaxSupply) external;

    /**
     * @notice Returns the max token supply.
     */
    function maxSupply() external view returns (uint256);

    /**
     * @notice Sets the base URI for the token metadata and emits an event.
     *
     * @param tokenURI The new base URI to set.
     */
    function setBaseURI(string calldata tokenURI) external;

    /**
     * @notice Sets the contract URI for contract metadata.
     *
     * @param newContractURI The new contract URI.
     */
    function setContractURI(string calldata newContractURI) external;

    /**
     * @notice Sets the provenance hash and emits an event.
     *
     *         The provenance hash is used for random reveals, which
     *         is a hash of the ordered metadata to show it has not been
     *         modified after mint started.
     *
     *         This function will revert after the first item has been minted.
     *
     * @param newProvenanceHash The new provenance hash to set.
     */
    function setProvenanceHash(bytes32 newProvenanceHash) external;

    /**
     * @notice Sets the default royalty information.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator of
     *   10_000 basis points.
     */
    function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;
}

File 4 of 10 : IERC173.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

interface IERC173 {
    /// @notice Returns the address of the owner.
    function owner() external view returns (address);
}

File 5 of 10 : ITheGenerates.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { ConfigStructs } from "../types/DataTypes.sol";

/**
 * @dev A helper interface to get and set parameters for TheGenerates.
 *      The token does not expose these methods as part of its external
 *      interface to optimize contract size, but does implement them.
 */
interface ITheGenerates {
    /**
     * @notice Update TheGenerates public drop parameters.
     *
     * @param publicDrop The new public drop parameters.
     */
    function updatePublicDrop(
        ConfigStructs.PublicDrop calldata publicDrop
    ) external;

    /**
     * @notice Returns the public drop stage parameters.
     */
    function getPublicDrop()
        external
        view
        returns (ConfigStructs.PublicDrop memory);

    /**
     * @notice Returns a set of mint stats.
     *         This assists the generates in enforcing maxSupply,
     *         and maxTokenSupplyForStage checks.
     *
     * @dev    NOTE: Implementing contracts should always update these numbers
     *         before transferring any tokens with _safeMint() to mitigate
     *         consequences of malicious onERC721Received() hooks.
     *
     */
    function getMintStats()
        external
        view
        returns (uint256 totalMinted, uint256 maxSupply);

    /**
     * @notice This function is only allowed to be called by the configurer
     *         contract as a way to batch mints and configuration in one tx.
     *
     * @param recipient The address to receive the mints.
     * @param quantity  The quantity of tokens to mint.
     */
    function multiConfigureMint(address recipient, uint256 quantity) external;

    /**
     * @notice Update TheGenerates payout address.
     *         The basis points must be max 1_000.
     *         Only the owner can use this function.
     *
     * @param unseenPayout The unseen payout.
     */
    function updateUnseenPayout(
        ConfigStructs.UnseenPayout calldata unseenPayout
    ) external;

    /**
     * @notice Update TheGenerates payment token.
     *         Only the owner can use this function.
     *
     * @param paymentToken    The paymen token to update.
     */
    function updatePaymentToken(address paymentToken) external;

    /**
     * @notice Update the generates allow list data.
     *         Only the owner can use this function.
     *
     * @param merkleRoot The new allow list merkle root.
     */
    function updateAllowList(bytes32 merkleRoot) external;

    /**
     * @notice Update the TGen allowed signer.
     *         Only the owner can use this function.
     *
     * @param signer  The signer to update.
     */
    function updateSigner(address signer) external;

    /**
     * @notice Returns TheGenerates creator payouts.
     */
    function getUnseenPayout()
        external
        view
        returns (ConfigStructs.UnseenPayout memory);

    /**
     * @notice Returns The payment token.
     */
    function getPaymentToken() external view returns (address);

    /**
     * @notice Returns TheGenerates allow list merkle root.
     */
    function getAllowListMerkleRoot() external view returns (bytes32);

    /**
     * @notice Returns TheGenerates allowed signer.
     */
    function getSigner() external view returns (address);

    /**
     * @notice Returns if the signed digest has been used.
     *
     * @param digest The digest hash.
     */
    function getDigestIsUsed(bytes32 digest) external view returns (bool);

    /**
     * @notice Returns the configurer contract.
     */
    function configurer() external view returns (address);
}

File 6 of 10 : ErrorsAndEvents.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { ConfigStructs } from "../types/DataTypes.sol";

interface ErrorsAndEvents {
    /**
     * @notice An event to signify that TheGenerates contract was deployed.
     */
    event TheGeneratesDeployed();

    /**
     * @notice Revert with an error if the function selector is not supported.
     */
    error UnsupportedFunctionSelector(bytes4 selector);

    /**
     * @dev Revert with an error if the drop stage is not active.
     */
    error NotActive(
        uint256 currentTimestamp,
        uint256 startTimestamp,
        uint256 endTimestamp
    );

    /**
     * @dev Revert with an error if the mint quantity exceeds the max token
     *      supply.
     */
    error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);

    /**
     * @dev Revert with an error if the mint quantity exceeds the max token
     *      supply for the stage.
     *      Note: The `maxTokenSupplyForStage` for public mint is
     *      always `type(uint).max`.
     */
    error MintQuantityExceedsMaxTokenSupplyForStage(
        uint256 total,
        uint256 maxTokenSupplyForStage
    );

    /**
     * @dev Revert if the fee basis points is greater than 1_000.
     */
    error InvalidFeeBps(uint256 feeBps);

    /**
     * @dev Revert if unseen payout address is the zero address.
     */
    error UnseenPayoutAddressCannotBeZeroAddress();

    /**
     * @dev Revert if unseen payout is not set.
     */
    error UnseenPayoutNotSet();

    /**
     * @dev Revert if basis points exceed 1_000.
     */
    error InvalidBasisPoints(uint256 totalReceivedBasisPoints);

    /**
     * @dev Revert with an error if the quantity is set to zero.
     */
    error QuantityNotSet();

    /**
     * @dev Revert with an error if the allow list proof is invalid.
     */
    error InvalidProof();

    /**
     * @dev Revert if a supplied signer address is the zero address.
     */
    error SignerCannotBeZeroAddress();

    /**
     * @dev Revert with an error if a signer is already included in mapping
     *      when adding.
     */
    error DuplicateSigner();

    /**
     * @dev Revert if a supplied payment token address is the zero address.
     */
    error PaymentTokenCannotBeZeroAddress();

    /**
     * @dev Revert if the payment token is not set.
     */
    error PaymentTokenNotSet();

    /**
     * @dev Revert with an error if a payment token is already the same when adding.
     */
    error DuplicatePaymentToken();

    /**
     * @dev An event with the updated payment token.
     */
    event PaymentTokenUpdated(address indexed paymentToken);

    /**
     * @dev Revert if the start time is greater than the end time.
     */
    error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);

    /**
     * @dev Revert with an error if a signature for a signed mint has already
     *      been used.
     */
    error SignatureAlreadyUsed();

    /**
     * @dev Revert with an error if the contract has no balance to withdraw.
     */
    error NoBalanceToWithdraw();

    /**
     * @dev Revert with an error if the extra data encoding is not supported.
     */
    error InvalidExtraDataEncoding();

    /**
     * @dev Revert with an error if the provided substandard is not supported.
     */
    error InvalidSubstandard(uint8 substandard);

    /**
     * @dev Revert with an error if the implementation contract is called without
     *      delegatecall.
     */
    error OnlyDelegateCalled();

    /**
     * @dev Revert with an error if the transfer validator is being set to the same address.
     */
    error SameTransferValidator();

    /**
     * @dev Revert with an error if unseen market registry is being set to the same address.
     */
    error SameUnseenMarketRegistry();

    /**
     * @dev An event with the updated unseen market registry.
     */
    event UnseenMarketRegistryUpdated(address registry);

    /**
     * @dev An event with details of a mint, for analytical purposes.
     *
     * @param payer          The address who payed for the tx.
     * @param dropStageIndex The drop stage index. Items minted through
     *                       public mint have dropStageIndex of 0
     */
    event TheGeneratesMint(address payer, uint256 dropStageIndex);

    /**
     * @dev An event with updated allow list data.
     *
     * @param previousMerkleRoot The previous allow list merkle root.
     * @param newMerkleRoot      The new allow list merkle root.
     */
    event AllowListUpdated(
        bytes32 indexed previousMerkleRoot,
        bytes32 indexed newMerkleRoot
    );

    /**
     * @dev An event with the updated unseen payout address.
     */
    event UnseenPayoutUpdated(ConfigStructs.UnseenPayout unseenPayout);

    /**
     * @dev An event with the updated signer.
     */
    event SignerUpdated(address indexed signer);

    /**
     * @dev An event with updated public drop data.
     */
    event PublicDropUpdated(ConfigStructs.PublicDrop publicDrop);

    /**
     * @dev An event with new transfer validator address.
     */
    event TransferValidatorUpdated(address oldValidator, address newValidator);

    /**
     * @dev Emit an event for token metadata reveals/updates,
     *      according to EIP-4906.
     *
     * @param _fromTokenId The start token id.
     * @param _toTokenId   The end token id.
     */
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);

    /**
     * @notice Throw if the configurer is set to address 0.
     */
    error ConfigurerCannotBeZeroAddress();

    /**
     * @notice Throw if the max supply exceeds uint64, a limit
     *         due to the storage of bit-packed variables.
     */
    error CannotExceedMaxSupplyOfUint64(uint256 got);

    /**
     * @notice Throw if the max supply exceeds the total minted.
     */
    error NewMaxSupplyCannotBeLessThenTotalMinted(
        uint256 got,
        uint256 totalMinted
    );

    /**
     * @dev Revert with an error when attempting to set the provenance
     *      hash after the mint has started.
     */
    error ProvenanceHashCannotBeSetAfterMintStarted();

    /**
     * @dev Revert with an error when attempting to set the provenance
     *      hash after it has already been set.
     */
    error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();

    /**
     * @dev Emit an event when the URI for the collection-level metadata
     *      is updated.
     */
    event ContractURIUpdated(string newContractURI);

    /**
     * @dev Emit an event with the previous and new provenance hash after
     *      being updated.
     */
    event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);

    /**
     * @dev Emit an event when the EIP-2981 royalty info is updated.
     */
    event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);

    /**
     * @dev Emit an event when the max token supply is updated.
     */
    event MaxSupplyUpdated(uint256 newMaxSupply);
}

File 7 of 10 : TheGeneratesStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import { ConfigStructs } from "../types/DataTypes.sol";

library TheGeneratesStorage {
    struct Layout {
        /// @notice The public drop data.
        ConfigStructs.PublicDrop _publicDrop;
        /// @notice Unseen payout address and fee basis points.
        ConfigStructs.UnseenPayout _unseenPayout;
        /// @notice The allow list merkle root.
        bytes32 _allowListMerkleRoot;
        /// @notice The allowed server-side signer.
        address _allowedSigner;
        /// @notice The payment token address.
        address _uncn;
        /// @notice The used signature digests.
        mapping(bytes32 => bool) _usedDigests;
    }

    bytes32 internal constant STORAGE_SLOT =
        bytes32(uint256(keccak256("contracts.storage.TGenContract")) - 1);

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 8 of 10 : DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

library ConfigStructs {
    /**
     * @notice A struct defining unseen payout
     *         address and fee basis points.
     *
     * @param payoutAddress The payout address.
     * @param basisPoints   The basis points to pay out to the unseen treasury.
     */
    struct UnseenPayout {
        address payoutAddress;
        uint16 basisPoints;
    }

    /**
     * @notice A struct defining public drop data.
     *         Designed to fit efficiently in one storage slot.
     *
     * @param startPrice               The start price per token.
     * @param endPrice                 The end price per token. If this differs
     *                                 from startPrice, the current price will
     *                                 be calculated based on the current time.
     * @param startTime                The start time, ensure this is not zero.
     * @param endTime                  The end time, ensure this is not zero.
     */
    struct PublicDrop {
        uint80 startPrice; // 80/256 bits
        uint80 endPrice; // 160/256 bits
        uint40 startTime; // 200/256 bits
        uint40 endTime; // 240/256 bits
    }

    /**
     * @notice A struct defining mint params for an allow list.
     *         An allow list leaf will be composed of `msg.sender` and
     *         the following params.
     *
     *
     * @param startPrice               The start price per token.
     * @param endPrice                 The end price per token. If this differs
     *                                 from startPrice, the current price will
     *                                 be calculated based on the current time.
     * @param startTime                The start time, ensure this is not zero.
     * @param endTime                  The end time, ensure this is not zero.
     * @param maxTokenSupplyForStage   The limit of token supply this stage can
     *                                 mint within.
     * @param dropStageIndex           The drop stage index to emit with the event
     *                                 for analytical purposes. This should be
     *                                 non-zero since the public mint emits with
     *                                 index zero.
     */
    struct MintParams {
        uint256 startPrice;
        uint256 endPrice;
        uint256 startTime;
        uint256 endTime;
        uint256 maxTokenSupplyForStage;
        uint256 dropStageIndex;
    }

    /**
     * @notice A struct to configure multiple contract options in one transaction.
     */
    struct MultiConfigureStruct {
        uint256 maxSupply;
        string baseURI;
        string contractURI;
        PublicDrop publicDrop;
        bytes32 merkleRoot;
        UnseenPayout unseenPayout;
        bytes32 provenanceHash;
        address paymentToken;
        // Server-signed
        address allowedSigner;
        // ERC-2981
        address royaltyReceiver;
        uint96 royaltyBps;
        // Mint
        address mintRecipient;
        uint256 mintQuantity;
    }
}

File 9 of 10 : ECDSA.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Gas optimized ECDSA wrapper.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol)
///
/// @dev Note:
/// - The recovery functions use the ecrecover precompile (0x1).
/// - As of Solady version 0.0.68, the `recover` variants will revert upon recovery failure.
///   This is for more safety by default.
///   Use the `tryRecover` variants if you need to get the zero address back
///   upon recovery failure instead.
/// - As of Solady version 0.0.134, all `bytes signature` variants accept both
///   regular 65-byte `(r, s, v)` and EIP-2098 `(r, vs)` short form signatures.
///   See: https://eips.ethereum.org/EIPS/eip-2098
///   This is for calldata efficiency on smart accounts prevalent on L2s.
///
/// WARNING! Do NOT use signatures as unique identifiers:
/// - Use a nonce in the digest to prevent replay attacks on the same contract.
/// - Use EIP-712 for the digest to prevent replay attacks across different chains and contracts.
///   EIP-712 also enables readable signing of typed data for better user safety.
/// This implementation does NOT check if a signature is non-malleable.
library ECDSA {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                        CUSTOM ERRORS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The signature is invalid.
    error InvalidSignature();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                    RECOVERY OPERATIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
    function recover(bytes32 hash, bytes memory signature) internal view returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            let m := mload(0x40) // Cache the free memory pointer.
            for {} 1 {} {
                mstore(0x00, hash)
                mstore(0x40, mload(add(signature, 0x20))) // `r`.
                if eq(mload(signature), 64) {
                    let vs := mload(add(signature, 0x40))
                    mstore(0x20, add(shr(255, vs), 27)) // `v`.
                    mstore(0x60, shr(1, shl(1, vs))) // `s`.
                    break
                }
                if eq(mload(signature), 65) {
                    mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`.
                    mstore(0x60, mload(add(signature, 0x40))) // `s`.
                    break
                }
                result := 0
                break
            }
            result :=
                mload(
                    staticcall(
                        gas(), // Amount of gas left for the transaction.
                        result, // Address of `ecrecover`.
                        0x00, // Start of input.
                        0x80, // Size of input.
                        0x01, // Start of output.
                        0x20 // Size of output.
                    )
                )
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            if iszero(returndatasize()) {
                mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
    function recoverCalldata(bytes32 hash, bytes calldata signature)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x00, hash)
            for {} 1 {} {
                if eq(signature.length, 64) {
                    let vs := calldataload(add(signature.offset, 0x20))
                    mstore(0x20, add(shr(255, vs), 27)) // `v`.
                    mstore(0x40, calldataload(signature.offset)) // `r`.
                    mstore(0x60, shr(1, shl(1, vs))) // `s`.
                    break
                }
                if eq(signature.length, 65) {
                    mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`.
                    calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`.
                    break
                }
                result := 0
                break
            }
            result :=
                mload(
                    staticcall(
                        gas(), // Amount of gas left for the transaction.
                        result, // Address of `ecrecover`.
                        0x00, // Start of input.
                        0x80, // Size of input.
                        0x01, // Start of output.
                        0x20 // Size of output.
                    )
                )
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            if iszero(returndatasize()) {
                mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the EIP-2098 short form signature defined by `r` and `vs`.
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x00, hash)
            mstore(0x20, add(shr(255, vs), 27)) // `v`.
            mstore(0x40, r)
            mstore(0x60, shr(1, shl(1, vs))) // `s`.
            result :=
                mload(
                    staticcall(
                        gas(), // Amount of gas left for the transaction.
                        1, // Address of `ecrecover`.
                        0x00, // Start of input.
                        0x80, // Size of input.
                        0x01, // Start of output.
                        0x20 // Size of output.
                    )
                )
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            if iszero(returndatasize()) {
                mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the signature defined by `v`, `r`, `s`.
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x00, hash)
            mstore(0x20, and(v, 0xff))
            mstore(0x40, r)
            mstore(0x60, s)
            result :=
                mload(
                    staticcall(
                        gas(), // Amount of gas left for the transaction.
                        1, // Address of `ecrecover`.
                        0x00, // Start of input.
                        0x80, // Size of input.
                        0x01, // Start of output.
                        0x20 // Size of output.
                    )
                )
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            if iszero(returndatasize()) {
                mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   TRY-RECOVER OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // WARNING!
    // These functions will NOT revert upon recovery failure.
    // Instead, they will return the zero address upon recovery failure.
    // It is critical that the returned address is NEVER compared against
    // a zero address (e.g. an uninitialized address variable).

    /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
    function tryRecover(bytes32 hash, bytes memory signature)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            let m := mload(0x40) // Cache the free memory pointer.
            for {} 1 {} {
                mstore(0x00, hash)
                mstore(0x40, mload(add(signature, 0x20))) // `r`.
                if eq(mload(signature), 64) {
                    let vs := mload(add(signature, 0x40))
                    mstore(0x20, add(shr(255, vs), 27)) // `v`.
                    mstore(0x60, shr(1, shl(1, vs))) // `s`.
                    break
                }
                if eq(mload(signature), 65) {
                    mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`.
                    mstore(0x60, mload(add(signature, 0x40))) // `s`.
                    break
                }
                result := 0
                break
            }
            pop(
                staticcall(
                    gas(), // Amount of gas left for the transaction.
                    result, // Address of `ecrecover`.
                    0x00, // Start of input.
                    0x80, // Size of input.
                    0x40, // Start of output.
                    0x20 // Size of output.
                )
            )
            mstore(0x60, 0) // Restore the zero slot.
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            result := mload(xor(0x60, returndatasize()))
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
    function tryRecoverCalldata(bytes32 hash, bytes calldata signature)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x00, hash)
            for {} 1 {} {
                if eq(signature.length, 64) {
                    let vs := calldataload(add(signature.offset, 0x20))
                    mstore(0x20, add(shr(255, vs), 27)) // `v`.
                    mstore(0x40, calldataload(signature.offset)) // `r`.
                    mstore(0x60, shr(1, shl(1, vs))) // `s`.
                    break
                }
                if eq(signature.length, 65) {
                    mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`.
                    calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`.
                    break
                }
                result := 0
                break
            }
            pop(
                staticcall(
                    gas(), // Amount of gas left for the transaction.
                    result, // Address of `ecrecover`.
                    0x00, // Start of input.
                    0x80, // Size of input.
                    0x40, // Start of output.
                    0x20 // Size of output.
                )
            )
            mstore(0x60, 0) // Restore the zero slot.
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            result := mload(xor(0x60, returndatasize()))
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the EIP-2098 short form signature defined by `r` and `vs`.
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x00, hash)
            mstore(0x20, add(shr(255, vs), 27)) // `v`.
            mstore(0x40, r)
            mstore(0x60, shr(1, shl(1, vs))) // `s`.
            pop(
                staticcall(
                    gas(), // Amount of gas left for the transaction.
                    1, // Address of `ecrecover`.
                    0x00, // Start of input.
                    0x80, // Size of input.
                    0x40, // Start of output.
                    0x20 // Size of output.
                )
            )
            mstore(0x60, 0) // Restore the zero slot.
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            result := mload(xor(0x60, returndatasize()))
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the signature defined by `v`, `r`, `s`.
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x00, hash)
            mstore(0x20, and(v, 0xff))
            mstore(0x40, r)
            mstore(0x60, s)
            pop(
                staticcall(
                    gas(), // Amount of gas left for the transaction.
                    1, // Address of `ecrecover`.
                    0x00, // Start of input.
                    0x80, // Size of input.
                    0x40, // Start of output.
                    0x20 // Size of output.
                )
            )
            mstore(0x60, 0) // Restore the zero slot.
            // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
            result := mload(xor(0x60, returndatasize()))
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     HASHING OPERATIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns an Ethereum Signed Message, created from a `hash`.
    /// This produces a hash corresponding to the one signed with the
    /// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign)
    /// JSON-RPC method as part of EIP-191.
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x20, hash) // Store into scratch space for keccak256.
            mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes.
            result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`.
        }
    }

    /// @dev Returns an Ethereum Signed Message, created from `s`.
    /// This produces a hash corresponding to the one signed with the
    /// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign)
    /// JSON-RPC method as part of EIP-191.
    /// Note: Supports lengths of `s` up to 999999 bytes.
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            let sLength := mload(s)
            let o := 0x20
            mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded.
            mstore(0x00, 0x00)
            // Convert the `s.length` to ASCII decimal representation: `base10(s.length)`.
            for { let temp := sLength } 1 {} {
                o := sub(o, 1)
                mstore8(o, add(48, mod(temp, 10)))
                temp := div(temp, 10)
                if iszero(temp) { break }
            }
            let n := sub(0x3a, o) // Header length: `26 + 32 - o`.
            // Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes.
            returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20))
            mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header.
            result := keccak256(add(s, sub(0x20, n)), add(n, sLength))
            mstore(s, sLength) // Restore the length.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   EMPTY CALLDATA HELPERS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns an empty calldata bytes.
    function emptySignature() internal pure returns (bytes calldata signature) {
        /// @solidity memory-safe-assembly
        assembly {
            signature.length := 0
        }
    }
}

File 10 of 10 : SafeTransferLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
/// - For ERC20s, this implementation won't check that a token has code,
///   responsibility is delegated to the caller.
library SafeTransferLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ETH transfer has failed.
    error ETHTransferFailed();

    /// @dev The ERC20 `transferFrom` has failed.
    error TransferFromFailed();

    /// @dev The ERC20 `transfer` has failed.
    error TransferFailed();

    /// @dev The ERC20 `approve` has failed.
    error ApproveFailed();

    /// @dev The Permit2 operation has failed.
    error Permit2Failed();

    /// @dev The Permit2 amount must be less than `2**160 - 1`.
    error Permit2AmountOverflow();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
    uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;

    /// @dev Suggested gas stipend for contract receiving ETH to perform a few
    /// storage reads and writes, but low enough to prevent griefing.
    uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;

    /// @dev The unique EIP-712 domain domain separator for the DAI token contract.
    bytes32 internal constant DAI_DOMAIN_SEPARATOR =
        0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;

    /// @dev The address for the WETH9 contract on Ethereum mainnet.
    address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    /// @dev The canonical Permit2 address.
    /// [Github](https://github.com/Uniswap/permit2)
    /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
    address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       ETH OPERATIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
    //
    // The regular variants:
    // - Forwards all remaining gas to the target.
    // - Reverts if the target reverts.
    // - Reverts if the current contract has insufficient balance.
    //
    // The force variants:
    // - Forwards with an optional gas stipend
    //   (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
    // - If the target reverts, or if the gas stipend is exhausted,
    //   creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
    //   Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
    // - Reverts if the current contract has insufficient balance.
    //
    // The try variants:
    // - Forwards with a mandatory gas stipend.
    // - Instead of reverting, returns whether the transfer succeeded.

    /// @dev Sends `amount` (in wei) ETH to `to`.
    function safeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Sends all the ETH in the current contract to `to`.
    function safeTransferAllETH(address to) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer all the ETH and check if it succeeded or not.
            if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if lt(selfbalance(), amount) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
            if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
    function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
    function forceSafeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            if lt(selfbalance(), amount) {
                mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
                revert(0x1c, 0x04)
            }
            if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
    function forceSafeTransferAllETH(address to) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // forgefmt: disable-next-item
            if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
            }
        }
    }

    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
        }
    }

    /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
    function trySafeTransferAllETH(address to, uint256 gasStipend)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      ERC20 OPERATIONS                      */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for
    /// the current contract to manage.
    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x60, amount) // Store the `amount` argument.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    ///
    /// The `from` account must have at least `amount` approved for the current contract to manage.
    function trySafeTransferFrom(address token, address from, address to, uint256 amount)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x60, amount) // Store the `amount` argument.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
            success :=
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends all of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have their entire balance approved for the current contract to manage.
    function safeTransferAllFrom(address token, address from, address to)
        internal
        returns (uint256 amount)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40) // Cache the free memory pointer.
            mstore(0x40, to) // Store the `to` argument.
            mstore(0x2c, shl(96, from)) // Store the `from` argument.
            mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
            // Read the balance, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
            amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, m) // Restore the free memory pointer.
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransfer(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sends all of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransferAll(address token, address to) internal returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
            mstore(0x20, address()) // Store the address of the current contract.
            // Read the balance, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                    staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x14, to) // Store the `to` argument.
            amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
            mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
            // Perform the transfer, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// Reverts upon failure.
    function safeApprove(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
            // Perform the approval, reverting upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                revert(0x1c, 0x04)
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
    /// then retries the approval again (some tokens, e.g. USDT, requires this).
    /// Reverts upon failure.
    function safeApproveWithRetry(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, to) // Store the `to` argument.
            mstore(0x34, amount) // Store the `amount` argument.
            mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
            // Perform the approval, retrying upon failure.
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                    call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                )
            ) {
                mstore(0x34, 0) // Store 0 for the `amount`.
                mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
                pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
                mstore(0x34, amount) // Store back the original `amount`.
                // Retry the approval, reverting upon failure.
                if iszero(
                    and(
                        or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing.
                        call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
                    )
                ) {
                    mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
                    revert(0x1c, 0x04)
                }
            }
            mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
        }
    }

    /// @dev Returns the amount of ERC20 `token` owned by `account`.
    /// Returns zero if the `token` does not exist.
    function balanceOf(address token, address account) internal view returns (uint256 amount) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x14, account) // Store the `account` argument.
            mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
            amount :=
                mul( // The arguments of `mul` are evaluated from right to left.
                    mload(0x20),
                    and( // The arguments of `and` are evaluated from right to left.
                        gt(returndatasize(), 0x1f), // At least 32 bytes returned.
                        staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
                    )
                )
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// If the initial attempt fails, try to use Permit2 to transfer the token.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for the current contract to manage.
    function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
        if (!trySafeTransferFrom(token, from, to, amount)) {
            permit2TransferFrom(token, from, to, amount);
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
    /// Reverts upon failure.
    function permit2TransferFrom(address token, address from, address to, uint256 amount)
        internal
    {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(add(m, 0x74), shr(96, shl(96, token)))
            mstore(add(m, 0x54), amount)
            mstore(add(m, 0x34), to)
            mstore(add(m, 0x20), shl(96, from))
            // `transferFrom(address,address,uint160,address)`.
            mstore(m, 0x36c78516000000000000000000000000)
            let p := PERMIT2
            let exists := eq(chainid(), 1)
            if iszero(exists) { exists := iszero(iszero(extcodesize(p))) }
            if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) {
                mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
                revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04)
            }
        }
    }

    /// @dev Permit a user to spend a given amount of
    /// another user's tokens via native EIP-2612 permit if possible, falling
    /// back to Permit2 if native permit fails or is not implemented on the token.
    function permit2(
        address token,
        address owner,
        address spender,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        bool success;
        /// @solidity memory-safe-assembly
        assembly {
            for {} shl(96, xor(token, WETH9)) {} {
                mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
                if iszero(
                    and( // The arguments of `and` are evaluated from right to left.
                        lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
                        // Gas stipend to limit gas burn for tokens that don't refund gas when
                        // an non-existing function is called. 5K should be enough for a SLOAD.
                        staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
                    )
                ) { break }
                // After here, we can be sure that token is a contract.
                let m := mload(0x40)
                mstore(add(m, 0x34), spender)
                mstore(add(m, 0x20), shl(96, owner))
                mstore(add(m, 0x74), deadline)
                if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
                    mstore(0x14, owner)
                    mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
                    mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
                    mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
                    // `nonces` is already at `add(m, 0x54)`.
                    // `1` is already stored at `add(m, 0x94)`.
                    mstore(add(m, 0xb4), and(0xff, v))
                    mstore(add(m, 0xd4), r)
                    mstore(add(m, 0xf4), s)
                    success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
                    break
                }
                mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
                mstore(add(m, 0x54), amount)
                mstore(add(m, 0x94), and(0xff, v))
                mstore(add(m, 0xb4), r)
                mstore(add(m, 0xd4), s)
                success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
                break
            }
        }
        if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
    }

    /// @dev Simple permit on the Permit2 contract.
    function simplePermit2(
        address token,
        address owner,
        address spender,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        /// @solidity memory-safe-assembly
        assembly {
            let m := mload(0x40)
            mstore(m, 0x927da105) // `allowance(address,address,address)`.
            {
                let addressMask := shr(96, not(0))
                mstore(add(m, 0x20), and(addressMask, owner))
                mstore(add(m, 0x40), and(addressMask, token))
                mstore(add(m, 0x60), and(addressMask, spender))
                mstore(add(m, 0xc0), and(addressMask, spender))
            }
            let p := mul(PERMIT2, iszero(shr(160, amount)))
            if iszero(
                and( // The arguments of `and` are evaluated from right to left.
                    gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
                    staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
                )
            ) {
                mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
                revert(add(0x18, shl(2, iszero(p))), 0x04)
            }
            mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
            // `owner` is already `add(m, 0x20)`.
            // `token` is already at `add(m, 0x40)`.
            mstore(add(m, 0x60), amount)
            mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
            // `nonce` is already at `add(m, 0xa0)`.
            // `spender` is already at `add(m, 0xc0)`.
            mstore(add(m, 0xe0), deadline)
            mstore(add(m, 0x100), 0x100) // `signature` offset.
            mstore(add(m, 0x120), 0x41) // `signature` length.
            mstore(add(m, 0x140), r)
            mstore(add(m, 0x160), s)
            mstore(add(m, 0x180), shl(248, v))
            if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) {
                mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
                revert(0x1c, 0x04)
            }
        }
    }
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"}],"name":"CannotExceedMaxSupplyOfUint64","type":"error"},{"inputs":[],"name":"ConfigurerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"DuplicatePaymentToken","type":"error"},{"inputs":[],"name":"DuplicateSigner","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalReceivedBasisPoints","type":"uint256"}],"name":"InvalidBasisPoints","type":"error"},{"inputs":[],"name":"InvalidExtraDataEncoding","type":"error"},{"inputs":[{"internalType":"uint256","name":"feeBps","type":"uint256"}],"name":"InvalidFeeBps","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"InvalidStartAndEndTime","type":"error"},{"inputs":[{"internalType":"uint8","name":"substandard","type":"uint8"}],"name":"InvalidSubstandard","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxTokenSupplyForStage","type":"uint256"}],"name":"MintQuantityExceedsMaxTokenSupplyForStage","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"totalMinted","type":"uint256"}],"name":"NewMaxSupplyCannotBeLessThenTotalMinted","type":"error"},{"inputs":[],"name":"NoBalanceToWithdraw","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"NotActive","type":"error"},{"inputs":[],"name":"OnlyDelegateCalled","type":"error"},{"inputs":[],"name":"PaymentTokenCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"PaymentTokenNotSet","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterAlreadyBeingSet","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterMintStarted","type":"error"},{"inputs":[],"name":"QuantityNotSet","type":"error"},{"inputs":[],"name":"SameTransferValidator","type":"error"},{"inputs":[],"name":"SameUnseenMarketRegistry","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"SignerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnseenPayoutAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"UnseenPayoutNotSet","type":"error"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"UnsupportedFunctionSelector","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"previousMerkleRoot","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"AllowListUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newContractURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"MaxSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"paymentToken","type":"address"}],"name":"PaymentTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"previousHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newHash","type":"bytes32"}],"name":"ProvenanceHashUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"}],"indexed":false,"internalType":"struct ConfigStructs.PublicDrop","name":"publicDrop","type":"tuple"}],"name":"PublicDropUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"basisPoints","type":"uint256"}],"name":"RoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"TheGeneratesDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"dropStageIndex","type":"uint256"}],"name":"TheGeneratesMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"TransferValidatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"registry","type":"address"}],"name":"UnseenMarketRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"indexed":false,"internalType":"struct ConfigStructs.UnseenPayout","name":"unseenPayout","type":"tuple"}],"name":"UnseenPayoutUpdated","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"bytes","name":"context","type":"bytes"}],"name":"mint","outputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"}],"internalType":"struct ConfigStructs.PublicDrop","name":"publicDrop","type":"tuple"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"internalType":"struct ConfigStructs.UnseenPayout","name":"unseenPayout","type":"tuple"},{"internalType":"bytes32","name":"provenanceHash","type":"bytes32"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"address","name":"allowedSigner","type":"address"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyBps","type":"uint96"},{"internalType":"address","name":"mintRecipient","type":"address"},{"internalType":"uint256","name":"mintQuantity","type":"uint256"}],"internalType":"struct ConfigStructs.MultiConfigureStruct","name":"config","type":"tuple"}],"name":"multiConfigure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"updateAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"paymentToken","type":"address"}],"name":"updatePaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"}],"internalType":"struct ConfigStructs.PublicDrop","name":"publicDrop","type":"tuple"}],"name":"updatePublicDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"updateSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"internalType":"struct ConfigStructs.UnseenPayout","name":"unseenPayout","type":"tuple"}],"name":"updateUnseenPayout","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a080604052346022573060805261199390816100288239608051816116130152f35b600080fdfe60806040526004361015610028575b346100235761001b6113f5565b602081519101f35b600080fd5b6000803560e01c806320351c01146111fc57806323e5db0b1461108357806326f8cd4f14610f3f5780634ccf1b3414610e8b5780637ba0e2e7146107c8578063a7ecd37e146107145763b913ff0914610081575061000e565b3461029d57604036600319011261029d5761009a611261565b9060243567ffffffffffffffff8111610710578060040192610220600319833603011261070c57604051638da5cb5b60e01b81526001600160a01b03919091169190602081600481865afa9081156103135784916106ca575b506001600160a01b031633036106bc5783359384610679575b8394506024820161011d8183611372565b9050610607575b50604482016101338183611372565b90506105ab575b50506101448101358061055f575b506101a481016001600160a01b0361015f826113cd565b1615159060016101c48401926001600160601b0361017c856113e1565b16151516146104ef575b505060a4810164ffffffffff61019b8261129f565b161515600160c484019164ffffffffff6101b48461129f565b1615151614610452575b505060e481013580610406575b50610104810160016001600160a01b036101e4836113cd565b1615151461037d575b5061018481016001600160a01b03610204826113cd565b1661031e575b5061016481016001600160a01b03610221826113cd565b166102b0575b50610204810135908161023957505050f35b6101e461024691016113cd565b90823b156102ab5760405163859edc5560e01b81526001600160a01b0392909216600483015260248201529082908290604490829084905af180156102a05761028c5750f35b81610296916112d7565b61029d5780f35b80fd5b6040513d84823e3d90fd5b505050fd5b6102b9906113cd565b823b156102ab57604051631333c6cd60e21b81526001600160a01b039091166004820152838160248183875af19081156103135784916102fa575b50610227565b81610304916112d7565b61030f5782386102f4565b5050fd5b6040513d86823e3d90fd5b610327906113cd565b823b156102ab576040516353f669bf60e11b81526001600160a01b039091166004820152838160248183875af1908115610313578491610368575b5061020a565b81610372916112d7565b61030f578238610362565b9250813b15610402576040516326f8cd4f60e01b815292356001600160a01b0381168103610023576001600160a01b031660048401526101248101359261ffff841684036100235761ffff8594166024820152838160448183875af19081156103135784916103ed575b506101ed565b816103f7916112d7565b61030f5782386103e7565b8380fd5b823b156102ab57604051906320351c0160e01b82526004820152838160248183875af190811561031357849161043d575b506101cb565b81610447916112d7565b61030f578238610437565b833b156104eb576104b964ffffffffff91826104ae604051956323e5db0b60e01b87526001600160501b0361048960648a016112b1565b1660048801526001600160501b036104a360848a016112b1565b1660248801526112c5565b1660448501526112c5565b166064820152838160848183875af1908115610313578491156101be57816104e0916112d7565b61030f5782386101be565b8480fd5b6104fb610501916113cd565b916113e1565b833b156104eb576040516304634d8d60e01b81526001600160a01b0390921660048301526001600160601b03166024820152838160448183875af1908115610313578491156101865781610554916112d7565b61030f578238610186565b823b156102ab57604051906304cdb5fd60e11b82526004820152838160248183875af1908115610313578491610596575b50610148565b816105a0916112d7565b61030f578238610590565b6105b491611372565b90833b156104eb5760405163938e3d7b60e01b8152918591839182916105de9190600484016113a5565b038183875af19081156103135784911561013a57816105fc916112d7565b61030f57823861013a565b6106119082611372565b90843b15610675576040516355f804b360e01b81529186918391829161063b9190600484016113a5565b038183885af190811561066a578591610655575b50610124565b8161065f916112d7565b6102ab57833861064f565b6040513d87823e3d90fd5b8580fd5b823b1561040257604051946306f8b44b60e41b86526004860152838560248183875af18015610313571561010c57929093816106b4916112d7565b91839061010c565b6282b42960e81b8352600483fd5b90506020813d602011610704575b816106e5602093836112d7565b8101031261040257516001600160a01b038116810361040257386100f3565b3d91506106d8565b8280fd5b5080fd5b503461029d57602036600319011261029d5761072e611261565b610736611610565b6001600160a01b031680156107b95760008051602061193e833981519152546001600160a01b031681146107aa5760008051602061193e83398151915280546001600160a01b031916821790557f5553331329228fbd4123164423717a4a7539f6dfa1c3279a923b98fd681a6c738280a280f35b638044bb3360e01b8252600482fd5b6367db084560e11b8252600482fd5b503461029d57602036600319011261029d5760043567ffffffffffffffff811161071057366023820112156107105780600401359167ffffffffffffffff831161029d576024838301019036821161029d57610822611610565b60358410610e7c578360351161029d576039830135938415610e6d578015610e5957602484013560f81c9360028511610e45578160151161070c57602581013560601c948515610e3d575b80610a1f5750506040519192507fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558890506080820167ffffffffffffffff811183821017610a0b579061090392916040525460606001600160501b038216918284526001600160501b038160501c169384602082015264ffffffffff808360a01c169283604084015260c81c169283910152611689565b6040805163224201db60e01b81529081600481305afa8015610a0057839184916109c7575b5080610934838861167c565b116109a757509161097360409261096c7fad0a47e7e525f47d77240580a4c9fd4fdd1649c973285fb5a300a466bd3ba8e9958861167c565b5086611819565b81516001600160a01b03851681526020810191909152a15b604080516001600160a01b039290921682526020820192909252f35b83906109b56044938861167c565b63384b48c560e21b8352600452602452fd5b9150506040813d6040116109f8575b816109e3604093836112d7565b8101031261070c576020815191015138610928565b3d91506109d6565b6040513d85823e3d90fd5b634e487b7160e01b84526041600452602484fd5b600103610b35578160f51161070c5790610a4382610119605994019384910161130f565b6000805160206118de833981519152549460405194602086019660018060a01b0389168852835160408801526020840194855160608901526040850193845160808a01526060860197885160a08b0152608087019a8b5160c08c015260a088019a8b5160e082015260e08152610abb610100826112d7565b5190209260f41901610b09575b505003610afa575091610af595949391610ae9935192519051915192611689565b915190519185856116fa565b61098b565b6309bde33960e01b8152600490fd5b915b602083359182811160051b9081521852602060408520920191818310610b0b579150503880610ac8565b90809294935060f51161040257610119810191610b55836059840161130f565b92816101151161067557359181610135116106755761013981013591610155116106755761015901359183516020850190815191604087019687519460608201938451956080840197885160a08601988951926040519460208601967f50ffd5117ec0ab54da7e62c16f960b5451eb3d9f9e67f1ffe6ff63924f3c6aa7885260408701526060860152608085015260a084015260c083015260e082015260e08152610c02610100826112d7565b51902060405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f92cb2863a937eecd2e79d45ee1bedf597b2486ddb5dcfa07b893821ce783ec8160408201527fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b360608201524660808201523060a082015260a08152610c9760c0826112d7565b519020916040519060208201927f2c42d8c62430fb671db6f232c528561a235206fa82d73adccba49cdd371ad4d384528d60018060a01b031660408401526060830152608082015260808152610cee60a0826112d7565b51902060405190602082019261190160f01b84526022830152604282015260428152610d1b6062826112d7565b51902097888b527fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558d60205260ff60408c205416600014610d645763900bb2c960e01b8b5260048bfd5b91610dc195949391610db5938a8d9c9d527fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558d60205260408c20600160ff198254161790555192519051915192611689565b915190519189896116fa565b604051928452601b8260ff1c0160205260405260018060ff1b031660605260206001608084825afa51903d15610e3057606083905260405260008051602061193e833981519152546001600160a01b03908116911603610e21575061098b565b638baa579f60e01b8152600490fd5b638baa579f83526004601cfd5b33955061086d565b630376da3160e51b83526004859052602483fd5b634e487b7160e01b82526032600452602482fd5b63c67d956b60e01b8252600482fd5b63b39e5b8160e01b8152600490fd5b503461029d57602036600319011261029d57610ea5611261565b610ead611610565b6001600160a01b03168015610f30576000805160206118fe833981519152546001600160a01b03168114610f21576000805160206118fe83398151915280546001600160a01b031916821790557fbd4032c1c91da2791730ea1bbc82c6b6f857da7c0a8318143d19ef74e62cd9138280a280f35b633b4f379560e01b8252600482fd5b63758f30c160e11b8252600482fd5b503461029d57604036600319011261029d57610f59611610565b8060008051602061191e833981519152556040516040810181811067ffffffffffffffff82111761106f57604052610f8f611261565b908181526024359161ffff8316918284036104eb5760208101848152916001600160a01b0316156110605761ffff8251166103e8811161104e57505160008051602061191e833981519152805492516001600160b01b03199093166001600160a01b039283161760a09390931b61ffff60a01b16929092179091556040516004359182169290918390036104eb577fa553a3b9c7b8c71b32d17164bf9893e7c71c2b08524395b909f8fc3b87afb9d2936040938352506020820152a180f35b630cbf8cb160e11b8652600452602485fd5b63e4ccae3160e01b8552600485fd5b634e487b7160e01b83526041600452602483fd5b503461029d57608036600319011261029d5761109d611610565b6110a5611277565b64ffffffffff806110b461128b565b16911610156111cd576004356001600160501b0381167fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558881830361040257805491602435916001600160501b038316938484036111c95764ffffffffff60a01b61111c611277565b60a01b1664ffffffffff60c81b61113161128b565b60c81b16918464ffffffffff60c81b199166ffffffffffffff60c81b1617166001600160501b0360501b8660501b1617171790556040519350835250602082015260443564ffffffffff811680910361070c57604082015260643564ffffffffff811680910361070c578160809160607faef194a3004255316c8468ed13b659935570ee249e2b682c1f2e09c828fb3a0b940152a180f35b8680fd5b60449064ffffffffff6111de611277565b816111e761128b565b6324e8fce760e01b8552911660045216602452fd5b503461029d57602036600319011261029d57600435611219611610565b6000805160206118de83398151915254816000805160206118de833981519152557fc0c9caab39dd0b6d465e16613ec23a2277fc69737013e962a794ea4237bc9c168380a380f35b600435906001600160a01b038216820361002357565b60443564ffffffffff811681036100235790565b60643564ffffffffff811681036100235790565b3564ffffffffff811681036100235790565b35906001600160501b038216820361002357565b359064ffffffffff8216820361002357565b90601f8019910116810190811067ffffffffffffffff8211176112f957604052565b634e487b7160e01b600052604160045260246000fd5b908160c0910312610023576040519060c082019082821067ffffffffffffffff8311176112f95760a0916040528035835260208101356020840152604081013560408401526060810135606084015260808101356080840152013560a082015290565b903590601e1981360301821215610023570180359067ffffffffffffffff82116100235760200191813603831361002357565b90918060409360208452816020850152848401376000828201840152601f01601f1916010190565b356001600160a01b03811681036100235790565b356001600160601b03811681036100235790565b6113fd611610565b6000356001600160e01b031916366004116100235763653f8fc360e11b810361149457507fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558864ffffffffff60405191546001600160501b03811660208401526001600160501b038160501c166040840152818160a01c16606084015260c81c1660808201526080815261149160a0826112d7565b90565b6339dc165f60e11b81036114df57506040805160008051602061191e833981519152546001600160a01b038116602083015260a01c61ffff16818301529081526114916060826112d7565b63d41c3a6560e01b810361151e575060018060a01b036000805160206118fe8339815191525416604051906020820152602081526114916040826112d7565b6382daf2a160e01b810361155557506000805160206118de83398151915254604051906020820152602081526114916040826112d7565b637ac3c02f60e01b8103611594575060018060a01b0360008051602061193e8339815191525416604051906020820152602081526114916040826112d7565b633f79b95560e21b81036115fc57503660031901602011610023576004356000527fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558d60205260ff604060002054166040519015156020820152602081526114916040826112d7565b6367fe1ffb60e01b60005260045260246000fd5b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461164257565b6327910b4760e01b60005260046000fd5b8181029291811591840414171561166657565b634e487b7160e01b600052601160045260246000fd5b9190820180921161166657565b92919042841142821115176116de578282146116d757916116c26116c8926116bc86600196039642039182880390611653565b92611653565b9061167c565b91600019830104019015150290565b5050905090565b836309ed117960e11b6000524260045260245260445260646000fd5b9194939260405163224201db60e01b8152604081600481305afa801561180d5760009182916117d3575b5080611730838661167c565b116117b2575081611741828561167c565b116117915750507fad0a47e7e525f47d77240580a4c9fd4fdd1649c973285fb5a300a466bd3ba8e9939461177491611819565b604080516001600160a01b039290921682526020820192909252a1565b61179b919261167c565b635cc6d5f560e11b60005260045260245260446000fd5b6117bc828561167c565b63384b48c560e21b60005260045260245260446000fd5b9190506040823d604011611805575b816117ef604093836112d7565b8101031261029d57506020815191015138611724565b3d91506117e2565b6040513d6000823e3d90fd5b9080156118d95761182991611653565b60008051602061191e833981519152546001600160a01b031680156118c8576000805160206118fe833981519152546001600160a01b031680156118b7576064601c60008093602095604051976060526040523360601b602c526323b872dd60601b600c525af13d156001600051141716156118a9576000606052604052565b637939f4246000526004601cfd5b63a51ad60560e01b60005260046000fd5b63ad4a5bbf60e01b60005260046000fd5b505056fede34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558ade34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558cde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e5589de34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558ba2646970667358221220de7ff88c9315fd02c99d38ca46c545fd0161183f5d6a4d5cd19b9bda2d8fef7f64736f6c634300081a0033

Deployed Bytecode

0x60806040526004361015610028575b346100235761001b6113f5565b602081519101f35b600080fd5b6000803560e01c806320351c01146111fc57806323e5db0b1461108357806326f8cd4f14610f3f5780634ccf1b3414610e8b5780637ba0e2e7146107c8578063a7ecd37e146107145763b913ff0914610081575061000e565b3461029d57604036600319011261029d5761009a611261565b9060243567ffffffffffffffff8111610710578060040192610220600319833603011261070c57604051638da5cb5b60e01b81526001600160a01b03919091169190602081600481865afa9081156103135784916106ca575b506001600160a01b031633036106bc5783359384610679575b8394506024820161011d8183611372565b9050610607575b50604482016101338183611372565b90506105ab575b50506101448101358061055f575b506101a481016001600160a01b0361015f826113cd565b1615159060016101c48401926001600160601b0361017c856113e1565b16151516146104ef575b505060a4810164ffffffffff61019b8261129f565b161515600160c484019164ffffffffff6101b48461129f565b1615151614610452575b505060e481013580610406575b50610104810160016001600160a01b036101e4836113cd565b1615151461037d575b5061018481016001600160a01b03610204826113cd565b1661031e575b5061016481016001600160a01b03610221826113cd565b166102b0575b50610204810135908161023957505050f35b6101e461024691016113cd565b90823b156102ab5760405163859edc5560e01b81526001600160a01b0392909216600483015260248201529082908290604490829084905af180156102a05761028c5750f35b81610296916112d7565b61029d5780f35b80fd5b6040513d84823e3d90fd5b505050fd5b6102b9906113cd565b823b156102ab57604051631333c6cd60e21b81526001600160a01b039091166004820152838160248183875af19081156103135784916102fa575b50610227565b81610304916112d7565b61030f5782386102f4565b5050fd5b6040513d86823e3d90fd5b610327906113cd565b823b156102ab576040516353f669bf60e11b81526001600160a01b039091166004820152838160248183875af1908115610313578491610368575b5061020a565b81610372916112d7565b61030f578238610362565b9250813b15610402576040516326f8cd4f60e01b815292356001600160a01b0381168103610023576001600160a01b031660048401526101248101359261ffff841684036100235761ffff8594166024820152838160448183875af19081156103135784916103ed575b506101ed565b816103f7916112d7565b61030f5782386103e7565b8380fd5b823b156102ab57604051906320351c0160e01b82526004820152838160248183875af190811561031357849161043d575b506101cb565b81610447916112d7565b61030f578238610437565b833b156104eb576104b964ffffffffff91826104ae604051956323e5db0b60e01b87526001600160501b0361048960648a016112b1565b1660048801526001600160501b036104a360848a016112b1565b1660248801526112c5565b1660448501526112c5565b166064820152838160848183875af1908115610313578491156101be57816104e0916112d7565b61030f5782386101be565b8480fd5b6104fb610501916113cd565b916113e1565b833b156104eb576040516304634d8d60e01b81526001600160a01b0390921660048301526001600160601b03166024820152838160448183875af1908115610313578491156101865781610554916112d7565b61030f578238610186565b823b156102ab57604051906304cdb5fd60e11b82526004820152838160248183875af1908115610313578491610596575b50610148565b816105a0916112d7565b61030f578238610590565b6105b491611372565b90833b156104eb5760405163938e3d7b60e01b8152918591839182916105de9190600484016113a5565b038183875af19081156103135784911561013a57816105fc916112d7565b61030f57823861013a565b6106119082611372565b90843b15610675576040516355f804b360e01b81529186918391829161063b9190600484016113a5565b038183885af190811561066a578591610655575b50610124565b8161065f916112d7565b6102ab57833861064f565b6040513d87823e3d90fd5b8580fd5b823b1561040257604051946306f8b44b60e41b86526004860152838560248183875af18015610313571561010c57929093816106b4916112d7565b91839061010c565b6282b42960e81b8352600483fd5b90506020813d602011610704575b816106e5602093836112d7565b8101031261040257516001600160a01b038116810361040257386100f3565b3d91506106d8565b8280fd5b5080fd5b503461029d57602036600319011261029d5761072e611261565b610736611610565b6001600160a01b031680156107b95760008051602061193e833981519152546001600160a01b031681146107aa5760008051602061193e83398151915280546001600160a01b031916821790557f5553331329228fbd4123164423717a4a7539f6dfa1c3279a923b98fd681a6c738280a280f35b638044bb3360e01b8252600482fd5b6367db084560e11b8252600482fd5b503461029d57602036600319011261029d5760043567ffffffffffffffff811161071057366023820112156107105780600401359167ffffffffffffffff831161029d576024838301019036821161029d57610822611610565b60358410610e7c578360351161029d576039830135938415610e6d578015610e5957602484013560f81c9360028511610e45578160151161070c57602581013560601c948515610e3d575b80610a1f5750506040519192507fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558890506080820167ffffffffffffffff811183821017610a0b579061090392916040525460606001600160501b038216918284526001600160501b038160501c169384602082015264ffffffffff808360a01c169283604084015260c81c169283910152611689565b6040805163224201db60e01b81529081600481305afa8015610a0057839184916109c7575b5080610934838861167c565b116109a757509161097360409261096c7fad0a47e7e525f47d77240580a4c9fd4fdd1649c973285fb5a300a466bd3ba8e9958861167c565b5086611819565b81516001600160a01b03851681526020810191909152a15b604080516001600160a01b039290921682526020820192909252f35b83906109b56044938861167c565b63384b48c560e21b8352600452602452fd5b9150506040813d6040116109f8575b816109e3604093836112d7565b8101031261070c576020815191015138610928565b3d91506109d6565b6040513d85823e3d90fd5b634e487b7160e01b84526041600452602484fd5b600103610b35578160f51161070c5790610a4382610119605994019384910161130f565b6000805160206118de833981519152549460405194602086019660018060a01b0389168852835160408801526020840194855160608901526040850193845160808a01526060860197885160a08b0152608087019a8b5160c08c015260a088019a8b5160e082015260e08152610abb610100826112d7565b5190209260f41901610b09575b505003610afa575091610af595949391610ae9935192519051915192611689565b915190519185856116fa565b61098b565b6309bde33960e01b8152600490fd5b915b602083359182811160051b9081521852602060408520920191818310610b0b579150503880610ac8565b90809294935060f51161040257610119810191610b55836059840161130f565b92816101151161067557359181610135116106755761013981013591610155116106755761015901359183516020850190815191604087019687519460608201938451956080840197885160a08601988951926040519460208601967f50ffd5117ec0ab54da7e62c16f960b5451eb3d9f9e67f1ffe6ff63924f3c6aa7885260408701526060860152608085015260a084015260c083015260e082015260e08152610c02610100826112d7565b51902060405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f92cb2863a937eecd2e79d45ee1bedf597b2486ddb5dcfa07b893821ce783ec8160408201527fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b360608201524660808201523060a082015260a08152610c9760c0826112d7565b519020916040519060208201927f2c42d8c62430fb671db6f232c528561a235206fa82d73adccba49cdd371ad4d384528d60018060a01b031660408401526060830152608082015260808152610cee60a0826112d7565b51902060405190602082019261190160f01b84526022830152604282015260428152610d1b6062826112d7565b51902097888b527fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558d60205260ff60408c205416600014610d645763900bb2c960e01b8b5260048bfd5b91610dc195949391610db5938a8d9c9d527fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558d60205260408c20600160ff198254161790555192519051915192611689565b915190519189896116fa565b604051928452601b8260ff1c0160205260405260018060ff1b031660605260206001608084825afa51903d15610e3057606083905260405260008051602061193e833981519152546001600160a01b03908116911603610e21575061098b565b638baa579f60e01b8152600490fd5b638baa579f83526004601cfd5b33955061086d565b630376da3160e51b83526004859052602483fd5b634e487b7160e01b82526032600452602482fd5b63c67d956b60e01b8252600482fd5b63b39e5b8160e01b8152600490fd5b503461029d57602036600319011261029d57610ea5611261565b610ead611610565b6001600160a01b03168015610f30576000805160206118fe833981519152546001600160a01b03168114610f21576000805160206118fe83398151915280546001600160a01b031916821790557fbd4032c1c91da2791730ea1bbc82c6b6f857da7c0a8318143d19ef74e62cd9138280a280f35b633b4f379560e01b8252600482fd5b63758f30c160e11b8252600482fd5b503461029d57604036600319011261029d57610f59611610565b8060008051602061191e833981519152556040516040810181811067ffffffffffffffff82111761106f57604052610f8f611261565b908181526024359161ffff8316918284036104eb5760208101848152916001600160a01b0316156110605761ffff8251166103e8811161104e57505160008051602061191e833981519152805492516001600160b01b03199093166001600160a01b039283161760a09390931b61ffff60a01b16929092179091556040516004359182169290918390036104eb577fa553a3b9c7b8c71b32d17164bf9893e7c71c2b08524395b909f8fc3b87afb9d2936040938352506020820152a180f35b630cbf8cb160e11b8652600452602485fd5b63e4ccae3160e01b8552600485fd5b634e487b7160e01b83526041600452602483fd5b503461029d57608036600319011261029d5761109d611610565b6110a5611277565b64ffffffffff806110b461128b565b16911610156111cd576004356001600160501b0381167fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558881830361040257805491602435916001600160501b038316938484036111c95764ffffffffff60a01b61111c611277565b60a01b1664ffffffffff60c81b61113161128b565b60c81b16918464ffffffffff60c81b199166ffffffffffffff60c81b1617166001600160501b0360501b8660501b1617171790556040519350835250602082015260443564ffffffffff811680910361070c57604082015260643564ffffffffff811680910361070c578160809160607faef194a3004255316c8468ed13b659935570ee249e2b682c1f2e09c828fb3a0b940152a180f35b8680fd5b60449064ffffffffff6111de611277565b816111e761128b565b6324e8fce760e01b8552911660045216602452fd5b503461029d57602036600319011261029d57600435611219611610565b6000805160206118de83398151915254816000805160206118de833981519152557fc0c9caab39dd0b6d465e16613ec23a2277fc69737013e962a794ea4237bc9c168380a380f35b600435906001600160a01b038216820361002357565b60443564ffffffffff811681036100235790565b60643564ffffffffff811681036100235790565b3564ffffffffff811681036100235790565b35906001600160501b038216820361002357565b359064ffffffffff8216820361002357565b90601f8019910116810190811067ffffffffffffffff8211176112f957604052565b634e487b7160e01b600052604160045260246000fd5b908160c0910312610023576040519060c082019082821067ffffffffffffffff8311176112f95760a0916040528035835260208101356020840152604081013560408401526060810135606084015260808101356080840152013560a082015290565b903590601e1981360301821215610023570180359067ffffffffffffffff82116100235760200191813603831361002357565b90918060409360208452816020850152848401376000828201840152601f01601f1916010190565b356001600160a01b03811681036100235790565b356001600160601b03811681036100235790565b6113fd611610565b6000356001600160e01b031916366004116100235763653f8fc360e11b810361149457507fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558864ffffffffff60405191546001600160501b03811660208401526001600160501b038160501c166040840152818160a01c16606084015260c81c1660808201526080815261149160a0826112d7565b90565b6339dc165f60e11b81036114df57506040805160008051602061191e833981519152546001600160a01b038116602083015260a01c61ffff16818301529081526114916060826112d7565b63d41c3a6560e01b810361151e575060018060a01b036000805160206118fe8339815191525416604051906020820152602081526114916040826112d7565b6382daf2a160e01b810361155557506000805160206118de83398151915254604051906020820152602081526114916040826112d7565b637ac3c02f60e01b8103611594575060018060a01b0360008051602061193e8339815191525416604051906020820152602081526114916040826112d7565b633f79b95560e21b81036115fc57503660031901602011610023576004356000527fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558d60205260ff604060002054166040519015156020820152602081526114916040826112d7565b6367fe1ffb60e01b60005260045260246000fd5b307f000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e436001600160a01b03161461164257565b6327910b4760e01b60005260046000fd5b8181029291811591840414171561166657565b634e487b7160e01b600052601160045260246000fd5b9190820180921161166657565b92919042841142821115176116de578282146116d757916116c26116c8926116bc86600196039642039182880390611653565b92611653565b9061167c565b91600019830104019015150290565b5050905090565b836309ed117960e11b6000524260045260245260445260646000fd5b9194939260405163224201db60e01b8152604081600481305afa801561180d5760009182916117d3575b5080611730838661167c565b116117b2575081611741828561167c565b116117915750507fad0a47e7e525f47d77240580a4c9fd4fdd1649c973285fb5a300a466bd3ba8e9939461177491611819565b604080516001600160a01b039290921682526020820192909252a1565b61179b919261167c565b635cc6d5f560e11b60005260045260245260446000fd5b6117bc828561167c565b63384b48c560e21b60005260045260245260446000fd5b9190506040823d604011611805575b816117ef604093836112d7565b8101031261029d57506020815191015138611724565b3d91506117e2565b6040513d6000823e3d90fd5b9080156118d95761182991611653565b60008051602061191e833981519152546001600160a01b031680156118c8576000805160206118fe833981519152546001600160a01b031680156118b7576064601c60008093602095604051976060526040523360601b602c526323b872dd60601b600c525af13d156001600051141716156118a9576000606052604052565b637939f4246000526004601cfd5b63a51ad60560e01b60005260046000fd5b63ad4a5bbf60e01b60005260046000fd5b505056fede34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558ade34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558cde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e5589de34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e558ba2646970667358221220de7ff88c9315fd02c99d38ca46c545fd0161183f5d6a4d5cd19b9bda2d8fef7f64736f6c634300081a0033

Block Transaction 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

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.