S Price: $0.519451 (+2.55%)

Contract

0x12dA4dF4207C64F8eA0b05B839D8C3d0296eA8aC

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S 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:
HumbleDonationsSonic

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 36 : HumbleDonationsSonic.sol
// SPDX-License-Identifier: MIT

// HumbleDonations.sol

/// @dev Scope of HumbleDonations
/*
  Allows users to mint projects which contain webpage metadata.
  Users can donate ERC-20 tokens or nativec currency to projects safely.
  Have fun, stay safe!

  - Norepi 
*/

pragma solidity >=0.8.20;
pragma abicoder v2;
// NonUpgradeable
import "./IHumbleDonations.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
// Swap
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
//// Upgradeable
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";

using SafeERC20 for IERC20;

// Interface for WETH to wrap ether
interface IWETH {
    function deposit() external payable;
}

interface ISolidlySwapRouter {
    struct Route {
        address from;
        address to;
        bool stable;
    }
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        Route[] calldata routes,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, Route[] calldata routes, address to, uint deadline)
    external
    payable
    returns (uint[] memory amounts);
}

contract HumbleDonationsSonic is IHumbleDonations,
Initializable, ERC721Upgradeable, ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, OwnableUpgradeable, UUPSUpgradeable, ReentrancyGuardUpgradeable
{
    /// @custom:oz-upgrades-unsafe-allow constructor state-variable-immutable

    constructor() {
        _disableInitializers();
    }
    
    /*
    * Testnet: 0xf08413857AF2CFBB6edb69A92475cC27EA51453b 
    * RouterV2: 0x7635cD591CFE965bE8beC60Da6eA69b6dcD27e4b
    * RouterV3: 0xcC6169aA1E879d3a4227536671F85afdb2d23fAD
    * */
    // -----CONSTANTS-----
    
    address private constant SWAP_ROUTER = 0xcC6169aA1E879d3a4227536671F85afdb2d23fAD;
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    ISolidlySwapRouter public immutable swapRouter = ISolidlySwapRouter(SWAP_ROUTER);
    // -----CONSTANTS-----


    // Contract is upgradable in the interest of upgrading to a Rust-based Stylus contract in the future.
    function initialize(address initialOwner) initializer public {
        __ERC721_init("Humble Donations", "Project");
        __ERC721URIStorage_init();
        __ERC721Burnable_init();
        __Ownable_init(initialOwner);
        __UUPSUpgradeable_init();
        __ReentrancyGuard_init();
        
        _tokenIdCounter = 1;
        taxPercentage = 15;
        mintRate = 0.005 ether;
        upgradeCount = 0;
    }

    // -----MAPPINGS-----
    // Mapping of tokenId to projectTitle
    mapping(uint256 => string) public tokenIdToProjectTitle;

    // Reverse mapping for projectTitle to tokenId
    mapping(string => uint256) public projectTitleToTokenId;
    // -----MAPPINGS-----


    // -----DECLARATIONS-----
    address private constant recipient1 = 0xBFD674dd1e4cDae881d0a9f5e9aC1C8232a38a40; // Sonic Safe
    address private constant recipient2 = 0x12FB341C803fC94Edd0481f8BDaB1A3B971521A6; // Sonic Dev Safe

    uint256 public upgradeCount; // Variable to track the number of upgrades
    address public HDT;
    address public WETH;
    uint256 public taxPercentage;
    uint256 public mintRate; // mintRate for safeMint
    uint256 private _tokenIdCounter; // Counter for token IDs  |  # initialized to 1 to make safeMint checks valid
    bytes32 public merkleRoot;
    // -----DECLARATIONS-----


    // ------UPGRADE------
   function getUpgradeCount() external view returns (uint256) {
        // returns upgrade counter
        return upgradeCount;
    }

    function _authorizeUpgrade(address newImplementation)
        internal
        onlyOwner
        override
    {        
        // Increment the upgrade count whenever an upgrade is authorized
        upgradeCount++;
    }

    // Supports interface
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721Upgradeable, ERC721URIStorageUpgradeable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
    // ------UPGRADE------
    

    // ------SET/CHANGE VARIABLES AFTER DEPLOYMENT------
    // Set HDT
    function setHDT(address _HDT) external onlyOwner {
        HDT = _HDT;
    }
    // Get HDT
    function getHDT() external view returns (address) {
        return HDT;
    }

    // Get WETH
    function getWETH() external view returns (address) {
        return WETH;
    }
    // Set WETH
    function setWETH(address _WETH) external onlyOwner {
        WETH = _WETH;
    }

    // Set the mintRate for minting ERC721 token 
    function set_mintRate(uint256 _mintRate) external onlyOwner {
        mintRate = _mintRate; // 0.0001 ether mintRate upon deployment
    }
    // Get the mintRate value
    function get_mintRate() external view returns (uint256) {
        return mintRate;
    }

    // Set taxPercentage
    function setTaxPercentage(uint256 tax) external onlyOwner {
        // # set limit to tax rate
        require(tax <= 300, "tax cannot be higher than 30%");
        // tax = 15 == 1.5%;
        taxPercentage = tax;
    }
    // Get tax percentage
    function getPercentage() external view returns (uint256) {
        return taxPercentage;
    }

    // set Merkle Root of token whitelist
    function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        merkleRoot = _merkleRoot;
    }
    // ------SET/CHANGE VARIABLES AFTER DEPLOYMENT------

   // Helper function to check if token is whitelisted
    function isTokenWhitelisted(address erc20Token, bytes32[] calldata proof) public view returns (bool) {
        bytes32 leaf = keccak256(abi.encodePacked(erc20Token));
        return MerkleProof.verify(proof, merkleRoot, leaf);
    }


    // -----COUNTER-----
    function latestTokenId() external view returns (uint256) {
        return _tokenIdCounter;
    }
    // -----COUNTER-----


    // -----CREATE PROJECT-----
    function safeMint(
        address to,
        string memory uri,
        string memory projectTitle
    ) external payable nonReentrant {
        require(msg.value >= mintRate, "Not enough ETH sent");
        require(balanceOf(to) == 0, "Address already owns a token");
        require(
            projectTitleToTokenId[projectTitle] == 0,
            "Project title already exists"
        );
        uint256 tokenId = _tokenIdCounter;
        _tokenIdCounter++;
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, uri);

        tokenIdToProjectTitle[tokenId] = projectTitle;

        // Update reverse mapping
        projectTitleToTokenId[projectTitle] = tokenId;
        // Using call method because call does not have a fixed gas lmit. Using payable for safety
        (bool success, ) = payable(recipient2).call{value: mintRate}("");
        require(success, "Mint Rate transfer failed");

        emit ProjectCreated(tokenId, to, projectTitle, uri, block.timestamp);
    }
    // -----CREATE PROJECT-----


    // -----TRANSFER PROJECT OVERRIDE-----
    /*
    # Override the _transfer function
    Prevents transfering a project to address
    which has ownership over another project
    */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override(ERC721Upgradeable, IERC721) {
        // Ensure the recipient does not already own a token
        require(balanceOf(to) == 0, "Recipient already owns a project NFT");

        // Proceed with the normal transfer operation
        super.transferFrom(from, to, tokenId);
    }
    // -----TRANSFER PROJECT OVERRIDE-----


    // -----CHECKS FOR OWNERSHIP-----
    function getOwnerByProjectTitle(
        string memory projectTitle
    ) external view returns (address) {
        uint256 tokenId = projectTitleToTokenId[projectTitle];
        if (tokenId != 0) {
            return ownerOf(tokenId);
        }
        return address(0);
    }

    // Getter function to retrieve the tokenId associated with a given projectTitle
    function getTokenId(string memory projectTitle) public view returns (uint256) {
        return projectTitleToTokenId[projectTitle];
    }
    // -----CHECKS FOR OWNERSHIP-----



    // -----ROUTER LOGIC-----
    function swapExactInputSingle(
        address tokenIn,
        uint256 amountIn,
        uint256 slippageWETH,
        uint256 slippageHDT
    ) internal returns (uint256 amountOut) {
        // Deadline in same tx
        uint256 deadline = block.timestamp;
        // Transfer amountIn of tokenIn to this contract
        IERC20(tokenIn).safeTransferFrom(
            msg.sender,
            address(this),
            amountIn
        );

        // Approve tokenIn to the swap router
        TransferHelper.safeApprove(tokenIn, address(swapRouter), amountIn);

        // Declared outside of if-else statement to be accessible by approval & swap to HDT         
        uint256 halfWETH;
        uint256 oneQuarterWETH;

        if (tokenIn == WETH) {
            // halfWETH = 50% of amountIn in WETH
            halfWETH = amountIn / 2;

            // oneQuarterWETH = 25% of amountIn in WETH
            oneQuarterWETH = amountIn / 4;

            // Transfer 50% WETH to recipient2
            IERC20(WETH).safeTransfer(recipient2, halfWETH);

            // Transfer 25% WETH to recipient1
            IERC20(WETH).safeTransfer(recipient1, oneQuarterWETH);

        } else {
            // Swap 100% of amountIn to WETH
            ISolidlySwapRouter.Route[] memory routesToWETH = new ISolidlySwapRouter.Route[](1);
            routesToWETH[0] = ISolidlySwapRouter.Route({
                from: tokenIn,
                to: WETH,
                stable: false
            });

            uint[] memory wethParams = swapRouter.swapExactTokensForTokens(
                amountIn,
                slippageWETH,
                routesToWETH,
                address(this),
                deadline
            );
            // Executes the swap
            amountOut = wethParams[wethParams.length - 1];

            // Transfer 75% of amountIn WETH to recipients

            // halfWETH = 50% of amountIn WETH
            halfWETH = amountOut / 2;

            // oneQuarterWETH = 25% of amountIn WETH
            oneQuarterWETH = amountOut / 4;

            // Transfer 50% WETH to recipient2
            IERC20(WETH).safeTransfer(recipient2, halfWETH);

            // Transfer 25% WETH to recipient1
            IERC20(WETH).safeTransfer(recipient1, oneQuarterWETH);
        }

        // Approving 1/4 WETH for swap to HDT
        TransferHelper.safeApprove(WETH, address(swapRouter), oneQuarterWETH);

        // Swap remaining 25% of amountIn WETH to HDT
        ISolidlySwapRouter.Route[] memory routesToHDT = new ISolidlySwapRouter.Route[](1);
        routesToHDT[0] = ISolidlySwapRouter.Route({
            from: WETH,
            to: HDT,
            stable: false
        });

        // Swap remaining 25% of WETH to HDT
        uint[] memory amountsOut = swapRouter.swapExactTokensForTokens(
            oneQuarterWETH,
            slippageHDT,
            routesToHDT,
            address(this),
            deadline
        );
        // Executes the swap
        uint256 amountOutHDT = amountsOut[amountsOut.length - 1];

        // Burn 25%, HDT
        ERC20Burnable(HDT).burn(amountOutHDT);
    }

    /* 
    swapExactInputSingleETH takes a slightly different route by handling the swap in ETH
    which eliminates the need for safeApprove, thereby optimizing efficiency. 
    */ 
    function swapExactInputSingleETH(
        uint256 amountIn,
        uint256 slippageHDT
    ) internal returns (uint256 amountOut) {
        // Deadline in same tx
        uint256 deadline = block.timestamp;

        require(amountIn > 0, "Amount in must be greater than 0");

        // Declared 3/4 of amountIn for wrapping
        uint256 threeQuartersETH = (amountIn * 3) / 4;
        require(threeQuartersETH > 0, "Three quarters of amountIn must be greater than 0");

        // Wrap 75% ETH to WETH
        IWETH(WETH).deposit{value: threeQuartersETH}();

        // halfWETH = 50% of amountIn in WETH
        uint256 halfWETH = amountIn / 2;

        // oneQuarterWETH = 25% of amountIn in WETH
        uint256 oneQuarterWETH = amountIn / 4;

        // Transfer 50% WETH to recipient2
        TransferHelper.safeTransfer(WETH, recipient2, halfWETH);

        // Transfer 25% WETH to recipient1
        TransferHelper.safeTransfer(WETH, recipient1, oneQuarterWETH);

        // Swap 25% of amountIn ETH to HDT - because this portion of amountIn was not wrapped, no approval is required
        ISolidlySwapRouter.Route[] memory routes = new ISolidlySwapRouter.Route[](1);
        routes[0] = ISolidlySwapRouter.Route({
            from: WETH,
            to: HDT,
            stable: false
        });

        // Swap 25% WETH to HDT
        uint[] memory amountsOut = swapRouter.swapExactETHForTokens{value: oneQuarterWETH}(
            slippageHDT, 
            routes,
            address(this),
            deadline
        );
        // Executes the swap
        amountOut = amountsOut[amountsOut.length - 1];
        // Burn 25%, HDT
        ERC20Burnable(HDT).burn(amountOut);
    }
    // -----ROUTER LOGIC-----


    // -----DONATION LOGIC-----
    function donate(
        uint256 tokenId,
        address erc20Token,
        uint256 amount,
        uint256 slippageWETH,
        uint256 slippageHDT,
        bytes32[] calldata proof
    ) external payable nonReentrant {
        // Ensure the sender is not the token owner
        address tokenOwner = ownerOf(tokenId);
        require(msg.sender != tokenOwner, "Cannot pay yourself");
        // Ensure that the project title is available before making payments
        require(
            bytes(tokenIdToProjectTitle[tokenId]).length > 0,
            "Project title not set"
        );

        // Prevents donations for tokenOwners that own more than one ERC-721 token
        require(balanceOf(tokenOwner) <= 1, "Token owner already owns more than one project NFT");

        // # Check to require that called amount is greater than 0
        require(amount > 0, "Input amount cannot be 0");

        uint256 total;
        uint256 taxAmount = (amount * taxPercentage) / 1000;

        IERC20 tokenContract = IERC20(erc20Token);
        if (erc20Token != address(HDT)) {
            total = amount - taxAmount;
            // ---If ETH is donated---
            if (erc20Token == address(0)) {
                // If the input token is ETH, ensure the sender has sent exactly the required amount
                require(msg.value >= amount, "Incorrect amount of ETH sent");

                // Performs swap of ETH, including wrapping ETH
                swapExactInputSingleETH(taxAmount, slippageHDT);

                // Using call method because call does not have a fixed gas lmit. Using payable for safety
                (bool success, ) = payable(tokenOwner).call{value: total}("");
                require(success, "ETH transfer failed");

            // ---If ERC-20 is donated---
            } else {
                // Whitelist  |  Checks whether input erc20Token is listed in the merkle proof
                require(isTokenWhitelisted(erc20Token, proof), "Token is not whitelisted");

                require(
                    tokenContract.allowance(msg.sender, address(this)) >= amount,
                    "Insufficient allowance"
                    
                );

                // Performs swap of ERC-20 token
                swapExactInputSingle(
                    erc20Token,
                    taxAmount,
                    slippageWETH,
                    slippageHDT
                );

                // Transfer total amount to the contract | eg. 98.5%
                tokenContract.safeTransferFrom(msg.sender, tokenOwner, total);
                    
            }
        // ---If ERC-20 tax-exempt token is donated (HDT)---
        } else {
            total = amount;

            // Ensure the sender has a sufficient token balance
            require(
                tokenContract.allowance(msg.sender, address(this)) >= amount,
                "Insufficient allowance"
            );

            // Transfer total amount to the contract | eg. 98.5%
            tokenContract.safeTransferFrom(msg.sender, tokenOwner, total);
        }
        // emits event to track donations via The Graph
        emit DonationMade(tokenId, msg.sender, erc20Token, total, block.timestamp);
    }
    // -----DONATION LOGIC-----


    // -----DELETE PROJECT-----
    function burnToken(uint256 tokenId) external {
        // Function called to delete a project & burn associated ERC-721 project
        address previousOwner = ownerOf(tokenId);

        // Only the owner of the token can burn the token
        require(ownerOf(tokenId) == msg.sender, "Caller is not the owner");

        // Retrieve the project title before burning the token
        string memory projectTitle = tokenIdToProjectTitle[tokenId];

        // Burn token
        _burn(tokenId);

        // Remove the tokenId from tokenIdToProjectTitle mapping
        delete tokenIdToProjectTitle[tokenId];

        // Remove the projectTitle from projectTitleToTokenId mapping
        delete projectTitleToTokenId[projectTitle];

        // emits token being burned, the owner of the token before it was burned, the burn address, and the current time stamp
        emit ProjectDeleted(tokenId, previousOwner, address(0), block.timestamp);
    }
    // -----DELETE PROJECT-----


    // -----URI-----
    function tokenURI(
        uint256 tokenId
    ) public view override(ERC721Upgradeable, ERC721URIStorageUpgradeable) returns (string memory) {
        return super.tokenURI(tokenId);
    }
    // -----URI-----


    // -----WITHDRAW-----
    /* 
    Tokens are not intended to be held by this contract
    This block exists to withdraw tokens accidently sent 
    to or otherwise accumulated by this contract.
    */

    // Withdraw ETH
    function withdraw() external onlyOwner {
        (bool success, ) = msg.sender.call{value: address(this).balance}("");
        require(success, "Transfer Failed");
    }

    // Withdraw ERC-20
    function withdrawToken(
        address erc20Token,
        uint256 amount
    ) external onlyOwner {
        require(erc20Token != address(0), "Invalid ERC-20 token address");
        // Interact with the ERC-20 token contract to transfer tokens
        IERC20 tokenContract = IERC20(erc20Token);
        // Ensure the contract has a sufficient token balance
        require(
            tokenContract.balanceOf(address(this)) >= amount,
            "Insufficient token balance"
        );

        // safeTransfer the ERC-20 tokens to the contract owner
        tokenContract.safeTransfer(msg.sender, amount);
    }
    // -----WITHDRAW-----


    // Reserved slots for future upgrades
    uint256[440] private __gap;
}

