APE Price: $0.65 (+4.67%)

Contract

0x6C672100d53178e0b149b8a402E703ecdc3B4E06

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE 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:
CyanVaultV2

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 500 runs

Other Settings:
default evmVersion
File 1 of 29 : CyanVaultV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";

import "../interfaces/main/ICyanVaultTokenV1.sol";
import "../interfaces/openzeppelin/ERC1155HolderUpgradeable.sol";
import "../interfaces/core/IFactory.sol";
import "../interfaces/main/ICyanPaymentPlanV2.sol";

/// @title Cyan Vault - Cyan's staking solution
/// @author Bulgantamir Gankhuyag - <[email protected]>
/// @author Naranbayar Uuganbayar - <[email protected]>
contract CyanVaultV2 is
    AccessControlUpgradeable,
    ReentrancyGuardUpgradeable,
    ERC721HolderUpgradeable,
    ERC1155HolderUpgradeable,
    PausableUpgradeable
{
    using ECDSAUpgradeable for bytes32;
    using SafeERC20Upgradeable for IERC20Upgradeable;

    bytes32 public constant CYAN_ROLE = keccak256("CYAN_ROLE");
    bytes32 public constant CYAN_PAYMENT_PLAN_ROLE = keccak256("CYAN_PAYMENT_PLAN_ROLE");

    event Deposit(address indexed from, uint256 amount, uint256 tokenAmount);
    event Lend(address indexed to, uint256 amount);
    event Earn(uint256 paymentAmount, uint256 profitAmount);
    event NftDefaulted(uint256 unpaidAmount, uint256 estimatedPriceOfNFT);
    event NftLiquidated(uint256 defaultedAssetsAmount, uint256 soldAmount, uint256 prevDefaultedAssetsAmount);
    event AutoLiquidated(uint256 indexed planId, uint8 autoLiquidationType);
    event Withdraw(address indexed from, uint256 amount, uint256 tokenAmount);
    event GetDefaultedNFT(address indexed to, address indexed contractAddress, uint256 indexed tokenId);
    event GetDefaultedERC1155(
        address indexed to,
        address indexed contractAddress,
        uint256 indexed tokenId,
        uint256 amount
    );
    event UpdatedDefaultedNFTAssetAmount(uint256 defaultedAssetsAmount, uint256 prevDefaultedAssetsAmount);
    event UpdatedServiceFeePercent(uint256 from, uint256 to);
    event UpdatedSafetyFundPercent(uint256 from, uint256 to);
    event UpdatedWithdrawLockTerm(uint256 from, uint256 to);
    event InitializedServiceFeePercent(uint256 to);
    event InitializedSafetyFundPercent(uint256 to);
    event ReceivedETH(uint256 amount, address indexed from);
    event WithdrewERC20(address indexed token, address to, uint256 amount);
    event CollectedServiceFee(uint256 collectedAmount);
    event UpdatedWalletFactory(address indexed factory);
    event UpdatedCyanSigner(address indexed signer);

    struct AutoLiquidationInfo {
        uint256 planId;
        uint256[2] apePlanIds;
        uint256 price;
        address paymentPlanAddress;
        uint256 signatureExpiryDate;
        bytes signature;
    }

    address public _cyanVaultTokenAddress;
    ICyanVaultTokenV1 private _cyanVaultTokenContract;

    address private _stEthTokenContract; // unused
    address private _stableSwapSTETHContract; // unused

    // Safety fund percent. (x100)
    uint256 public _safetyFundPercent;

    // Cyan service fee percent. (x100)
    uint256 public _serviceFeePercent;

    // Total loaned amount
    uint256 private LOANED_AMOUNT;

    // Total defaulted NFT amount
    uint256 private DEFAULTED_NFT_ASSET_AMOUNT;

    // Cyan collected service fee
    uint256 private COLLECTED_SERVICE_FEE_AMOUNT;

    address public _currencyTokenAddress;
    IERC20Upgradeable private _currencyToken;
    bool public nonNativeCurrency;
    address _walletFactory;
    uint256 public _withdrawLockTerm;
    mapping(address => uint256) public withdrawLocked;
    bool public autoLiquidationEnabled;
    address private cyanSigner;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initializeV3(
        address cyanVaultTokenAddress,
        address currencyTokenAddress,
        address cyanPaymentPlanAddress,
        address cyanSuperAdmin,
        address factory,
        uint256 safetyFundPercent,
        uint256 serviceFeePercent,
        uint256 withdrawLockTerm,
        bool autoLiquidation,
        address signer
    ) external reinitializer(3) {
        // The contract is considered initialized if the vault token address is set.
        if (_cyanVaultTokenAddress == address(0)) {
            require(cyanVaultTokenAddress != address(0), "Cyan Vault Token address cannot be zero");
            require(cyanPaymentPlanAddress != address(0), "Cyan Payment Plan address cannot be zero");
            require(cyanSuperAdmin != address(0), "Cyan Super Admin address cannot be zero");
            require(safetyFundPercent <= 10000, "Safety fund percent must be equal or less than 100 percent");
            require(serviceFeePercent <= 200, "Service fee percent must not be greater than 2 percent");
            require(factory != address(0), "Factory address cannot be zero");

            __AccessControl_init();
            __ReentrancyGuard_init();
            __ERC721Holder_init();
            __Pausable_init();

            _cyanVaultTokenAddress = cyanVaultTokenAddress;
            _cyanVaultTokenContract = ICyanVaultTokenV1(_cyanVaultTokenAddress);
            _currencyTokenAddress = currencyTokenAddress;

            if (currencyTokenAddress != address(0)) {
                _currencyToken = IERC20Upgradeable(currencyTokenAddress);
                nonNativeCurrency = true;
            } else {
                nonNativeCurrency = false;
            }
            _safetyFundPercent = safetyFundPercent;
            _serviceFeePercent = serviceFeePercent;

            LOANED_AMOUNT = 0;
            DEFAULTED_NFT_ASSET_AMOUNT = 0;

            _setupRole(DEFAULT_ADMIN_ROLE, cyanSuperAdmin);
            _setupRole(CYAN_PAYMENT_PLAN_ROLE, cyanPaymentPlanAddress);

            _walletFactory = factory;
            _withdrawLockTerm = withdrawLockTerm;

            emit InitializedServiceFeePercent(serviceFeePercent);
            emit InitializedSafetyFundPercent(safetyFundPercent);
            emit UpdatedWalletFactory(factory);
        }
        require(signer != address(0), "Signer address cannot be zero");

        autoLiquidationEnabled = autoLiquidation;
        cyanSigner = signer;

        emit UpdatedCyanSigner(signer);
    }

    // User stakes
    function deposit(uint256 amount) external payable nonReentrant whenNotPaused {
        require(amount > 0, "Must deposit more than zero");
        if (nonNativeCurrency) {
            require(msg.value == 0, "Invalid deposit amount");
        } else {
            require(msg.value == amount, "Invalid deposit amount");
        }
        if (nonNativeCurrency) {
            _currencyToken.safeTransferFrom(msg.sender, address(this), amount);
        }

        address cyanWalletAddress = IFactory(_walletFactory).getOrDeployWallet(msg.sender);
        // Cyan collecting service fee from deposits
        uint256 cyanServiceFee = (amount * _serviceFeePercent) / 10000;
        uint256 depositedAmount = amount - cyanServiceFee;
        (uint256 totalCurrency, uint256 totalToken) = getTotalCurrencyAndToken();
        uint256 mintAmount = calculateTokenByCurrency(depositedAmount, totalCurrency - amount, totalToken);

        COLLECTED_SERVICE_FEE_AMOUNT += cyanServiceFee;

        _cyanVaultTokenContract.mint(cyanWalletAddress, mintAmount);

        withdrawLocked[cyanWalletAddress] = block.timestamp + _withdrawLockTerm;
        emit Deposit(msg.sender, depositedAmount, mintAmount);
    }

    // Cyan lends money from Vault to do BNPL or PAWN
    function lend(address to, uint256 amount) external nonReentrant whenNotPaused onlyRole(CYAN_PAYMENT_PLAN_ROLE) {
        require(to != address(0), "to address cannot be zero");

        uint256 maxWithdrableAmount = getMaxWithdrawableAmount();
        require(amount <= maxWithdrableAmount, "Not enough balance in the Vault");

        LOANED_AMOUNT += amount;

        safeCurrencyTransfer(to, amount);

        emit Lend(to, amount);
    }

    // Cyan Payment Plan contract transfers paid amount back to Vault
    function earn(uint256 amount, uint256 profit) external payable nonReentrant onlyRole(CYAN_PAYMENT_PLAN_ROLE) {
        if (nonNativeCurrency) {
            require(msg.value == 0, "Wrong tranfer amount");
        } else {
            require(msg.value == amount + profit, "Wrong tranfer amount");
        }

        if (nonNativeCurrency) {
            _currencyToken.safeTransferFrom(msg.sender, address(this), amount + profit);
        }
        if (LOANED_AMOUNT >= amount) {
            LOANED_AMOUNT -= amount;
        } else {
            LOANED_AMOUNT = 0;
        }

        emit Earn(amount, profit);
    }

    // When BNPL or PAWN plan defaults
    function nftDefaulted(uint256 unpaidAmount, uint256 estimatedPriceOfNFT)
        external
        nonReentrant
        onlyRole(CYAN_PAYMENT_PLAN_ROLE)
    {
        DEFAULTED_NFT_ASSET_AMOUNT += estimatedPriceOfNFT;

        if (LOANED_AMOUNT >= unpaidAmount) {
            LOANED_AMOUNT -= unpaidAmount;
        } else {
            LOANED_AMOUNT = 0;
        }

        emit NftDefaulted(unpaidAmount, estimatedPriceOfNFT);
    }

    // Liquidating defaulted BNPL or PAWN token and tranferred sold amount to Vault
    function liquidateNFT(uint256 liquidatedAmount, uint256 totalDefaultedNFTAmount)
        external
        payable
        whenNotPaused
        onlyRole(CYAN_ROLE)
    {
        if (nonNativeCurrency) {
            require(msg.value == 0, "Invalid deposit amount");
        } else {
            require(msg.value == liquidatedAmount, "Invalid deposit amount");
        }
        if (nonNativeCurrency) {
            _currencyToken.safeTransferFrom(msg.sender, address(this), liquidatedAmount);
        }

        emit NftLiquidated(liquidatedAmount, totalDefaultedNFTAmount, DEFAULTED_NFT_ASSET_AMOUNT);

        DEFAULTED_NFT_ASSET_AMOUNT = totalDefaultedNFTAmount;
    }

    function autoLiquidatePlan(AutoLiquidationInfo calldata info)
        external
        onlyAutoLiquidated
        whenNotPaused
        onlyRole(CYAN_ROLE)
    {
        verifyAutoLiquidationSignature(info);

        ICyanPaymentPlanV2 paymentPlan = ICyanPaymentPlanV2(info.paymentPlanAddress);
        paymentPlan.liquidate(info.planId, info.apePlanIds, info.price);
        emit AutoLiquidated(info.planId, 0); // Liquidated
    }

    function autoLiquidateByEarlyUnwindOpensea(
        AutoLiquidationInfo calldata info,
        bytes calldata offer,
        uint256 unwindSignatureExpiryDate,
        bytes calldata unwindSignature
    ) external onlyAutoLiquidated whenNotPaused onlyRole(CYAN_ROLE) {
        verifyAutoLiquidationSignature(info);

        ICyanPaymentPlanV2 paymentPlan = ICyanPaymentPlanV2(info.paymentPlanAddress);
        paymentPlan.earlyUnwindOpensea(
            info.planId,
            info.apePlanIds,
            info.price,
            offer,
            unwindSignatureExpiryDate,
            unwindSignature
        );
        emit AutoLiquidated(info.planId, 1); // Opensea
    }

    function autoLiquidateByEarlyUnwindCyan(
        AutoLiquidationInfo calldata info,
        address cyanBuyerAddress,
        uint256 unwindSignatureExpiryDate,
        bytes memory unwindSignature
    ) external onlyAutoLiquidated whenNotPaused onlyRole(CYAN_ROLE) {
        verifyAutoLiquidationSignature(info);

        ICyanPaymentPlanV2 paymentPlan = ICyanPaymentPlanV2(info.paymentPlanAddress);
        paymentPlan.earlyUnwindCyan(
            info.planId,
            info.apePlanIds,
            info.price,
            cyanBuyerAddress,
            unwindSignatureExpiryDate,
            unwindSignature
        );
        emit AutoLiquidated(info.planId, 2); // Cyan
    }

    // User unstakes tokenAmount of tokens and receives withdrawAmount of currency
    function withdraw(uint256 tokenAmount) external nonReentrant whenNotPaused {
        require(tokenAmount > 0, "Non-positive token amount");
        require(withdrawLocked[msg.sender] < block.timestamp, "Withdrawal locked");

        uint256 withdrawableTokenBalance = getWithdrawableBalance(msg.sender);
        require(tokenAmount <= withdrawableTokenBalance, "Not enough active balance in Cyan Vault");

        uint256 withdrawAmount = calculateCurrencyByToken(tokenAmount);

        _cyanVaultTokenContract.burn(msg.sender, tokenAmount);
        safeCurrencyTransfer(msg.sender, withdrawAmount);

        emit Withdraw(msg.sender, withdrawAmount, tokenAmount);
    }

    // Cyan updating total amount of defaulted NFT assets
    function updateDefaultedNFTAssetAmount(uint256 amount) external whenNotPaused onlyRole(CYAN_ROLE) {
        emit UpdatedDefaultedNFTAssetAmount(amount, DEFAULTED_NFT_ASSET_AMOUNT);
        DEFAULTED_NFT_ASSET_AMOUNT = amount;
    }

    // Get defaulted NFT from Vault to Cyan Admin account
    function getDefaultedNFT(address contractAddress, uint256 tokenId)
        external
        nonReentrant
        whenNotPaused
        onlyRole(CYAN_ROLE)
    {
        require(contractAddress != address(0), "Zero contract address");
        IERC721 originalContract = IERC721(contractAddress);
        require(originalContract.ownerOf(tokenId) == address(this), "Vault is not the owner of the token");

        originalContract.safeTransferFrom(address(this), msg.sender, tokenId);

        emit GetDefaultedNFT(msg.sender, contractAddress, tokenId);
    }

    // Get defaulted ERC1155 from Vault to Cyan Admin account
    function getDefaultedERC1155(
        address contractAddress,
        uint256 tokenId,
        uint256 amount
    ) external nonReentrant whenNotPaused onlyRole(CYAN_ROLE) {
        require(contractAddress != address(0), "Zero contract address");
        IERC1155 originalContract = IERC1155(contractAddress);
        require(originalContract.balanceOf(address(this), tokenId) >= amount, "Vault does not have enough token");

        originalContract.safeTransferFrom(address(this), msg.sender, tokenId, amount, bytes(""));

        emit GetDefaultedERC1155(msg.sender, contractAddress, tokenId, amount);
    }

    function getWithdrawableBalance(address user) public view returns (uint256) {
        uint256 tokenBalance = _cyanVaultTokenContract.balanceOf(user);
        uint256 currencyAmountForToken = calculateCurrencyByToken(tokenBalance);
        uint256 maxWithdrawableAmount = getMaxWithdrawableAmount();

        if (currencyAmountForToken <= maxWithdrawableAmount) {
            return tokenBalance;
        }
        return calculateTokenByCurrency(maxWithdrawableAmount);
    }

    function getMaxWithdrawableAmount() public view returns (uint256) {
        uint256 util = ((LOANED_AMOUNT + DEFAULTED_NFT_ASSET_AMOUNT) * _safetyFundPercent) / 10000;
        uint256 remainingAmount = getRemainingAmount();
        if (remainingAmount > util) {
            return remainingAmount - util;
        }
        return 0;
    }

    function getRemainingAmount() private view returns (uint256) {
        if (nonNativeCurrency) {
            return _currencyToken.balanceOf(address(this)) - COLLECTED_SERVICE_FEE_AMOUNT;
        }
        return address(this).balance - COLLECTED_SERVICE_FEE_AMOUNT;
    }

    function getCurrentAssetAmounts()
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256
        )
    {
        return (getRemainingAmount(), LOANED_AMOUNT, DEFAULTED_NFT_ASSET_AMOUNT, COLLECTED_SERVICE_FEE_AMOUNT);
    }

    function getCurrencyAddress() external view returns (address) {
        return _currencyTokenAddress;
    }

    function calculateTokenByCurrency(
        uint256 amount,
        uint256 totalCurrency,
        uint256 totalToken
    ) private pure returns (uint256) {
        if (totalCurrency == 0) return amount;
        return (amount * totalToken) / totalCurrency;
    }

    function calculateCurrencyByToken(
        uint256 amount,
        uint256 totalCurrency,
        uint256 totalToken
    ) private pure returns (uint256) {
        if (totalToken == 0) return amount;
        return (amount * totalCurrency) / totalToken;
    }

    function calculateTokenByCurrency(uint256 amount) public view returns (uint256) {
        (uint256 totalCurrency, uint256 totalToken) = getTotalCurrencyAndToken();
        return calculateTokenByCurrency(amount, totalCurrency, totalToken);
    }

    function calculateCurrencyByToken(uint256 amount) public view returns (uint256) {
        (uint256 totalCurrency, uint256 totalToken) = getTotalCurrencyAndToken();
        return calculateCurrencyByToken(amount, totalCurrency, totalToken);
    }

    function getTotalCurrencyAndToken() private view returns (uint256, uint256) {
        uint256 totalCurrency = getRemainingAmount() + LOANED_AMOUNT + DEFAULTED_NFT_ASSET_AMOUNT;
        uint256 totalToken = _cyanVaultTokenContract.totalSupply();

        return (totalCurrency, totalToken);
    }

    function updateSafetyFundPercent(uint256 safetyFundPercent) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(safetyFundPercent <= 10000, "Safety fund percent must be equal or less than 100 percent");
        emit UpdatedSafetyFundPercent(_safetyFundPercent, safetyFundPercent);
        _safetyFundPercent = safetyFundPercent;
    }

    function updateServiceFeePercent(uint256 serviceFeePercent) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(serviceFeePercent <= 200, "Service fee percent must not be greater than 2 percent");
        emit UpdatedServiceFeePercent(_serviceFeePercent, serviceFeePercent);
        _serviceFeePercent = serviceFeePercent;
    }

    function updateWithdrawLockTerm(uint256 withdrawLockTerm) external onlyRole(DEFAULT_ADMIN_ROLE) {
        emit UpdatedWithdrawLockTerm(_withdrawLockTerm, withdrawLockTerm);
        _withdrawLockTerm = withdrawLockTerm;
    }

    function collectServiceFee() external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) {
        emit CollectedServiceFee(COLLECTED_SERVICE_FEE_AMOUNT);
        safeCurrencyTransfer(msg.sender, COLLECTED_SERVICE_FEE_AMOUNT);
        COLLECTED_SERVICE_FEE_AMOUNT = 0;
    }

    function safeCurrencyTransfer(address to, uint256 amount) private {
        if (nonNativeCurrency) {
            _currencyToken.safeTransfer(to, amount);
        } else {
            (bool success, ) = payable(to).call{ value: amount }("");
            require(success, "Payment failed: Native token transfer");
        }
    }

    function withdrawAirDroppedERC20(address contractAddress, uint256 amount)
        external
        nonReentrant
        onlyRole(CYAN_ROLE)
    {
        require(contractAddress != _currencyTokenAddress, "Cannot withdraw currency token");
        IERC20Upgradeable erc20Contract = IERC20Upgradeable(contractAddress);
        require(erc20Contract.balanceOf(address(this)) >= amount, "ERC20 balance not enough");
        erc20Contract.safeTransfer(msg.sender, amount);

        emit WithdrewERC20(contractAddress, msg.sender, amount);
    }

    function withdrawApprovedERC20(
        address contractAddress,
        address from,
        uint256 amount
    ) external nonReentrant onlyRole(CYAN_ROLE) {
        require(contractAddress != _currencyTokenAddress, "Cannot withdraw currency token");
        IERC20Upgradeable erc20Contract = IERC20Upgradeable(contractAddress);
        require(erc20Contract.allowance(from, address(this)) >= amount, "ERC20 allowance not enough");
        erc20Contract.safeTransferFrom(from, msg.sender, amount);

        emit WithdrewERC20(contractAddress, msg.sender, amount);
    }

    /**
     * @notice Updating Cyan wallet factory address that used for deploying new wallets
     * @param factory New Cyan wallet factory address
     */
    function updateWalletFactoryAddress(address factory) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(factory != address(0) && _walletFactory != factory, "Invalid factory address");
        _walletFactory = factory;
        emit UpdatedWalletFactory(factory);
    }

    /**
     * @notice Updating Cyan signer address that used for verifying auto liquidation signature
     * @param signer New Cyan signer address
     */
    function updateCyanSigner(address signer) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(signer != address(0), "Invalid signer address");
        cyanSigner = signer;
        emit UpdatedCyanSigner(signer);
    }

    modifier onlyAutoLiquidated() {
        require(autoLiquidationEnabled, "Auto liquidation is disabled for this vault");
        _;
    }

    function verifyAutoLiquidationSignature(AutoLiquidationInfo calldata info) internal view {
        require(block.timestamp <= info.signatureExpiryDate, "Signature expired");
        bytes32 msgHash = keccak256(
            abi.encodePacked(
                info.planId,
                info.apePlanIds[0],
                info.apePlanIds[1],
                info.price,
                info.signatureExpiryDate,
                block.chainid
            )
        );
        bytes32 signedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", msgHash));
        require(signedHash.recover(info.signature) == cyanSigner, "Invalid Signature");
    }

    function pause() external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) {
        _pause();
    }

    function unpause() external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) {
        _unpause();
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(AccessControlUpgradeable, ERC1155ReceiverUpgradeable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

File 2 of 29 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(account),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 29 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @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]
 * ```
 * 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 Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _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 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _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() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @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 {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 5 of 29 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

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

pragma solidity ^0.8.0;
import "../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;

    uint256 private _status;

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

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 7 of 29 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 8 of 29 : draft-IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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.
 */
interface IERC20PermitUpgradeable {
    /**
     * @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].
     */
    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 9 of 29 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount
    ) external returns (bool);
}

File 10 of 29 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20PermitUpgradeable token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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(IERC20Upgradeable 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, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @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 12 of 29 : ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

File 14 of 29 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 15 of 29 : ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../StringsUpgradeable.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSAUpgradeable {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../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);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @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 18 of 29 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

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

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

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

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

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

File 20 of 29 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 21 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount
    ) external returns (bool);
}

File 22 of 29 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 24 of 29 : IFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IFactory {
    function getOrDeployWallet(address) external returns (address);

    function getWalletOwner(address) external view returns (address);

    function getOwnerWallet(address) external view returns (address);
}

File 25 of 29 : ICyanPaymentPlanV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import { PaymentPlanStatus } from "../../main/payment-plan/PaymentPlanTypes.sol";

interface ICyanPaymentPlanV2 {
    function pay(uint256, bool) external payable;

    function getPlanStatus(uint256) external view returns (PaymentPlanStatus);

    function getCurrencyAddressByPlanId(uint256) external view returns (address);

    function earlyUnwindOpensea(
        uint256,
        uint256[2] calldata,
        uint256,
        bytes memory,
        uint256,
        bytes memory
    ) external;

    function earlyUnwindCyan(
        uint256,
        uint256[2] calldata,
        uint256,
        address,
        uint256,
        bytes memory
    ) external;

    function liquidate(
        uint256,
        uint256[2] calldata,
        uint256
    ) external;
}

File 26 of 29 : ICyanVaultTokenV1.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

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

interface ICyanVaultTokenV1 is IERC20 {
    function mint(address to, uint256 amount) external;

    function burn(address from, uint256 amount) external;

    function burnAdminToken(uint256 amount) external;
}

File 27 of 29 : ERC1155HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
    function __ERC1155Holder_init() internal onlyInitializing {}

    function __ERC1155Holder_init_unchained() internal onlyInitializing {}

    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 28 of 29 : ERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155ReceiverUpgradeable is Initializable, ERC165Upgradeable, IERC1155ReceiverUpgradeable {
    function __ERC1155Receiver_init() internal onlyInitializing {}

    function __ERC1155Receiver_init_unchained() internal onlyInitializing {}

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

File 29 of 29 : PaymentPlanTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

// DataTypes
enum PawnCreateType {
    REGULAR,
    BEND_DAO,
    REFINANCE
}
enum PaymentPlanStatus {
    BNPL_CREATED,
    BNPL_FUNDED,
    BNPL_ACTIVE,
    BNPL_DEFAULTED,
    BNPL_REJECTED,
    BNPL_COMPLETED,
    BNPL_LIQUIDATED,
    PAWN_ACTIVE,
    PAWN_DEFAULTED,
    PAWN_COMPLETED,
    PAWN_LIQUIDATED
}
struct Plan {
    uint256 amount;
    uint32 downPaymentPercent;
    uint32 interestRate;
    uint32 serviceFeeRate;
    uint32 term;
    uint8 totalNumberOfPayments;
    uint8 counterPaidPayments;
    uint8 autoRepayStatus;
}
struct PaymentPlan {
    Plan plan;
    uint256 createdDate;
    address cyanWalletAddress;
    PaymentPlanStatus status;
}

struct Item {
    uint256 amount;
    uint256 tokenId;
    address contractAddress;
    address cyanVaultAddress;
    // 1 -> ERC721
    // 2 -> ERC1155
    // 3 -> CryptoPunks
    uint8 itemType;
}

struct PaymentAmountInfo {
    uint256 loanAmount;
    uint256 interestAmount;
    uint256 serviceAmount;
}

// Errors
error InvalidSender();
error InvalidBlockNumber();
error InvalidSignature();
error InvalidServiceFeeRate();
error InvalidTokenPrice();
error InvalidInterestRate();
error InvalidDownPaymentPercent();
error InvalidDownPayment();
error InvalidAmount();
error InvalidTerm();
error InvalidPaidCount();
error InvalidStage();
error InvalidAddress();
error InvalidAutoRepaymentDate();
error InvalidAutoRepaymentStatus();
error InvalidTotalNumberOfPayments();
error InvalidReviveDate();
error InvalidItem();
error InvalidBaseDiscountRate();
error InvalidApeCoinPlan();
error InvalidBendDaoPlan();
error InvalidCurrency();
error InvalidCyanBuyer();
error InvalidSelector();

error EthTransferFailed();

error PaymentPlanAlreadyExists();
error PaymentPlanNotFound();

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"planId","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"autoLiquidationType","type":"uint8"}],"name":"AutoLiquidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"collectedAmount","type":"uint256"}],"name":"CollectedServiceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profitAmount","type":"uint256"}],"name":"Earn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"GetDefaultedERC1155","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"GetDefaultedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"InitializedSafetyFundPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"InitializedServiceFeePercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Lend","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"unpaidAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"estimatedPriceOfNFT","type":"uint256"}],"name":"NftDefaulted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"defaultedAssetsAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"soldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prevDefaultedAssetsAmount","type":"uint256"}],"name":"NftLiquidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"}],"name":"ReceivedETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"}],"name":"UpdatedCyanSigner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"defaultedAssetsAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prevDefaultedAssetsAmount","type":"uint256"}],"name":"UpdatedDefaultedNFTAssetAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"UpdatedSafetyFundPercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"UpdatedServiceFeePercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"factory","type":"address"}],"name":"UpdatedWalletFactory","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"from","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"to","type":"uint256"}],"name":"UpdatedWithdrawLockTerm","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrewERC20","type":"event"},{"inputs":[],"name":"CYAN_PAYMENT_PLAN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CYAN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_currencyTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_cyanVaultTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_safetyFundPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_serviceFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_withdrawLockTerm","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"uint256[2]","name":"apePlanIds","type":"uint256[2]"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"paymentPlanAddress","type":"address"},{"internalType":"uint256","name":"signatureExpiryDate","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct CyanVaultV2.AutoLiquidationInfo","name":"info","type":"tuple"},{"internalType":"address","name":"cyanBuyerAddress","type":"address"},{"internalType":"uint256","name":"unwindSignatureExpiryDate","type":"uint256"},{"internalType":"bytes","name":"unwindSignature","type":"bytes"}],"name":"autoLiquidateByEarlyUnwindCyan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"uint256[2]","name":"apePlanIds","type":"uint256[2]"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"paymentPlanAddress","type":"address"},{"internalType":"uint256","name":"signatureExpiryDate","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct CyanVaultV2.AutoLiquidationInfo","name":"info","type":"tuple"},{"internalType":"bytes","name":"offer","type":"bytes"},{"internalType":"uint256","name":"unwindSignatureExpiryDate","type":"uint256"},{"internalType":"bytes","name":"unwindSignature","type":"bytes"}],"name":"autoLiquidateByEarlyUnwindOpensea","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"uint256[2]","name":"apePlanIds","type":"uint256[2]"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"address","name":"paymentPlanAddress","type":"address"},{"internalType":"uint256","name":"signatureExpiryDate","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct CyanVaultV2.AutoLiquidationInfo","name":"info","type":"tuple"}],"name":"autoLiquidatePlan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"autoLiquidationEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateCurrencyByToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateTokenByCurrency","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectServiceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"profit","type":"uint256"}],"name":"earn","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getCurrencyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentAssetAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getDefaultedERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getDefaultedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMaxWithdrawableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getWithdrawableBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"cyanVaultTokenAddress","type":"address"},{"internalType":"address","name":"currencyTokenAddress","type":"address"},{"internalType":"address","name":"cyanPaymentPlanAddress","type":"address"},{"internalType":"address","name":"cyanSuperAdmin","type":"address"},{"internalType":"address","name":"factory","type":"address"},{"internalType":"uint256","name":"safetyFundPercent","type":"uint256"},{"internalType":"uint256","name":"serviceFeePercent","type":"uint256"},{"internalType":"uint256","name":"withdrawLockTerm","type":"uint256"},{"internalType":"bool","name":"autoLiquidation","type":"bool"},{"internalType":"address","name":"signer","type":"address"}],"name":"initializeV3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"lend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"liquidatedAmount","type":"uint256"},{"internalType":"uint256","name":"totalDefaultedNFTAmount","type":"uint256"}],"name":"liquidateNFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"unpaidAmount","type":"uint256"},{"internalType":"uint256","name":"estimatedPriceOfNFT","type":"uint256"}],"name":"nftDefaulted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nonNativeCurrency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","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":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"updateCyanSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updateDefaultedNFTAssetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"safetyFundPercent","type":"uint256"}],"name":"updateSafetyFundPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"serviceFeePercent","type":"uint256"}],"name":"updateServiceFeePercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"factory","type":"address"}],"name":"updateWalletFactoryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"withdrawLockTerm","type":"uint256"}],"name":"updateWithdrawLockTerm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawAirDroppedERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawApprovedERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61460480620000f46000396000f3fe6080604052600436106103295760003560e01c8063843592d3116101a5578063b5a68b81116100ec578063d23f9a9a11610095578063e8c5c6d31161006f578063e8c5c6d31461093c578063ec8e83c01461095c578063f23a6e611461097c578063f61e0268146109a857600080fd5b8063d23f9a9a146108da578063d547741f146108fc578063e895e1171461091c57600080fd5b8063bfe0c27e116100c6578063bfe0c27e14610866578063c7e01ad614610885578063c9d375f4146108a557600080fd5b8063b5a68b8114610806578063b6b55f2514610827578063bc197c811461083a57600080fd5b806391d148541161014e578063a2fb342d11610128578063a2fb342d1461079f578063a6617e78146107bf578063a930daf4146107d257600080fd5b806391d14854146107295780639a0bf1481461076f578063a217fddf1461078a57600080fd5b806388b122e71161017f57806388b122e7146106d25780638d676a92146106e9578063904af1951461070957600080fd5b8063843592d31461067d5780638456cb591461069d57806387acb02c146106b257600080fd5b806345e1aa3c11610274578063643840f21161021d5780637ac0d155116101f75780637ac0d155146105e15780637bc565581461060f5780637d8d18461461062f578063823cbb091461064457600080fd5b8063643840f2146105975780636c66cee2146105aa5780636d54294b146105ca57600080fd5b8063590c5ef31161024e578063590c5ef31461053f5780635c975abb1461055f5780635ef6a3bc1461057757600080fd5b806345e1aa3c146104dd57806346fe120e146104fd578063555f90c41461051f57600080fd5b80632b09dd0f116102d657806336568abe116102b057806336568abe146104885780633f4ba83a146104a8578063404da783146104bd57600080fd5b80632b09dd0f146104285780632e1a7d4d146104485780632f2ff15d1461046857600080fd5b8063150b7a0211610307578063150b7a021461039d578063156b2d89146103d6578063248a9ca3146103f857600080fd5b806301ffc9a71461032e578063037d69f5146103635780630bdb92c014610388575b600080fd5b34801561033a57600080fd5b5061034e610349366004613b7d565b6109c8565b60405190151581526020015b60405180910390f35b34801561036f57600080fd5b5061037a6101325481565b60405190815260200161035a565b34801561039457600080fd5b5061037a6109d9565b3480156103a957600080fd5b506103bd6103b8366004613c73565b610a39565b6040516001600160e01b0319909116815260200161035a565b3480156103e257600080fd5b506103f66103f1366004613cf7565b610a4a565b005b34801561040457600080fd5b5061037a610413366004613d2c565b60009081526065602052604090206001015490565b34801561043457600080fd5b506103f6610443366004613d45565b610b9a565b34801561045457600080fd5b506103f6610463366004613d2c565b610c64565b34801561047457600080fd5b506103f6610483366004613d62565b610e55565b34801561049457600080fd5b506103f66104a3366004613d62565b610e7f565b3480156104b457600080fd5b506103f6610f0b565b3480156104c957600080fd5b506103f66104d8366004613d2c565b610f33565b3480156104e957600080fd5b506103f66104f8366004613d92565b610ffa565b34801561050957600080fd5b5061037a6000805160206145af83398151915281565b34801561052b57600080fd5b506103f661053a366004613dd3565b6111a0565b34801561054b57600080fd5b506103f661055a366004613d45565b6112f4565b34801561056b57600080fd5b5060fb5460ff1661034e565b34801561058357600080fd5b506103f6610592366004613e8b565b6113b6565b6103f66105a5366004613f29565b611510565b3480156105b657600080fd5b506103f66105c5366004613d2c565b611699565b3480156105d657600080fd5b5061037a6101315481565b3480156105ed57600080fd5b5061037a6105fc366004613d45565b61013a6020526000908152604090205481565b34801561061b57600080fd5b506103f661062a366004613f29565b6116e8565b34801561063b57600080fd5b506103f6611797565b34801561065057600080fd5b5061012d54610665906001600160a01b031681565b6040516001600160a01b03909116815260200161035a565b34801561068957600080fd5b5061037a610698366004613d45565b611804565b3480156106a957600080fd5b506103f66118b4565b3480156106be57600080fd5b506103f66106cd366004613f4b565b6118cf565b3480156106de57600080fd5b5061037a6101395481565b3480156106f557600080fd5b506103f6610704366004613f77565b611a6d565b34801561071557600080fd5b506103f6610724366004613fba565b611c6e565b34801561073557600080fd5b5061034e610744366004613d62565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561077b57600080fd5b5061013b5461034e9060ff1681565b34801561079657600080fd5b5061037a600081565b3480156107ab57600080fd5b506103f66107ba366004613f4b565b61226e565b6103f66107cd366004613f29565b6123b8565b3480156107de57600080fd5b5061037a7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd81565b34801561081257600080fd5b5061013654610665906001600160a01b031681565b6103f6610835366004613d2c565b6124f7565b34801561084657600080fd5b506103bd6108553660046140e4565b63bc197c8160e01b95945050505050565b34801561087257600080fd5b50610136546001600160a01b0316610665565b34801561089157600080fd5b506103f66108a0366004613d2c565b6127e9565b3480156108b157600080fd5b506108ba6128af565b60408051948552602085019390935291830152606082015260800161035a565b3480156108e657600080fd5b506101375461034e90600160a01b900460ff1681565b34801561090857600080fd5b506103f6610917366004613d62565b6128d7565b34801561092857600080fd5b506103f6610937366004613d2c565b6128fc565b34801561094857600080fd5b5061037a610957366004613d2c565b612961565b34801561096857600080fd5b506103f6610977366004613f4b565b61297d565b34801561098857600080fd5b506103bd610997366004614192565b63f23a6e6160e01b95945050505050565b3480156109b457600080fd5b5061037a6109c3366004613d2c565b612b6c565b60006109d382612b88565b92915050565b6000806127106101315461013454610133546109f59190614211565b6109ff9190614224565b610a09919061423b565b90506000610a15612bad565b905081811115610a3057610a29828261425d565b9250505090565b60009250505090565b630a85bd0160e11b5b949350505050565b61013b5460ff16610ab65760405162461bcd60e51b815260206004820152602b60248201527f4175746f206c69717569646174696f6e2069732064697361626c656420666f7260448201526a081d1a1a5cc81d985d5b1d60aa1b60648201526084015b60405180910390fd5b610abe612c51565b6000805160206145af833981519152610ad681612ca4565b610adf82612cae565b6000610af160a0840160808501613d45565b6040516323c4b44960e01b81529091506001600160a01b038216906323c4b44990610b2c908635906020880190606089013590600401614270565b600060405180830381600087803b158015610b4657600080fd5b505af1158015610b5a573d6000803e3d6000fd5b505060405160008152853592507f1bc13c64b284b03bd27bb0a4ce4d00d1d6892b4e10344c01bfcbe79396651bc1915060200160405180910390a2505050565b6000610ba581612ca4565b6001600160a01b03821615801590610bcc5750610138546001600160a01b03838116911614155b610c185760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420666163746f727920616464726573730000000000000000006044820152606401610aad565b61013880546001600160a01b0319166001600160a01b0384169081179091556040517fe62d9ecc2f46536d69df8cf1ba196250488dc869eadabc42466d72ee898716ce90600090a25050565b610c6c612e6a565b610c74612c51565b60008111610cc45760405162461bcd60e51b815260206004820152601960248201527f4e6f6e2d706f73697469766520746f6b656e20616d6f756e74000000000000006044820152606401610aad565b33600090815261013a60205260409020544211610d235760405162461bcd60e51b815260206004820152601160248201527f5769746864726177616c206c6f636b65640000000000000000000000000000006044820152606401610aad565b6000610d2e33611804565b905080821115610d905760405162461bcd60e51b815260206004820152602760248201527f4e6f7420656e6f756768206163746976652062616c616e636520696e204379616044820152661b8815985d5b1d60ca1b6064820152608401610aad565b6000610d9b83612b6c565b61012e54604051632770a7eb60e21b8152336004820152602481018690529192506001600160a01b031690639dc29fac90604401600060405180830381600087803b158015610de957600080fd5b505af1158015610dfd573d6000803e3d6000fd5b50505050610e0b3382612ec3565b604080518281526020810185905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a25050610e526001609755565b50565b600082815260656020526040902060010154610e7081612ca4565b610e7a8383612fa6565b505050565b6001600160a01b0381163314610efd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610aad565b610f078282613048565b5050565b610f13612e6a565b6000610f1e81612ca4565b610f266130cb565b50610f316001609755565b565b6000610f3e81612ca4565b612710821115610fb65760405162461bcd60e51b815260206004820152603a60248201527f5361666574792066756e642070657263656e74206d757374206265206571756160448201527f6c206f72206c657373207468616e203130302070657263656e740000000000006064820152608401610aad565b6101315460408051918252602082018490527feeeb5af1c3ceeab4fb8414a031926b58ba0e9b17d71c2ade80057757e6cb0260910160405180910390a15061013155565b611002612e6a565b6000805160206145af83398151915261101a81612ca4565b610136546001600160a01b03908116908516036110795760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f742077697468647261772063757272656e637920746f6b656e00006044820152606401610aad565b604051636eb1769f60e11b81526001600160a01b0384811660048301523060248301528591849183169063dd62ed3e90604401602060405180830381865afa1580156110c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ed919061428d565b101561113b5760405162461bcd60e51b815260206004820152601a60248201527f455243323020616c6c6f77616e6365206e6f7420656e6f7567680000000000006044820152606401610aad565b6111506001600160a01b03821685338661311d565b60408051338152602081018590526001600160a01b038716917fa14466d832b5a1ff01be72c58e51196498a8e10751ab9c227fe73c4730dedc41910160405180910390a25050610e7a6001609755565b61013b5460ff166112075760405162461bcd60e51b815260206004820152602b60248201527f4175746f206c69717569646174696f6e2069732064697361626c656420666f7260448201526a081d1a1a5cc81d985d5b1d60aa1b6064820152608401610aad565b61120f612c51565b6000805160206145af83398151915261122781612ca4565b61123085612cae565b600061124260a0870160808801613d45565b604051630d2a47a760e41b81529091506001600160a01b0382169063d2a47a70906112839089359060208b019060608c0135908b908b908b906004016142f6565b600060405180830381600087803b15801561129d57600080fd5b505af11580156112b1573d6000803e3d6000fd5b505060405160028152883592507f1bc13c64b284b03bd27bb0a4ce4d00d1d6892b4e10344c01bfcbe79396651bc1915060200160405180910390a2505050505050565b60006112ff81612ca4565b6001600160a01b0382166113555760405162461bcd60e51b815260206004820152601660248201527f496e76616c6964207369676e65722061646472657373000000000000000000006044820152606401610aad565b61013b805474ffffffffffffffffffffffffffffffffffffffff0019166101006001600160a01b038516908102919091179091556040517fb600274ef5d11bda880beece19f867f60804daa64e9abecaf8f54ba2d2a73c1190600090a25050565b61013b5460ff1661141d5760405162461bcd60e51b815260206004820152602b60248201527f4175746f206c69717569646174696f6e2069732064697361626c656420666f7260448201526a081d1a1a5cc81d985d5b1d60aa1b6064820152608401610aad565b611425612c51565b6000805160206145af83398151915261143d81612ca4565b61144687612cae565b600061145860a0890160808a01613d45565b604051634f0815c160e11b81529091506001600160a01b03821690639e102b829061149d908b359060208d019060608e0135908d908d908d908d908d90600401614367565b600060405180830381600087803b1580156114b757600080fd5b505af11580156114cb573d6000803e3d6000fd5b5050604051600181528a3592507f1bc13c64b284b03bd27bb0a4ce4d00d1d6892b4e10344c01bfcbe79396651bc1915060200160405180910390a25050505050505050565b611518612e6a565b7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd61154281612ca4565b61013754600160a01b900460ff161561159f57341561159a5760405162461bcd60e51b815260206004820152601460248201527315dc9bdb99c81d1c985b99995c88185b5bdd5b9d60621b6044820152606401610aad565b6115ee565b6115a98284614211565b34146115ee5760405162461bcd60e51b815260206004820152601460248201527315dc9bdb99c81d1c985b99995c88185b5bdd5b9d60621b6044820152606401610aad565b61013754600160a01b900460ff16156116255761162533306116108587614211565b610137546001600160a01b031692919061311d565b82610133541061164d57826101336000828254611642919061425d565b909155506116549050565b6000610133555b60408051848152602081018490527f5850d758e6151f474c145f4f59e8cb315c3f1a9fe82d96dff5bd2d48b5a76f9b91015b60405180910390a150610f076001609755565b60006116a481612ca4565b6101395460408051918252602082018490527f4cbae8b98c0d2e56b6aea023eb7a2bd38b351afbefdc5ca1f8b2583f1f781925910160405180910390a15061013955565b6116f0612e6a565b7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd61171a81612ca4565b81610134600082825461172d9190614211565b909155505061013354831161175a5782610133600082825461174f919061425d565b909155506117619050565b6000610133555b60408051848152602081018490527f9b8376ea2c5e9863179edf3c51616d423d51e32eea3ca2e7a02ce8a3d3aa01429101611686565b61179f612e6a565b60006117aa81612ca4565b7ff0b42f9fe97fe866aaeaccc4da4b80df4b1e9d625522db8c2529cdf7f1cd1451610135546040516117de91815260200190565b60405180910390a16117f33361013554612ec3565b50600061013555610f316001609755565b61012e546040516370a0823160e01b81526001600160a01b03838116600483015260009283929116906370a0823190602401602060405180830381865afa158015611853573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611877919061428d565b9050600061188482612b6c565b905060006118906109d9565b90508082116118a25750909392505050565b6118ab81612961565b95945050505050565b6118bc612e6a565b60006118c781612ca4565b610f266131a3565b6118d7612e6a565b6000805160206145af8339815191526118ef81612ca4565b610136546001600160a01b039081169084160361194e5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f742077697468647261772063757272656e637920746f6b656e00006044820152606401610aad565b6040516370a0823160e01b8152306004820152839083906001600160a01b038316906370a0823190602401602060405180830381865afa158015611996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ba919061428d565b1015611a085760405162461bcd60e51b815260206004820152601860248201527f45524332302062616c616e6365206e6f7420656e6f75676800000000000000006044820152606401610aad565b611a1c6001600160a01b03821633856131e0565b60408051338152602081018590526001600160a01b038616917fa14466d832b5a1ff01be72c58e51196498a8e10751ab9c227fe73c4730dedc4191015b60405180910390a25050610f076001609755565b611a75612e6a565b611a7d612c51565b6000805160206145af833981519152611a9581612ca4565b6001600160a01b038416611ae35760405162461bcd60e51b81526020600482015260156024820152745a65726f20636f6e7472616374206164647265737360581b6044820152606401610aad565b604051627eeac760e11b815230600482015260248101849052849083906001600160a01b0383169062fdd58e90604401602060405180830381865afa158015611b30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b54919061428d565b1015611ba25760405162461bcd60e51b815260206004820181905260248201527f5661756c7420646f6573206e6f74206861766520656e6f75676820746f6b656e6044820152606401610aad565b60408051602081018252600081529051637921219560e11b81526001600160a01b0383169163f242432a91611be291309133918a918a91906004016143b7565b600060405180830381600087803b158015611bfc57600080fd5b505af1158015611c10573d6000803e3d6000fd5b5050505083856001600160a01b0316336001600160a01b03167f07394b3fad6920c344c25134bb6cf65ee1313a0296830f2043653661beb4136d86604051611c5a91815260200190565b60405180910390a45050610e7a6001609755565b600054600390610100900460ff16158015611c90575060005460ff8083169116105b611d025760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610aad565b6000805461ffff191660ff83161761010017905561012d546001600160a01b0316612151576001600160a01b038b16611d8d5760405162461bcd60e51b815260206004820152602760248201527f4379616e205661756c7420546f6b656e20616464726573732063616e6e6f74206044820152666265207a65726f60c81b6064820152608401610aad565b6001600160a01b038916611df45760405162461bcd60e51b815260206004820152602860248201527f4379616e205061796d656e7420506c616e20616464726573732063616e6e6f74604482015267206265207a65726f60c01b6064820152608401610aad565b6001600160a01b038816611e5a5760405162461bcd60e51b815260206004820152602760248201527f4379616e2053757065722041646d696e20616464726573732063616e6e6f74206044820152666265207a65726f60c81b6064820152608401610aad565b612710861115611ed25760405162461bcd60e51b815260206004820152603a60248201527f5361666574792066756e642070657263656e74206d757374206265206571756160448201527f6c206f72206c657373207468616e203130302070657263656e740000000000006064820152608401610aad565b60c8851115611f495760405162461bcd60e51b815260206004820152603660248201527f53657276696365206665652070657263656e74206d757374206e6f742062652060448201527f67726561746572207468616e20322070657263656e74000000000000000000006064820152608401610aad565b6001600160a01b038716611f9f5760405162461bcd60e51b815260206004820152601e60248201527f466163746f727920616464726573732063616e6e6f74206265207a65726f00006044820152606401610aad565b611fa7613210565b611faf613237565b611fb7613210565b611fbf613266565b61012d80546001600160a01b03808e166001600160a01b0319928316811790935561012e805483169093179092556101368054928d1692909116821790551561203757610137805474ffffffffffffffffffffffffffffffffffffffffff19166001600160a01b038c1617600160a01b179055612046565b610137805460ff60a01b191690555b610131869055610132859055600061013381905561013481905561206a9089613295565b6120947f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd8a613295565b61013880546001600160a01b0319166001600160a01b0389161790556101398490556040518581527f9946eeb5f4ca76305e83426173176fffd327e46ff4ac0e853f1806a8a6accb879060200160405180910390a16040518681527f183d0700d6a3fbe1d9843804c26a1fad21802c73c8976b4945f947600230b2679060200160405180910390a16040516001600160a01b038816907fe62d9ecc2f46536d69df8cf1ba196250488dc869eadabc42466d72ee898716ce90600090a25b6001600160a01b0382166121a75760405162461bcd60e51b815260206004820152601d60248201527f5369676e657220616464726573732063616e6e6f74206265207a65726f0000006044820152606401610aad565b61013b805474ffffffffffffffffffffffffffffffffffffffffff191684151574ffffffffffffffffffffffffffffffffffffffff001916176101006001600160a01b038516908102919091179091556040517fb600274ef5d11bda880beece19f867f60804daa64e9abecaf8f54ba2d2a73c1190600090a26000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050505050505050505050565b612276612e6a565b61227e612c51565b7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd6122a881612ca4565b6001600160a01b0383166122fe5760405162461bcd60e51b815260206004820152601960248201527f746f20616464726573732063616e6e6f74206265207a65726f000000000000006044820152606401610aad565b60006123086109d9565b90508083111561235a5760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f7567682062616c616e636520696e20746865205661756c74006044820152606401610aad565b82610133600082825461236d9190614211565b9091555061237d90508484612ec3565b836001600160a01b03167f41b123d2493c7b2067b8b7f49cf71532523d83ead11494d793531ece1fd4d04684604051611a5991815260200190565b6123c0612c51565b6000805160206145af8339815191526123d881612ca4565b61013754600160a01b900460ff16156124375734156124325760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b61247f565b82341461247f5760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b61013754600160a01b900460ff16156124ab57610137546124ab906001600160a01b031633308661311d565b61013454604080518581526020810185905280820192909252517f96e6bedbdb3caf466b6cdc33efaeacb3e7aabe7a4c7407eb7bbcfbc6bfe61bd79181900360600190a1506101345550565b6124ff612e6a565b612507612c51565b600081116125575760405162461bcd60e51b815260206004820152601b60248201527f4d757374206465706f736974206d6f7265207468616e207a65726f00000000006044820152606401610aad565b61013754600160a01b900460ff16156125b65734156125b15760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b6125fe565b8034146125fe5760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b61013754600160a01b900460ff161561262a576101375461262a906001600160a01b031633308461311d565b61013854604051635035507560e11b81523360048201526000916001600160a01b03169063a06aa0ea906024016020604051808303816000875af1158015612676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269a91906143ef565b9050600061271061013254846126b09190614224565b6126ba919061423b565b905060006126c8828561425d565b90506000806126d561329f565b909250905060006126f0846126ea898661425d565b8461334f565b90508461013560008282546127059190614211565b909155505061012e546040516340c10f1960e01b81526001600160a01b03888116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561275957600080fd5b505af115801561276d573d6000803e3d6000fd5b5050505061013954426127809190614211565b6001600160a01b038716600090815261013a602090815260409182902092909255805186815291820183905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15910160405180910390a2505050505050610e526001609755565b60006127f481612ca4565b60c882111561286b5760405162461bcd60e51b815260206004820152603660248201527f53657276696365206665652070657263656e74206d757374206e6f742062652060448201527f67726561746572207468616e20322070657263656e74000000000000000000006064820152608401610aad565b6101325460408051918252602082018490527f67ea558a1975802c885d7e38bc96ea4f925e1d5d86c8f53ad1a8387906297a90910160405180910390a15061013255565b6000806000806128bd612bad565b610133546101345461013554935093509350935090919293565b6000828152606560205260409020600101546128f281612ca4565b610e7a8383613048565b612904612c51565b6000805160206145af83398151915261291c81612ca4565b610134546040805184815260208101929092527f7225a18e2ba86dcc138ac0b9f071bb3b96001da5a09fd2633472545f7eeec4c0910160405180910390a15061013455565b600080600061296e61329f565b91509150610a4284838361334f565b612985612e6a565b61298d612c51565b6000805160206145af8339815191526129a581612ca4565b6001600160a01b0383166129f35760405162461bcd60e51b81526020600482015260156024820152745a65726f20636f6e7472616374206164647265737360581b6044820152606401610aad565b6040516331a9108f60e11b815260048101839052839030906001600160a01b03831690636352211e90602401602060405180830381865afa158015612a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a6091906143ef565b6001600160a01b031614612ac25760405162461bcd60e51b815260206004820152602360248201527f5661756c74206973206e6f7420746865206f776e6572206f662074686520746f60448201526235b2b760e91b6064820152608401610aad565b604051632142170760e11b8152306004820152336024820152604481018490526001600160a01b038216906342842e0e90606401600060405180830381600087803b158015612b1057600080fd5b505af1158015612b24573d6000803e3d6000fd5b50506040518592506001600160a01b038716915033907f8c6ca3d9b6a0c7bebfa8490b1b23bd368f29583611fadb449ff9ff56a33d94dd90600090a45050610f076001609755565b6000806000612b7961329f565b91509150610a4284838361337f565b60006001600160e01b03198216630271189760e51b14806109d357506109d38261339b565b61013754600090600160a01b900460ff1615612c435761013554610137546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612c10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c34919061428d565b612c3e919061425d565b905090565b61013554612c3e904761425d565b60fb5460ff1615610f315760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610aad565b610e5281336133d0565b8060a00135421115612d025760405162461bcd60e51b815260206004820152601160248201527f5369676e617475726520657870697265640000000000000000000000000000006044820152606401610aad565b6040805182356020828101919091528301358183015290820135606082810191909152820135608082015260a080830135908201524660c082015260009060e001604051602081830303815290604052805190602001209050600081604051602001612d9a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051808303601f19018152919052805160209091012061013b5490915061010090046001600160a01b0316612e14612dd760c0860186614422565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525086939250506134459050565b6001600160a01b031614610e7a5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964205369676e61747572650000000000000000000000000000006044820152606401610aad565b600260975403612ebc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610aad565b6002609755565b61013754600160a01b900460ff1615612eee5761013754610f07906001600160a01b031683836131e0565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f3b576040519150601f19603f3d011682016040523d82523d6000602084013e612f40565b606091505b5050905080610e7a5760405162461bcd60e51b815260206004820152602560248201527f5061796d656e74206661696c65643a204e617469766520746f6b656e207472616044820152643739b332b960d91b6064820152608401610aad565b6001609755565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610f075760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556130043390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610f075760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6130d3613469565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b038085166024830152831660448201526064810182905261319d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526134bb565b50505050565b6131ab612c51565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131003390565b6040516001600160a01b038316602482015260448101829052610e7a90849063a9059cbb60e01b90606401613151565b600054610100900460ff16610f315760405162461bcd60e51b8152600401610aad90614469565b600054610100900460ff1661325e5760405162461bcd60e51b8152600401610aad90614469565b610f3161358d565b600054610100900460ff1661328d5760405162461bcd60e51b8152600401610aad90614469565b610f316135b4565b610f078282612fa6565b600080600061013454610133546132b4612bad565b6132be9190614211565b6132c89190614211565b9050600061012e60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613320573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613344919061428d565b919491935090915050565b600082600003613360575082613378565b8261336b8386614224565b613375919061423b565b90505b9392505050565b600081600003613390575082613378565b8161336b8486614224565b60006001600160e01b03198216637965db0b60e01b14806109d357506301ffc9a760e01b6001600160e01b03198316146109d3565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610f0757613403816135e7565b61340e8360206135f9565b60405160200161341f9291906144b4565b60408051601f198184030181529082905262461bcd60e51b8252610aad91600401614535565b600080600061345485856137a2565b91509150613461816137e7565b509392505050565b60fb5460ff16610f315760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610aad565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166139319092919063ffffffff16565b805190915015610e7a578080602001905181019061352e9190614548565b610e7a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aad565b600054610100900460ff16612f9f5760405162461bcd60e51b8152600401610aad90614469565b600054610100900460ff166135db5760405162461bcd60e51b8152600401610aad90614469565b60fb805460ff19169055565b60606109d36001600160a01b03831660145b60606000613608836002614224565b613613906002614211565b67ffffffffffffffff81111561362b5761362b613bbc565b6040519080825280601f01601f191660200182016040528015613655576020820181803683370190505b509050600360fc1b816000815181106136705761367061440c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061369f5761369f61440c565b60200101906001600160f81b031916908160001a90535060006136c3846002614224565b6136ce906001614211565b90505b6001811115613753577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061370f5761370f61440c565b1a60f81b8282815181106137255761372561440c565b60200101906001600160f81b031916908160001a90535060049490941c9361374c81614565565b90506136d1565b5083156133785760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610aad565b60008082516041036137d85760208301516040840151606085015160001a6137cc87828585613940565b945094505050506137e0565b506000905060025b9250929050565b60008160048111156137fb576137fb61457c565b036138035750565b60018160048111156138175761381761457c565b036138645760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610aad565b60028160048111156138785761387861457c565b036138c55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610aad565b60038160048111156138d9576138d961457c565b03610e525760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610aad565b60606133758484600085613a04565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561397757506000905060036139fb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156139cb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166139f4576000600192509250506139fb565b9150600090505b94509492505050565b606082471015613a655760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610aad565b600080866001600160a01b03168587604051613a819190614592565b60006040518083038185875af1925050503d8060008114613abe576040519150601f19603f3d011682016040523d82523d6000602084013e613ac3565b606091505b5091509150613ad487838387613adf565b979650505050505050565b60608315613b4e578251600003613b47576001600160a01b0385163b613b475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aad565b5081610a42565b610a428383815115613b635781518083602001fd5b8060405162461bcd60e51b8152600401610aad9190614535565b600060208284031215613b8f57600080fd5b81356001600160e01b03198116811461337857600080fd5b6001600160a01b0381168114610e5257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613bfb57613bfb613bbc565b604052919050565b600082601f830112613c1457600080fd5b813567ffffffffffffffff811115613c2e57613c2e613bbc565b613c41601f8201601f1916602001613bd2565b818152846020838601011115613c5657600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613c8957600080fd5b8435613c9481613ba7565b93506020850135613ca481613ba7565b925060408501359150606085013567ffffffffffffffff811115613cc757600080fd5b613cd387828801613c03565b91505092959194509250565b600060e08284031215613cf157600080fd5b50919050565b600060208284031215613d0957600080fd5b813567ffffffffffffffff811115613d2057600080fd5b610a4284828501613cdf565b600060208284031215613d3e57600080fd5b5035919050565b600060208284031215613d5757600080fd5b813561337881613ba7565b60008060408385031215613d7557600080fd5b823591506020830135613d8781613ba7565b809150509250929050565b600080600060608486031215613da757600080fd5b8335613db281613ba7565b92506020840135613dc281613ba7565b929592945050506040919091013590565b60008060008060808587031215613de957600080fd5b843567ffffffffffffffff80821115613e0157600080fd5b613e0d88838901613cdf565b955060208701359150613e1f82613ba7565b9093506040860135925060608601359080821115613e3c57600080fd5b50613cd387828801613c03565b60008083601f840112613e5b57600080fd5b50813567ffffffffffffffff811115613e7357600080fd5b6020830191508360208285010111156137e057600080fd5b60008060008060008060808789031215613ea457600080fd5b863567ffffffffffffffff80821115613ebc57600080fd5b613ec88a838b01613cdf565b97506020890135915080821115613ede57600080fd5b613eea8a838b01613e49565b9097509550604089013594506060890135915080821115613f0a57600080fd5b50613f1789828a01613e49565b979a9699509497509295939492505050565b60008060408385031215613f3c57600080fd5b50508035926020909101359150565b60008060408385031215613f5e57600080fd5b8235613f6981613ba7565b946020939093013593505050565b600080600060608486031215613f8c57600080fd5b8335613f9781613ba7565b95602085013595506040909401359392505050565b8015158114610e5257600080fd5b6000806000806000806000806000806101408b8d031215613fda57600080fd5b8a35613fe581613ba7565b995060208b0135613ff581613ba7565b985060408b013561400581613ba7565b975060608b013561401581613ba7565b965060808b013561402581613ba7565b955060a08b0135945060c08b0135935060e08b013592506101008b013561404b81613fac565b91506101208b013561405c81613ba7565b809150509295989b9194979a5092959850565b600082601f83011261408057600080fd5b8135602067ffffffffffffffff82111561409c5761409c613bbc565b8160051b6140ab828201613bd2565b92835284810182019282810190878511156140c557600080fd5b83870192505b84831015613ad4578235825291830191908301906140cb565b600080600080600060a086880312156140fc57600080fd5b853561410781613ba7565b9450602086013561411781613ba7565b9350604086013567ffffffffffffffff8082111561413457600080fd5b61414089838a0161406f565b9450606088013591508082111561415657600080fd5b61416289838a0161406f565b9350608088013591508082111561417857600080fd5b5061418588828901613c03565b9150509295509295909350565b600080600080600060a086880312156141aa57600080fd5b85356141b581613ba7565b945060208601356141c581613ba7565b93506040860135925060608601359150608086013567ffffffffffffffff8111156141ef57600080fd5b61418588828901613c03565b634e487b7160e01b600052601160045260246000fd5b808201808211156109d3576109d36141fb565b80820281158282048414176109d3576109d36141fb565b60008261425857634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156109d3576109d36141fb565b838152608081016040846020840137826060830152949350505050565b60006020828403121561429f57600080fd5b5051919050565b60005b838110156142c15781810151838201526020016142a9565b50506000910152565b600081518084526142e28160208601602086016142a6565b601f01601f19169290920160200192915050565b86815260408660208301378460608201526001600160a01b03841660808201528260a082015260e060c0820152600061433260e08301846142ca565b98975050505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b888152604088602083013786606082015260e06080820152600061438f60e08301878961433e565b8560a084015282810360c08401526143a881858761433e565b9b9a5050505050505050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613ad460a08301846142ca565b60006020828403121561440157600080fd5b815161337881613ba7565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261443957600080fd5b83018035915067ffffffffffffffff82111561445457600080fd5b6020019150368190038213156137e057600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516144ec8160178501602088016142a6565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516145298160288401602088016142a6565b01602801949350505050565b60208152600061337860208301846142ca565b60006020828403121561455a57600080fd5b815161337881613fac565b600081614574576145746141fb565b506000190190565b634e487b7160e01b600052602160045260246000fd5b600082516145a48184602087016142a6565b919091019291505056fe321163fcbab3bac890d4fb1f03b22c5c6bd95bc472ee55584937974a1db03356a26469706673582212209e18c4780fcae88e4e7e17b3c08bda91a05f2da8b9a7667d891cacf4ee40055b64736f6c63430008130033

Deployed Bytecode

0x6080604052600436106103295760003560e01c8063843592d3116101a5578063b5a68b81116100ec578063d23f9a9a11610095578063e8c5c6d31161006f578063e8c5c6d31461093c578063ec8e83c01461095c578063f23a6e611461097c578063f61e0268146109a857600080fd5b8063d23f9a9a146108da578063d547741f146108fc578063e895e1171461091c57600080fd5b8063bfe0c27e116100c6578063bfe0c27e14610866578063c7e01ad614610885578063c9d375f4146108a557600080fd5b8063b5a68b8114610806578063b6b55f2514610827578063bc197c811461083a57600080fd5b806391d148541161014e578063a2fb342d11610128578063a2fb342d1461079f578063a6617e78146107bf578063a930daf4146107d257600080fd5b806391d14854146107295780639a0bf1481461076f578063a217fddf1461078a57600080fd5b806388b122e71161017f57806388b122e7146106d25780638d676a92146106e9578063904af1951461070957600080fd5b8063843592d31461067d5780638456cb591461069d57806387acb02c146106b257600080fd5b806345e1aa3c11610274578063643840f21161021d5780637ac0d155116101f75780637ac0d155146105e15780637bc565581461060f5780637d8d18461461062f578063823cbb091461064457600080fd5b8063643840f2146105975780636c66cee2146105aa5780636d54294b146105ca57600080fd5b8063590c5ef31161024e578063590c5ef31461053f5780635c975abb1461055f5780635ef6a3bc1461057757600080fd5b806345e1aa3c146104dd57806346fe120e146104fd578063555f90c41461051f57600080fd5b80632b09dd0f116102d657806336568abe116102b057806336568abe146104885780633f4ba83a146104a8578063404da783146104bd57600080fd5b80632b09dd0f146104285780632e1a7d4d146104485780632f2ff15d1461046857600080fd5b8063150b7a0211610307578063150b7a021461039d578063156b2d89146103d6578063248a9ca3146103f857600080fd5b806301ffc9a71461032e578063037d69f5146103635780630bdb92c014610388575b600080fd5b34801561033a57600080fd5b5061034e610349366004613b7d565b6109c8565b60405190151581526020015b60405180910390f35b34801561036f57600080fd5b5061037a6101325481565b60405190815260200161035a565b34801561039457600080fd5b5061037a6109d9565b3480156103a957600080fd5b506103bd6103b8366004613c73565b610a39565b6040516001600160e01b0319909116815260200161035a565b3480156103e257600080fd5b506103f66103f1366004613cf7565b610a4a565b005b34801561040457600080fd5b5061037a610413366004613d2c565b60009081526065602052604090206001015490565b34801561043457600080fd5b506103f6610443366004613d45565b610b9a565b34801561045457600080fd5b506103f6610463366004613d2c565b610c64565b34801561047457600080fd5b506103f6610483366004613d62565b610e55565b34801561049457600080fd5b506103f66104a3366004613d62565b610e7f565b3480156104b457600080fd5b506103f6610f0b565b3480156104c957600080fd5b506103f66104d8366004613d2c565b610f33565b3480156104e957600080fd5b506103f66104f8366004613d92565b610ffa565b34801561050957600080fd5b5061037a6000805160206145af83398151915281565b34801561052b57600080fd5b506103f661053a366004613dd3565b6111a0565b34801561054b57600080fd5b506103f661055a366004613d45565b6112f4565b34801561056b57600080fd5b5060fb5460ff1661034e565b34801561058357600080fd5b506103f6610592366004613e8b565b6113b6565b6103f66105a5366004613f29565b611510565b3480156105b657600080fd5b506103f66105c5366004613d2c565b611699565b3480156105d657600080fd5b5061037a6101315481565b3480156105ed57600080fd5b5061037a6105fc366004613d45565b61013a6020526000908152604090205481565b34801561061b57600080fd5b506103f661062a366004613f29565b6116e8565b34801561063b57600080fd5b506103f6611797565b34801561065057600080fd5b5061012d54610665906001600160a01b031681565b6040516001600160a01b03909116815260200161035a565b34801561068957600080fd5b5061037a610698366004613d45565b611804565b3480156106a957600080fd5b506103f66118b4565b3480156106be57600080fd5b506103f66106cd366004613f4b565b6118cf565b3480156106de57600080fd5b5061037a6101395481565b3480156106f557600080fd5b506103f6610704366004613f77565b611a6d565b34801561071557600080fd5b506103f6610724366004613fba565b611c6e565b34801561073557600080fd5b5061034e610744366004613d62565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561077b57600080fd5b5061013b5461034e9060ff1681565b34801561079657600080fd5b5061037a600081565b3480156107ab57600080fd5b506103f66107ba366004613f4b565b61226e565b6103f66107cd366004613f29565b6123b8565b3480156107de57600080fd5b5061037a7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd81565b34801561081257600080fd5b5061013654610665906001600160a01b031681565b6103f6610835366004613d2c565b6124f7565b34801561084657600080fd5b506103bd6108553660046140e4565b63bc197c8160e01b95945050505050565b34801561087257600080fd5b50610136546001600160a01b0316610665565b34801561089157600080fd5b506103f66108a0366004613d2c565b6127e9565b3480156108b157600080fd5b506108ba6128af565b60408051948552602085019390935291830152606082015260800161035a565b3480156108e657600080fd5b506101375461034e90600160a01b900460ff1681565b34801561090857600080fd5b506103f6610917366004613d62565b6128d7565b34801561092857600080fd5b506103f6610937366004613d2c565b6128fc565b34801561094857600080fd5b5061037a610957366004613d2c565b612961565b34801561096857600080fd5b506103f6610977366004613f4b565b61297d565b34801561098857600080fd5b506103bd610997366004614192565b63f23a6e6160e01b95945050505050565b3480156109b457600080fd5b5061037a6109c3366004613d2c565b612b6c565b60006109d382612b88565b92915050565b6000806127106101315461013454610133546109f59190614211565b6109ff9190614224565b610a09919061423b565b90506000610a15612bad565b905081811115610a3057610a29828261425d565b9250505090565b60009250505090565b630a85bd0160e11b5b949350505050565b61013b5460ff16610ab65760405162461bcd60e51b815260206004820152602b60248201527f4175746f206c69717569646174696f6e2069732064697361626c656420666f7260448201526a081d1a1a5cc81d985d5b1d60aa1b60648201526084015b60405180910390fd5b610abe612c51565b6000805160206145af833981519152610ad681612ca4565b610adf82612cae565b6000610af160a0840160808501613d45565b6040516323c4b44960e01b81529091506001600160a01b038216906323c4b44990610b2c908635906020880190606089013590600401614270565b600060405180830381600087803b158015610b4657600080fd5b505af1158015610b5a573d6000803e3d6000fd5b505060405160008152853592507f1bc13c64b284b03bd27bb0a4ce4d00d1d6892b4e10344c01bfcbe79396651bc1915060200160405180910390a2505050565b6000610ba581612ca4565b6001600160a01b03821615801590610bcc5750610138546001600160a01b03838116911614155b610c185760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420666163746f727920616464726573730000000000000000006044820152606401610aad565b61013880546001600160a01b0319166001600160a01b0384169081179091556040517fe62d9ecc2f46536d69df8cf1ba196250488dc869eadabc42466d72ee898716ce90600090a25050565b610c6c612e6a565b610c74612c51565b60008111610cc45760405162461bcd60e51b815260206004820152601960248201527f4e6f6e2d706f73697469766520746f6b656e20616d6f756e74000000000000006044820152606401610aad565b33600090815261013a60205260409020544211610d235760405162461bcd60e51b815260206004820152601160248201527f5769746864726177616c206c6f636b65640000000000000000000000000000006044820152606401610aad565b6000610d2e33611804565b905080821115610d905760405162461bcd60e51b815260206004820152602760248201527f4e6f7420656e6f756768206163746976652062616c616e636520696e204379616044820152661b8815985d5b1d60ca1b6064820152608401610aad565b6000610d9b83612b6c565b61012e54604051632770a7eb60e21b8152336004820152602481018690529192506001600160a01b031690639dc29fac90604401600060405180830381600087803b158015610de957600080fd5b505af1158015610dfd573d6000803e3d6000fd5b50505050610e0b3382612ec3565b604080518281526020810185905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a25050610e526001609755565b50565b600082815260656020526040902060010154610e7081612ca4565b610e7a8383612fa6565b505050565b6001600160a01b0381163314610efd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610aad565b610f078282613048565b5050565b610f13612e6a565b6000610f1e81612ca4565b610f266130cb565b50610f316001609755565b565b6000610f3e81612ca4565b612710821115610fb65760405162461bcd60e51b815260206004820152603a60248201527f5361666574792066756e642070657263656e74206d757374206265206571756160448201527f6c206f72206c657373207468616e203130302070657263656e740000000000006064820152608401610aad565b6101315460408051918252602082018490527feeeb5af1c3ceeab4fb8414a031926b58ba0e9b17d71c2ade80057757e6cb0260910160405180910390a15061013155565b611002612e6a565b6000805160206145af83398151915261101a81612ca4565b610136546001600160a01b03908116908516036110795760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f742077697468647261772063757272656e637920746f6b656e00006044820152606401610aad565b604051636eb1769f60e11b81526001600160a01b0384811660048301523060248301528591849183169063dd62ed3e90604401602060405180830381865afa1580156110c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ed919061428d565b101561113b5760405162461bcd60e51b815260206004820152601a60248201527f455243323020616c6c6f77616e6365206e6f7420656e6f7567680000000000006044820152606401610aad565b6111506001600160a01b03821685338661311d565b60408051338152602081018590526001600160a01b038716917fa14466d832b5a1ff01be72c58e51196498a8e10751ab9c227fe73c4730dedc41910160405180910390a25050610e7a6001609755565b61013b5460ff166112075760405162461bcd60e51b815260206004820152602b60248201527f4175746f206c69717569646174696f6e2069732064697361626c656420666f7260448201526a081d1a1a5cc81d985d5b1d60aa1b6064820152608401610aad565b61120f612c51565b6000805160206145af83398151915261122781612ca4565b61123085612cae565b600061124260a0870160808801613d45565b604051630d2a47a760e41b81529091506001600160a01b0382169063d2a47a70906112839089359060208b019060608c0135908b908b908b906004016142f6565b600060405180830381600087803b15801561129d57600080fd5b505af11580156112b1573d6000803e3d6000fd5b505060405160028152883592507f1bc13c64b284b03bd27bb0a4ce4d00d1d6892b4e10344c01bfcbe79396651bc1915060200160405180910390a2505050505050565b60006112ff81612ca4565b6001600160a01b0382166113555760405162461bcd60e51b815260206004820152601660248201527f496e76616c6964207369676e65722061646472657373000000000000000000006044820152606401610aad565b61013b805474ffffffffffffffffffffffffffffffffffffffff0019166101006001600160a01b038516908102919091179091556040517fb600274ef5d11bda880beece19f867f60804daa64e9abecaf8f54ba2d2a73c1190600090a25050565b61013b5460ff1661141d5760405162461bcd60e51b815260206004820152602b60248201527f4175746f206c69717569646174696f6e2069732064697361626c656420666f7260448201526a081d1a1a5cc81d985d5b1d60aa1b6064820152608401610aad565b611425612c51565b6000805160206145af83398151915261143d81612ca4565b61144687612cae565b600061145860a0890160808a01613d45565b604051634f0815c160e11b81529091506001600160a01b03821690639e102b829061149d908b359060208d019060608e0135908d908d908d908d908d90600401614367565b600060405180830381600087803b1580156114b757600080fd5b505af11580156114cb573d6000803e3d6000fd5b5050604051600181528a3592507f1bc13c64b284b03bd27bb0a4ce4d00d1d6892b4e10344c01bfcbe79396651bc1915060200160405180910390a25050505050505050565b611518612e6a565b7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd61154281612ca4565b61013754600160a01b900460ff161561159f57341561159a5760405162461bcd60e51b815260206004820152601460248201527315dc9bdb99c81d1c985b99995c88185b5bdd5b9d60621b6044820152606401610aad565b6115ee565b6115a98284614211565b34146115ee5760405162461bcd60e51b815260206004820152601460248201527315dc9bdb99c81d1c985b99995c88185b5bdd5b9d60621b6044820152606401610aad565b61013754600160a01b900460ff16156116255761162533306116108587614211565b610137546001600160a01b031692919061311d565b82610133541061164d57826101336000828254611642919061425d565b909155506116549050565b6000610133555b60408051848152602081018490527f5850d758e6151f474c145f4f59e8cb315c3f1a9fe82d96dff5bd2d48b5a76f9b91015b60405180910390a150610f076001609755565b60006116a481612ca4565b6101395460408051918252602082018490527f4cbae8b98c0d2e56b6aea023eb7a2bd38b351afbefdc5ca1f8b2583f1f781925910160405180910390a15061013955565b6116f0612e6a565b7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd61171a81612ca4565b81610134600082825461172d9190614211565b909155505061013354831161175a5782610133600082825461174f919061425d565b909155506117619050565b6000610133555b60408051848152602081018490527f9b8376ea2c5e9863179edf3c51616d423d51e32eea3ca2e7a02ce8a3d3aa01429101611686565b61179f612e6a565b60006117aa81612ca4565b7ff0b42f9fe97fe866aaeaccc4da4b80df4b1e9d625522db8c2529cdf7f1cd1451610135546040516117de91815260200190565b60405180910390a16117f33361013554612ec3565b50600061013555610f316001609755565b61012e546040516370a0823160e01b81526001600160a01b03838116600483015260009283929116906370a0823190602401602060405180830381865afa158015611853573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611877919061428d565b9050600061188482612b6c565b905060006118906109d9565b90508082116118a25750909392505050565b6118ab81612961565b95945050505050565b6118bc612e6a565b60006118c781612ca4565b610f266131a3565b6118d7612e6a565b6000805160206145af8339815191526118ef81612ca4565b610136546001600160a01b039081169084160361194e5760405162461bcd60e51b815260206004820152601e60248201527f43616e6e6f742077697468647261772063757272656e637920746f6b656e00006044820152606401610aad565b6040516370a0823160e01b8152306004820152839083906001600160a01b038316906370a0823190602401602060405180830381865afa158015611996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ba919061428d565b1015611a085760405162461bcd60e51b815260206004820152601860248201527f45524332302062616c616e6365206e6f7420656e6f75676800000000000000006044820152606401610aad565b611a1c6001600160a01b03821633856131e0565b60408051338152602081018590526001600160a01b038616917fa14466d832b5a1ff01be72c58e51196498a8e10751ab9c227fe73c4730dedc4191015b60405180910390a25050610f076001609755565b611a75612e6a565b611a7d612c51565b6000805160206145af833981519152611a9581612ca4565b6001600160a01b038416611ae35760405162461bcd60e51b81526020600482015260156024820152745a65726f20636f6e7472616374206164647265737360581b6044820152606401610aad565b604051627eeac760e11b815230600482015260248101849052849083906001600160a01b0383169062fdd58e90604401602060405180830381865afa158015611b30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b54919061428d565b1015611ba25760405162461bcd60e51b815260206004820181905260248201527f5661756c7420646f6573206e6f74206861766520656e6f75676820746f6b656e6044820152606401610aad565b60408051602081018252600081529051637921219560e11b81526001600160a01b0383169163f242432a91611be291309133918a918a91906004016143b7565b600060405180830381600087803b158015611bfc57600080fd5b505af1158015611c10573d6000803e3d6000fd5b5050505083856001600160a01b0316336001600160a01b03167f07394b3fad6920c344c25134bb6cf65ee1313a0296830f2043653661beb4136d86604051611c5a91815260200190565b60405180910390a45050610e7a6001609755565b600054600390610100900460ff16158015611c90575060005460ff8083169116105b611d025760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610aad565b6000805461ffff191660ff83161761010017905561012d546001600160a01b0316612151576001600160a01b038b16611d8d5760405162461bcd60e51b815260206004820152602760248201527f4379616e205661756c7420546f6b656e20616464726573732063616e6e6f74206044820152666265207a65726f60c81b6064820152608401610aad565b6001600160a01b038916611df45760405162461bcd60e51b815260206004820152602860248201527f4379616e205061796d656e7420506c616e20616464726573732063616e6e6f74604482015267206265207a65726f60c01b6064820152608401610aad565b6001600160a01b038816611e5a5760405162461bcd60e51b815260206004820152602760248201527f4379616e2053757065722041646d696e20616464726573732063616e6e6f74206044820152666265207a65726f60c81b6064820152608401610aad565b612710861115611ed25760405162461bcd60e51b815260206004820152603a60248201527f5361666574792066756e642070657263656e74206d757374206265206571756160448201527f6c206f72206c657373207468616e203130302070657263656e740000000000006064820152608401610aad565b60c8851115611f495760405162461bcd60e51b815260206004820152603660248201527f53657276696365206665652070657263656e74206d757374206e6f742062652060448201527f67726561746572207468616e20322070657263656e74000000000000000000006064820152608401610aad565b6001600160a01b038716611f9f5760405162461bcd60e51b815260206004820152601e60248201527f466163746f727920616464726573732063616e6e6f74206265207a65726f00006044820152606401610aad565b611fa7613210565b611faf613237565b611fb7613210565b611fbf613266565b61012d80546001600160a01b03808e166001600160a01b0319928316811790935561012e805483169093179092556101368054928d1692909116821790551561203757610137805474ffffffffffffffffffffffffffffffffffffffffff19166001600160a01b038c1617600160a01b179055612046565b610137805460ff60a01b191690555b610131869055610132859055600061013381905561013481905561206a9089613295565b6120947f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd8a613295565b61013880546001600160a01b0319166001600160a01b0389161790556101398490556040518581527f9946eeb5f4ca76305e83426173176fffd327e46ff4ac0e853f1806a8a6accb879060200160405180910390a16040518681527f183d0700d6a3fbe1d9843804c26a1fad21802c73c8976b4945f947600230b2679060200160405180910390a16040516001600160a01b038816907fe62d9ecc2f46536d69df8cf1ba196250488dc869eadabc42466d72ee898716ce90600090a25b6001600160a01b0382166121a75760405162461bcd60e51b815260206004820152601d60248201527f5369676e657220616464726573732063616e6e6f74206265207a65726f0000006044820152606401610aad565b61013b805474ffffffffffffffffffffffffffffffffffffffffff191684151574ffffffffffffffffffffffffffffffffffffffff001916176101006001600160a01b038516908102919091179091556040517fb600274ef5d11bda880beece19f867f60804daa64e9abecaf8f54ba2d2a73c1190600090a26000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050505050505050505050565b612276612e6a565b61227e612c51565b7f507793b6688804c17fc033a24c049858152fd713503d8768de9c67313c5a3afd6122a881612ca4565b6001600160a01b0383166122fe5760405162461bcd60e51b815260206004820152601960248201527f746f20616464726573732063616e6e6f74206265207a65726f000000000000006044820152606401610aad565b60006123086109d9565b90508083111561235a5760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f7567682062616c616e636520696e20746865205661756c74006044820152606401610aad565b82610133600082825461236d9190614211565b9091555061237d90508484612ec3565b836001600160a01b03167f41b123d2493c7b2067b8b7f49cf71532523d83ead11494d793531ece1fd4d04684604051611a5991815260200190565b6123c0612c51565b6000805160206145af8339815191526123d881612ca4565b61013754600160a01b900460ff16156124375734156124325760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b61247f565b82341461247f5760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b61013754600160a01b900460ff16156124ab57610137546124ab906001600160a01b031633308661311d565b61013454604080518581526020810185905280820192909252517f96e6bedbdb3caf466b6cdc33efaeacb3e7aabe7a4c7407eb7bbcfbc6bfe61bd79181900360600190a1506101345550565b6124ff612e6a565b612507612c51565b600081116125575760405162461bcd60e51b815260206004820152601b60248201527f4d757374206465706f736974206d6f7265207468616e207a65726f00000000006044820152606401610aad565b61013754600160a01b900460ff16156125b65734156125b15760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b6125fe565b8034146125fe5760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b6044820152606401610aad565b61013754600160a01b900460ff161561262a576101375461262a906001600160a01b031633308461311d565b61013854604051635035507560e11b81523360048201526000916001600160a01b03169063a06aa0ea906024016020604051808303816000875af1158015612676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269a91906143ef565b9050600061271061013254846126b09190614224565b6126ba919061423b565b905060006126c8828561425d565b90506000806126d561329f565b909250905060006126f0846126ea898661425d565b8461334f565b90508461013560008282546127059190614211565b909155505061012e546040516340c10f1960e01b81526001600160a01b03888116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561275957600080fd5b505af115801561276d573d6000803e3d6000fd5b5050505061013954426127809190614211565b6001600160a01b038716600090815261013a602090815260409182902092909255805186815291820183905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15910160405180910390a2505050505050610e526001609755565b60006127f481612ca4565b60c882111561286b5760405162461bcd60e51b815260206004820152603660248201527f53657276696365206665652070657263656e74206d757374206e6f742062652060448201527f67726561746572207468616e20322070657263656e74000000000000000000006064820152608401610aad565b6101325460408051918252602082018490527f67ea558a1975802c885d7e38bc96ea4f925e1d5d86c8f53ad1a8387906297a90910160405180910390a15061013255565b6000806000806128bd612bad565b610133546101345461013554935093509350935090919293565b6000828152606560205260409020600101546128f281612ca4565b610e7a8383613048565b612904612c51565b6000805160206145af83398151915261291c81612ca4565b610134546040805184815260208101929092527f7225a18e2ba86dcc138ac0b9f071bb3b96001da5a09fd2633472545f7eeec4c0910160405180910390a15061013455565b600080600061296e61329f565b91509150610a4284838361334f565b612985612e6a565b61298d612c51565b6000805160206145af8339815191526129a581612ca4565b6001600160a01b0383166129f35760405162461bcd60e51b81526020600482015260156024820152745a65726f20636f6e7472616374206164647265737360581b6044820152606401610aad565b6040516331a9108f60e11b815260048101839052839030906001600160a01b03831690636352211e90602401602060405180830381865afa158015612a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a6091906143ef565b6001600160a01b031614612ac25760405162461bcd60e51b815260206004820152602360248201527f5661756c74206973206e6f7420746865206f776e6572206f662074686520746f60448201526235b2b760e91b6064820152608401610aad565b604051632142170760e11b8152306004820152336024820152604481018490526001600160a01b038216906342842e0e90606401600060405180830381600087803b158015612b1057600080fd5b505af1158015612b24573d6000803e3d6000fd5b50506040518592506001600160a01b038716915033907f8c6ca3d9b6a0c7bebfa8490b1b23bd368f29583611fadb449ff9ff56a33d94dd90600090a45050610f076001609755565b6000806000612b7961329f565b91509150610a4284838361337f565b60006001600160e01b03198216630271189760e51b14806109d357506109d38261339b565b61013754600090600160a01b900460ff1615612c435761013554610137546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612c10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c34919061428d565b612c3e919061425d565b905090565b61013554612c3e904761425d565b60fb5460ff1615610f315760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610aad565b610e5281336133d0565b8060a00135421115612d025760405162461bcd60e51b815260206004820152601160248201527f5369676e617475726520657870697265640000000000000000000000000000006044820152606401610aad565b6040805182356020828101919091528301358183015290820135606082810191909152820135608082015260a080830135908201524660c082015260009060e001604051602081830303815290604052805190602001209050600081604051602001612d9a91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60408051808303601f19018152919052805160209091012061013b5490915061010090046001600160a01b0316612e14612dd760c0860186614422565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525086939250506134459050565b6001600160a01b031614610e7a5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964205369676e61747572650000000000000000000000000000006044820152606401610aad565b600260975403612ebc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610aad565b6002609755565b61013754600160a01b900460ff1615612eee5761013754610f07906001600160a01b031683836131e0565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f3b576040519150601f19603f3d011682016040523d82523d6000602084013e612f40565b606091505b5050905080610e7a5760405162461bcd60e51b815260206004820152602560248201527f5061796d656e74206661696c65643a204e617469766520746f6b656e207472616044820152643739b332b960d91b6064820152608401610aad565b6001609755565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610f075760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556130043390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610f075760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6130d3613469565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040516001600160a01b038085166024830152831660448201526064810182905261319d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526134bb565b50505050565b6131ab612c51565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131003390565b6040516001600160a01b038316602482015260448101829052610e7a90849063a9059cbb60e01b90606401613151565b600054610100900460ff16610f315760405162461bcd60e51b8152600401610aad90614469565b600054610100900460ff1661325e5760405162461bcd60e51b8152600401610aad90614469565b610f3161358d565b600054610100900460ff1661328d5760405162461bcd60e51b8152600401610aad90614469565b610f316135b4565b610f078282612fa6565b600080600061013454610133546132b4612bad565b6132be9190614211565b6132c89190614211565b9050600061012e60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613320573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613344919061428d565b919491935090915050565b600082600003613360575082613378565b8261336b8386614224565b613375919061423b565b90505b9392505050565b600081600003613390575082613378565b8161336b8486614224565b60006001600160e01b03198216637965db0b60e01b14806109d357506301ffc9a760e01b6001600160e01b03198316146109d3565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610f0757613403816135e7565b61340e8360206135f9565b60405160200161341f9291906144b4565b60408051601f198184030181529082905262461bcd60e51b8252610aad91600401614535565b600080600061345485856137a2565b91509150613461816137e7565b509392505050565b60fb5460ff16610f315760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610aad565b6000613510826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166139319092919063ffffffff16565b805190915015610e7a578080602001905181019061352e9190614548565b610e7a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aad565b600054610100900460ff16612f9f5760405162461bcd60e51b8152600401610aad90614469565b600054610100900460ff166135db5760405162461bcd60e51b8152600401610aad90614469565b60fb805460ff19169055565b60606109d36001600160a01b03831660145b60606000613608836002614224565b613613906002614211565b67ffffffffffffffff81111561362b5761362b613bbc565b6040519080825280601f01601f191660200182016040528015613655576020820181803683370190505b509050600360fc1b816000815181106136705761367061440c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061369f5761369f61440c565b60200101906001600160f81b031916908160001a90535060006136c3846002614224565b6136ce906001614211565b90505b6001811115613753577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061370f5761370f61440c565b1a60f81b8282815181106137255761372561440c565b60200101906001600160f81b031916908160001a90535060049490941c9361374c81614565565b90506136d1565b5083156133785760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610aad565b60008082516041036137d85760208301516040840151606085015160001a6137cc87828585613940565b945094505050506137e0565b506000905060025b9250929050565b60008160048111156137fb576137fb61457c565b036138035750565b60018160048111156138175761381761457c565b036138645760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610aad565b60028160048111156138785761387861457c565b036138c55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610aad565b60038160048111156138d9576138d961457c565b03610e525760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610aad565b60606133758484600085613a04565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561397757506000905060036139fb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156139cb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166139f4576000600192509250506139fb565b9150600090505b94509492505050565b606082471015613a655760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610aad565b600080866001600160a01b03168587604051613a819190614592565b60006040518083038185875af1925050503d8060008114613abe576040519150601f19603f3d011682016040523d82523d6000602084013e613ac3565b606091505b5091509150613ad487838387613adf565b979650505050505050565b60608315613b4e578251600003613b47576001600160a01b0385163b613b475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aad565b5081610a42565b610a428383815115613b635781518083602001fd5b8060405162461bcd60e51b8152600401610aad9190614535565b600060208284031215613b8f57600080fd5b81356001600160e01b03198116811461337857600080fd5b6001600160a01b0381168114610e5257600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613bfb57613bfb613bbc565b604052919050565b600082601f830112613c1457600080fd5b813567ffffffffffffffff811115613c2e57613c2e613bbc565b613c41601f8201601f1916602001613bd2565b818152846020838601011115613c5657600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215613c8957600080fd5b8435613c9481613ba7565b93506020850135613ca481613ba7565b925060408501359150606085013567ffffffffffffffff811115613cc757600080fd5b613cd387828801613c03565b91505092959194509250565b600060e08284031215613cf157600080fd5b50919050565b600060208284031215613d0957600080fd5b813567ffffffffffffffff811115613d2057600080fd5b610a4284828501613cdf565b600060208284031215613d3e57600080fd5b5035919050565b600060208284031215613d5757600080fd5b813561337881613ba7565b60008060408385031215613d7557600080fd5b823591506020830135613d8781613ba7565b809150509250929050565b600080600060608486031215613da757600080fd5b8335613db281613ba7565b92506020840135613dc281613ba7565b929592945050506040919091013590565b60008060008060808587031215613de957600080fd5b843567ffffffffffffffff80821115613e0157600080fd5b613e0d88838901613cdf565b955060208701359150613e1f82613ba7565b9093506040860135925060608601359080821115613e3c57600080fd5b50613cd387828801613c03565b60008083601f840112613e5b57600080fd5b50813567ffffffffffffffff811115613e7357600080fd5b6020830191508360208285010111156137e057600080fd5b60008060008060008060808789031215613ea457600080fd5b863567ffffffffffffffff80821115613ebc57600080fd5b613ec88a838b01613cdf565b97506020890135915080821115613ede57600080fd5b613eea8a838b01613e49565b9097509550604089013594506060890135915080821115613f0a57600080fd5b50613f1789828a01613e49565b979a9699509497509295939492505050565b60008060408385031215613f3c57600080fd5b50508035926020909101359150565b60008060408385031215613f5e57600080fd5b8235613f6981613ba7565b946020939093013593505050565b600080600060608486031215613f8c57600080fd5b8335613f9781613ba7565b95602085013595506040909401359392505050565b8015158114610e5257600080fd5b6000806000806000806000806000806101408b8d031215613fda57600080fd5b8a35613fe581613ba7565b995060208b0135613ff581613ba7565b985060408b013561400581613ba7565b975060608b013561401581613ba7565b965060808b013561402581613ba7565b955060a08b0135945060c08b0135935060e08b013592506101008b013561404b81613fac565b91506101208b013561405c81613ba7565b809150509295989b9194979a5092959850565b600082601f83011261408057600080fd5b8135602067ffffffffffffffff82111561409c5761409c613bbc565b8160051b6140ab828201613bd2565b92835284810182019282810190878511156140c557600080fd5b83870192505b84831015613ad4578235825291830191908301906140cb565b600080600080600060a086880312156140fc57600080fd5b853561410781613ba7565b9450602086013561411781613ba7565b9350604086013567ffffffffffffffff8082111561413457600080fd5b61414089838a0161406f565b9450606088013591508082111561415657600080fd5b61416289838a0161406f565b9350608088013591508082111561417857600080fd5b5061418588828901613c03565b9150509295509295909350565b600080600080600060a086880312156141aa57600080fd5b85356141b581613ba7565b945060208601356141c581613ba7565b93506040860135925060608601359150608086013567ffffffffffffffff8111156141ef57600080fd5b61418588828901613c03565b634e487b7160e01b600052601160045260246000fd5b808201808211156109d3576109d36141fb565b80820281158282048414176109d3576109d36141fb565b60008261425857634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156109d3576109d36141fb565b838152608081016040846020840137826060830152949350505050565b60006020828403121561429f57600080fd5b5051919050565b60005b838110156142c15781810151838201526020016142a9565b50506000910152565b600081518084526142e28160208601602086016142a6565b601f01601f19169290920160200192915050565b86815260408660208301378460608201526001600160a01b03841660808201528260a082015260e060c0820152600061433260e08301846142ca565b98975050505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b888152604088602083013786606082015260e06080820152600061438f60e08301878961433e565b8560a084015282810360c08401526143a881858761433e565b9b9a5050505050505050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613ad460a08301846142ca565b60006020828403121561440157600080fd5b815161337881613ba7565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811261443957600080fd5b83018035915067ffffffffffffffff82111561445457600080fd5b6020019150368190038213156137e057600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516144ec8160178501602088016142a6565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516145298160288401602088016142a6565b01602801949350505050565b60208152600061337860208301846142ca565b60006020828403121561455a57600080fd5b815161337881613fac565b600081614574576145746141fb565b506000190190565b634e487b7160e01b600052602160045260246000fd5b600082516145a48184602087016142a6565b919091019291505056fe321163fcbab3bac890d4fb1f03b22c5c6bd95bc472ee55584937974a1db03356a26469706673582212209e18c4780fcae88e4e7e17b3c08bda91a05f2da8b9a7667d891cacf4ee40055b64736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.