File 2 of 36 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 36 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 4 of 36 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.20;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual notDelegated returns (bytes32) {
        return ERC1967Utils.IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC1967-compliant implementation pointing to self.
     * See {_onlyProxy}.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

File 5 of 36 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol";
import {IERC721Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

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

    /// @custom:storage-location erc7201:openzeppelin.storage.ERC721
    struct ERC721Storage {
        // Token name
        string _name;

        // Token symbol
        string _symbol;

        mapping(uint256 tokenId => address) _owners;

        mapping(address owner => uint256) _balances;

        mapping(uint256 tokenId => address) _tokenApprovals;

        mapping(address owner => mapping(address operator => bool)) _operatorApprovals;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300;

    function _getERC721Storage() private pure returns (ERC721Storage storage $) {
        assembly {
            $.slot := ERC721StorageLocation
        }
    }

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC721Storage storage $ = _getERC721Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual returns (uint256) {
        ERC721Storage storage $ = _getERC721Storage();
        if (owner == address(0)) {
            revert ERC721InvalidOwner(address(0));
        }
        return $._balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual returns (address) {
        return _requireOwned(tokenId);
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual returns (string memory) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual returns (string memory) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._symbol;
    }

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

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

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual {
        _approve(to, tokenId, _msgSender());
    }

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

        return _getApproved(tokenId);
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
     * the `spender` for the specific `tokenId`.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        unchecked {
            $._balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                $._balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                $._balances[to] += 1;
            }
        }

        $._owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

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

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC721 standard to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        $._tokenApprovals[tokenId] = to;
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Requirements:
     * - operator can't be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        if (operator == address(0)) {
            revert ERC721InvalidOperator(operator);
        }
        $._operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
     * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    revert ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert ERC721InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

File 6 of 36 : ERC721BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.20;

import {ERC721Upgradeable} from "../ERC721Upgradeable.sol";
import {ContextUpgradeable} from "../../../utils/ContextUpgradeable.sol";
import {Initializable} from "../../../proxy/utils/Initializable.sol";

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
    function __ERC721Burnable_init() internal onlyInitializing {
    }

    function __ERC721Burnable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        _update(address(0), tokenId, _msgSender());
    }
}

File 7 of 36 : ERC721URIStorageUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721URIStorage.sol)

pragma solidity ^0.8.20;

import {ERC721Upgradeable} from "../ERC721Upgradeable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC4906} from "@openzeppelin/contracts/interfaces/IERC4906.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../../proxy/utils/Initializable.sol";

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorageUpgradeable is Initializable, IERC4906, ERC721Upgradeable {
    using Strings for uint256;

    // Interface ID as defined in ERC-4906. This does not correspond to a traditional interface ID as ERC-4906 only
    // defines events and does not include any external function.
    bytes4 private constant ERC4906_INTERFACE_ID = bytes4(0x49064906);

    /// @custom:storage-location erc7201:openzeppelin.storage.ERC721URIStorage
    struct ERC721URIStorageStorage {
        // Optional mapping for token URIs
        mapping(uint256 tokenId => string) _tokenURIs;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721URIStorage")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC721URIStorageStorageLocation = 0x0542a41881ee128a365a727b282c86fa859579490b9bb45aab8503648c8e7900;

    function _getERC721URIStorageStorage() private pure returns (ERC721URIStorageStorage storage $) {
        assembly {
            $.slot := ERC721URIStorageStorageLocation
        }
    }

    function __ERC721URIStorage_init() internal onlyInitializing {
    }

    function __ERC721URIStorage_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165) returns (bool) {
        return interfaceId == ERC4906_INTERFACE_ID || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        ERC721URIStorageStorage storage $ = _getERC721URIStorageStorage();
        _requireOwned(tokenId);

        string memory _tokenURI = $._tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via string.concat).
        if (bytes(_tokenURI).length > 0) {
            return string.concat(base, _tokenURI);
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Emits {MetadataUpdate}.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        ERC721URIStorageStorage storage $ = _getERC721URIStorageStorage();
        $._tokenURIs[tokenId] = _tokenURI;
        emit MetadataUpdate(tokenId);
    }
}

File 8 of 36 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 9 of 36 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 10 of 36 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

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

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

File 11 of 36 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 12 of 36 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 13 of 36 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 14 of 36 : IERC4906.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4906.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";
import {IERC721} from "./IERC721.sol";

/// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC165, IERC721 {
    /// @dev This event emits when the metadata of a token is changed.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFT.
    event MetadataUpdate(uint256 _tokenId);

    /// @dev This event emits when the metadata of a range of tokens is changed.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFTs.
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}

File 15 of 36 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../token/ERC721/IERC721.sol";

File 16 of 36 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 17 of 36 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 18 of 36 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

File 19 of 36 : ERC20Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.20;

import {ERC20} from "../ERC20.sol";
import {Context} from "../../../utils/Context.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys a `value` amount of tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 value) public virtual {
        _burn(_msgSender(), value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, deducting from
     * the caller's allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `value`.
     */
    function burnFrom(address account, uint256 value) public virtual {
        _spendAllowance(account, _msgSender(), value);
        _burn(account, value);
    }
}

File 20 of 36 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 21 of 36 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 22 of 36 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 23 of 36 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 24 of 36 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

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

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 25 of 36 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

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

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

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

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

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

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

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

File 26 of 36 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

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

File 27 of 36 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

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

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

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

File 28 of 36 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 29 of 36 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.20;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the Merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates Merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     *@dev The multiproof provided is not valid.
     */
    error MerkleProofInvalidMultiproof();

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Sorts the pair (a, b) and hashes the result.
     */
    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    /**
     * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
     */
    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 30 of 36 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 31 of 36 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

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

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

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

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

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

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 32 of 36 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 33 of 36 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 34 of 36 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

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

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

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

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

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

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

File 35 of 36 : TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) =
            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}

File 36 of 36 : IHumbleDonations.sol
// SPDX-License-Identifier: MIT

// IHumbleDonations.sol

pragma solidity >=0.7.0 <0.9.0;


interface IHumbleDonations {
    event DonationMade(uint256 indexed tokenId, address indexed donor, address erc20Token, uint256 amount, uint256 timestamp);
    event ProjectCreated(uint256 indexed tokenId, address indexed owner, string projectTitle, string uri, uint256 timestamp);
    event ProjectDeleted(uint256 indexed tokenId, address indexed previousOwner, address indexed burnAddress, uint256 timestamp);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"donor","type":"address"},{"indexed":false,"internalType":"address","name":"erc20Token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"DonationMade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"projectTitle","type":"string"},{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProjectCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"burnAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProjectDeleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"HDT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burnToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"slippageWETH","type":"uint256"},{"internalType":"uint256","name":"slippageHDT","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"donate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHDT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"projectTitle","type":"string"}],"name":"getOwnerByProjectTitle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"projectTitle","type":"string"}],"name":"getTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpgradeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"get_mintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc20Token","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"isTokenWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"projectTitleToTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"string","name":"projectTitle","type":"string"}],"name":"safeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_HDT","type":"address"}],"name":"setHDT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tax","type":"uint256"}],"name":"setTaxPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_WETH","type":"address"}],"name":"setWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintRate","type":"uint256"}],"name":"set_mintRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapRouter","outputs":[{"internalType":"contract ISolidlySwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToProjectTitle","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgradeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc20Token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523060805273cc6169aa1e879d3a4227536671f85afdb2d23fad60a0523480156200002d57600080fd5b50620000386200003e565b620000f2565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156200008f5760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000ef5780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b60805160a0516141816200014960003960008181610771015281816120000152818161214d01528181612292015281816123de015261249501526000818161264f0152818161267801526127d101526141816000f3fe6080604052600436106102ae5760003560e01c80637cb6475911610175578063ae7b6d16116100dc578063ca0dcf1611610095578063e8ba1dff1161006f578063e8ba1dff14610855578063e985e9c51461086a578063eca81d421461088a578063f2fde38b1461089d57600080fd5b8063ca0dcf16146107e9578063cae5f11e146107ff578063cd99b0101461081d57600080fd5b8063ae7b6d1614610729578063b88d4fde1461073f578063c31c9c071461075f578063c4128b6d14610793578063c4d66de8146107a9578063c87b56dd146107c957600080fd5b80639e281a981161012e5780639e281a98146106585780639f4a7c1014610678578063a01d371214610698578063a22cb465146106b8578063ad3cb1cc146106d8578063ad5c46481461070957600080fd5b80637cb64759146105915780638c0e8349146105b15780638da5cb5b146105c657806391f7e39714610603578063930baae81461062357806395d89b411461064357600080fd5b80634a9957f4116102195780636352211e116101d25780636352211e146104e7578063699abb3c146105075780636fa2fd591461052757806370a082311461053c578063715018a61461055c5780637b47ec1a1461057157600080fd5b80634a9957f41461044e5780634f1ef2861461046157806352d1902d1461047457806356b1ddbb146104895780635b769f3c146104a95780635fea0294146104c957600080fd5b806323b872dd1161026b57806323b872dd146103a35780632eb4a7ab146103c35780633ccfd60b146103d957806342842e0e146103ee57806342966c681461040e5780634744f6191461042e57600080fd5b806301ffc9a7146102b357806306fdde03146102e8578063081812fc1461030a578063095ea7b3146103425780630b2accb2146103645780631e7663bc14610383575b600080fd5b3480156102bf57600080fd5b506102d36102ce3660046137ca565b6108bd565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b506102fd6108ce565b6040516102df9190613837565b34801561031657600080fd5b5061032a61032536600461384a565b610972565b6040516001600160a01b0390911681526020016102df565b34801561034e57600080fd5b5061036261035d36600461387f565b610987565b005b34801561037057600080fd5b506005545b6040519081526020016102df565b34801561038f57600080fd5b5061037561039e36600461395e565b610996565b3480156103af57600080fd5b506103626103be366004613992565b6109be565b3480156103cf57600080fd5b5061037560085481565b3480156103e557600080fd5b50610362610a35565b3480156103fa57600080fd5b50610362610409366004613992565b610aca565b34801561041a57600080fd5b5061036261042936600461384a565b610ae5565b34801561043a57600080fd5b5061036261044936600461384a565b610af1565b61036261045c366004613a19565b610afe565b61036261046f366004613a93565b611045565b34801561048057600080fd5b50610375611060565b34801561049557600080fd5b5060035461032a906001600160a01b031681565b3480156104b557600080fd5b506103626104c4366004613ae0565b61107d565b3480156104d557600080fd5b506003546001600160a01b031661032a565b3480156104f357600080fd5b5061032a61050236600461384a565b6110a7565b34801561051357600080fd5b5061036261052236600461384a565b6110b2565b34801561053357600080fd5b50600254610375565b34801561054857600080fd5b50610375610557366004613ae0565b611111565b34801561056857600080fd5b5061036261116d565b34801561057d57600080fd5b5061036261058c36600461384a565b611181565b34801561059d57600080fd5b506103626105ac36600461384a565b61131d565b3480156105bd57600080fd5b50600754610375565b3480156105d257600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031661032a565b34801561060f57600080fd5b5061032a61061e36600461395e565b61132a565b34801561062f57600080fd5b5061036261063e366004613ae0565b61136f565b34801561064f57600080fd5b506102fd611399565b34801561066457600080fd5b5061036261067336600461387f565b6113d8565b34801561068457600080fd5b506102fd61069336600461384a565b611504565b3480156106a457600080fd5b506102d36106b3366004613afb565b61159e565b3480156106c457600080fd5b506103626106d3366004613b5b565b611624565b3480156106e457600080fd5b506102fd604051806040016040528060058152602001640352e302e360dc1b81525081565b34801561071557600080fd5b5060045461032a906001600160a01b031681565b34801561073557600080fd5b5061037560055481565b34801561074b57600080fd5b5061036261075a366004613b92565b61162f565b34801561076b57600080fd5b5061032a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561079f57600080fd5b5061037560025481565b3480156107b557600080fd5b506103626107c4366004613ae0565b61164c565b3480156107d557600080fd5b506102fd6107e436600461384a565b6117e5565b3480156107f557600080fd5b5061037560065481565b34801561080b57600080fd5b506004546001600160a01b031661032a565b34801561082957600080fd5b5061037561083836600461395e565b805160208183018101805160018252928201919093012091525481565b34801561086157600080fd5b50600654610375565b34801561087657600080fd5b506102d3610885366004613bf9565b6117f0565b610362610898366004613c2c565b61183d565b3480156108a957600080fd5b506103626108b8366004613ae0565b611ac3565b60006108c882611afe565b92915050565b6000805160206140ec83398151915280546060919081906108ee90613c9f565b80601f016020809104026020016040519081016040528092919081815260200182805461091a90613c9f565b80156109675780601f1061093c57610100808354040283529160200191610967565b820191906000526020600020905b81548152906001019060200180831161094a57829003601f168201915b505050505091505090565b600061097d82611b23565b506108c882611b5b565b610992828233611b95565b5050565b60006001826040516109a89190613cd9565b9081526020016040518091039020549050919050565b6109c782611111565b15610a255760405162461bcd60e51b8152602060048201526024808201527f526563697069656e7420616c7265616479206f776e7320612070726f6a6563746044820152630813919560e21b60648201526084015b60405180910390fd5b610a30838383611ba2565b505050565b610a3d611c27565b604051600090339047908381818185875af1925050503d8060008114610a7f576040519150601f19603f3d011682016040523d82523d6000602084013e610a84565b606091505b5050905080610ac75760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8811985a5b1959608a1b6044820152606401610a1c565b50565b610a308383836040518060200160405280600081525061162f565b61099260008233611c82565b610af9611c27565b600655565b610b06611d8c565b6000610b11886110a7565b90506001600160a01b0381163303610b615760405162461bcd60e51b815260206004820152601360248201527221b0b73737ba103830bc903cb7bab939b2b63360691b6044820152606401610a1c565b60008881526020819052604081208054610b7a90613c9f565b905011610bc15760405162461bcd60e51b8152602060048201526015602482015274141c9bda9958dd081d1a5d1b19481b9bdd081cd95d605a1b6044820152606401610a1c565b6001610bcc82611111565b1115610c355760405162461bcd60e51b815260206004820152603260248201527f546f6b656e206f776e657220616c7265616479206f776e73206d6f7265207468604482015271185b881bdb99481c1c9bda9958dd0813919560721b6064820152608401610a1c565b60008611610c855760405162461bcd60e51b815260206004820152601860248201527f496e70757420616d6f756e742063616e6e6f74206265203000000000000000006044820152606401610a1c565b6000806103e860055489610c999190613d0b565b610ca39190613d22565b60035490915089906001600160a01b03808316911614610f0657610cc7828a613d44565b92506001600160a01b038a16610dd15788341015610d275760405162461bcd60e51b815260206004820152601c60248201527f496e636f727265637420616d6f756e74206f66204554482073656e74000000006044820152606401610a1c565b610d318288611dc4565b506000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114610d7f576040519150601f19603f3d011682016040523d82523d6000602084013e610d84565b606091505b5050905080610dcb5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610a1c565b50610fd5565b610ddc8a878761159e565b610e285760405162461bcd60e51b815260206004820152601860248201527f546f6b656e206973206e6f742077686974656c697374656400000000000000006044820152606401610a1c565b604051636eb1769f60e11b815233600482015230602482015289906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015610e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e989190613d57565b1015610edf5760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610a1c565b610eeb8a838a8a61212f565b50610f016001600160a01b0382163386866125c9565b610fd5565b604051636eb1769f60e11b815233600482015230602482015289935083906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015610f55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f799190613d57565b1015610fc05760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610a1c565b610fd56001600160a01b0382163386866125c9565b604080516001600160a01b038c168152602081018590524281830152905133918d917fda38851157f2984cc47615155e6daa02931c36f0ecaa4822d8b631b5b368eb6e9181900360600190a35050505061103c600160008051602061412c83398151915255565b50505050505050565b61104d612644565b611056826126e9565b6109928282612709565b600061106a6127c6565b5060008051602061410c83398151915290565b611085611c27565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60006108c882611b23565b6110ba611c27565b61012c81111561110c5760405162461bcd60e51b815260206004820152601d60248201527f7461782063616e6e6f7420626520686967686572207468616e203330250000006044820152606401610a1c565b600555565b60006000805160206140ec8339815191526001600160a01b03831661114c576040516322718ad960e21b815260006004820152602401610a1c565b6001600160a01b039092166000908152600390920160205250604090205490565b611175611c27565b61117f600061280f565b565b600061118c826110a7565b905033611198836110a7565b6001600160a01b0316146111ee5760405162461bcd60e51b815260206004820152601760248201527f43616c6c6572206973206e6f7420746865206f776e65720000000000000000006044820152606401610a1c565b6000828152602081905260408120805461120790613c9f565b80601f016020809104026020016040519081016040528092919081815260200182805461123390613c9f565b80156112805780601f1061125557610100808354040283529160200191611280565b820191906000526020600020905b81548152906001019060200180831161126357829003601f168201915b5050505050905061129083612880565b60008381526020819052604081206112a791613766565b6001816040516112b79190613cd9565b90815260200160405180910390206000905560006001600160a01b0316826001600160a01b0316847f4ef8c0478b7cb23d7c76bbb226f7898438ece317e83af2b79f9a015974efcc7f4260405161131091815260200190565b60405180910390a4505050565b611325611c27565b600855565b60008060018360405161133d9190613cd9565b9081526020016040518091039020549050806000146113665761135f816110a7565b9392505050565b50600092915050565b611377611c27565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930180546060916000805160206140ec833981519152916108ee90613c9f565b6113e0611c27565b6001600160a01b0382166114365760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964204552432d323020746f6b656e2061646472657373000000006044820152606401610a1c565b6040516370a0823160e01b8152306004820152829082906001600160a01b038316906370a0823190602401602060405180830381865afa15801561147e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a29190613d57565b10156114f05760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606401610a1c565b610a306001600160a01b03821633846128bb565b6000602081905290815260409020805461151d90613c9f565b80601f016020809104026020016040519081016040528092919081815260200182805461154990613c9f565b80156115965780601f1061156b57610100808354040283529160200191611596565b820191906000526020600020905b81548152906001019060200180831161157957829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff19606085901b166020820152600090819060340160405160208183030381529060405280519060200120905061161b8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060085491508490506128ec565b95945050505050565b610992338383612902565b61163a8484846109be565b611646848484846129b3565b50505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156116915750825b90506000826001600160401b031660011480156116ad5750303b155b9050811580156116bb575080155b156116d95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561170357845460ff60401b1916600160401b1785555b6117546040518060400160405280601081526020016f48756d626c6520446f6e6174696f6e7360801b81525060405180604001604052806007815260200166141c9bda9958dd60ca1b815250612adc565b61175c612aee565b611764612aee565b61176d86612af6565b611775612aee565b61177d612b07565b6001600755600f6005556611c37937e08000600655600060025583156117dd57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b60606108c882612b17565b6001600160a01b0391821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b611845611d8c565b60065434101561188d5760405162461bcd60e51b8152602060048201526013602482015272139bdd08195b9bdd59da08115512081cd95b9d606a1b6044820152606401610a1c565b61189683611111565b156118e35760405162461bcd60e51b815260206004820152601c60248201527f4164647265737320616c7265616479206f776e73206120746f6b656e000000006044820152606401610a1c565b6001816040516118f39190613cd9565b9081526020016040518091039020546000146119515760405162461bcd60e51b815260206004820152601c60248201527f50726f6a656374207469746c6520616c726561647920657869737473000000006044820152606401610a1c565b60078054908190600061196383613d70565b91905055506119728482612c43565b61197c8184612c5d565b60008181526020819052604090206119948382613dcf565b50806001836040516119a69190613cd9565b908152604051908190036020018120919091556006546000917312fb341c803fc94edd0481f8bdab1a3b971521a691908381818185875af1925050503d8060008114611a0e576040519150601f19603f3d011682016040523d82523d6000602084013e611a13565b606091505b5050905080611a645760405162461bcd60e51b815260206004820152601960248201527f4d696e742052617465207472616e73666572206661696c6564000000000000006044820152606401610a1c565b846001600160a01b0316827f3c3fbb6a154e75fbef89d966d453c10b2ecc4dba66a0b8a755d720fae33a8fda858742604051611aa293929190613e8e565b60405180910390a35050610a30600160008051602061412c83398151915255565b611acb611c27565b6001600160a01b038116611af557604051631e4fbdf760e01b815260006004820152602401610a1c565b610ac78161280f565b60006001600160e01b03198216632483248360e11b14806108c857506108c882612cd0565b600080611b2f83612d20565b90506001600160a01b0381166108c857604051637e27328960e01b815260048101849052602401610a1c565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b031690565b610a308383836001612d5a565b6001600160a01b038216611bcc57604051633250574960e11b815260006004820152602401610a1c565b6000611bd9838333611c82565b9050836001600160a01b0316816001600160a01b031614611646576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610a1c565b33611c597f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b03161461117f5760405163118cdaa760e01b8152336004820152602401610a1c565b60006000805160206140ec83398151915281611c9d85612d20565b90506001600160a01b03841615611cb957611cb9818587612e70565b6001600160a01b03811615611cf957611cd6600086600080612d5a565b6001600160a01b0381166000908152600383016020526040902080546000190190555b6001600160a01b03861615611d2a576001600160a01b03861660009081526003830160205260409020805460010190555b600085815260028301602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a495945050505050565b60008051602061412c833981519152805460011901611dbe57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b60004283611e145760405162461bcd60e51b815260206004820181905260248201527f416d6f756e7420696e206d7573742062652067726561746572207468616e20306044820152606401610a1c565b60006004611e23866003613d0b565b611e2d9190613d22565b905060008111611e995760405162461bcd60e51b815260206004820152603160248201527f5468726565207175617274657273206f6620616d6f756e74496e206d75737420604482015270062652067726561746572207468616e203607c1b6064820152608401610a1c565b6004805460408051630d0e30db60e41b815290516001600160a01b039092169263d0e30db0928592808301926000929182900301818588803b158015611ede57600080fd5b505af1158015611ef2573d6000803e3d6000fd5b50505050506000600286611f069190613d22565b90506000611f15600488613d22565b600454909150611f43906001600160a01b03167312fb341c803fc94edd0481f8bdab1a3b971521a684612ed4565b600454611f6e906001600160a01b031673bfd674dd1e4cdae881d0a9f5e9ac1c8232a38a4083612ed4565b604080516001808252818301909252600091816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611f85575050604080516060810182526004546001600160a01b0390811682526003541660208201526000918101829052825192935091839190611ff157611ff1613ec4565b602002602001018190525060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166367ffb66a848a85308b6040518663ffffffff1660e01b81526004016120519493929190613f39565b60006040518083038185885af115801561206f573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526120989190810190613f6e565b905080600182516120a99190613d44565b815181106120b9576120b9613ec4565b6020908102919091010151600354604051630852cd8d60e31b8152600481018390529198506001600160a01b0316906342966c6890602401600060405180830381600087803b15801561210b57600080fd5b505af115801561211f573d6000803e3d6000fd5b5050505050505050505092915050565b6000426121476001600160a01b0387163330886125c9565b612172867f000000000000000000000000000000000000000000000000000000000000000087612fcd565b60045460009081906001600160a01b039081169089160361220357612198600288613d22565b91506121a5600488613d22565b6004549091506121d3906001600160a01b03167312fb341c803fc94edd0481f8bdab1a3b971521a6846128bb565b6004546121fe906001600160a01b031673bfd674dd1e4cdae881d0a9f5e9ac1c8232a38a40836128bb565b6123cc565b604080516001808252818301909252600091816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161221a575050604080516060810182526001600160a01b038c81168252600454166020820152600091810182905282519293509183919061228357612283613ec4565b602002602001018190525060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f41766d88a8a85308a6040518663ffffffff1660e01b81526004016122e4959493929190614013565b6000604051808303816000875af1158015612303573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261232b9190810190613f6e565b9050806001825161233c9190613d44565b8151811061234c5761234c613ec4565b602002602001015195506002866123639190613d22565b9350612370600487613d22565b60045490935061239e906001600160a01b03167312fb341c803fc94edd0481f8bdab1a3b971521a6866128bb565b6004546123c9906001600160a01b031673bfd674dd1e4cdae881d0a9f5e9ac1c8232a38a40856128bb565b50505b600454612403906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000083612fcd565b604080516001808252818301909252600091816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161241a575050604080516060810182526004546001600160a01b039081168252600354166020820152600091810182905282519293509183919061248657612486613ec4565b602002602001018190525060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f41766d8848985308a6040518663ffffffff1660e01b81526004016124e7959493929190614013565b6000604051808303816000875af1158015612506573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261252e9190810190613f6e565b9050600081600183516125419190613d44565b8151811061255157612551613ec4565b6020908102919091010151600354604051630852cd8d60e31b8152600481018390529192506001600160a01b0316906342966c6890602401600060405180830381600087803b1580156125a357600080fd5b505af11580156125b7573d6000803e3d6000fd5b50505050505050505050949350505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526116469186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506130c6565b600160008051602061412c83398151915255565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806126cb57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166126bf60008051602061410c833981519152546001600160a01b031690565b6001600160a01b031614155b1561117f5760405163703e46dd60e11b815260040160405180910390fd5b6126f1611c27565b6002805490600061270183613d70565b919050555050565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612763575060408051601f3d908101601f1916820190925261276091810190613d57565b60015b61278b57604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610a1c565b60008051602061410c83398151915281146127bc57604051632a87526960e21b815260048101829052602401610a1c565b610a308383613129565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461117f5760405163703e46dd60e11b815260040160405180910390fd5b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600061288f6000836000611c82565b90506001600160a01b03811661099257604051637e27328960e01b815260048101839052602401610a1c565b6040516001600160a01b03838116602483015260448201839052610a3091859182169063a9059cbb906064016125fe565b6000826128f9858461317f565b14949350505050565b6000805160206140ec8339815191526001600160a01b03831661294357604051630b61174360e31b81526001600160a01b0384166004820152602401610a1c565b6001600160a01b038481166000818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b1561164657604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906129f590339088908790879060040161404f565b6020604051808303816000875af1925050508015612a30575060408051601f3d908101601f19168201909252612a2d91810190614082565b60015b612a99573d808015612a5e576040519150601f19603f3d011682016040523d82523d6000602084013e612a63565b606091505b508051600003612a9157604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14612ad557604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b5050505050565b612ae46131cc565b6109928282613215565b61117f6131cc565b612afe6131cc565b610ac781613246565b612b0f6131cc565b61117f61324e565b60607f0542a41881ee128a365a727b282c86fa859579490b9bb45aab8503648c8e7900612b4383611b23565b5060008381526020829052604081208054612b5d90613c9f565b80601f0160208091040260200160405190810160405280929190818152602001828054612b8990613c9f565b8015612bd65780601f10612bab57610100808354040283529160200191612bd6565b820191906000526020600020905b815481529060010190602001808311612bb957829003601f168201915b505050505090506000612bf460408051602081019091526000815290565b90508051600003612c0757509392505050565b815115612c3a578082604051602001612c2192919061409f565b6040516020818303038152906040529350505050919050565b61161b85613256565b6109928282604051806020016040528060008152506132ca565b60008281527f0542a41881ee128a365a727b282c86fa859579490b9bb45aab8503648c8e790060208190526040909120612c978382613dcf565b506040518381527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a1505050565b60006001600160e01b031982166380ac58cd60e01b1480612d0157506001600160e01b03198216635b5e139f60e01b145b806108c857506301ffc9a760e01b6001600160e01b03198316146108c8565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260409020546001600160a01b031690565b6000805160206140ec8339815191528180612d7d57506001600160a01b03831615155b15612e3f576000612d8d85611b23565b90506001600160a01b03841615801590612db95750836001600160a01b0316816001600160a01b031614155b8015612dcc5750612dca81856117f0565b155b15612df55760405163a9fbf51f60e01b81526001600160a01b0385166004820152602401610a1c565b8215612e3d5784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b600093845260040160205250506040902080546001600160a01b0319166001600160a01b0392909216919091179055565b612e7b8383836132e1565b610a30576001600160a01b038316612ea957604051637e27328960e01b815260048101829052602401610a1c565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610a1c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691612f309190613cd9565b6000604051808303816000865af19150503d8060008114612f6d576040519150601f19603f3d011682016040523d82523d6000602084013e612f72565b606091505b5091509150818015612f9c575080511580612f9c575080806020019051810190612f9c91906140ce565b612ad55760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401610a1c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916130299190613cd9565b6000604051808303816000865af19150503d8060008114613066576040519150601f19603f3d011682016040523d82523d6000602084013e61306b565b606091505b509150915081801561309557508051158061309557508080602001905181019061309591906140ce565b612ad55760405162461bcd60e51b8152602060048201526002602482015261534160f01b6044820152606401610a1c565b60006130db6001600160a01b03841683613347565b905080516000141580156131005750808060200190518101906130fe91906140ce565b155b15610a3057604051635274afe760e01b81526001600160a01b0384166004820152602401610a1c565b61313282613355565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a280511561317757610a3082826133ba565b610992613427565b600081815b84518110156131c4576131b0828683815181106131a3576131a3613ec4565b6020026020010151613446565b9150806131bc81613d70565b915050613184565b509392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661117f57604051631afcd79f60e31b815260040160405180910390fd5b61321d6131cc565b6000805160206140ec833981519152806132378482613dcf565b50600181016116468382613dcf565b611acb6131cc565b6126306131cc565b606061326182611b23565b50600061327960408051602081019091526000815290565b90506000815111613299576040518060200160405280600081525061135f565b806132a384613475565b6040516020016132b492919061409f565b6040516020818303038152906040529392505050565b6132d48383613507565b610a3060008484846129b3565b60006001600160a01b0383161580159061333f5750826001600160a01b0316846001600160a01b0316148061331b575061331b84846117f0565b8061333f5750826001600160a01b031661333483611b5b565b6001600160a01b0316145b949350505050565b606061135f8383600061356c565b806001600160a01b03163b60000361338b57604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610a1c565b60008051602061410c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516133d79190613cd9565b600060405180830381855af49150503d8060008114613412576040519150601f19603f3d011682016040523d82523d6000602084013e613417565b606091505b509150915061161b858383613609565b341561117f5760405163b398979f60e01b815260040160405180910390fd5b600081831061346257600082815260208490526040902061135f565b600083815260208390526040902061135f565b6060600061348283613665565b60010190506000816001600160401b038111156134a1576134a16138a9565b6040519080825280601f01601f1916602001820160405280156134cb576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846134d557509392505050565b6001600160a01b03821661353157604051633250574960e11b815260006004820152602401610a1c565b600061353f83836000611c82565b90506001600160a01b03811615610a30576040516339e3563760e11b815260006004820152602401610a1c565b6060814710156135915760405163cd78605960e01b8152306004820152602401610a1c565b600080856001600160a01b031684866040516135ad9190613cd9565b60006040518083038185875af1925050503d80600081146135ea576040519150601f19603f3d011682016040523d82523d6000602084013e6135ef565b606091505b50915091506135ff868383613609565b9695505050505050565b60608261361e576136198261373d565b61135f565b815115801561363557506001600160a01b0384163b155b1561365e57604051639996b31560e01b81526001600160a01b0385166004820152602401610a1c565b508061135f565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106136a45772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106136d0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106136ee57662386f26fc10000830492506010015b6305f5e1008310613706576305f5e100830492506008015b612710831061371a57612710830492506004015b6064831061372c576064830492506002015b600a83106108c85760010192915050565b80511561374d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50805461377290613c9f565b6000825580601f10613782575050565b601f016020900490600052602060002090810190610ac791905b808211156137b0576000815560010161379c565b5090565b6001600160e01b031981168114610ac757600080fd5b6000602082840312156137dc57600080fd5b813561135f816137b4565b60005b838110156138025781810151838201526020016137ea565b50506000910152565b600081518084526138238160208601602086016137e7565b601f01601f19169290920160200192915050565b60208152600061135f602083018461380b565b60006020828403121561385c57600080fd5b5035919050565b80356001600160a01b038116811461387a57600080fd5b919050565b6000806040838503121561389257600080fd5b61389b83613863565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156138e7576138e76138a9565b604052919050565b600082601f83011261390057600080fd5b81356001600160401b03811115613919576139196138a9565b61392c601f8201601f19166020016138bf565b81815284602083860101111561394157600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561397057600080fd5b81356001600160401b0381111561398657600080fd5b61333f848285016138ef565b6000806000606084860312156139a757600080fd5b6139b084613863565b92506139be60208501613863565b9150604084013590509250925092565b60008083601f8401126139e057600080fd5b5081356001600160401b038111156139f757600080fd5b6020830191508360208260051b8501011115613a1257600080fd5b9250929050565b600080600080600080600060c0888a031215613a3457600080fd5b87359650613a4460208901613863565b955060408801359450606088013593506080880135925060a08801356001600160401b03811115613a7457600080fd5b613a808a828b016139ce565b989b979a50959850939692959293505050565b60008060408385031215613aa657600080fd5b613aaf83613863565b915060208301356001600160401b03811115613aca57600080fd5b613ad6858286016138ef565b9150509250929050565b600060208284031215613af257600080fd5b61135f82613863565b600080600060408486031215613b1057600080fd5b613b1984613863565b925060208401356001600160401b03811115613b3457600080fd5b613b40868287016139ce565b9497909650939450505050565b8015158114610ac757600080fd5b60008060408385031215613b6e57600080fd5b613b7783613863565b91506020830135613b8781613b4d565b809150509250929050565b60008060008060808587031215613ba857600080fd5b613bb185613863565b9350613bbf60208601613863565b92506040850135915060608501356001600160401b03811115613be157600080fd5b613bed878288016138ef565b91505092959194509250565b60008060408385031215613c0c57600080fd5b613c1583613863565b9150613c2360208401613863565b90509250929050565b600080600060608486031215613c4157600080fd5b613c4a84613863565b925060208401356001600160401b0380821115613c6657600080fd5b613c72878388016138ef565b93506040860135915080821115613c8857600080fd5b50613c95868287016138ef565b9150509250925092565b600181811c90821680613cb357607f821691505b602082108103613cd357634e487b7160e01b600052602260045260246000fd5b50919050565b60008251613ceb8184602087016137e7565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108c8576108c8613cf5565b600082613d3f57634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108c8576108c8613cf5565b600060208284031215613d6957600080fd5b5051919050565b600060018201613d8257613d82613cf5565b5060010190565b601f821115610a3057600081815260208120601f850160051c81016020861015613db05750805b601f850160051c820191505b818110156117dd57828155600101613dbc565b81516001600160401b03811115613de857613de86138a9565b613dfc81613df68454613c9f565b84613d89565b602080601f831160018114613e315760008415613e195750858301515b600019600386901b1c1916600185901b1785556117dd565b600085815260208120601f198616915b82811015613e6057888601518255948401946001909101908401613e41565b5085821015613e7e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b606081526000613ea1606083018661380b565b8281036020840152613eb3818661380b565b915050826040830152949350505050565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015613f2e57815180516001600160a01b03908116895284820151168489015260409081015115159088015260609096019590820190600101613eee565b509495945050505050565b848152608060208201526000613f526080830186613eda565b6001600160a01b03949094166040830152506060015292915050565b60006020808385031215613f8157600080fd5b82516001600160401b0380821115613f9857600080fd5b818501915085601f830112613fac57600080fd5b815181811115613fbe57613fbe6138a9565b8060051b9150613fcf8483016138bf565b8181529183018401918481019088841115613fe957600080fd5b938501935b8385101561400757845182529385019390850190613fee565b98975050505050505050565b85815284602082015260a06040820152600061403260a0830186613eda565b6001600160a01b0394909416606083015250608001529392505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906135ff9083018461380b565b60006020828403121561409457600080fd5b815161135f816137b4565b600083516140b18184602088016137e7565b8351908301906140c58183602088016137e7565b01949350505050565b6000602082840312156140e057600080fd5b815161135f81613b4d56fe80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220bd3e27a607d9be960d450b5414420b6edf1a86083bb7bd35900f63b646f4054a64736f6c63430008140033

Deployed Bytecode

0x6080604052600436106102ae5760003560e01c80637cb6475911610175578063ae7b6d16116100dc578063ca0dcf1611610095578063e8ba1dff1161006f578063e8ba1dff14610855578063e985e9c51461086a578063eca81d421461088a578063f2fde38b1461089d57600080fd5b8063ca0dcf16146107e9578063cae5f11e146107ff578063cd99b0101461081d57600080fd5b8063ae7b6d1614610729578063b88d4fde1461073f578063c31c9c071461075f578063c4128b6d14610793578063c4d66de8146107a9578063c87b56dd146107c957600080fd5b80639e281a981161012e5780639e281a98146106585780639f4a7c1014610678578063a01d371214610698578063a22cb465146106b8578063ad3cb1cc146106d8578063ad5c46481461070957600080fd5b80637cb64759146105915780638c0e8349146105b15780638da5cb5b146105c657806391f7e39714610603578063930baae81461062357806395d89b411461064357600080fd5b80634a9957f4116102195780636352211e116101d25780636352211e146104e7578063699abb3c146105075780636fa2fd591461052757806370a082311461053c578063715018a61461055c5780637b47ec1a1461057157600080fd5b80634a9957f41461044e5780634f1ef2861461046157806352d1902d1461047457806356b1ddbb146104895780635b769f3c146104a95780635fea0294146104c957600080fd5b806323b872dd1161026b57806323b872dd146103a35780632eb4a7ab146103c35780633ccfd60b146103d957806342842e0e146103ee57806342966c681461040e5780634744f6191461042e57600080fd5b806301ffc9a7146102b357806306fdde03146102e8578063081812fc1461030a578063095ea7b3146103425780630b2accb2146103645780631e7663bc14610383575b600080fd5b3480156102bf57600080fd5b506102d36102ce3660046137ca565b6108bd565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b506102fd6108ce565b6040516102df9190613837565b34801561031657600080fd5b5061032a61032536600461384a565b610972565b6040516001600160a01b0390911681526020016102df565b34801561034e57600080fd5b5061036261035d36600461387f565b610987565b005b34801561037057600080fd5b506005545b6040519081526020016102df565b34801561038f57600080fd5b5061037561039e36600461395e565b610996565b3480156103af57600080fd5b506103626103be366004613992565b6109be565b3480156103cf57600080fd5b5061037560085481565b3480156103e557600080fd5b50610362610a35565b3480156103fa57600080fd5b50610362610409366004613992565b610aca565b34801561041a57600080fd5b5061036261042936600461384a565b610ae5565b34801561043a57600080fd5b5061036261044936600461384a565b610af1565b61036261045c366004613a19565b610afe565b61036261046f366004613a93565b611045565b34801561048057600080fd5b50610375611060565b34801561049557600080fd5b5060035461032a906001600160a01b031681565b3480156104b557600080fd5b506103626104c4366004613ae0565b61107d565b3480156104d557600080fd5b506003546001600160a01b031661032a565b3480156104f357600080fd5b5061032a61050236600461384a565b6110a7565b34801561051357600080fd5b5061036261052236600461384a565b6110b2565b34801561053357600080fd5b50600254610375565b34801561054857600080fd5b50610375610557366004613ae0565b611111565b34801561056857600080fd5b5061036261116d565b34801561057d57600080fd5b5061036261058c36600461384a565b611181565b34801561059d57600080fd5b506103626105ac36600461384a565b61131d565b3480156105bd57600080fd5b50600754610375565b3480156105d257600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031661032a565b34801561060f57600080fd5b5061032a61061e36600461395e565b61132a565b34801561062f57600080fd5b5061036261063e366004613ae0565b61136f565b34801561064f57600080fd5b506102fd611399565b34801561066457600080fd5b5061036261067336600461387f565b6113d8565b34801561068457600080fd5b506102fd61069336600461384a565b611504565b3480156106a457600080fd5b506102d36106b3366004613afb565b61159e565b3480156106c457600080fd5b506103626106d3366004613b5b565b611624565b3480156106e457600080fd5b506102fd604051806040016040528060058152602001640352e302e360dc1b81525081565b34801561071557600080fd5b5060045461032a906001600160a01b031681565b34801561073557600080fd5b5061037560055481565b34801561074b57600080fd5b5061036261075a366004613b92565b61162f565b34801561076b57600080fd5b5061032a7f000000000000000000000000cc6169aa1e879d3a4227536671f85afdb2d23fad81565b34801561079f57600080fd5b5061037560025481565b3480156107b557600080fd5b506103626107c4366004613ae0565b61164c565b3480156107d557600080fd5b506102fd6107e436600461384a565b6117e5565b3480156107f557600080fd5b5061037560065481565b34801561080b57600080fd5b506004546001600160a01b031661032a565b34801561082957600080fd5b5061037561083836600461395e565b805160208183018101805160018252928201919093012091525481565b34801561086157600080fd5b50600654610375565b34801561087657600080fd5b506102d3610885366004613bf9565b6117f0565b610362610898366004613c2c565b61183d565b3480156108a957600080fd5b506103626108b8366004613ae0565b611ac3565b60006108c882611afe565b92915050565b6000805160206140ec83398151915280546060919081906108ee90613c9f565b80601f016020809104026020016040519081016040528092919081815260200182805461091a90613c9f565b80156109675780601f1061093c57610100808354040283529160200191610967565b820191906000526020600020905b81548152906001019060200180831161094a57829003601f168201915b505050505091505090565b600061097d82611b23565b506108c882611b5b565b610992828233611b95565b5050565b60006001826040516109a89190613cd9565b9081526020016040518091039020549050919050565b6109c782611111565b15610a255760405162461bcd60e51b8152602060048201526024808201527f526563697069656e7420616c7265616479206f776e7320612070726f6a6563746044820152630813919560e21b60648201526084015b60405180910390fd5b610a30838383611ba2565b505050565b610a3d611c27565b604051600090339047908381818185875af1925050503d8060008114610a7f576040519150601f19603f3d011682016040523d82523d6000602084013e610a84565b606091505b5050905080610ac75760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8811985a5b1959608a1b6044820152606401610a1c565b50565b610a308383836040518060200160405280600081525061162f565b61099260008233611c82565b610af9611c27565b600655565b610b06611d8c565b6000610b11886110a7565b90506001600160a01b0381163303610b615760405162461bcd60e51b815260206004820152601360248201527221b0b73737ba103830bc903cb7bab939b2b63360691b6044820152606401610a1c565b60008881526020819052604081208054610b7a90613c9f565b905011610bc15760405162461bcd60e51b8152602060048201526015602482015274141c9bda9958dd081d1a5d1b19481b9bdd081cd95d605a1b6044820152606401610a1c565b6001610bcc82611111565b1115610c355760405162461bcd60e51b815260206004820152603260248201527f546f6b656e206f776e657220616c7265616479206f776e73206d6f7265207468604482015271185b881bdb99481c1c9bda9958dd0813919560721b6064820152608401610a1c565b60008611610c855760405162461bcd60e51b815260206004820152601860248201527f496e70757420616d6f756e742063616e6e6f74206265203000000000000000006044820152606401610a1c565b6000806103e860055489610c999190613d0b565b610ca39190613d22565b60035490915089906001600160a01b03808316911614610f0657610cc7828a613d44565b92506001600160a01b038a16610dd15788341015610d275760405162461bcd60e51b815260206004820152601c60248201527f496e636f727265637420616d6f756e74206f66204554482073656e74000000006044820152606401610a1c565b610d318288611dc4565b506000846001600160a01b03168460405160006040518083038185875af1925050503d8060008114610d7f576040519150601f19603f3d011682016040523d82523d6000602084013e610d84565b606091505b5050905080610dcb5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610a1c565b50610fd5565b610ddc8a878761159e565b610e285760405162461bcd60e51b815260206004820152601860248201527f546f6b656e206973206e6f742077686974656c697374656400000000000000006044820152606401610a1c565b604051636eb1769f60e11b815233600482015230602482015289906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015610e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e989190613d57565b1015610edf5760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610a1c565b610eeb8a838a8a61212f565b50610f016001600160a01b0382163386866125c9565b610fd5565b604051636eb1769f60e11b815233600482015230602482015289935083906001600160a01b0383169063dd62ed3e90604401602060405180830381865afa158015610f55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f799190613d57565b1015610fc05760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610a1c565b610fd56001600160a01b0382163386866125c9565b604080516001600160a01b038c168152602081018590524281830152905133918d917fda38851157f2984cc47615155e6daa02931c36f0ecaa4822d8b631b5b368eb6e9181900360600190a35050505061103c600160008051602061412c83398151915255565b50505050505050565b61104d612644565b611056826126e9565b6109928282612709565b600061106a6127c6565b5060008051602061410c83398151915290565b611085611c27565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60006108c882611b23565b6110ba611c27565b61012c81111561110c5760405162461bcd60e51b815260206004820152601d60248201527f7461782063616e6e6f7420626520686967686572207468616e203330250000006044820152606401610a1c565b600555565b60006000805160206140ec8339815191526001600160a01b03831661114c576040516322718ad960e21b815260006004820152602401610a1c565b6001600160a01b039092166000908152600390920160205250604090205490565b611175611c27565b61117f600061280f565b565b600061118c826110a7565b905033611198836110a7565b6001600160a01b0316146111ee5760405162461bcd60e51b815260206004820152601760248201527f43616c6c6572206973206e6f7420746865206f776e65720000000000000000006044820152606401610a1c565b6000828152602081905260408120805461120790613c9f565b80601f016020809104026020016040519081016040528092919081815260200182805461123390613c9f565b80156112805780601f1061125557610100808354040283529160200191611280565b820191906000526020600020905b81548152906001019060200180831161126357829003601f168201915b5050505050905061129083612880565b60008381526020819052604081206112a791613766565b6001816040516112b79190613cd9565b90815260200160405180910390206000905560006001600160a01b0316826001600160a01b0316847f4ef8c0478b7cb23d7c76bbb226f7898438ece317e83af2b79f9a015974efcc7f4260405161131091815260200190565b60405180910390a4505050565b611325611c27565b600855565b60008060018360405161133d9190613cd9565b9081526020016040518091039020549050806000146113665761135f816110a7565b9392505050565b50600092915050565b611377611c27565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930180546060916000805160206140ec833981519152916108ee90613c9f565b6113e0611c27565b6001600160a01b0382166114365760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964204552432d323020746f6b656e2061646472657373000000006044820152606401610a1c565b6040516370a0823160e01b8152306004820152829082906001600160a01b038316906370a0823190602401602060405180830381865afa15801561147e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a29190613d57565b10156114f05760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606401610a1c565b610a306001600160a01b03821633846128bb565b6000602081905290815260409020805461151d90613c9f565b80601f016020809104026020016040519081016040528092919081815260200182805461154990613c9f565b80156115965780601f1061156b57610100808354040283529160200191611596565b820191906000526020600020905b81548152906001019060200180831161157957829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff19606085901b166020820152600090819060340160405160208183030381529060405280519060200120905061161b8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060085491508490506128ec565b95945050505050565b610992338383612902565b61163a8484846109be565b611646848484846129b3565b50505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156116915750825b90506000826001600160401b031660011480156116ad5750303b155b9050811580156116bb575080155b156116d95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561170357845460ff60401b1916600160401b1785555b6117546040518060400160405280601081526020016f48756d626c6520446f6e6174696f6e7360801b81525060405180604001604052806007815260200166141c9bda9958dd60ca1b815250612adc565b61175c612aee565b611764612aee565b61176d86612af6565b611775612aee565b61177d612b07565b6001600755600f6005556611c37937e08000600655600060025583156117dd57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b60606108c882612b17565b6001600160a01b0391821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b611845611d8c565b60065434101561188d5760405162461bcd60e51b8152602060048201526013602482015272139bdd08195b9bdd59da08115512081cd95b9d606a1b6044820152606401610a1c565b61189683611111565b156118e35760405162461bcd60e51b815260206004820152601c60248201527f4164647265737320616c7265616479206f776e73206120746f6b656e000000006044820152606401610a1c565b6001816040516118f39190613cd9565b9081526020016040518091039020546000146119515760405162461bcd60e51b815260206004820152601c60248201527f50726f6a656374207469746c6520616c726561647920657869737473000000006044820152606401610a1c565b60078054908190600061196383613d70565b91905055506119728482612c43565b61197c8184612c5d565b60008181526020819052604090206119948382613dcf565b50806001836040516119a69190613cd9565b908152604051908190036020018120919091556006546000917312fb341c803fc94edd0481f8bdab1a3b971521a691908381818185875af1925050503d8060008114611a0e576040519150601f19603f3d011682016040523d82523d6000602084013e611a13565b606091505b5050905080611a645760405162461bcd60e51b815260206004820152601960248201527f4d696e742052617465207472616e73666572206661696c6564000000000000006044820152606401610a1c565b846001600160a01b0316827f3c3fbb6a154e75fbef89d966d453c10b2ecc4dba66a0b8a755d720fae33a8fda858742604051611aa293929190613e8e565b60405180910390a35050610a30600160008051602061412c83398151915255565b611acb611c27565b6001600160a01b038116611af557604051631e4fbdf760e01b815260006004820152602401610a1c565b610ac78161280f565b60006001600160e01b03198216632483248360e11b14806108c857506108c882612cd0565b600080611b2f83612d20565b90506001600160a01b0381166108c857604051637e27328960e01b815260048101849052602401610a1c565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b031690565b610a308383836001612d5a565b6001600160a01b038216611bcc57604051633250574960e11b815260006004820152602401610a1c565b6000611bd9838333611c82565b9050836001600160a01b0316816001600160a01b031614611646576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610a1c565b33611c597f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b03161461117f5760405163118cdaa760e01b8152336004820152602401610a1c565b60006000805160206140ec83398151915281611c9d85612d20565b90506001600160a01b03841615611cb957611cb9818587612e70565b6001600160a01b03811615611cf957611cd6600086600080612d5a565b6001600160a01b0381166000908152600383016020526040902080546000190190555b6001600160a01b03861615611d2a576001600160a01b03861660009081526003830160205260409020805460010190555b600085815260028301602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a495945050505050565b60008051602061412c833981519152805460011901611dbe57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b60004283611e145760405162461bcd60e51b815260206004820181905260248201527f416d6f756e7420696e206d7573742062652067726561746572207468616e20306044820152606401610a1c565b60006004611e23866003613d0b565b611e2d9190613d22565b905060008111611e995760405162461bcd60e51b815260206004820152603160248201527f5468726565207175617274657273206f6620616d6f756e74496e206d75737420604482015270062652067726561746572207468616e203607c1b6064820152608401610a1c565b6004805460408051630d0e30db60e41b815290516001600160a01b039092169263d0e30db0928592808301926000929182900301818588803b158015611ede57600080fd5b505af1158015611ef2573d6000803e3d6000fd5b50505050506000600286611f069190613d22565b90506000611f15600488613d22565b600454909150611f43906001600160a01b03167312fb341c803fc94edd0481f8bdab1a3b971521a684612ed4565b600454611f6e906001600160a01b031673bfd674dd1e4cdae881d0a9f5e9ac1c8232a38a4083612ed4565b604080516001808252818301909252600091816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611f85575050604080516060810182526004546001600160a01b0390811682526003541660208201526000918101829052825192935091839190611ff157611ff1613ec4565b602002602001018190525060007f000000000000000000000000cc6169aa1e879d3a4227536671f85afdb2d23fad6001600160a01b03166367ffb66a848a85308b6040518663ffffffff1660e01b81526004016120519493929190613f39565b60006040518083038185885af115801561206f573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526120989190810190613f6e565b905080600182516120a99190613d44565b815181106120b9576120b9613ec4565b6020908102919091010151600354604051630852cd8d60e31b8152600481018390529198506001600160a01b0316906342966c6890602401600060405180830381600087803b15801561210b57600080fd5b505af115801561211f573d6000803e3d6000fd5b5050505050505050505092915050565b6000426121476001600160a01b0387163330886125c9565b612172867f000000000000000000000000cc6169aa1e879d3a4227536671f85afdb2d23fad87612fcd565b60045460009081906001600160a01b039081169089160361220357612198600288613d22565b91506121a5600488613d22565b6004549091506121d3906001600160a01b03167312fb341c803fc94edd0481f8bdab1a3b971521a6846128bb565b6004546121fe906001600160a01b031673bfd674dd1e4cdae881d0a9f5e9ac1c8232a38a40836128bb565b6123cc565b604080516001808252818301909252600091816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161221a575050604080516060810182526001600160a01b038c81168252600454166020820152600091810182905282519293509183919061228357612283613ec4565b602002602001018190525060007f000000000000000000000000cc6169aa1e879d3a4227536671f85afdb2d23fad6001600160a01b031663f41766d88a8a85308a6040518663ffffffff1660e01b81526004016122e4959493929190614013565b6000604051808303816000875af1158015612303573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261232b9190810190613f6e565b9050806001825161233c9190613d44565b8151811061234c5761234c613ec4565b602002602001015195506002866123639190613d22565b9350612370600487613d22565b60045490935061239e906001600160a01b03167312fb341c803fc94edd0481f8bdab1a3b971521a6866128bb565b6004546123c9906001600160a01b031673bfd674dd1e4cdae881d0a9f5e9ac1c8232a38a40856128bb565b50505b600454612403906001600160a01b03167f000000000000000000000000cc6169aa1e879d3a4227536671f85afdb2d23fad83612fcd565b604080516001808252818301909252600091816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161241a575050604080516060810182526004546001600160a01b039081168252600354166020820152600091810182905282519293509183919061248657612486613ec4565b602002602001018190525060007f000000000000000000000000cc6169aa1e879d3a4227536671f85afdb2d23fad6001600160a01b031663f41766d8848985308a6040518663ffffffff1660e01b81526004016124e7959493929190614013565b6000604051808303816000875af1158015612506573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261252e9190810190613f6e565b9050600081600183516125419190613d44565b8151811061255157612551613ec4565b6020908102919091010151600354604051630852cd8d60e31b8152600481018390529192506001600160a01b0316906342966c6890602401600060405180830381600087803b1580156125a357600080fd5b505af11580156125b7573d6000803e3d6000fd5b50505050505050505050949350505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526116469186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506130c6565b600160008051602061412c83398151915255565b306001600160a01b037f00000000000000000000000012da4df4207c64f8ea0b05b839d8c3d0296ea8ac1614806126cb57507f00000000000000000000000012da4df4207c64f8ea0b05b839d8c3d0296ea8ac6001600160a01b03166126bf60008051602061410c833981519152546001600160a01b031690565b6001600160a01b031614155b1561117f5760405163703e46dd60e11b815260040160405180910390fd5b6126f1611c27565b6002805490600061270183613d70565b919050555050565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612763575060408051601f3d908101601f1916820190925261276091810190613d57565b60015b61278b57604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610a1c565b60008051602061410c83398151915281146127bc57604051632a87526960e21b815260048101829052602401610a1c565b610a308383613129565b306001600160a01b037f00000000000000000000000012da4df4207c64f8ea0b05b839d8c3d0296ea8ac161461117f5760405163703e46dd60e11b815260040160405180910390fd5b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600061288f6000836000611c82565b90506001600160a01b03811661099257604051637e27328960e01b815260048101839052602401610a1c565b6040516001600160a01b03838116602483015260448201839052610a3091859182169063a9059cbb906064016125fe565b6000826128f9858461317f565b14949350505050565b6000805160206140ec8339815191526001600160a01b03831661294357604051630b61174360e31b81526001600160a01b0384166004820152602401610a1c565b6001600160a01b038481166000818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b1561164657604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906129f590339088908790879060040161404f565b6020604051808303816000875af1925050508015612a30575060408051601f3d908101601f19168201909252612a2d91810190614082565b60015b612a99573d808015612a5e576040519150601f19603f3d011682016040523d82523d6000602084013e612a63565b606091505b508051600003612a9157604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14612ad557604051633250574960e11b81526001600160a01b0385166004820152602401610a1c565b5050505050565b612ae46131cc565b6109928282613215565b61117f6131cc565b612afe6131cc565b610ac781613246565b612b0f6131cc565b61117f61324e565b60607f0542a41881ee128a365a727b282c86fa859579490b9bb45aab8503648c8e7900612b4383611b23565b5060008381526020829052604081208054612b5d90613c9f565b80601f0160208091040260200160405190810160405280929190818152602001828054612b8990613c9f565b8015612bd65780601f10612bab57610100808354040283529160200191612bd6565b820191906000526020600020905b815481529060010190602001808311612bb957829003601f168201915b505050505090506000612bf460408051602081019091526000815290565b90508051600003612c0757509392505050565b815115612c3a578082604051602001612c2192919061409f565b6040516020818303038152906040529350505050919050565b61161b85613256565b6109928282604051806020016040528060008152506132ca565b60008281527f0542a41881ee128a365a727b282c86fa859579490b9bb45aab8503648c8e790060208190526040909120612c978382613dcf565b506040518381527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a1505050565b60006001600160e01b031982166380ac58cd60e01b1480612d0157506001600160e01b03198216635b5e139f60e01b145b806108c857506301ffc9a760e01b6001600160e01b03198316146108c8565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260409020546001600160a01b031690565b6000805160206140ec8339815191528180612d7d57506001600160a01b03831615155b15612e3f576000612d8d85611b23565b90506001600160a01b03841615801590612db95750836001600160a01b0316816001600160a01b031614155b8015612dcc5750612dca81856117f0565b155b15612df55760405163a9fbf51f60e01b81526001600160a01b0385166004820152602401610a1c565b8215612e3d5784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b600093845260040160205250506040902080546001600160a01b0319166001600160a01b0392909216919091179055565b612e7b8383836132e1565b610a30576001600160a01b038316612ea957604051637e27328960e01b815260048101829052602401610a1c565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610a1c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691612f309190613cd9565b6000604051808303816000865af19150503d8060008114612f6d576040519150601f19603f3d011682016040523d82523d6000602084013e612f72565b606091505b5091509150818015612f9c575080511580612f9c575080806020019051810190612f9c91906140ce565b612ad55760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401610a1c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916130299190613cd9565b6000604051808303816000865af19150503d8060008114613066576040519150601f19603f3d011682016040523d82523d6000602084013e61306b565b606091505b509150915081801561309557508051158061309557508080602001905181019061309591906140ce565b612ad55760405162461bcd60e51b8152602060048201526002602482015261534160f01b6044820152606401610a1c565b60006130db6001600160a01b03841683613347565b905080516000141580156131005750808060200190518101906130fe91906140ce565b155b15610a3057604051635274afe760e01b81526001600160a01b0384166004820152602401610a1c565b61313282613355565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a280511561317757610a3082826133ba565b610992613427565b600081815b84518110156131c4576131b0828683815181106131a3576131a3613ec4565b6020026020010151613446565b9150806131bc81613d70565b915050613184565b509392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661117f57604051631afcd79f60e31b815260040160405180910390fd5b61321d6131cc565b6000805160206140ec833981519152806132378482613dcf565b50600181016116468382613dcf565b611acb6131cc565b6126306131cc565b606061326182611b23565b50600061327960408051602081019091526000815290565b90506000815111613299576040518060200160405280600081525061135f565b806132a384613475565b6040516020016132b492919061409f565b6040516020818303038152906040529392505050565b6132d48383613507565b610a3060008484846129b3565b60006001600160a01b0383161580159061333f5750826001600160a01b0316846001600160a01b0316148061331b575061331b84846117f0565b8061333f5750826001600160a01b031661333483611b5b565b6001600160a01b0316145b949350505050565b606061135f8383600061356c565b806001600160a01b03163b60000361338b57604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610a1c565b60008051602061410c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516133d79190613cd9565b600060405180830381855af49150503d8060008114613412576040519150601f19603f3d011682016040523d82523d6000602084013e613417565b606091505b509150915061161b858383613609565b341561117f5760405163b398979f60e01b815260040160405180910390fd5b600081831061346257600082815260208490526040902061135f565b600083815260208390526040902061135f565b6060600061348283613665565b60010190506000816001600160401b038111156134a1576134a16138a9565b6040519080825280601f01601f1916602001820160405280156134cb576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846134d557509392505050565b6001600160a01b03821661353157604051633250574960e11b815260006004820152602401610a1c565b600061353f83836000611c82565b90506001600160a01b03811615610a30576040516339e3563760e11b815260006004820152602401610a1c565b6060814710156135915760405163cd78605960e01b8152306004820152602401610a1c565b600080856001600160a01b031684866040516135ad9190613cd9565b60006040518083038185875af1925050503d80600081146135ea576040519150601f19603f3d011682016040523d82523d6000602084013e6135ef565b606091505b50915091506135ff868383613609565b9695505050505050565b60608261361e576136198261373d565b61135f565b815115801561363557506001600160a01b0384163b155b1561365e57604051639996b31560e01b81526001600160a01b0385166004820152602401610a1c565b508061135f565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106136a45772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106136d0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106136ee57662386f26fc10000830492506010015b6305f5e1008310613706576305f5e100830492506008015b612710831061371a57612710830492506004015b6064831061372c576064830492506002015b600a83106108c85760010192915050565b80511561374d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50805461377290613c9f565b6000825580601f10613782575050565b601f016020900490600052602060002090810190610ac791905b808211156137b0576000815560010161379c565b5090565b6001600160e01b031981168114610ac757600080fd5b6000602082840312156137dc57600080fd5b813561135f816137b4565b60005b838110156138025781810151838201526020016137ea565b50506000910152565b600081518084526138238160208601602086016137e7565b601f01601f19169290920160200192915050565b60208152600061135f602083018461380b565b60006020828403121561385c57600080fd5b5035919050565b80356001600160a01b038116811461387a57600080fd5b919050565b6000806040838503121561389257600080fd5b61389b83613863565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156138e7576138e76138a9565b604052919050565b600082601f83011261390057600080fd5b81356001600160401b03811115613919576139196138a9565b61392c601f8201601f19166020016138bf565b81815284602083860101111561394157600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561397057600080fd5b81356001600160401b0381111561398657600080fd5b61333f848285016138ef565b6000806000606084860312156139a757600080fd5b6139b084613863565b92506139be60208501613863565b9150604084013590509250925092565b60008083601f8401126139e057600080fd5b5081356001600160401b038111156139f757600080fd5b6020830191508360208260051b8501011115613a1257600080fd5b9250929050565b600080600080600080600060c0888a031215613a3457600080fd5b87359650613a4460208901613863565b955060408801359450606088013593506080880135925060a08801356001600160401b03811115613a7457600080fd5b613a808a828b016139ce565b989b979a50959850939692959293505050565b60008060408385031215613aa657600080fd5b613aaf83613863565b915060208301356001600160401b03811115613aca57600080fd5b613ad6858286016138ef565b9150509250929050565b600060208284031215613af257600080fd5b61135f82613863565b600080600060408486031215613b1057600080fd5b613b1984613863565b925060208401356001600160401b03811115613b3457600080fd5b613b40868287016139ce565b9497909650939450505050565b8015158114610ac757600080fd5b60008060408385031215613b6e57600080fd5b613b7783613863565b91506020830135613b8781613b4d565b809150509250929050565b60008060008060808587031215613ba857600080fd5b613bb185613863565b9350613bbf60208601613863565b92506040850135915060608501356001600160401b03811115613be157600080fd5b613bed878288016138ef565b91505092959194509250565b60008060408385031215613c0c57600080fd5b613c1583613863565b9150613c2360208401613863565b90509250929050565b600080600060608486031215613c4157600080fd5b613c4a84613863565b925060208401356001600160401b0380821115613c6657600080fd5b613c72878388016138ef565b93506040860135915080821115613c8857600080fd5b50613c95868287016138ef565b9150509250925092565b600181811c90821680613cb357607f821691505b602082108103613cd357634e487b7160e01b600052602260045260246000fd5b50919050565b60008251613ceb8184602087016137e7565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108c8576108c8613cf5565b600082613d3f57634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108c8576108c8613cf5565b600060208284031215613d6957600080fd5b5051919050565b600060018201613d8257613d82613cf5565b5060010190565b601f821115610a3057600081815260208120601f850160051c81016020861015613db05750805b601f850160051c820191505b818110156117dd57828155600101613dbc565b81516001600160401b03811115613de857613de86138a9565b613dfc81613df68454613c9f565b84613d89565b602080601f831160018114613e315760008415613e195750858301515b600019600386901b1c1916600185901b1785556117dd565b600085815260208120601f198616915b82811015613e6057888601518255948401946001909101908401613e41565b5085821015613e7e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b606081526000613ea1606083018661380b565b8281036020840152613eb3818661380b565b915050826040830152949350505050565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015613f2e57815180516001600160a01b03908116895284820151168489015260409081015115159088015260609096019590820190600101613eee565b509495945050505050565b848152608060208201526000613f526080830186613eda565b6001600160a01b03949094166040830152506060015292915050565b60006020808385031215613f8157600080fd5b82516001600160401b0380821115613f9857600080fd5b818501915085601f830112613fac57600080fd5b815181811115613fbe57613fbe6138a9565b8060051b9150613fcf8483016138bf565b8181529183018401918481019088841115613fe957600080fd5b938501935b8385101561400757845182529385019390850190613fee565b98975050505050505050565b85815284602082015260a06040820152600061403260a0830186613eda565b6001600160a01b0394909416606083015250608001529392505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906135ff9083018461380b565b60006020828403121561409457600080fd5b815161135f816137b4565b600083516140b18184602088016137e7565b8351908301906140c58183602088016137e7565b01949350505050565b6000602082840312156140e057600080fd5b815161135f81613b4d56fe80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220bd3e27a607d9be960d450b5414420b6edf1a86083bb7bd35900f63b646f4054a64736f6c63430008140033

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.