false
true

Contract Address Details

0x4c34eab48475589E8793f544aB9eC077c12059a2

Contract Name
GDCrowdfundHelper
Creator
0x8687d8–47bc82 at 0x31f386–76fb1a
Balance
0.00001
Tokens
Fetching tokens...
Transactions
10 Transactions
Transfers
6 Transfers
Gas Used
3,092,986
Last Balance Update
32234470
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify.
Contract name:
GDCrowdfundHelper




Optimization enabled
true
Compiler version
v0.8.18+commit.87f61d96




Optimization runs
100
EVM Version
default




Verified at
2025-04-03T09:12:54.409692Z

Constructor Arguments

0x00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e80501730000000000000000000000000512f8ee3c2b310238151b8caec8fdab26d044130000000000000000000000000000000000000000000000000000000000000064

Arg [0] (address) : 0x00ab10cc7fc8105ad7ea8bbfa1103bd3e8050173
Arg [1] (address) : 0x0512f8ee3c2b310238151b8caec8fdab26d04413
Arg [2] (uint256) : 100

              

contracts/factory/GDCrowdfundHelper.sol

Sol2uml
new
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./IDOPool.sol";
import "./IDOFactory.sol";
import "./IDOToken.sol";

// Custom errors for better gas efficiency
error InvalidAddress(string message);
error InvalidParameter(string message);
error InvalidDuration(string message);
error InvalidAmount(string message);
error InvalidRatio(string message);

contract GDCrowdfundHelper is Ownable, ReentrancyGuard, Pausable {
    using Address for address;

    // === Constants ===
    uint256 private constant BASIS_POINTS = 10000;           // Base for percentage calculations
    // uint256 private constant FIXED_TOTAL_SUPPLY = 100_000_000_000;  // 100B tokens
    uint256 private constant MAX_SHARE_RATIO = 200;         // Maximum share ratio (2%)
    uint256 private constant DECIMAL_PRECISION = 1e18;      // Standard decimal precision
    uint256 private constant MIN_IDO_ALLOCATION = 2000;     // Minimum IDO allocation (20%)
    uint256 private constant MAX_IDO_ALLOCATION = 8000;     // Maximum IDO allocation (80%)

    // === State Variables ===
    IDOFactory public immutable idoFactory;     // Factory contract for creating IDO pools
    address public rewardWallet;                // Wallet for receiving shared tokens
    uint256 public softCapRatio = 8000;         // 8000 = 80% of hardcap
    bool public enableShare;                    // Toggle for share mechanism
    uint256 public creationFee = 0.005 ether;
    uint256 public rewardFeeRatio = 10000; // 100% by default
    
    // Configurable parameters with default values
    uint256 public minIDODuration = 3 days;    // Minimum IDO duration
    uint256 public maxIDODuration = 15 days;     // Maximum IDO duration
    uint256 public shareRatio = 100;            // Share percentage in basis points (1%)
    uint256 public idoAllocationRatio = 5500;   // IDO allocation in basis points (55%)
    uint256 public lpInterestRate = 100;        // LP ETH percentage (100% of hardcap)
    uint256 public minPersonalRatio = 10;          // Minimum investment ratio(0.1%)
    uint256 public maxPersonalRatio = 10000;        // Maximum investment ratio(10%)

    // === Structs ===
    struct TokenInfo {
        address tokenAddress;     // Token contract address
        uint256 idoAmount;       // Amount of tokens for IDO
    }

    struct IDOParameters {
        uint256 hardCapInETH;      // Maximum ETH to raise
        uint256 tokenPrice;        // Price per token in ETH
        uint256 listingPrice;      // Initial DEX listing price
        uint256 idoTokens;         // Tokens allocated for IDO
        uint256 lpTokens;          // Tokens allocated for liquidity
        IDOPool.Timestamps timestamps;  // IDO timeline
        address lockerFactory;     // Factory for LP token locking
        string metadataURL;        // IPFS hash for project metadata
    }

    // IDO creation info structure
    struct IDOCreationInfo {
        // base info
        address creator;           // creator address
        uint256 fee;              // fee
        uint256 creationTime;     // creation time
        uint256 storedFeeRatio;   // fee ratio
        bool feeReturned;         // fee returned
        
        // IDO config info
        uint256 hardCapInETH;     // hard cap
        bool userEnableShare;     // user enable share
        uint256 idoTokenAmount;   // IDO token amount
        uint256 lpTokenAmount;    // LP token amount
        uint256 shareAmount;      // Share token amount
        uint256 tokenPrice;       // token price
        uint256 listingPrice;     // listing price
        
        // DEX info
        address router;           // DEX router address
        address factory;          // DEX factory address
        address weth;            // WETH address
        
        // timestamps info
        uint256 startTime;        // start time
        uint256 endTime;          // end time
        uint256 unlockTime;       // unlock time
        address idoPoolAddress;   // IDO pool address

        // metadata info
        string metadataURL;        // metadata URL
    }
    
    mapping(address => IDOCreationInfo) public idoCreationInfo;

    // === Events ===
    event TokenCreated(
        address token,      // Address of created token
        string name,        // Token name
        string symbol,      // Token symbol
        uint256 totalSupply,        // Total token supply
        address receiver      // Receiver address
    );
    
    event IDOCreated(
        address indexed token,
        address indexed creator,
        uint256 fee,
        uint256 feeRatio,
        IDOCreationInfo info,
        uint256 timestamp
    );

    event IDOCreatedByHelper(
        address indexed token,      // Token address
        address indexed idoPool,    // IDO pool address
        uint256 shareAmount,       // Share amount
        uint256 timestamp,         // Creation timestamp
        uint256 idoTokenAmount,    // token amount for ido
        uint256 lpTokenAmount      // token amount for lp
    );
    
    event ConfigUpdated(
        string indexed configName,  // Name of updated parameter
        uint256 oldValue,          // Previous value
        uint256 newValue,          // New value
        address indexed operator   // Address that made the update
    );

    event WalletUpdated(
        address indexed oldWallet,  // Previous wallet address
        address indexed newWallet,  // New wallet address
        address indexed operator   // Address that made the update
    );
    
    event EmergencyAction(
        string indexed actionType,  // Type of emergency action
        address indexed initiator, // Address that initiated the action
        uint256 timestamp         // Action timestamp
    );

    event ShareStatusUpdated(
        bool enabled,              // New share status
        address indexed operator  // Address that made the update
    );

    event Calculation(
        uint256 hardCapInETH,
        uint256 hardCapWei,
        uint256 tokenPrice,
        uint256 idoTokenAmount,
        uint256 lpTokenAmount,
        uint256 shareAmount
    );

    event TokenDistribution(
        uint256 totalSupply,
        uint256 idoAllocationRatio,
        uint256 shareRatio,
        uint256 lpInterestRate
    );

    event CreationFeeUpdated(
        uint256 indexed oldFee, 
        uint256 indexed newFee, 
        address indexed operator
    );
    
    event RewardFeeRatioUpdated(
        uint256 indexed oldRatio, 
        uint256 indexed newRatio, 
        address indexed operator
    );
    
    event FeeReturned(
        address indexed token, 
        address indexed creator, 
        uint256 amount,
        uint256 originalFee,
        uint256 appliedRatio
    );

    event IDOActivated(
        address indexed poolAddress,
        address indexed lpToken,
        uint256 timestamp
    );

    address private constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

    /**
     * @dev Modifier to validate address is not zero
     */
    modifier validAddress(address _address) {
        if(_address == address(0)) revert InvalidAddress("Zero address");
        _;
    }

    /**
     * @dev Contract constructor
     * @param _idoFactory Address of IDO factory contract
     * @param _rewardWallet Address to receive shared tokens
     * @param _initialShareRatio Initial share ratio in basis points
     */
    constructor(
        address _idoFactory,
        address _rewardWallet,
        uint256 _initialShareRatio
    ) validAddress(_idoFactory) validAddress(_rewardWallet) {
        if(!_idoFactory.isContract()) revert InvalidAddress("Factory must be contract");
        if(_initialShareRatio > MAX_SHARE_RATIO) revert InvalidRatio("Share ratio too high");

        idoFactory = IDOFactory(_idoFactory);
        rewardWallet = _rewardWallet;
        shareRatio = _initialShareRatio;
    }

    /**
     * @dev Internal function to validate contract address
     * @param addr Address to validate
     * @param errorMsg Error message if validation fails
     */
    function _validateContractAddress(address addr, string memory errorMsg) private view {
        if (addr == address(0)) revert InvalidAddress("Zero address");
        if (!addr.isContract()) revert InvalidAddress(errorMsg);
    }

    /**
     * @dev Public function to get fee information
     * @return feeToken Fee token address
     * @return feeAmount Fee amount
     */
    function getFeeInfo() public view returns (address feeToken, uint256 feeAmount) {
        return (
            address(idoFactory.feeToken()),
            idoFactory.feeAmount()
        );
    }

    /**
     * @dev Create token and launch IDO
     * @param _tokenInfo Token information (name, symbol)
     * @param hardCapInETH Maximum ETH to raise
     * @param _timestamps IDO timeline parameters
     * @param _lockerFactoryAddress Locker factory address
     * @param _metadataURL Project metadata URL
     * @param _dexInfo DEX configuration
     * @param _userEnableShare User enable share
     */
    function createIDO(
        TokenInfo calldata _tokenInfo,
        uint256 hardCapInETH,
        IDOPool.Timestamps calldata _timestamps,
        address _lockerFactoryAddress,
        string calldata _metadataURL,
        IDOPool.DEXInfo calldata _dexInfo,
        bool _userEnableShare
    ) external payable nonReentrant whenNotPaused onlyOwner() {
        // creationFee 
        require(msg.value >= creationFee, "Insufficient creation fee");
        
        // 1. get fee info
        (address _feeToken, uint256 _feeAmount) = getFeeInfo();
        
        if (_feeToken != address(0) && _feeAmount > 0) {
            // validate all related addresses
            require(address(idoFactory) != address(0), "IDOFactory address is zero");
            require(msg.sender != address(0), "Sender address is zero");
            require(address(this) != address(0), "Helper address is zero");
            
            ERC20 feeToken = ERC20(_feeToken);
            
            // check balance and allowance
            require(feeToken.balanceOf(msg.sender) >= _feeAmount, "Insufficient fee token balance");
            require(feeToken.allowance(msg.sender, address(this)) >= _feeAmount, "Insufficient allowance");
            
            // transfer fee token to helper
            bool success = feeToken.transferFrom(msg.sender, address(this), _feeAmount);
            require(success, "Fee token transfer to helper failed");
            
            // check helper balance
            uint256 helperBalance = feeToken.balanceOf(address(this));
            require(helperBalance >= _feeAmount, "Helper insufficient balance after transfer");
            
            // approve fee token to factory
            success = feeToken.approve(address(idoFactory), _feeAmount);
            require(success, "Fee token approval to factory failed");
        }
        
        // 1. Checks (all checks)
        if(hardCapInETH == 0) revert InvalidAmount("Invalid hardcap");
        _validateContractAddress(_lockerFactoryAddress, "Locker must be contract");
        _validateContractAddress(_dexInfo.router, "Router must be contract");
        _validateContractAddress(_dexInfo.factory, "Factory must be contract");
        _validateContractAddress(_dexInfo.weth, "WETH must be contract");
        _validateContractAddress(_tokenInfo.tokenAddress, "Token address invalid");
        
        // set unlockTimestamp = endTimestamp
        IDOPool.Timestamps memory timestamps = IDOPool.Timestamps({
            startTimestamp: _timestamps.startTimestamp,
            endTimestamp: _timestamps.endTimestamp,
            unlockTimestamp: _timestamps.endTimestamp  // 确保 unlockTimestamp = endTimestamp
        });
        
        // validate timestamps
        _validateTimestamps(timestamps);

        // Validate token amount and allowance
        IERC20 idoToken = IERC20(_tokenInfo.tokenAddress);
        require(_tokenInfo.idoAmount > 0, "IDO amount must be greater than 0");
        require(
            idoToken.balanceOf(msg.sender) >= _tokenInfo.idoAmount,
            "Insufficient token balance"
        );
        require(
            idoToken.allowance(msg.sender, address(this)) >= _tokenInfo.idoAmount,
            "Insufficient token allowance"
        );

        // Transfer tokens to helper
        require(
            idoToken.transferFrom(msg.sender, address(this), _tokenInfo.idoAmount),
            "Token transfer to helper failed"
        );

        // Approve tokens to factory
        require(
            idoToken.approve(address(idoFactory), _tokenInfo.idoAmount + _feeAmount),
            "Token approval to factory failed"
        );

        // 2. Effects (state calculation)
        bool finalEnableShare = enableShare && _userEnableShare;
        
        (uint256 tokenPrice, uint256 listingPrice, uint256 idoTokenAmount, uint256 lpTokenAmount, uint256 shareAmount) = 
            _calculateTokenDistributionFromAmount(_tokenInfo.idoAmount, hardCapInETH, finalEnableShare);

        // store creation info
        idoCreationInfo[_tokenInfo.tokenAddress] = IDOCreationInfo({
            creator: msg.sender,
            fee: msg.value,
            creationTime: block.timestamp,
            storedFeeRatio: rewardFeeRatio, // store current reward ratio
            feeReturned: false,
            hardCapInETH: hardCapInETH,
            userEnableShare: _userEnableShare,
            idoTokenAmount: idoTokenAmount,
            lpTokenAmount: lpTokenAmount,
            shareAmount: shareAmount,
            tokenPrice: tokenPrice,
            listingPrice: listingPrice,
            router: _dexInfo.router,
            factory: _dexInfo.factory,
            weth: _dexInfo.weth,
            startTime: timestamps.startTimestamp,
            endTime: timestamps.endTimestamp,
            unlockTime: timestamps.endTimestamp,
            idoPoolAddress: address(0),
            metadataURL: _metadataURL
        });
        
        emit IDOCreated(
            _tokenInfo.tokenAddress,
            msg.sender,
            msg.value,
            rewardFeeRatio,
            idoCreationInfo[_tokenInfo.tokenAddress],
            block.timestamp
        );
        
        // 4. Interactions (external interactions)
        _executeExternalInteractions(
            ERC20(_tokenInfo.tokenAddress),
            shareAmount,
            idoTokenAmount,
            lpTokenAmount,
            hardCapInETH,
            tokenPrice,
            listingPrice,
            timestamps,
            _lockerFactoryAddress,
            _metadataURL,
            _dexInfo
        );
    }

    function _calculateTokenDistributionFromAmount(
        uint256 totalAmount,
        uint256 hardCapInETH,
        bool _enableShare
    ) private returns (
        uint256 tokenPrice,
        uint256 listingPrice,
        uint256 idoTokenAmount,
        uint256 lpTokenAmount,
        uint256 shareAmount
    ) {
        emit TokenDistribution(
            totalAmount,
            idoAllocationRatio,
            shareRatio,
            lpInterestRate
        );
        
        uint256 hardCapWei = hardCapInETH * DECIMAL_PRECISION;
        
        unchecked {
            // 1. compute base amount
            uint256 baseAmount = totalAmount / DECIMAL_PRECISION;
            uint256 baseIdoAmount = (baseAmount * idoAllocationRatio) / BASIS_POINTS;
            uint256 baseShareAmount = _enableShare ? (baseAmount * shareRatio) / BASIS_POINTS : 0;
            uint256 baseLpAmount = baseAmount - baseIdoAmount - baseShareAmount;
            
            // 2. compute token price
            tokenPrice = hardCapWei / baseIdoAmount;
            
            uint256 ethForLP = (hardCapWei * lpInterestRate) / 100;
            listingPrice = ethForLP / baseLpAmount;

            // 3. add precision
            idoTokenAmount = baseIdoAmount * DECIMAL_PRECISION;
            shareAmount = baseShareAmount * DECIMAL_PRECISION;
            lpTokenAmount = baseLpAmount * DECIMAL_PRECISION;

            emit Calculation(
                hardCapInETH,
                hardCapWei,
                tokenPrice,
                idoTokenAmount,
                lpTokenAmount,
                shareAmount
            );
        }
        
        return (tokenPrice, listingPrice, idoTokenAmount, lpTokenAmount, shareAmount);
    }

    // execute external interactions
    function _executeExternalInteractions(
        ERC20 token,
        uint256 shareAmount,
        uint256 idoTokenAmount,
        uint256 lpTokenAmount,
        uint256 hardCapInETH,
        uint256 tokenPrice,
        uint256 listingPrice,
        IDOPool.Timestamps memory timestamps,
        address lockerFactory,
        string memory metadataURL,
        IDOPool.DEXInfo memory dexInfo
    ) private {
        // 1. transfer share token (if enabled)
        if (enableShare && shareAmount > 0) {
            bool shareTransferSuccess = token.transfer(
                rewardWallet, 
                shareAmount
            );
            require(shareTransferSuccess, "Share transfer failed");
        }

        // 2. create IDO pool financial info
        IDOPool.FinInfo memory finInfo = IDOPool.FinInfo({
            hardCap: hardCapInETH * DECIMAL_PRECISION,
            softCap: (hardCapInETH * DECIMAL_PRECISION * softCapRatio) / BASIS_POINTS,
            tokenPrice: tokenPrice,
            lpInterestRate: lpInterestRate,
            listingPrice: listingPrice,
            minEthPayment: hardCapInETH * DECIMAL_PRECISION * minPersonalRatio / BASIS_POINTS,
            maxEthPayment: hardCapInETH * DECIMAL_PRECISION * maxPersonalRatio / BASIS_POINTS
        });

        // 3. use new createIDObyHelper method
        address idoPoolAddress = idoFactory.createIDOByHelper(
            token,
            finInfo,
            timestamps,
            dexInfo,
            lockerFactory,
            metadataURL,
            idoTokenAmount, 
            lpTokenAmount
        );

        // update IDO creation info pool address
        IDOCreationInfo storage info = idoCreationInfo[address(token)];
        info.idoPoolAddress = idoPoolAddress;

        emit IDOCreatedByHelper(
            address(token),
            idoPoolAddress,
            shareAmount,
            block.timestamp,
            idoTokenAmount,
            lpTokenAmount
        );
    }

    /**
     * @dev Validate IDO timestamps
     * @param _timestamps IDO timeline parameters
     */
    function _validateTimestamps(IDOPool.Timestamps memory _timestamps) private view {
        // Start time must be in future
        if(_timestamps.startTimestamp <= block.timestamp) {
            revert InvalidDuration("Start time must be in future");
        }
        
        // End time must be after start time
        if(_timestamps.endTimestamp <= _timestamps.startTimestamp) {
            revert InvalidDuration("End time must be after start");
        }
        
        // Unlock time must be at least the same as end time (ensure they are equal)
        if(_timestamps.unlockTimestamp != _timestamps.endTimestamp) {
            revert InvalidDuration("Unlock time must be same as end time");
        }
        
        // Validate IDO duration
        uint256 duration = _timestamps.endTimestamp - _timestamps.startTimestamp;
        if(duration < minIDODuration) revert InvalidDuration("IDO duration too short");
        if(duration > maxIDODuration) revert InvalidDuration("IDO duration too long");
    }

    /**
     * @dev Update reward wallet address
     * @param _newWallet New wallet address
     */
    function updateRewardWallet(address _newWallet) 
        external 
        onlyOwner 
        validAddress(_newWallet) 
    {
        if(_newWallet == rewardWallet) revert InvalidAddress("Same wallet address");
        
        address oldWallet = rewardWallet;
        rewardWallet = _newWallet;
        
        emit WalletUpdated(
            oldWallet, 
            _newWallet, 
            msg.sender
        );
    }

    /**
     * @dev Update share ratio
     * @param _newRatio New share ratio
     */
    function updateShareRatio(uint256 _newRatio) external onlyOwner {
        if(_newRatio > MAX_SHARE_RATIO) revert InvalidRatio("Share ratio too high");
        
        uint256 oldRatio = shareRatio;
        shareRatio = _newRatio;
        
        emit ConfigUpdated(
            "ShareRatio",
            oldRatio,
            _newRatio,
            msg.sender
        );
    }

    /**
     * @dev Update IDO duration range
     * @param _newMinDuration New minimum duration
     * @param _newMaxDuration New maximum duration
     */
    function updateIDODuration(
        uint256 _newMinDuration,
        uint256 _newMaxDuration
    ) external onlyOwner {
        if(_newMinDuration == 0) revert InvalidDuration("Min duration must be > 0");
        if(_newMaxDuration <= _newMinDuration) revert InvalidDuration("Max must be > min");
        
        uint256 oldMinDuration = minIDODuration;
        uint256 oldMaxDuration = maxIDODuration;
        
        minIDODuration = _newMinDuration;
        maxIDODuration = _newMaxDuration;
        
        emit ConfigUpdated(
            "MinDuration",
            oldMinDuration,
            _newMinDuration,
            msg.sender
        );
        emit ConfigUpdated(
            "MaxDuration",
            oldMaxDuration,
            _newMaxDuration,
            msg.sender
        );
    }

    /**
     * @dev Update LP interest rate
     * @param _newRate New LP interest rate (1-100)
     */
    function updateLPInterestRate(uint256 _newRate) external onlyOwner {
        if(_newRate == 0 || _newRate > 100) revert InvalidRatio("Invalid rate: 1-100");
        
        uint256 oldRate = lpInterestRate;
        lpInterestRate = _newRate;
        
        emit ConfigUpdated(
            "LPInterestRate",
            oldRate,
            _newRate,
            msg.sender
        );
    }

    /**
     * @dev Update IDO allocation ratio
     * @param _newRatio New allocation ratio
     */
    function updateIDOAllocation(uint256 _newRatio) external onlyOwner {
        if(_newRatio < MIN_IDO_ALLOCATION) revert InvalidRatio("Allocation too low");
        if(_newRatio > MAX_IDO_ALLOCATION) revert InvalidRatio("Allocation too high");
        
        uint256 oldRatio = idoAllocationRatio;
        idoAllocationRatio = _newRatio;
        
        emit ConfigUpdated(
            "IdoAllocation",
            oldRatio,
            _newRatio,
            msg.sender
        );
    }

    /**
     * @dev Emergency withdraw
     * @param token Token address, address(0) represents ETH
     */
    function emergencyWithdraw(address token) external onlyOwner {
        if(token == address(0)) {
            uint256 balance = address(this).balance;
            if(balance > 0) {
                (bool success,) = payable(owner()).call{value: balance}("");
                if(!success) revert InvalidParameter("ETH transfer failed");
            }
        } else {
            IERC20 tokenContract = IERC20(token);
            uint256 balance = tokenContract.balanceOf(address(this));
            if(balance > 0) {
                if(!tokenContract.transfer(owner(), balance)) {
                    revert InvalidParameter("Token transfer failed");
                }
            }
        }
        
        emit EmergencyAction(
            "WITHDRAW", 
            msg.sender, 
            block.timestamp
        );
    }

    /**
     * @dev Get all current configurations
     */
    function getConfigurations() external view returns (
        address _rewardWallet,
        uint256 _shareRatio,
        uint256 _idoAllocationRatio,
        uint256 _lpInterestRate,
        uint256 _minIDODuration,
        uint256 _maxIDODuration,
        bool _enableShare,
        uint256 _creationFee,
        uint256 _rewardFeeRatio
    ) {
        return (
            rewardWallet,
            shareRatio,
            idoAllocationRatio,
            lpInterestRate,
            minIDODuration,
            maxIDODuration,
            enableShare,
            creationFee,
            rewardFeeRatio
        );
    }

    /**
     * @dev Receive ETH
     */
    receive() external payable {}

    /**
     * @dev Control function
     * @param _enable Whether to enable share mechanism
     */
    function setEnableShare(bool _enable) external onlyOwner {
        enableShare = _enable;
        emit ShareStatusUpdated(_enable, msg.sender);
    }

    /**
     * @dev Update personal limits
     * @param _newMinRatio New minimum ratio
     * @param _newMaxRatio New maximum ratio
     */
    function updatePersonalLimits(
        uint256 _newMinRatio,
        uint256 _newMaxRatio
    ) external onlyOwner {
        if(_newMinRatio == 0 || _newMinRatio > 10000) revert InvalidRatio("Min ratio must be > 0 and <= 10000");
        if(_newMaxRatio == 0 || _newMaxRatio > 10000) revert InvalidRatio("Max ratio must be > 0 and <= 10000");
        if(_newMinRatio >= _newMaxRatio) revert InvalidRatio("Min ratio must be less than max");
        
        uint256 oldMinRatio = minPersonalRatio;
        uint256 oldMaxRatio = maxPersonalRatio;
        
        minPersonalRatio = _newMinRatio;
        maxPersonalRatio = _newMaxRatio;
        
        emit ConfigUpdated("MinPersonalRatio", oldMinRatio, _newMinRatio, msg.sender);
        emit ConfigUpdated("MaxPersonalRatio", oldMaxRatio, _newMaxRatio, msg.sender);
    }

    /**
     * @dev Activate IDO and handle token distribution
     * @param _poolAddress IDO pool address
     */
    function activateIDO(address _poolAddress) external nonReentrant onlyOwner() {
        _validateContractAddress(_poolAddress, "Pool must be contract");
        IDOPool pool = IDOPool(_poolAddress);
        
        // check owner
        require(
            pool.owner() == address(this),
            "Helper is not the pool owner"
        );
        
        // get unlockTimestamp
        (,, uint256 unlockTimestamp) = pool.timestamps();
        require(
            block.timestamp > unlockTimestamp,
            "Not reached unlock time"
        );
        
        // validate not distributed
        require(!pool.distributed(), "Already distributed");
        
        // 1. withdraw ETH and add liquidity
        pool.withdrawETH();
        
        // 2. get LP token address, ignore router
        (, address factory, address weth) = pool.dexInfo();
        address lpTokenAddress = IUniswapV2Factory(factory).getPair(
            address(pool.rewardToken()),
            weth
        );
        
        // 3. burn LP token - transfer to burn address
        uint256 lpBalance = IERC20(lpTokenAddress).balanceOf(address(this));
        if (lpBalance > 0) {
            require(
                IERC20(lpTokenAddress).transfer(BURN_ADDRESS, lpBalance),
                "LP burn failed"
            );
        }
        
        // 4. burn unsold tokens - use IDOToken's burn method
        uint256 balance = pool.getNotSoldToken();
        if (balance > 0) {
            pool.withdrawNotSoldTokens();
            IDOToken rewardToken = IDOToken(address(pool.rewardToken()));
            uint256 unsoldBalance = rewardToken.balanceOf(address(this));
            if (unsoldBalance > 0) {
                rewardToken.burn(unsoldBalance);
            }
        }
        
        emit IDOActivated(
            _poolAddress,
            lpTokenAddress,
            block.timestamp
        );
        
        // use creation fee ratio to return fee
        // IDOCreationInfo storage info = idoCreationInfo[address(pool.rewardToken())];
        // if (!info.feeReturned && info.fee > 0) {
        //     uint256 rewardAmount = (info.fee * info.storedFeeRatio) / BASIS_POINTS;
        //     if (rewardAmount > 0) {
        //         info.feeReturned = true;
        //         (bool success,) = payable(info.creator).call{value: rewardAmount}("");
        //         require(success, "Fee return failed");
                
        //         emit FeeReturned(
        //             address(pool.rewardToken()),
        //             info.creator,
        //             rewardAmount,
        //             info.fee,
        //             info.storedFeeRatio
        //         );
        //     }
        // }
    }

    /**
     * @dev Update soft cap ratio
     * @param _newRatio New soft cap ratio (in basis points, 1-10000)
     */
    function updateSoftCapRatio(uint256 _newRatio) external onlyOwner {
        if(_newRatio == 0 || _newRatio > BASIS_POINTS) revert InvalidRatio("Invalid ratio: 1-10000");
        
        uint256 oldRatio = softCapRatio;
        softCapRatio = _newRatio;
        
        emit ConfigUpdated(
            "SoftCapRatio",
            oldRatio,
            _newRatio,
            msg.sender
        );
    }

    /**
     * @dev Update creation fee
     * @param _newFee New creation fee in wei
     */
    function updateCreationFee(uint256 _newFee) external onlyOwner {
        require(_newFee > 0, "Creation fee must be greater than zero");
        
        uint256 oldFee = creationFee;
        creationFee = _newFee;
        
        emit CreationFeeUpdated(oldFee, _newFee, msg.sender);
    }

    /**
     * @dev Update reward fee ratio
     * @param _newRatio New reward fee ratio (in basis points)
     */
    function updateRewardFeeRatio(uint256 _newRatio) external onlyOwner {
        require(_newRatio <= 10000, "Reward fee ratio must be <= 100%");
        
        uint256 oldRatio = rewardFeeRatio;
        rewardFeeRatio = _newRatio;
        
        emit RewardFeeRatioUpdated(oldRatio, _newRatio, msg.sender);
    }
}
        

contracts/factory/IDOFactory.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";

import "./IDOPool.sol";

contract IDOFactory is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for ERC20Burnable;
    using SafeERC20 for ERC20;

    ERC20Burnable public feeToken;
    address public feeWallet;
    uint256 public feeAmount;
    uint256 public burnPercent; // use this state only if your token is ERC20Burnable and has burnFrom method
    uint256 public divider;

    address[] public idoPools;

    event IDOCreated(
        address indexed owner,
        address idoPool,
        address indexed rewardToken,
        string tokenURI
    );

    event IDOCreatedByHelper(
        address indexed owner,
        address idoPool,
        address indexed rewardToken,
        string tokenURI,
        uint256 idoTokenAmount,     // IDO token exact amount
        uint256 lpTokenAmount      // LP token exact amount
    );

    event TokenFeeUpdated(address newFeeToken);
    event FeeAmountUpdated(uint256 newFeeAmount);
    event BurnPercentUpdated(uint256 newBurnPercent, uint256 divider);
    event FeeWalletUpdated(address newFeeWallet);

    event IDOPoolInitialized(
        address indexed idoPool,
        address indexed rewardToken,
        IDOPool.FinInfo finInfo,
        IDOPool.Timestamps timestamps,
        IDOPool.DEXInfo dexInfo,
        address lockerFactory,
        string metadataURL
    );

    constructor(
        ERC20Burnable _feeToken,
        uint256 _feeAmount,
        uint256 _burnPercent
    ){
        feeToken = _feeToken;
        feeAmount = _feeAmount;
        burnPercent = _burnPercent;
        divider = 100;
    }

    function getIdoPools() public view returns (address[] memory) {
      return idoPools;
    }

    function setFeeToken(address _newFeeToken) external onlyOwner {
        require(isContract(_newFeeToken), "New address is not a token");
        feeToken = ERC20Burnable(_newFeeToken);

        emit TokenFeeUpdated(_newFeeToken);
    }

    function setFeeAmount(uint256 _newFeeAmount) external onlyOwner {
        feeAmount = _newFeeAmount;

        emit FeeAmountUpdated(_newFeeAmount);
    }

    function setFeeWallet(address _newFeeWallet) external onlyOwner {
        feeWallet = _newFeeWallet;

        emit FeeWalletUpdated(_newFeeWallet);
    }

    function setBurnPercent(uint256 _newBurnPercent, uint256 _newDivider)
        external
        onlyOwner
    {
        require(_newBurnPercent <= _newDivider, "Burn percent must be less than divider");
        burnPercent = _newBurnPercent;
        divider = _newDivider;

        emit BurnPercentUpdated(_newBurnPercent, _newDivider);
    }

    function handleFees() internal {
       if(feeAmount > 0){
            if (burnPercent > 0){
                uint256 burnAmount = feeAmount.mul(burnPercent).div(divider);

                feeToken.safeTransferFrom(
                    msg.sender,
                    feeWallet,
                    feeAmount.sub(burnAmount)
                );

                feeToken.burnFrom(msg.sender, burnAmount);
            } else {
                feeToken.safeTransferFrom(
                    msg.sender,
                    feeWallet,
                    feeAmount
                );
            }
        }
    }

    function createIDO(
        ERC20 _rewardToken,
        IDOPool.FinInfo memory _finInfo,
        IDOPool.Timestamps memory _timestamps,
        IDOPool.DEXInfo memory _dexInfo,
        address _lockerFactoryAddress,
        string memory _metadataURL
    ) external returns (address idoPoolAddress) {
        IDOPool idoPool =
            new IDOPool(
                _rewardToken,
                _finInfo,
                _timestamps,
                _dexInfo,
                _lockerFactoryAddress,
                _metadataURL
            );

        uint8 tokenDecimals = _rewardToken.decimals();

        uint256 transferAmount = getTokenAmount(_finInfo.hardCap, _finInfo.tokenPrice, tokenDecimals);

        if (_finInfo.lpInterestRate > 0 && _finInfo.listingPrice > 0) {
            transferAmount += getTokenAmount(_finInfo.hardCap * _finInfo.lpInterestRate / 100, _finInfo.listingPrice, tokenDecimals);
        }

        idoPool.transferOwnership(msg.sender);

        idoPoolAddress = address(idoPool);
        _rewardToken.safeTransferFrom(
            msg.sender,
            idoPoolAddress,
            transferAmount
        );

        idoPools.push(idoPoolAddress);

        emit IDOCreated(
            msg.sender,
            idoPoolAddress,
            address(_rewardToken),
            _metadataURL
        );

        handleFees();
    }

    function createIDOByHelper(
        ERC20 _rewardToken,
        IDOPool.FinInfo memory _finInfo,
        IDOPool.Timestamps memory _timestamps,
        IDOPool.DEXInfo memory _dexInfo,
        address _lockerFactoryAddress,
        string memory _metadataURL,
        uint256 idoTokenAmount,
        uint256 lpTokenAmount
    ) external returns (address idoPoolAddress) {
        IDOPool idoPool = new IDOPool(
            _rewardToken,
            _finInfo,
            _timestamps,
            _dexInfo,
            _lockerFactoryAddress,
            _metadataURL
        );

        // trigger initialized event
        emit IDOPoolInitialized(
            address(idoPool),
            address(_rewardToken),
            _finInfo,
            _timestamps,
            _dexInfo,
            _lockerFactoryAddress,
            _metadataURL
        );

        // use exact token amount
        uint256 transferAmount = idoTokenAmount + lpTokenAmount;

        // transfer ownership
        idoPool.transferOwnership(msg.sender);
        
        // set pool address
        idoPoolAddress = address(idoPool);

        // transfer token to pool
        _rewardToken.safeTransferFrom(
            msg.sender,
            idoPoolAddress,
            transferAmount
        );

        // record pool address
        idoPools.push(idoPoolAddress);

        // trigger event
        emit IDOCreatedByHelper(
            msg.sender,
            idoPoolAddress,
            address(_rewardToken),
            _metadataURL,
            idoTokenAmount, 
            lpTokenAmount
        );

        handleFees();
    }

    function getTokenAmount(
        uint256 ethAmount,
        uint256 tokenPrice,
        uint8 decimals
    ) internal pure returns (uint256) {
        return (ethAmount / tokenPrice) * (10**decimals);
    }
    function isContract(address _addr) private view returns (bool) {
        uint32 size;
        assembly {
            size := extcodesize(_addr)
        }
        return (size > 0);
    }

}
          

contracts/factory/IDOPool.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import "./IUniswapV2Router02.sol";
import "./IUniswapV2Factory.sol";
import "./TokenLockerFactory.sol";

contract IDOPool is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    struct FinInfo {
        uint256 tokenPrice; // one token in WEI
        uint256 softCap;
        uint256 hardCap;
        uint256 minEthPayment;
        uint256 maxEthPayment;
        uint256 listingPrice; // one token in WEI
        uint256 lpInterestRate;
    }

    struct Timestamps {
        uint256 startTimestamp;
        uint256 endTimestamp;
        uint256 unlockTimestamp;
    }

    struct DEXInfo {
        address router;
        address factory;
        address weth;
    }

    struct UserInfo {
        uint debt;
        uint total;
        uint totalInvestedETH;
    }

    ERC20 public rewardToken;
    uint256 public decimals;
    string public metadataURL;

    FinInfo public finInfo;
    Timestamps public timestamps;
    DEXInfo public dexInfo;

    TokenLockerFactory public lockerFactory;

    uint256 public totalInvestedETH;
    uint256 public tokensForDistribution;
    uint256 public distributedTokens;

    bool public distributed = false;

    mapping(address => UserInfo) public userInfo;

    event TokensDebt(
        address indexed holder,
        uint256 ethAmount,
        uint256 tokenAmount
    );

    event TokensWithdrawn(address indexed holder, uint256 amount);

    // Events for detailed parameter logging
    event AddLiquidityETHParams(
        address token,           // Token address
        uint256 amountToken,     // Token amount
        uint256 amountETH,       // ETH amount
        uint256 amountTokenMin,  // Minimum token amount (slippage protection)
        uint256 amountETHMin,    // Minimum ETH amount (slippage protection)
        address to,              // LP token recipient
        uint256 deadline         // Transaction deadline
    );

    event TokenLockerParams(
        address lpToken,         // LP token address
        string lockerName,       // Locker name
        uint256 amount,          // Amount to lock
        address owner,           // Locker owner
        uint256 unlockTime,      // Unlock timestamp
        uint256 value            // ETH value sent for fee
    );

    event ETHTransferParams(
        address to,              // Recipient address
        uint256 amount,          // Amount to transfer
        bool isLockFee           // Whether it's a lock fee
    );

    // Debug parameters event
    event DebugParams(
        string label,            // Parameter label for identification
        uint256 value1,          // Primary value
        uint256 value2,          // Secondary value
        address addr1,           // Primary address
        address addr2            // Secondary address
    );

    constructor(
        ERC20 _rewardToken,
        FinInfo memory _finInfo,
        Timestamps memory _timestamps,
        DEXInfo memory _dexInfo,
        address _lockerFactoryAddress,
        string memory _metadataURL
    ) {

        rewardToken = _rewardToken;
        decimals = rewardToken.decimals();
        lockerFactory = TokenLockerFactory(_lockerFactoryAddress);

        finInfo = _finInfo;

        setTimestamps(_timestamps);

        dexInfo = _dexInfo;

        setMetadataURL(_metadataURL);
    }

    function setTimestamps(Timestamps memory _timestamps) internal {
        require(
            _timestamps.startTimestamp < _timestamps.endTimestamp,
            "Start timestamp must be less than finish timestamp"
        );
        require(
            _timestamps.endTimestamp > block.timestamp,
            "Finish timestamp must be more than current block"
        );

        timestamps = _timestamps;
    }

    function setMetadataURL(string memory _metadataURL) public{
        metadataURL = _metadataURL;
    }

    function pay() payable external {
        require(block.timestamp >= timestamps.startTimestamp, "Not started");
        require(block.timestamp < timestamps.endTimestamp, "Ended");

        require(msg.value >= finInfo.minEthPayment, "Less then min amount");
        require(msg.value <= finInfo.maxEthPayment, "More then max amount");
        require(totalInvestedETH.add(msg.value) <= finInfo.hardCap, "Overfilled");

        UserInfo storage user = userInfo[msg.sender];
        require(user.totalInvestedETH.add(msg.value) <= finInfo.maxEthPayment, "More then max amount");

        uint256 tokenAmount = getTokenAmount(msg.value, finInfo.tokenPrice);

        totalInvestedETH = totalInvestedETH.add(msg.value);
        tokensForDistribution = tokensForDistribution.add(tokenAmount);
        user.totalInvestedETH = user.totalInvestedETH.add(msg.value);
        user.total = user.total.add(tokenAmount);
        user.debt = user.debt.add(tokenAmount);

        emit TokensDebt(msg.sender, msg.value, tokenAmount);
    }

    function refund() external {
        require(block.timestamp > timestamps.endTimestamp, "The IDO pool has not ended.");
        require(totalInvestedETH < finInfo.softCap, "The IDO pool has reach soft cap.");

        UserInfo storage user = userInfo[msg.sender];

        uint256 _amount = user.totalInvestedETH;
        require(_amount > 0 , "You have no investment.");

        user.debt = 0;
        user.totalInvestedETH = 0;
        user.total = 0;

        (bool success, ) = msg.sender.call{value: _amount}("");
        require(success, "Transfer failed.");

    }

    /// @dev Allows to claim tokens for the specific user.
    /// @param _user Token receiver.
    function claimFor(address _user) external {
        proccessClaim(_user);
    }

    /// @dev Allows to claim tokens for themselves.
    function claim() external {
        proccessClaim(msg.sender);
    }

    /// @dev Proccess the claim.
    /// @param _receiver Token receiver.
    function proccessClaim(
        address _receiver
    ) internal nonReentrant{
        require(block.timestamp > timestamps.endTimestamp, "The IDO pool has not ended.");
        require(totalInvestedETH >= finInfo.softCap, "The IDO pool did not reach soft cap.");

        UserInfo storage user = userInfo[_receiver];

        uint256 _amount = user.debt;
        require(_amount > 0 , "You do not have debt tokens.");

        user.debt = 0;
        distributedTokens = distributedTokens.add(_amount);
        rewardToken.safeTransfer(_receiver, _amount);
        emit TokensWithdrawn(_receiver,_amount);
    }

    // /**
    //  * @dev Debug version of withdrawETH that logs all parameters without actual external calls
    //  * Records exact parameters that would be passed to addLiquidityETH
    //  */
    // function withdrawETHDebug() external payable onlyOwner {
    //     // Check prerequisites
    //     require(block.timestamp > timestamps.endTimestamp, "The IDO pool has not ended.");
    //     require(totalInvestedETH >= finInfo.softCap, "The IDO pool did not reach soft cap.");
    //     require(!distributed, "Already distributed.");

    //     // Record initial state
    //     emit DebugParams(
    //         "Initial State", 
    //         address(this).balance,            // Contract ETH balance
    //         rewardToken.balanceOf(address(this)), // Contract token balance
    //         address(0),
    //         address(0)
    //     );
        
    //     // Record address information
    //     emit DebugParams(
    //         "Contract Addresses",
    //         0,
    //         0,
    //         dexInfo.router,                   // Router address
    //         dexInfo.factory                   // Factory address
    //     );
        
    //     emit DebugParams(
    //         "Token Addresses",
    //         0,
    //         0,
    //         dexInfo.weth,                     // WETH address
    //         address(rewardToken)              // Reward token address
    //     );
        
    //     emit DebugParams(
    //         "Control Addresses",
    //         0,
    //         0,
    //         owner(),                          // Contract owner
    //         msg.sender                        // Function caller
    //     );

    //     // Record timestamps
    //     emit DebugParams(
    //         "Timestamps",
    //         timestamps.startTimestamp,        // Start time
    //         timestamps.endTimestamp,          // End time
    //         address(0),
    //         address(0)
    //     );
        
    //     emit DebugParams(
    //         "More Timestamps",
    //         timestamps.unlockTimestamp,       // Unlock time
    //         block.timestamp,                  // Current time
    //         address(0),
    //         address(0)
    //     );
        
    //     // Record financial parameters
    //     emit DebugParams(
    //         "Financial Info",
    //         finInfo.tokenPrice,               // Token price in wei
    //         finInfo.listingPrice,             // Listing price in wei
    //         address(0),
    //         address(0)
    //     );
        
    //     emit DebugParams(
    //         "Cap Info",
    //         finInfo.softCap,                  // Soft cap
    //         finInfo.hardCap,                  // Hard cap
    //         address(0),
    //         address(0)
    //     );
        
    //     emit DebugParams(
    //         "LP Rate",
    //         finInfo.lpInterestRate,           // LP interest rate percentage
    //         totalInvestedETH,                 // Total invested ETH
    //         address(0),
    //         address(0)
    //     );

    //     // Calculate ETH allocation
    //     uint256 balance = address(this).balance;
        
    //     // Liquidity-related logic
    //     if (finInfo.lpInterestRate > 0 && finInfo.listingPrice > 0) {
    //         // Subtract msg.value (for locker fee)
    //         balance -= msg.value;
            
    //         // Calculate ETH for LP and ETH to withdraw
    //         uint256 ethForLP = (balance * finInfo.lpInterestRate) / 100;
    //         uint256 ethWithdraw = balance - ethForLP;
            
    //         // Calculate token amount needed for LP
    //         uint256 tokenAmount = getTokenAmount(ethForLP, finInfo.listingPrice);
            
    //         // Record calculated values
    //         emit DebugParams(
    //             "LP Calculation",
    //             ethForLP,                     // ETH for liquidity
    //             ethWithdraw,                  // ETH to withdraw
    //             address(0),
    //             address(0)
    //         );
            
    //         emit DebugParams(
    //             "Token Calculation",
    //             tokenAmount,                  // Token amount for LP
    //             msg.value,                    // Fee amount
    //             address(0),
    //             address(0)
    //         );
            
    //         // Check token allowance before approval
    //         uint256 allowanceBefore = rewardToken.allowance(address(this), dexInfo.router);
    //         emit DebugParams(
    //             "Allowance Before",
    //             allowanceBefore,              // Current allowance
    //             0,
    //             dexInfo.router,               // Router address
    //             address(0)
    //         );
            
    //         distributed = true;
    //         // Record expected parameters for addLiquidityETH
    //         emit AddLiquidityETHParams(
    //             address(rewardToken),         // Token address
    //             tokenAmount,                  // Token amount
    //             ethForLP,                     // ETH amount
    //             0,                            // Minimum token amount (0 = no slippage protection)
    //             0,                            // Minimum ETH amount (0 = no slippage protection)
    //             address(this),                // LP token recipient
    //             block.timestamp + 360         // Deadline (6 minutes)
    //         );
            
    //         // Check if LP locking is needed
    //         bool needsLock = timestamps.unlockTimestamp > block.timestamp;
    //         emit DebugParams(
    //             "LP Lock Status",
    //             needsLock ? 1 : 0,            // Whether locking is needed
    //             timestamps.unlockTimestamp,   // Unlock timestamp
    //             address(0),
    //             address(0)
    //         );
            
    //         // Try to get pair address if it exists
    //         try IUniswapV2Factory(dexInfo.factory).getPair(address(rewardToken), dexInfo.weth) returns (address pair) {
    //             emit DebugParams(
    //                 "Existing Pair",
    //                 pair != address(0) ? 1 : 0, // Whether pair exists
    //                 0,
    //                 pair,                     // Pair address
    //                 address(0)
    //             );
    //         } catch {
    //             emit DebugParams(
    //                 "Pair Check Failed",
    //                 0,
    //                 0,
    //                 address(0),
    //                 address(0)
    //             );
    //         }
            
    //         // Simulate LP token handling with mock liquidity
    //         uint256 mockLiquidity = 1000; // Example value
            
    //         if (needsLock) {
    //             // Record locker parameters
    //             emit TokenLockerParams(
    //                 address(0),               // LP token address (unknown yet)
    //                 "LP Token Locker",        // Locker name
    //                 mockLiquidity,            // LP amount (mock)
    //                 msg.sender,               // Owner
    //                 timestamps.unlockTimestamp, // Unlock time
    //                 msg.value                 // Fee amount
    //             );
                
    //             // Record ETH transfer parameters
    //             emit ETHTransferParams(
    //                 msg.sender,               // Recipient
    //                 ethWithdraw,              // Amount
    //                 true                      // Is lock fee
    //             );
    //         } else {
    //             // Record LP token transfer (without locking)
    //             emit DebugParams(
    //                 "LP Transfer",
    //                 mockLiquidity,            // LP amount (mock)
    //                 0,
    //                 msg.sender,               // Recipient
    //                 address(0)
    //             );
                
    //             // Record ETH transfer parameters
    //             emit ETHTransferParams(
    //                 msg.sender,               // Recipient
    //                 ethWithdraw + msg.value,  // Amount (including msg.value)
    //                 false                     // Not a lock fee
    //             );
    //         }
    //     } else {
    //         // If no liquidity addition, record direct ETH transfer
    //         emit ETHTransferParams(
    //             msg.sender,                   // Recipient
    //             balance,                      // Full balance
    //             false                         // Not a lock fee
    //         );
    //     }
        
    //     // Record gas information
    //     emit DebugParams(
    //         "Gas Info",
    //         gasleft(),                        // Remaining gas
    //         block.gaslimit,                   // Block gas limit
    //         address(0),
    //         address(0)
    //     );
    // }

    function withdrawETH() external payable onlyOwner {
        require(block.timestamp > timestamps.endTimestamp, "The IDO pool has not ended.");
        require(totalInvestedETH >= finInfo.softCap, "The IDO pool did not reach soft cap.");
        require(!distributed, "Already distributed.");

        // This forwards all available gas. Be sure to check the return value!
        uint256 balance = address(this).balance;

        if ( finInfo.lpInterestRate > 0 && finInfo.listingPrice > 0 ) {
            // if TokenLockerFactory has fee we should provide there fee by msg.value and sub it from balance for correct execution
            balance -= msg.value;
            uint256 ethForLP = (balance * finInfo.lpInterestRate)/100;
            uint256 ethWithdraw = balance - ethForLP;

            uint256 tokenAmount = getTokenAmount(ethForLP, finInfo.listingPrice);

            // Add Liquidity ETH
            IUniswapV2Router02 uniswapRouter = IUniswapV2Router02(dexInfo.router);
            rewardToken.approve(address(uniswapRouter), tokenAmount);
            // (,, uint liquidity) = uniswapRouter.addLiquidityETH{value: ethForLP}(
            //     address(rewardToken),
            //     tokenAmount,
            //     0, // slippage is unavoidable
            //     0, // slippage is unavoidable
            //     address(this),
            //     block.timestamp + 360
            // );

            uint256 liquidity = 0;
            emit AddLiquidityETHParams(
                address(rewardToken),         // Token address
                tokenAmount,                  // Token amount
                ethForLP,                     // ETH amount
                0,                            // Minimum token amount (0 = no slippage protection)
                0,                            // Minimum ETH amount (0 = no slippage protection)
                address(this),                // LP token recipient
                block.timestamp + 360         // Deadline (6 minutes)
            );
            

            // Lock LP Tokens
            (address lpTokenAddress) = IUniswapV2Factory(dexInfo.factory).getPair(address(rewardToken), dexInfo.weth);

            ERC20 lpToken = ERC20(lpTokenAddress);

            if (timestamps.unlockTimestamp > block.timestamp) {
                lpToken.approve(address(lockerFactory), liquidity);
                lockerFactory.createLocker{value: msg.value}(
                    lpToken,
                    string.concat(lpToken.symbol(), " tokens locker"),
                    liquidity, msg.sender, timestamps.unlockTimestamp
                );
            } else {
                lpToken.transfer(msg.sender, liquidity);
                // return msg.value along with eth to output if someone sent it wrong
                ethWithdraw += msg.value;
            }

            // Withdraw rest ETH
            (bool success, ) = msg.sender.call{value: ethWithdraw}("");
            require(success, "Transfer failed.");
        } else {
            (bool success, ) = msg.sender.call{value: balance}("");
            require(success, "Transfer failed.");
        }

        distributed = true;
    }

     function withdrawNotSoldTokens() external onlyOwner {
        require(distributed, "Withdraw allowed after distributed.");

        uint256 balance = getNotSoldToken();
        require(balance > 0, "The IDO pool has not unsold tokens.");
        rewardToken.safeTransfer(msg.sender, balance);
    }

    function getNotSoldToken() public view returns(uint256){
        uint256 balance = rewardToken.balanceOf(address(this));
        return balance.add(distributedTokens).sub(tokensForDistribution);
    }

    function refundTokens() external onlyOwner {
        require(block.timestamp > timestamps.endTimestamp, "The IDO pool has not ended.");
        require(totalInvestedETH < finInfo.softCap, "The IDO pool has reach soft cap.");

        uint256 balance = rewardToken.balanceOf(address(this));
        require(balance > 0, "The IDO pool has not refund tokens.");
        rewardToken.safeTransfer(msg.sender, balance);
    }

    function getTokenAmount(uint256 ethAmount, uint256 oneTokenInWei)
        internal
        view
        returns (uint256)
    {
        return (ethAmount / oneTokenInWei) * 10**decimals;
    }

    /**
     * @notice It allows the owner to recover wrong tokens sent to the contract
     * @param _tokenAddress: the address of the token to withdraw with the exception of rewardToken
     * @param _tokenAmount: the number of token amount to withdraw
     * @dev Only callable by owner.
     */
    function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
        require(_tokenAddress != address(rewardToken));
        ERC20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount);
    }
}
          

contracts/factory/IDOToken.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";

/**
 * @title IDOToken
 * @notice Standard ido token
 */
contract IDOToken is ERC20Burnable {
    constructor(
        string memory name,
        string memory symbol,
        uint256 totalSupply,
        address recipient
    ) ERC20(name, symbol) {
        _mint(recipient, totalSupply);
    }
}
          

contracts/factory/IUniswapV2Factory.sol

pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}
          

@openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
          

@openzeppelin/contracts/security/Pausable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.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 Pausable is Context {
    /**
     * @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.
     */
    constructor() {
        _paused = false;
    }

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

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

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        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());
    }
}
          

@openzeppelin/contracts/security/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

@openzeppelin/contracts/token/ERC20/ERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}
          

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}
          

@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC20.sol";
import "../../../utils/Context.sol";

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

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
}
          

@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

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

    function safeTransferFrom(
        IERC20 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(
        IERC20 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(
        IERC20 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(
        IERC20 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));
        }
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

@openzeppelin/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

@openzeppelin/contracts/utils/math/SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

contracts/factory/IUniswapV2Router01.sol

pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
          

contracts/factory/IUniswapV2Router02.sol

pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}
          

contracts/factory/TokenLocker.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TokenLocker is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    ERC20 public token;
    address public withdrawer;
    uint256 public withdrawTime;
    string public name;

    event withdrawTokenEvent(uint256 timestamp, uint256 amount);

    constructor(
        ERC20 _token,
        string memory _name,
        address _withdrawer,
        uint256 _withdrawTime
    ){
        require(_withdrawTime > block.timestamp, "withdraw time should be more than now");

        token = _token;
        name = _name;
        withdrawer = _withdrawer;
        withdrawTime = _withdrawTime;
    }

    function _processWithdraw(uint256 amount) internal {
        require(msg.sender == withdrawer, "You are not withdrawer");
        require(block.timestamp > withdrawTime, "Not time yet");
        token.safeTransfer(msg.sender, amount);
        emit withdrawTokenEvent(block.timestamp, amount);
    }

    function withdrawToken(uint256 amount) public {
        require(amount <= token.balanceOf(address(this)), "Withdraw amount exceeds balance");
        _processWithdraw(amount);
    }

    function withdrawTokenAll() public {
        uint256 amount = token.balanceOf(address(this));
        _processWithdraw(amount);
    }

    function tokenRemaining() public view returns(uint256){
        return token.balanceOf(address(this));
    }
}
          

contracts/factory/TokenLockerFactory.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./TokenLocker.sol";

contract TokenLockerFactory is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    uint256 public lockerCount = 0;
    uint256 public fee = 0;

    struct lockerInfo {
        uint256 lockerId;
        address tokenAddress;
        address creator;
        uint256 ramaining;
        address withdrawer;
        uint256 withdrawTime;
    }

    address[] public lockerAddresses;

    mapping(address => address[]) public creatorLockers;
    mapping(address => address[]) public tokenLockers;

    event LockerCreated(uint256 lockerId, address indexed lockerAddress, address tokenAddress);
    event FeeUpdated(uint256 oldFee, uint256 newFee);

    constructor(){}

    function getLockerAddresses() public view returns (address[] memory) {
      return lockerAddresses;
    }

    function createLocker(
        ERC20 _tokenAddress,
        string memory _name,
        uint256 _lockAmount,
        address _withdrawer,
        uint256 _withdrawTime
        ) payable public returns(address){
        require(msg.value == fee, 'Fee amount is required');
        require(_lockAmount > 0, 'Lock amount must be greater than 0');
        require(_withdrawer != address(0), 'Withdrawer cannot be zero address');

        TokenLocker tokenLocker = new TokenLocker(_tokenAddress, _name, _withdrawer, _withdrawTime);
        tokenLocker.transferOwnership(msg.sender);

        _tokenAddress.safeTransferFrom(
                msg.sender,
                address(tokenLocker),
                _lockAmount
            );

        lockerAddresses.push(address(tokenLocker));

        creatorLockers[msg.sender].push(address(tokenLocker));
        tokenLockers[address(_tokenAddress)].push(address(tokenLocker));

        emit LockerCreated(lockerCount, address(tokenLocker), address(_tokenAddress));
        lockerCount++;
        return address(tokenLocker);

    }

    function withdrawFee() public onlyOwner{
        (bool success, ) = msg.sender.call{value: address(this).balance}("");
        require(success, "Transfer failed.");
    }

    function setFee(uint256 amount) public onlyOwner{
        uint256 oldFee = fee;
        fee = amount;
        emit FeeUpdated(oldFee, amount);
    }

    function getLockersByCreator(address creator) public view returns (address[] memory) {
        return creatorLockers[creator];
    }

    function getLockersByToken(address tokenAddress) public view returns (address[] memory) {
        return tokenLockers[tokenAddress];
    }
}
          

Compiler Settings

{"viaIR":true,"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":100,"enabled":true},"metadata":{"bytecodeHash":"none"},"libraries":{}}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_idoFactory","internalType":"address"},{"type":"address","name":"_rewardWallet","internalType":"address"},{"type":"uint256","name":"_initialShareRatio","internalType":"uint256"}]},{"type":"error","name":"InvalidAddress","inputs":[{"type":"string","name":"message","internalType":"string"}]},{"type":"error","name":"InvalidAmount","inputs":[{"type":"string","name":"message","internalType":"string"}]},{"type":"error","name":"InvalidDuration","inputs":[{"type":"string","name":"message","internalType":"string"}]},{"type":"error","name":"InvalidParameter","inputs":[{"type":"string","name":"message","internalType":"string"}]},{"type":"error","name":"InvalidRatio","inputs":[{"type":"string","name":"message","internalType":"string"}]},{"type":"event","name":"Calculation","inputs":[{"type":"uint256","name":"hardCapInETH","internalType":"uint256","indexed":false},{"type":"uint256","name":"hardCapWei","internalType":"uint256","indexed":false},{"type":"uint256","name":"tokenPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"idoTokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"lpTokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"shareAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ConfigUpdated","inputs":[{"type":"string","name":"configName","internalType":"string","indexed":true},{"type":"uint256","name":"oldValue","internalType":"uint256","indexed":false},{"type":"uint256","name":"newValue","internalType":"uint256","indexed":false},{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"CreationFeeUpdated","inputs":[{"type":"uint256","name":"oldFee","internalType":"uint256","indexed":true},{"type":"uint256","name":"newFee","internalType":"uint256","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EmergencyAction","inputs":[{"type":"string","name":"actionType","internalType":"string","indexed":true},{"type":"address","name":"initiator","internalType":"address","indexed":true},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FeeReturned","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"creator","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"originalFee","internalType":"uint256","indexed":false},{"type":"uint256","name":"appliedRatio","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"IDOActivated","inputs":[{"type":"address","name":"poolAddress","internalType":"address","indexed":true},{"type":"address","name":"lpToken","internalType":"address","indexed":true},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"IDOCreated","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"creator","internalType":"address","indexed":true},{"type":"uint256","name":"fee","internalType":"uint256","indexed":false},{"type":"uint256","name":"feeRatio","internalType":"uint256","indexed":false},{"type":"tuple","name":"info","internalType":"struct GDCrowdfundHelper.IDOCreationInfo","indexed":false,"components":[{"type":"address","name":"creator","internalType":"address"},{"type":"uint256","name":"fee","internalType":"uint256"},{"type":"uint256","name":"creationTime","internalType":"uint256"},{"type":"uint256","name":"storedFeeRatio","internalType":"uint256"},{"type":"bool","name":"feeReturned","internalType":"bool"},{"type":"uint256","name":"hardCapInETH","internalType":"uint256"},{"type":"bool","name":"userEnableShare","internalType":"bool"},{"type":"uint256","name":"idoTokenAmount","internalType":"uint256"},{"type":"uint256","name":"lpTokenAmount","internalType":"uint256"},{"type":"uint256","name":"shareAmount","internalType":"uint256"},{"type":"uint256","name":"tokenPrice","internalType":"uint256"},{"type":"uint256","name":"listingPrice","internalType":"uint256"},{"type":"address","name":"router","internalType":"address"},{"type":"address","name":"factory","internalType":"address"},{"type":"address","name":"weth","internalType":"address"},{"type":"uint256","name":"startTime","internalType":"uint256"},{"type":"uint256","name":"endTime","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"},{"type":"address","name":"idoPoolAddress","internalType":"address"},{"type":"string","name":"metadataURL","internalType":"string"}]},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"IDOCreatedByHelper","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"idoPool","internalType":"address","indexed":true},{"type":"uint256","name":"shareAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false},{"type":"uint256","name":"idoTokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"lpTokenAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RewardFeeRatioUpdated","inputs":[{"type":"uint256","name":"oldRatio","internalType":"uint256","indexed":true},{"type":"uint256","name":"newRatio","internalType":"uint256","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ShareStatusUpdated","inputs":[{"type":"bool","name":"enabled","internalType":"bool","indexed":false},{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TokenCreated","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"string","name":"name","internalType":"string","indexed":false},{"type":"string","name":"symbol","internalType":"string","indexed":false},{"type":"uint256","name":"totalSupply","internalType":"uint256","indexed":false},{"type":"address","name":"receiver","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"TokenDistribution","inputs":[{"type":"uint256","name":"totalSupply","internalType":"uint256","indexed":false},{"type":"uint256","name":"idoAllocationRatio","internalType":"uint256","indexed":false},{"type":"uint256","name":"shareRatio","internalType":"uint256","indexed":false},{"type":"uint256","name":"lpInterestRate","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"WalletUpdated","inputs":[{"type":"address","name":"oldWallet","internalType":"address","indexed":true},{"type":"address","name":"newWallet","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"activateIDO","inputs":[{"type":"address","name":"_poolAddress","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"createIDO","inputs":[{"type":"tuple","name":"_tokenInfo","internalType":"struct GDCrowdfundHelper.TokenInfo","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"idoAmount","internalType":"uint256"}]},{"type":"uint256","name":"hardCapInETH","internalType":"uint256"},{"type":"tuple","name":"_timestamps","internalType":"struct IDOPool.Timestamps","components":[{"type":"uint256","name":"startTimestamp","internalType":"uint256"},{"type":"uint256","name":"endTimestamp","internalType":"uint256"},{"type":"uint256","name":"unlockTimestamp","internalType":"uint256"}]},{"type":"address","name":"_lockerFactoryAddress","internalType":"address"},{"type":"string","name":"_metadataURL","internalType":"string"},{"type":"tuple","name":"_dexInfo","internalType":"struct IDOPool.DEXInfo","components":[{"type":"address","name":"router","internalType":"address"},{"type":"address","name":"factory","internalType":"address"},{"type":"address","name":"weth","internalType":"address"}]},{"type":"bool","name":"_userEnableShare","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"creationFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"enableShare","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_rewardWallet","internalType":"address"},{"type":"uint256","name":"_shareRatio","internalType":"uint256"},{"type":"uint256","name":"_idoAllocationRatio","internalType":"uint256"},{"type":"uint256","name":"_lpInterestRate","internalType":"uint256"},{"type":"uint256","name":"_minIDODuration","internalType":"uint256"},{"type":"uint256","name":"_maxIDODuration","internalType":"uint256"},{"type":"bool","name":"_enableShare","internalType":"bool"},{"type":"uint256","name":"_creationFee","internalType":"uint256"},{"type":"uint256","name":"_rewardFeeRatio","internalType":"uint256"}],"name":"getConfigurations","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"feeToken","internalType":"address"},{"type":"uint256","name":"feeAmount","internalType":"uint256"}],"name":"getFeeInfo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"idoAllocationRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"creator","internalType":"address"},{"type":"uint256","name":"fee","internalType":"uint256"},{"type":"uint256","name":"creationTime","internalType":"uint256"},{"type":"uint256","name":"storedFeeRatio","internalType":"uint256"},{"type":"bool","name":"feeReturned","internalType":"bool"},{"type":"uint256","name":"hardCapInETH","internalType":"uint256"},{"type":"bool","name":"userEnableShare","internalType":"bool"},{"type":"uint256","name":"idoTokenAmount","internalType":"uint256"},{"type":"uint256","name":"lpTokenAmount","internalType":"uint256"},{"type":"uint256","name":"shareAmount","internalType":"uint256"},{"type":"uint256","name":"tokenPrice","internalType":"uint256"},{"type":"uint256","name":"listingPrice","internalType":"uint256"},{"type":"address","name":"router","internalType":"address"},{"type":"address","name":"factory","internalType":"address"},{"type":"address","name":"weth","internalType":"address"},{"type":"uint256","name":"startTime","internalType":"uint256"},{"type":"uint256","name":"endTime","internalType":"uint256"},{"type":"uint256","name":"unlockTime","internalType":"uint256"},{"type":"address","name":"idoPoolAddress","internalType":"address"},{"type":"string","name":"metadataURL","internalType":"string"}],"name":"idoCreationInfo","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IDOFactory"}],"name":"idoFactory","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lpInterestRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxIDODuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxPersonalRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minIDODuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minPersonalRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardFeeRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardWallet","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEnableShare","inputs":[{"type":"bool","name":"_enable","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"shareRatio","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"softCapRatio","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCreationFee","inputs":[{"type":"uint256","name":"_newFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateIDOAllocation","inputs":[{"type":"uint256","name":"_newRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateIDODuration","inputs":[{"type":"uint256","name":"_newMinDuration","internalType":"uint256"},{"type":"uint256","name":"_newMaxDuration","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateLPInterestRate","inputs":[{"type":"uint256","name":"_newRate","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePersonalLimits","inputs":[{"type":"uint256","name":"_newMinRatio","internalType":"uint256"},{"type":"uint256","name":"_newMaxRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRewardFeeRatio","inputs":[{"type":"uint256","name":"_newRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRewardWallet","inputs":[{"type":"address","name":"_newWallet","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateShareRatio","inputs":[{"type":"uint256","name":"_newRatio","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSoftCapRatio","inputs":[{"type":"uint256","name":"_newRatio","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

Verify & Publish
0x60a0346200026557601f620038d838819003918201601f191683019291906001600160401b038411838510176200026a5781606092849260409687528339810103126200026557620000518162000280565b82620000606020840162000280565b92015160008054336001600160a01b0319821681178355865193956001600160a01b039590949390928616907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001805560025493611f406003556611c37937e08000600555612710806006556203f4806007556213c68060085561157c600a556064600b55600a600c55600d55808216928315620002335750831615620001ff573b15620001ba5760c8841162000175576080526001600160a81b031990911660089190911b610100600160a81b031617600255600955516136429081620002968239608051818181610b810152818161141b01528181611af701528181611c42015281816127ba015261336c0152f35b8451631d8e7cd960e01b815260206004820152601460248201527f536861726520726174696f20746f6f20686967680000000000000000000000006044820152606490fd5b8451630b0f5aa160e11b815260206004820152601860248201527f466163746f7279206d75737420626520636f6e747261637400000000000000006044820152606490fd5b8551630b0f5aa160e11b815260206004820152600c60248201526b5a65726f206164647265737360a01b6044820152606490fd5b630b0f5aa160e11b815260206004820152600c60248201526b5a65726f206164647265737360a01b6044820152606490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620002655756fe610180604052600436101561001c575b361561001a57600080fd5b005b6000803560e01c806202eab7146131295780630d9e034814612a6d5780631109164c146128ac57806313a1cee2146127e95780631d534014146127a4578063224325ed146126845780633bdca2b514612666578063504963551461248f5780635c975abb1461246c5780635f7be498146123f75780635fa89bef146123d957806367cf11ad146123bb5780636b52b73e1461239d5780636d6ab3be1461237f5780636fa23795146122cb5780636ff1c9bc146120a5578063715018a6146120465780637689f780146107fb5780638da5cb5b146107d45780639a23e0ce146107b1578063b0b5114e14610793578063b6d31bb11461069d578063bf427265146105f6578063c57ae93d146105d8578063c8fa235414610562578063c9be140f146104b3578063cc600f91146103a7578063dce0b4e414610389578063dee250c21461036b578063e74d70cf146102aa578063f2fde38b146101df578063fb75b2c7146101b25763fc536fc614610192575061000f565b346101af57806003193601126101af576020600854604051908152f35b80fd5b50346101af57806003193601126101af5760025460405160089190911c6001600160a01b03168152602090f35b50346101af5760203660031901126101af576101f961315f565b81546001600160a01b039182916102139083163314613305565b16908115610256576000548260018060a01b0319821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b50346101af5760203660031901126101af576004356102d360018060a01b038354163314613305565b80158015610361575b61032557600b549080600b55600e6040516d4c50496e7465726573745261746560901b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b81526020600482015260136024820152720496e76616c696420726174653a20312d31303606c1b6044820152606490fd5b50606481116102dc565b50346101af57806003193601126101af576020600b54604051908152f35b50346101af57806003193601126101af576020600554604051908152f35b50346101af5760203660031901126101af576103c161315f565b81546001600160a01b03906103d99082163314613305565b80821690811561047a57600254908160081c169283831461043e57610100600160a81b031990911660089190911b610100600160a81b03161760025533917fa51743acc566a17de801f1b15ea2b3b0ef044d425ccb02be8d95d44455436d208480a480f35b604051630b0f5aa160e11b815260206004820152601360248201527253616d652077616c6c6574206164647265737360681b6044820152606490fd5b604051630b0f5aa160e11b815260206004820152600c60248201526b5a65726f206164647265737360a01b6044820152606490fd5b0390fd5b50346101af5760203660031901126101af576004356104dc60018060a01b038354163314613305565b60c88111610525576009549080600955600a604051695368617265526174696f60b01b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b81526020600482015260146024820152730a6d0c2e4ca40e4c2e8d2de40e8dede40d0d2ced60631b6044820152606490fd5b50346101af5760203660031901126101af576004358015158091036105d35761059560018060a01b038354163314613305565b60ff196004541660ff8216176004556040519081527feb02cb610f9961bf22297150567d1d3dc7ad6feff74bb04a48fccfe76a6c7f6e60203392a280f35b600080fd5b50346101af57806003193601126101af576020600754604051908152f35b50346101af5760203660031901126101af5760043561061f60018060a01b038354163314613305565b612710811161065957600654908060065533917f1c9a4e34a4bf68e24613d76f2b11c61ea826ec012c4e952cd850cbe4c61af4788480a480f35b606460405162461bcd60e51b815260206004820152602060248201527f5265776172642066656520726174696f206d757374206265203c3d20313030256044820152fd5b50346101af5760203660031901126101af576004356106c660018060a01b038354163314613305565b6107d0811061075857611f40811161071c57600a549080600a55600d6040516c24b237a0b63637b1b0ba34b7b760991b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b8152602060048201526013602482015272082d8d8dec6c2e8d2dedc40e8dede40d0d2ced606b1b6044820152606490fd5b604051631d8e7cd960e01b8152602060048201526012602482015271416c6c6f636174696f6e20746f6f206c6f7760701b6044820152606490fd5b50346101af57806003193601126101af576020600c54604051908152f35b50346101af57806003193601126101af57602060ff600454166040519015158152f35b50346101af57806003193601126101af57546040516001600160a01b039091168152602090f35b5036600319016101808112612042576040136101af5760603660631901126101af5760c4356001600160a01b03811690036105d3576001600160401b0360e435116101af5736602360e4350112156101af576001600160401b0360e43560040135116101af5736602460e4356004013560e4350101116101af576060366101031901126101af5761016435151561016435036105d3576108a06002600154141561344b565b600260015560ff6002541661200a576108c360018060a01b038254163314613305565b6005543410611fc9576108d4613350565b906001600160a01b038116151580611fc0575b611af5575b5060443515611abd5761093060405161090481613289565b6017815276131bd8dad95c881b5d5cdd0818994818dbdb9d1c9858dd604a1b602082015260c43561355c565b61097161093b6134ca565b6040519061094882613289565b6017825276149bdd5d195c881b5d5cdd0818994818dbdb9d1c9858dd604a1b602083015261355c565b6109b361097c6134e1565b6040519061098982613289565b6018825277119858dd1bdc9e481b5d5cdd0818994818dbdb9d1c9858dd60421b602083015261355c565b6109f26109be6134f8565b604051906109cb82613289565b601582527415d15512081b5d5cdd0818994818dbdb9d1c9858dd605a1b602083015261355c565b610a316109fd61350f565b60405190610a0a82613289565b6015825274151bdad95b881859191c995cdcc81a5b9d985b1a59605a1b602083015261355c565b60405190610a3e8261326e565b6064358083526084358060208501526040840152421015611a7757602082015182511015611a315760408201516020830151036119df576020820151825181039081116117ad5760075481106119a05760085410611962576001600160a01b03610aa661350f565b169060243515611913576040516370a0823160e01b8152336004820152602081602481865afa90811561154e5785916118e1575b506024351161189c57604051636eb1769f60e11b8152336004820152306024820152602081604481865afa90811561154e57859161186a575b5060243511611825576040516323b872dd60e01b81523360048201523060248083019190915235604482015260208160648188875af190811561154e578591611806575b50156117c1578060243501602435116117ad5760405163095ea7b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166004820152602480359290920191810191909152906020908290604490829087905af19081156117a2578391611783575b501561173f5760ff6004541680611735575b600a54600954600b54927f09a1d37d532e1e115c71082a22b97400b7a9d8c4beb95296c9778c2cdacd63ee60405180610c39878688602435859094939260609260808301968352602083015260408201520152565b0390a1604435670de0b6b3a76400006044350204670de0b6b3a764000003611721571561171a5761271090670de0b6b3a76400006024350402045b610cca610c9f61271084670de0b6b3a7640000602435040204670de0b6b3a7640000604435026135c2565b936064670de0b6b3a764000084612710878360243504020482602435040303926044350202046135c2565b927fce521722436e7f86e6aa9cca187bcb7703bd5b396be6c1cc812d85ee6d914bf060c06040516044358152670de0b6b3a7640000604435026020820152836040820152670de0b6b3a76400006127108782602435040204026060820152670de0b6b3a764000085612710888360243504020482602435040303026080820152670de0b6b3a7640000850260a0820152a1600654610d666134ca565b610d6e6134e1565b610d766134f8565b88519160208a01519360405195866102808101106001600160401b036102808901111761155957610280870160405233875234602088015242604088015260608701528b608087015260443560a087015261016435151560c0870152670de0b6b3a76400006127108a826024350402040260e0870152670de0b6b3a7640000886127108b836024350402048260243504030302610100870152670de0b6b3a76400008802610120870152866101408701528961016087015260018060a01b031661018086015260018060a01b03166101a085015260018060a01b03166101c08401526101e08301528061020083015261022082015286610240820152610e883660e43560040135602460e43501613525565b6102608201526001600160a01b03610e9e61350f565b168752600e602052610260604088209160018060a01b0381511660018060a01b0319845416178355602081015160018401556040810151600284015560608101516003840155610f0360808201511515600485019060ff801983541691151516179055565b60a08101516005840155610f2c60c08201511515600685019060ff801983541691151516179055565b60e0810151600784015561010081015160088401556101208101516009840155610140810151600a840155610160810151600b840155610180810151600c840180546001600160a01b03199081166001600160a01b03938416179091556101a0830151600d8601805483169184169190911790556101c0830151600e8601805483169184169190911790556101e0830151600f86015561020083015160108601556102208301516011860155610240830151601286018054909216921691909117905501518051906001600160401b0382116117065761100f601384015461318b565b601f81116116c2575b50602090601f831160011461165557601392918a918361164a575b50508160011b916000199060031b1c1916179101555b61105161350f565b6006546001600160a01b0361106461350f565b168852600e6020527f3731f5741606128343b567f88b880c0689f2e57bcc13f40fd9b72e4b885b30f56111ba60408a206040519334855260208501526080604085015260018060a01b038154166080850152600181015460a0850152600281015460c0850152600381015460e085015260ff6004820154161515610100850152600581015461012085015260ff60068201541615156101408501526007810154610160850152600881015461018085015260098101546101a0850152600a8101546101c0850152600b8101546101e085015260018060a01b03600c8201541661020085015260018060a01b03600d8201541661022085015260018060a01b03600e82015416610240850152600f810154610260850152601081015461028085015260118101546102a085015260018060a01b036012820154166102c08501526102806102e08501526013610300850191016131c5565b42606084015233936001600160a01b0316929081900390a36001600160a01b036111e261350f565b16936111fa3660e43560040135602460e43501613525565b90604051926112088461326e565b610104356001600160a01b03811681036105d3578452610124356001600160a01b03811690036105d357610124356020850152610144356001600160a01b03811690036105d35761014435604085015260ff6004541680611637575b61156f575b612710611284600354670de0b6b3a764000060443502613599565b0492600b54946127106112a5600c54670de0b6b3a764000060443502613599565b04956127106112c2600d54670de0b6b3a764000060443502613599565b0494604051958660e08101106001600160401b0360e0890111176115595760209860c0986113e79760e08a0160405289528a890152670de0b6b3a76400006044350260408901526060880152608087015260a086015285850152604080519a8b9687966301202f4160e01b88528c60048901528051602489015289810151604489015283810151606489015260608101516084890152608081015160a489015260a081015160c4890152015160e4870152805161010487015287810151610124870152015161014485015260018060a01b0381511661016485015260018060a01b038682015116610184850152604060018060a01b03910151166101a484015260018060a01b0360c435166101c48401526102406101e48401526102448301906132c5565b612710670de0b6b3a764000060243581900480890292909204808202610204860152909103869003026102248301520381887f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af193841561154e5785946114eb575b50828552600e6020908152604080872060120180546001600160a01b0319166001600160a01b039790971696871790558051670de0b6b3a76400008481028252429382019390935261271060243584900495860204808402928201929092529303919091030260608201527f8abddd60a512ff3837c5fa0b33bec2e686f13651642b93940db110516af8f81490608090a36001805580f35b919093506020823d602011611546575b81611508602093836132a4565b810103126115425761153a7f8abddd60a512ff3837c5fa0b33bec2e686f13651642b93940db110516af8f814926135e2565b939091611453565b8480fd5b3d91506114fb565b6040513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b60025460405163a9059cbb60e01b815260089190911c6001600160a01b03166004820152670de0b6b3a7640000860260248201526020816044818d8c5af190811561162c578a916115fd575b506112695760405162461bcd60e51b815260206004820152601560248201527414da185c99481d1c985b9cd9995c8819985a5b1959605a1b6044820152606490fd5b61161f915060203d602011611625575b61161781836132a4565b810190613497565b386115bb565b503d61160d565b6040513d8c823e3d90fd5b50670de0b6b3a764000085021515611264565b015190503880611033565b90601384018a5260208a20918a5b601f19851681106116aa5750918391600193601395601f19811610611691575b505050811b01910155611049565b015160001960f88460031b161c19169055388080611683565b91926020600181928685015181550194019201611663565b601384018a5260208a20601f840160051c8101602085106116ff575b601f830160051c820181106116f4575050611018565b8b81556001016116de565b50806116de565b634e487b7160e01b89526041600452602489fd5b5083610c74565b634e487b7160e01b86526011600452602486fd5b5061016435610be4565b606460405162461bcd60e51b815260206004820152602060248201527f546f6b656e20617070726f76616c20746f20666163746f7279206661696c65646044820152fd5b61179c915060203d6020116116255761161781836132a4565b38610bd2565b6040513d85823e3d90fd5b634e487b7160e01b84526011600452602484fd5b60405162461bcd60e51b815260206004820152601f60248201527f546f6b656e207472616e7366657220746f2068656c706572206661696c6564006044820152606490fd5b61181f915060203d6020116116255761161781836132a4565b38610b57565b60405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420746f6b656e20616c6c6f77616e6365000000006044820152606490fd5b90506020813d602011611894575b81611885602093836132a4565b810103126105d3575138610b13565b3d9150611878565b60405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606490fd5b90506020813d60201161190b575b816118fc602093836132a4565b810103126105d3575138610ada565b3d91506118ef565b60405162461bcd60e51b815260206004820152602160248201527f49444f20616d6f756e74206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608490fd5b60405163716f4c8f60e01b815260206004820152601560248201527449444f206475726174696f6e20746f6f206c6f6e6760581b6044820152606490fd5b60405163716f4c8f60e01b8152602060048201526016602482015275125113c8191d5c985d1a5bdb881d1bdbc81cda1bdc9d60521b6044820152606490fd5b60405163716f4c8f60e01b8152602060048201526024808201527f556e6c6f636b2074696d65206d7573742062652073616d6520617320656e642060448201526374696d6560e01b6064820152608490fd5b60405163716f4c8f60e01b815260206004820152601c60248201527f456e642074696d65206d757374206265206166746572207374617274000000006044820152606490fd5b60405163716f4c8f60e01b815260206004820152601c60248201527f53746172742074696d65206d75737420626520696e20667574757265000000006044820152606490fd5b60405163589956a560e11b815260206004820152600f60248201526e0496e76616c6964206861726463617608c1b6044820152606490fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615611f7b573315611f3d573015611eff576040516370a0823160e01b81523360048201526020816024816001600160a01b0386165afa8015611d975783918591611eca575b5010611e8557604051636eb1769f60e11b81523360048201523060248201526020816044816001600160a01b0386165afa8015611d975783918591611e50575b5010611e12576040516323b872dd60e01b815233600482015230602482015260448101839052602081606481876001600160a01b0387165af1908115611d97578491611df3575b5015611da2576040516370a0823160e01b81523060048201526020816024816001600160a01b0386165afa8015611d975783918591611d62575b5010611d0a5760405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490529091602091839160449183918891165af19081156117a2578391611ceb575b5015611c9a57386108ec565b60405162461bcd60e51b8152602060048201526024808201527f46656520746f6b656e20617070726f76616c20746f20666163746f72792066616044820152631a5b195960e21b6064820152608490fd5b611d04915060203d6020116116255761161781836132a4565b38611c8e565b60405162461bcd60e51b815260206004820152602a60248201527f48656c70657220696e73756666696369656e742062616c616e6365206166746560448201526939103a3930b739b332b960b11b6064820152608490fd5b9150506020813d602011611d8f575b81611d7e602093836132a4565b810103126105d35782905138611c25565b3d9150611d71565b6040513d86823e3d90fd5b60405162461bcd60e51b815260206004820152602360248201527f46656520746f6b656e207472616e7366657220746f2068656c706572206661696044820152621b195960ea1b6064820152608490fd5b611e0c915060203d6020116116255761161781836132a4565b38611beb565b60405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606490fd5b9150506020813d602011611e7d575b81611e6c602093836132a4565b810103126105d35782905138611ba4565b3d9150611e5f565b60405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e742066656520746f6b656e2062616c616e636500006044820152606490fd5b9150506020813d602011611ef7575b81611ee6602093836132a4565b810103126105d35782905138611b64565b3d9150611ed9565b60405162461bcd60e51b815260206004820152601660248201527548656c7065722061646472657373206973207a65726f60501b6044820152606490fd5b60405162461bcd60e51b815260206004820152601660248201527553656e6465722061646472657373206973207a65726f60501b6044820152606490fd5b60405162461bcd60e51b815260206004820152601a60248201527f49444f466163746f72792061646472657373206973207a65726f0000000000006044820152606490fd5b508115156108e7565b60405162461bcd60e51b8152602060048201526019602482015278496e73756666696369656e74206372656174696f6e2066656560381b6044820152606490fd5b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b5080fd5b50346101af57806003193601126101af57600060018060a01b0361206e818454163314613305565b81546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101af5760208060031936011261204257816120c161315f565b81546001600160a01b03919082169082906120dd338414613305565b16806121b15750504780612132575b5050505b600860405167574954484452415760c01b8152207f6758593a60801a617f0db7ba7baa12f6c9e46bafd2d55b3dad6b807d1c215a9c604051924284523393a380f35b8280929181928254165af13d156121ac573d61214d816134af565b9061215b60405192836132a4565b815283833d92013e5b15612171578138806120ec565b606490604051906305519d6f60e51b825260048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152fd5b612164565b6040516370a0823160e01b81523060048201529193509091508382602481845afa90811561154e578492869261229a575b50816121f2575b505050506120f0565b60405163a9059cbb60e01b81526001600160a01b0394909416600485015260248401919091528290604490829087905af19081156117a257839161227d575b501561224057388181806121e9565b606490604051906305519d6f60e51b825260048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152fd5b6122949150823d84116116255761161781836132a4565b38612231565b8381949293503d83116122c4575b6122b281836132a4565b810103126105d35783915190386121e2565b503d6122a8565b50346101af5760203660031901126101af576004356122f460018060a01b038354163314613305565b801561232b57600554908060055533917fcf6ba38564654f22e1cd03d3b4ecb765884d356b6e051f2433185e44eacb15018480a480f35b60405162461bcd60e51b815260206004820152602660248201527f4372656174696f6e20666565206d7573742062652067726561746572207468616044820152656e207a65726f60d01b6064820152608490fd5b50346101af57806003193601126101af576020600354604051908152f35b50346101af57806003193601126101af576020600654604051908152f35b50346101af57806003193601126101af576020600954604051908152f35b50346101af57806003193601126101af576020600a54604051908152f35b50346101af57806003193601126101af57610120600254600954600a54600b546007546008549060ff600454169260055494600654966040519860018060a01b039060081c168952602089015260408801526060870152608086015260a0850152151560c084015260e0830152610100820152f35b50346101af57806003193601126101af57602060ff600254166040519015158152f35b50346101af5760203660031901126101af576001600160a01b036124b161315f565b168152600e6020819052604091829020610100819052805460018201546101405260028201546080526003820154600483015460058401546006850154600786015460088701546009880154600a890154600b8a0154600c8b0154600d8c01549c8c0154600f8d015460108e015460e05260118e015460a05260128e01546001600160a01b0390811660c0529f51610160819052909f9182169e82169d9282169c939b949a9599969860ff9081169796169493909116916125769082906013016131c5565b036101605190612585916132a4565b60405180610120525261014051610120516020015260805161012051604001526101205160600152151561012051608001526101205160a0015215156101205160c001526101205160e00152610120516101000152610120516101200152610120516101400152610120516101600152610120516101800152610120516101a00152610120516101c00152610120516101e0015260e05161012051610200015260a05161012051610220015260c0516101205161024001526102808061012051610260015261012051908101610160519061265f916132c5565b0361012051f35b50346101af57806003193601126101af576020600d54604051908152f35b50346101af5761269336613175565b6126a760018060a01b038454163314613305565b811561276357818111156127295760075491600854928160075582600855600b6040516a26b4b7223ab930ba34b7b760a91b815220916040519182526020820152600080516020613616833981519152918260403393a3600b6040516a26b0bc223ab930ba34b7b760a91b81522091604051938452602084015260403393a380f35b60405163716f4c8f60e01b815260206004820152601160248201527026b0bc1036bab9ba103132901f1036b4b760791b6044820152606490fd5b60405163716f4c8f60e01b815260206004820152601860248201527704d696e206475726174696f6e206d757374206265203e20360441b6044820152606490fd5b50346101af57806003193601126101af576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b50346101af5760203660031901126101af5760043561281260018060a01b038354163314613305565b801580156128a1575b612862576003549080600355600c6040516b536f6674436170526174696f60a01b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b81526020600482015260166024820152750496e76616c696420726174696f3a20312d31303030360541b6044820152606490fd5b50612710811161281b565b50346101af576128bb36613175565b6128cf60018060a01b038454163314613305565b81158015612a62575b612a115780158015612a06575b6129b5578082101561296f57600c5491600d549281600c5582600d5560106040516f4d696e506572736f6e616c526174696f60801b815220916040519182526020820152600080516020613616833981519152918260403393a360106040516f4d6178506572736f6e616c526174696f60801b81522091604051938452602084015260403393a380f35b604051631d8e7cd960e01b815260206004820152601f60248201527f4d696e20726174696f206d757374206265206c657373207468616e206d6178006044820152606490fd5b604051631d8e7cd960e01b815260206004820152602260248201527f4d617820726174696f206d757374206265203e203020616e64203c3d20313030604482015261030360f41b6064820152608490fd5b5061271081116128e5565b604051631d8e7cd960e01b815260206004820152602260248201527f4d696e20726174696f206d757374206265203e203020616e64203c3d20313030604482015261030360f41b6064820152608490fd5b5061271082116128d8565b50346101af5760208060031936011261204257612a8861315f565b90612a986002600154141561344b565b600260015582546001600160a01b03928391612ab79083163314613305565b612aed604051612ac681613289565b6015815274141bdbdb081b5d5cdd0818994818dbdb9d1c9858dd605a1b858201528261355c565b1690604051638da5cb5b60e01b81528181600481865afa90811561154e5785916130f4575b5083309116036130b05760405163092288f560e31b81526060908181600481875afa908115612fda57869161307c575b5042111561303d57604051637c25c81f60e11b81528281600481875afa908115612fda578691613020575b50612fe557823b1561154257604051633821b97b60e21b8152858160048183885af18015612fda57612fc7575b5060405163d8d2a56d60e01b815285918082600481885afa9182156117a25783918493612f77575b505060405163f7c618c160e01b8082529285826004818a5afa92831561154e578880612c289589958991612f5a575b5060405163e6a4390560e01b81526001600160a01b0391909316811660048401529093166024820152938492839182906044820190565b0392165afa80156117a25786918491612f22575b501694604051916370a0823160e01b9283815230600482015285816024818b5afa90811561154e578591612ef1575b5080612e4c575b506040516362bea93f60e01b815285816004818a5afa90811561154e578591612e1b575b50612cd0575b505050507fc5d9a09fc5445e80c9533e2f13bfee5635c109f6d0d848eaad8926d5e27b75ca90604051428152a36001805580f35b853b15612d965760405163c6a0e27d60e01b81528481600481838b5af190811561154e578591612e07575b50506040519081528481600481895afa908115611d97578491612dda575b5016906040519081523060048201528381602481855afa9081156117a2578391612da9575b5080612d4b575b80612c9c565b813b15612da5578291602483926040519485938492630852cd8d60e31b845260048401525af18015612d9a57612d82575b80612d45565b612d8b9061325b565b612d96578338612d7c565b8380fd5b6040513d84823e3d90fd5b8280fd5b809350848092503d8311612dd3575b612dc281836132a4565b810103126105d35785915138612d3e565b503d612db8565b612dfa9150853d8711612e00575b612df281836132a4565b8101906135f6565b38612d19565b503d612de8565b612e109061325b565b612d96578338612cfb565b809550868092503d8311612e45575b612e3481836132a4565b810103126105d35787935138612c96565b503d612e2a565b90919293506040519063a9059cbb60e01b825261dead6004830152602482015284816044818b8b5af1908115612ee6578891612ec9575b5015612e93579086929138612c72565b60405162461bcd60e51b815260048101859052600e60248201526d131408189d5c9b8819985a5b195960921b6044820152606490fd5b612ee09150853d87116116255761161781836132a4565b38612e83565b6040513d8a823e3d90fd5b809550868092503d8311612f1b575b612f0a81836132a4565b810103126105d35787935138612c6b565b503d612f00565b809250858092503d8311612f53575b612f3b81836132a4565b81010312612da557612f4d86916135e2565b38612c3c565b503d612f31565b612f719150863d8811612e0057612df281836132a4565b38612bf1565b8193508092503d8311612fc0575b612f8f81836132a4565b8101031261204257612fa0816135e2565b50612fb86040612fb18584016135e2565b92016135e2565b903880612bc2565b503d612f85565b612fd39095919561325b565b9338612b9a565b6040513d88823e3d90fd5b60405162461bcd60e51b8152600481018390526013602482015272105b1c9958591e48191a5cdd1c9a589d5d1959606a1b6044820152606490fd5b6130379150833d85116116255761161781836132a4565b38612b6d565b60405162461bcd60e51b81526004810183905260176024820152764e6f74207265616368656420756e6c6f636b2074696d6560481b6044820152606490fd5b90508181813d83116130a9575b61309381836132a4565b810103126130a5576040015138612b42565b8580fd5b503d613089565b6064906040519062461bcd60e51b82526004820152601c60248201527f48656c706572206973206e6f742074686520706f6f6c206f776e6572000000006044820152fd5b90508181813d8311613122575b61310b81836132a4565b810103126115425761311c906135e2565b38612b12565b503d613101565b50346101af57806003193601126101af57613142613350565b604080516001600160a01b03939093168352602083019190915290f35b600435906001600160a01b03821682036105d357565b60409060031901126105d3576004359060243590565b90600182811c921680156131bb575b60208310146131a557565b634e487b7160e01b600052602260045260246000fd5b91607f169161319a565b90600092918054916131d68361318b565b91828252600193848116908160001461323857506001146131f8575b50505050565b90919394506000526020928360002092846000945b8386106132245750505050010190388080806131f2565b80548587018301529401938590820161320d565b9294505050602093945060ff191683830152151560051b010190388080806131f2565b6001600160401b03811161155957604052565b606081019081106001600160401b0382111761155957604052565b604081019081106001600160401b0382111761155957604052565b90601f801991011681019081106001600160401b0382111761155957604052565b919082519283825260005b8481106132f1575050826000602080949584010152601f8019910116010190565b6020818301810151848301820152016132d0565b1561330c57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60405163647846a560e01b8152602091906001600160a01b03907f00000000000000000000000000000000000000000000000000000000000000008216908481600481855afa908115613407578590600092613413575b50604051631a78550160e21b81529192829060049082905afa948515613407576000956133d6575b5050169190565b8181969293963d8311613400575b6133ee81836132a4565b810103126101af5750519238806133cf565b503d6133e4565b6040513d6000823e3d90fd5b9081813d8311613444575b61342881836132a4565b8101031261204257519083821682036101af57508460046133a7565b503d61341e565b1561345257565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b908160209103126105d3575180151581036105d35790565b6001600160401b03811161155957601f01601f191660200190565b610104356001600160a01b03811681036105d35790565b610124356001600160a01b03811681036105d35790565b610144356001600160a01b03811681036105d35790565b6004356001600160a01b03811681036105d35790565b929192613531826134af565b9161353f60405193846132a4565b8294818452818301116105d3578281602093846000960137010152565b6001600160a01b0381161561047a573b156135745750565b604051630b0f5aa160e11b8152602060048201529081906104af9060248301906132c5565b818102929181159184041417156135ac57565b634e487b7160e01b600052601160045260246000fd5b81156135cc570490565b634e487b7160e01b600052601260045260246000fd5b51906001600160a01b03821682036105d357565b908160209103126105d357516001600160a01b03811681036105d3579056fe29001f6e945ad5f9458437d5342e82db11db1e52556f83318116c09a0265d852a164736f6c6343000812000a00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e80501730000000000000000000000000512f8ee3c2b310238151b8caec8fdab26d044130000000000000000000000000000000000000000000000000000000000000064

Deployed ByteCode

0x610180604052600436101561001c575b361561001a57600080fd5b005b6000803560e01c806202eab7146131295780630d9e034814612a6d5780631109164c146128ac57806313a1cee2146127e95780631d534014146127a4578063224325ed146126845780633bdca2b514612666578063504963551461248f5780635c975abb1461246c5780635f7be498146123f75780635fa89bef146123d957806367cf11ad146123bb5780636b52b73e1461239d5780636d6ab3be1461237f5780636fa23795146122cb5780636ff1c9bc146120a5578063715018a6146120465780637689f780146107fb5780638da5cb5b146107d45780639a23e0ce146107b1578063b0b5114e14610793578063b6d31bb11461069d578063bf427265146105f6578063c57ae93d146105d8578063c8fa235414610562578063c9be140f146104b3578063cc600f91146103a7578063dce0b4e414610389578063dee250c21461036b578063e74d70cf146102aa578063f2fde38b146101df578063fb75b2c7146101b25763fc536fc614610192575061000f565b346101af57806003193601126101af576020600854604051908152f35b80fd5b50346101af57806003193601126101af5760025460405160089190911c6001600160a01b03168152602090f35b50346101af5760203660031901126101af576101f961315f565b81546001600160a01b039182916102139083163314613305565b16908115610256576000548260018060a01b0319821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b50346101af5760203660031901126101af576004356102d360018060a01b038354163314613305565b80158015610361575b61032557600b549080600b55600e6040516d4c50496e7465726573745261746560901b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b81526020600482015260136024820152720496e76616c696420726174653a20312d31303606c1b6044820152606490fd5b50606481116102dc565b50346101af57806003193601126101af576020600b54604051908152f35b50346101af57806003193601126101af576020600554604051908152f35b50346101af5760203660031901126101af576103c161315f565b81546001600160a01b03906103d99082163314613305565b80821690811561047a57600254908160081c169283831461043e57610100600160a81b031990911660089190911b610100600160a81b03161760025533917fa51743acc566a17de801f1b15ea2b3b0ef044d425ccb02be8d95d44455436d208480a480f35b604051630b0f5aa160e11b815260206004820152601360248201527253616d652077616c6c6574206164647265737360681b6044820152606490fd5b604051630b0f5aa160e11b815260206004820152600c60248201526b5a65726f206164647265737360a01b6044820152606490fd5b0390fd5b50346101af5760203660031901126101af576004356104dc60018060a01b038354163314613305565b60c88111610525576009549080600955600a604051695368617265526174696f60b01b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b81526020600482015260146024820152730a6d0c2e4ca40e4c2e8d2de40e8dede40d0d2ced60631b6044820152606490fd5b50346101af5760203660031901126101af576004358015158091036105d35761059560018060a01b038354163314613305565b60ff196004541660ff8216176004556040519081527feb02cb610f9961bf22297150567d1d3dc7ad6feff74bb04a48fccfe76a6c7f6e60203392a280f35b600080fd5b50346101af57806003193601126101af576020600754604051908152f35b50346101af5760203660031901126101af5760043561061f60018060a01b038354163314613305565b612710811161065957600654908060065533917f1c9a4e34a4bf68e24613d76f2b11c61ea826ec012c4e952cd850cbe4c61af4788480a480f35b606460405162461bcd60e51b815260206004820152602060248201527f5265776172642066656520726174696f206d757374206265203c3d20313030256044820152fd5b50346101af5760203660031901126101af576004356106c660018060a01b038354163314613305565b6107d0811061075857611f40811161071c57600a549080600a55600d6040516c24b237a0b63637b1b0ba34b7b760991b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b8152602060048201526013602482015272082d8d8dec6c2e8d2dedc40e8dede40d0d2ced606b1b6044820152606490fd5b604051631d8e7cd960e01b8152602060048201526012602482015271416c6c6f636174696f6e20746f6f206c6f7760701b6044820152606490fd5b50346101af57806003193601126101af576020600c54604051908152f35b50346101af57806003193601126101af57602060ff600454166040519015158152f35b50346101af57806003193601126101af57546040516001600160a01b039091168152602090f35b5036600319016101808112612042576040136101af5760603660631901126101af5760c4356001600160a01b03811690036105d3576001600160401b0360e435116101af5736602360e4350112156101af576001600160401b0360e43560040135116101af5736602460e4356004013560e4350101116101af576060366101031901126101af5761016435151561016435036105d3576108a06002600154141561344b565b600260015560ff6002541661200a576108c360018060a01b038254163314613305565b6005543410611fc9576108d4613350565b906001600160a01b038116151580611fc0575b611af5575b5060443515611abd5761093060405161090481613289565b6017815276131bd8dad95c881b5d5cdd0818994818dbdb9d1c9858dd604a1b602082015260c43561355c565b61097161093b6134ca565b6040519061094882613289565b6017825276149bdd5d195c881b5d5cdd0818994818dbdb9d1c9858dd604a1b602083015261355c565b6109b361097c6134e1565b6040519061098982613289565b6018825277119858dd1bdc9e481b5d5cdd0818994818dbdb9d1c9858dd60421b602083015261355c565b6109f26109be6134f8565b604051906109cb82613289565b601582527415d15512081b5d5cdd0818994818dbdb9d1c9858dd605a1b602083015261355c565b610a316109fd61350f565b60405190610a0a82613289565b6015825274151bdad95b881859191c995cdcc81a5b9d985b1a59605a1b602083015261355c565b60405190610a3e8261326e565b6064358083526084358060208501526040840152421015611a7757602082015182511015611a315760408201516020830151036119df576020820151825181039081116117ad5760075481106119a05760085410611962576001600160a01b03610aa661350f565b169060243515611913576040516370a0823160e01b8152336004820152602081602481865afa90811561154e5785916118e1575b506024351161189c57604051636eb1769f60e11b8152336004820152306024820152602081604481865afa90811561154e57859161186a575b5060243511611825576040516323b872dd60e01b81523360048201523060248083019190915235604482015260208160648188875af190811561154e578591611806575b50156117c1578060243501602435116117ad5760405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e8050173166004820152602480359290920191810191909152906020908290604490829087905af19081156117a2578391611783575b501561173f5760ff6004541680611735575b600a54600954600b54927f09a1d37d532e1e115c71082a22b97400b7a9d8c4beb95296c9778c2cdacd63ee60405180610c39878688602435859094939260609260808301968352602083015260408201520152565b0390a1604435670de0b6b3a76400006044350204670de0b6b3a764000003611721571561171a5761271090670de0b6b3a76400006024350402045b610cca610c9f61271084670de0b6b3a7640000602435040204670de0b6b3a7640000604435026135c2565b936064670de0b6b3a764000084612710878360243504020482602435040303926044350202046135c2565b927fce521722436e7f86e6aa9cca187bcb7703bd5b396be6c1cc812d85ee6d914bf060c06040516044358152670de0b6b3a7640000604435026020820152836040820152670de0b6b3a76400006127108782602435040204026060820152670de0b6b3a764000085612710888360243504020482602435040303026080820152670de0b6b3a7640000850260a0820152a1600654610d666134ca565b610d6e6134e1565b610d766134f8565b88519160208a01519360405195866102808101106001600160401b036102808901111761155957610280870160405233875234602088015242604088015260608701528b608087015260443560a087015261016435151560c0870152670de0b6b3a76400006127108a826024350402040260e0870152670de0b6b3a7640000886127108b836024350402048260243504030302610100870152670de0b6b3a76400008802610120870152866101408701528961016087015260018060a01b031661018086015260018060a01b03166101a085015260018060a01b03166101c08401526101e08301528061020083015261022082015286610240820152610e883660e43560040135602460e43501613525565b6102608201526001600160a01b03610e9e61350f565b168752600e602052610260604088209160018060a01b0381511660018060a01b0319845416178355602081015160018401556040810151600284015560608101516003840155610f0360808201511515600485019060ff801983541691151516179055565b60a08101516005840155610f2c60c08201511515600685019060ff801983541691151516179055565b60e0810151600784015561010081015160088401556101208101516009840155610140810151600a840155610160810151600b840155610180810151600c840180546001600160a01b03199081166001600160a01b03938416179091556101a0830151600d8601805483169184169190911790556101c0830151600e8601805483169184169190911790556101e0830151600f86015561020083015160108601556102208301516011860155610240830151601286018054909216921691909117905501518051906001600160401b0382116117065761100f601384015461318b565b601f81116116c2575b50602090601f831160011461165557601392918a918361164a575b50508160011b916000199060031b1c1916179101555b61105161350f565b6006546001600160a01b0361106461350f565b168852600e6020527f3731f5741606128343b567f88b880c0689f2e57bcc13f40fd9b72e4b885b30f56111ba60408a206040519334855260208501526080604085015260018060a01b038154166080850152600181015460a0850152600281015460c0850152600381015460e085015260ff6004820154161515610100850152600581015461012085015260ff60068201541615156101408501526007810154610160850152600881015461018085015260098101546101a0850152600a8101546101c0850152600b8101546101e085015260018060a01b03600c8201541661020085015260018060a01b03600d8201541661022085015260018060a01b03600e82015416610240850152600f810154610260850152601081015461028085015260118101546102a085015260018060a01b036012820154166102c08501526102806102e08501526013610300850191016131c5565b42606084015233936001600160a01b0316929081900390a36001600160a01b036111e261350f565b16936111fa3660e43560040135602460e43501613525565b90604051926112088461326e565b610104356001600160a01b03811681036105d3578452610124356001600160a01b03811690036105d357610124356020850152610144356001600160a01b03811690036105d35761014435604085015260ff6004541680611637575b61156f575b612710611284600354670de0b6b3a764000060443502613599565b0492600b54946127106112a5600c54670de0b6b3a764000060443502613599565b04956127106112c2600d54670de0b6b3a764000060443502613599565b0494604051958660e08101106001600160401b0360e0890111176115595760209860c0986113e79760e08a0160405289528a890152670de0b6b3a76400006044350260408901526060880152608087015260a086015285850152604080519a8b9687966301202f4160e01b88528c60048901528051602489015289810151604489015283810151606489015260608101516084890152608081015160a489015260a081015160c4890152015160e4870152805161010487015287810151610124870152015161014485015260018060a01b0381511661016485015260018060a01b038682015116610184850152604060018060a01b03910151166101a484015260018060a01b0360c435166101c48401526102406101e48401526102448301906132c5565b612710670de0b6b3a764000060243581900480890292909204808202610204860152909103869003026102248301520381887f00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e80501736001600160a01b03165af193841561154e5785946114eb575b50828552600e6020908152604080872060120180546001600160a01b0319166001600160a01b039790971696871790558051670de0b6b3a76400008481028252429382019390935261271060243584900495860204808402928201929092529303919091030260608201527f8abddd60a512ff3837c5fa0b33bec2e686f13651642b93940db110516af8f81490608090a36001805580f35b919093506020823d602011611546575b81611508602093836132a4565b810103126115425761153a7f8abddd60a512ff3837c5fa0b33bec2e686f13651642b93940db110516af8f814926135e2565b939091611453565b8480fd5b3d91506114fb565b6040513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b60025460405163a9059cbb60e01b815260089190911c6001600160a01b03166004820152670de0b6b3a7640000860260248201526020816044818d8c5af190811561162c578a916115fd575b506112695760405162461bcd60e51b815260206004820152601560248201527414da185c99481d1c985b9cd9995c8819985a5b1959605a1b6044820152606490fd5b61161f915060203d602011611625575b61161781836132a4565b810190613497565b386115bb565b503d61160d565b6040513d8c823e3d90fd5b50670de0b6b3a764000085021515611264565b015190503880611033565b90601384018a5260208a20918a5b601f19851681106116aa5750918391600193601395601f19811610611691575b505050811b01910155611049565b015160001960f88460031b161c19169055388080611683565b91926020600181928685015181550194019201611663565b601384018a5260208a20601f840160051c8101602085106116ff575b601f830160051c820181106116f4575050611018565b8b81556001016116de565b50806116de565b634e487b7160e01b89526041600452602489fd5b5083610c74565b634e487b7160e01b86526011600452602486fd5b5061016435610be4565b606460405162461bcd60e51b815260206004820152602060248201527f546f6b656e20617070726f76616c20746f20666163746f7279206661696c65646044820152fd5b61179c915060203d6020116116255761161781836132a4565b38610bd2565b6040513d85823e3d90fd5b634e487b7160e01b84526011600452602484fd5b60405162461bcd60e51b815260206004820152601f60248201527f546f6b656e207472616e7366657220746f2068656c706572206661696c6564006044820152606490fd5b61181f915060203d6020116116255761161781836132a4565b38610b57565b60405162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420746f6b656e20616c6c6f77616e6365000000006044820152606490fd5b90506020813d602011611894575b81611885602093836132a4565b810103126105d3575138610b13565b3d9150611878565b60405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606490fd5b90506020813d60201161190b575b816118fc602093836132a4565b810103126105d3575138610ada565b3d91506118ef565b60405162461bcd60e51b815260206004820152602160248201527f49444f20616d6f756e74206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608490fd5b60405163716f4c8f60e01b815260206004820152601560248201527449444f206475726174696f6e20746f6f206c6f6e6760581b6044820152606490fd5b60405163716f4c8f60e01b8152602060048201526016602482015275125113c8191d5c985d1a5bdb881d1bdbc81cda1bdc9d60521b6044820152606490fd5b60405163716f4c8f60e01b8152602060048201526024808201527f556e6c6f636b2074696d65206d7573742062652073616d6520617320656e642060448201526374696d6560e01b6064820152608490fd5b60405163716f4c8f60e01b815260206004820152601c60248201527f456e642074696d65206d757374206265206166746572207374617274000000006044820152606490fd5b60405163716f4c8f60e01b815260206004820152601c60248201527f53746172742074696d65206d75737420626520696e20667574757265000000006044820152606490fd5b60405163589956a560e11b815260206004820152600f60248201526e0496e76616c6964206861726463617608c1b6044820152606490fd5b7f00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e80501736001600160a01b031615611f7b573315611f3d573015611eff576040516370a0823160e01b81523360048201526020816024816001600160a01b0386165afa8015611d975783918591611eca575b5010611e8557604051636eb1769f60e11b81523360048201523060248201526020816044816001600160a01b0386165afa8015611d975783918591611e50575b5010611e12576040516323b872dd60e01b815233600482015230602482015260448101839052602081606481876001600160a01b0387165af1908115611d97578491611df3575b5015611da2576040516370a0823160e01b81523060048201526020816024816001600160a01b0386165afa8015611d975783918591611d62575b5010611d0a5760405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e805017381166004830152602482018490529091602091839160449183918891165af19081156117a2578391611ceb575b5015611c9a57386108ec565b60405162461bcd60e51b8152602060048201526024808201527f46656520746f6b656e20617070726f76616c20746f20666163746f72792066616044820152631a5b195960e21b6064820152608490fd5b611d04915060203d6020116116255761161781836132a4565b38611c8e565b60405162461bcd60e51b815260206004820152602a60248201527f48656c70657220696e73756666696369656e742062616c616e6365206166746560448201526939103a3930b739b332b960b11b6064820152608490fd5b9150506020813d602011611d8f575b81611d7e602093836132a4565b810103126105d35782905138611c25565b3d9150611d71565b6040513d86823e3d90fd5b60405162461bcd60e51b815260206004820152602360248201527f46656520746f6b656e207472616e7366657220746f2068656c706572206661696044820152621b195960ea1b6064820152608490fd5b611e0c915060203d6020116116255761161781836132a4565b38611beb565b60405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606490fd5b9150506020813d602011611e7d575b81611e6c602093836132a4565b810103126105d35782905138611ba4565b3d9150611e5f565b60405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e742066656520746f6b656e2062616c616e636500006044820152606490fd5b9150506020813d602011611ef7575b81611ee6602093836132a4565b810103126105d35782905138611b64565b3d9150611ed9565b60405162461bcd60e51b815260206004820152601660248201527548656c7065722061646472657373206973207a65726f60501b6044820152606490fd5b60405162461bcd60e51b815260206004820152601660248201527553656e6465722061646472657373206973207a65726f60501b6044820152606490fd5b60405162461bcd60e51b815260206004820152601a60248201527f49444f466163746f72792061646472657373206973207a65726f0000000000006044820152606490fd5b508115156108e7565b60405162461bcd60e51b8152602060048201526019602482015278496e73756666696369656e74206372656174696f6e2066656560381b6044820152606490fd5b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b5080fd5b50346101af57806003193601126101af57600060018060a01b0361206e818454163314613305565b81546001600160a01b031981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346101af5760208060031936011261204257816120c161315f565b81546001600160a01b03919082169082906120dd338414613305565b16806121b15750504780612132575b5050505b600860405167574954484452415760c01b8152207f6758593a60801a617f0db7ba7baa12f6c9e46bafd2d55b3dad6b807d1c215a9c604051924284523393a380f35b8280929181928254165af13d156121ac573d61214d816134af565b9061215b60405192836132a4565b815283833d92013e5b15612171578138806120ec565b606490604051906305519d6f60e51b825260048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152fd5b612164565b6040516370a0823160e01b81523060048201529193509091508382602481845afa90811561154e578492869261229a575b50816121f2575b505050506120f0565b60405163a9059cbb60e01b81526001600160a01b0394909416600485015260248401919091528290604490829087905af19081156117a257839161227d575b501561224057388181806121e9565b606490604051906305519d6f60e51b825260048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152fd5b6122949150823d84116116255761161781836132a4565b38612231565b8381949293503d83116122c4575b6122b281836132a4565b810103126105d35783915190386121e2565b503d6122a8565b50346101af5760203660031901126101af576004356122f460018060a01b038354163314613305565b801561232b57600554908060055533917fcf6ba38564654f22e1cd03d3b4ecb765884d356b6e051f2433185e44eacb15018480a480f35b60405162461bcd60e51b815260206004820152602660248201527f4372656174696f6e20666565206d7573742062652067726561746572207468616044820152656e207a65726f60d01b6064820152608490fd5b50346101af57806003193601126101af576020600354604051908152f35b50346101af57806003193601126101af576020600654604051908152f35b50346101af57806003193601126101af576020600954604051908152f35b50346101af57806003193601126101af576020600a54604051908152f35b50346101af57806003193601126101af57610120600254600954600a54600b546007546008549060ff600454169260055494600654966040519860018060a01b039060081c168952602089015260408801526060870152608086015260a0850152151560c084015260e0830152610100820152f35b50346101af57806003193601126101af57602060ff600254166040519015158152f35b50346101af5760203660031901126101af576001600160a01b036124b161315f565b168152600e6020819052604091829020610100819052805460018201546101405260028201546080526003820154600483015460058401546006850154600786015460088701546009880154600a890154600b8a0154600c8b0154600d8c01549c8c0154600f8d015460108e015460e05260118e015460a05260128e01546001600160a01b0390811660c0529f51610160819052909f9182169e82169d9282169c939b949a9599969860ff9081169796169493909116916125769082906013016131c5565b036101605190612585916132a4565b60405180610120525261014051610120516020015260805161012051604001526101205160600152151561012051608001526101205160a0015215156101205160c001526101205160e00152610120516101000152610120516101200152610120516101400152610120516101600152610120516101800152610120516101a00152610120516101c00152610120516101e0015260e05161012051610200015260a05161012051610220015260c0516101205161024001526102808061012051610260015261012051908101610160519061265f916132c5565b0361012051f35b50346101af57806003193601126101af576020600d54604051908152f35b50346101af5761269336613175565b6126a760018060a01b038454163314613305565b811561276357818111156127295760075491600854928160075582600855600b6040516a26b4b7223ab930ba34b7b760a91b815220916040519182526020820152600080516020613616833981519152918260403393a3600b6040516a26b0bc223ab930ba34b7b760a91b81522091604051938452602084015260403393a380f35b60405163716f4c8f60e01b815260206004820152601160248201527026b0bc1036bab9ba103132901f1036b4b760791b6044820152606490fd5b60405163716f4c8f60e01b815260206004820152601860248201527704d696e206475726174696f6e206d757374206265203e20360441b6044820152606490fd5b50346101af57806003193601126101af576040517f00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e80501736001600160a01b03168152602090f35b50346101af5760203660031901126101af5760043561281260018060a01b038354163314613305565b801580156128a1575b612862576003549080600355600c6040516b536f6674436170526174696f60a01b81522090604051928352602083015260008051602061361683398151915260403393a380f35b604051631d8e7cd960e01b81526020600482015260166024820152750496e76616c696420726174696f3a20312d31303030360541b6044820152606490fd5b50612710811161281b565b50346101af576128bb36613175565b6128cf60018060a01b038454163314613305565b81158015612a62575b612a115780158015612a06575b6129b5578082101561296f57600c5491600d549281600c5582600d5560106040516f4d696e506572736f6e616c526174696f60801b815220916040519182526020820152600080516020613616833981519152918260403393a360106040516f4d6178506572736f6e616c526174696f60801b81522091604051938452602084015260403393a380f35b604051631d8e7cd960e01b815260206004820152601f60248201527f4d696e20726174696f206d757374206265206c657373207468616e206d6178006044820152606490fd5b604051631d8e7cd960e01b815260206004820152602260248201527f4d617820726174696f206d757374206265203e203020616e64203c3d20313030604482015261030360f41b6064820152608490fd5b5061271081116128e5565b604051631d8e7cd960e01b815260206004820152602260248201527f4d696e20726174696f206d757374206265203e203020616e64203c3d20313030604482015261030360f41b6064820152608490fd5b5061271082116128d8565b50346101af5760208060031936011261204257612a8861315f565b90612a986002600154141561344b565b600260015582546001600160a01b03928391612ab79083163314613305565b612aed604051612ac681613289565b6015815274141bdbdb081b5d5cdd0818994818dbdb9d1c9858dd605a1b858201528261355c565b1690604051638da5cb5b60e01b81528181600481865afa90811561154e5785916130f4575b5083309116036130b05760405163092288f560e31b81526060908181600481875afa908115612fda57869161307c575b5042111561303d57604051637c25c81f60e11b81528281600481875afa908115612fda578691613020575b50612fe557823b1561154257604051633821b97b60e21b8152858160048183885af18015612fda57612fc7575b5060405163d8d2a56d60e01b815285918082600481885afa9182156117a25783918493612f77575b505060405163f7c618c160e01b8082529285826004818a5afa92831561154e578880612c289589958991612f5a575b5060405163e6a4390560e01b81526001600160a01b0391909316811660048401529093166024820152938492839182906044820190565b0392165afa80156117a25786918491612f22575b501694604051916370a0823160e01b9283815230600482015285816024818b5afa90811561154e578591612ef1575b5080612e4c575b506040516362bea93f60e01b815285816004818a5afa90811561154e578591612e1b575b50612cd0575b505050507fc5d9a09fc5445e80c9533e2f13bfee5635c109f6d0d848eaad8926d5e27b75ca90604051428152a36001805580f35b853b15612d965760405163c6a0e27d60e01b81528481600481838b5af190811561154e578591612e07575b50506040519081528481600481895afa908115611d97578491612dda575b5016906040519081523060048201528381602481855afa9081156117a2578391612da9575b5080612d4b575b80612c9c565b813b15612da5578291602483926040519485938492630852cd8d60e31b845260048401525af18015612d9a57612d82575b80612d45565b612d8b9061325b565b612d96578338612d7c565b8380fd5b6040513d84823e3d90fd5b8280fd5b809350848092503d8311612dd3575b612dc281836132a4565b810103126105d35785915138612d3e565b503d612db8565b612dfa9150853d8711612e00575b612df281836132a4565b8101906135f6565b38612d19565b503d612de8565b612e109061325b565b612d96578338612cfb565b809550868092503d8311612e45575b612e3481836132a4565b810103126105d35787935138612c96565b503d612e2a565b90919293506040519063a9059cbb60e01b825261dead6004830152602482015284816044818b8b5af1908115612ee6578891612ec9575b5015612e93579086929138612c72565b60405162461bcd60e51b815260048101859052600e60248201526d131408189d5c9b8819985a5b195960921b6044820152606490fd5b612ee09150853d87116116255761161781836132a4565b38612e83565b6040513d8a823e3d90fd5b809550868092503d8311612f1b575b612f0a81836132a4565b810103126105d35787935138612c6b565b503d612f00565b809250858092503d8311612f53575b612f3b81836132a4565b81010312612da557612f4d86916135e2565b38612c3c565b503d612f31565b612f719150863d8811612e0057612df281836132a4565b38612bf1565b8193508092503d8311612fc0575b612f8f81836132a4565b8101031261204257612fa0816135e2565b50612fb86040612fb18584016135e2565b92016135e2565b903880612bc2565b503d612f85565b612fd39095919561325b565b9338612b9a565b6040513d88823e3d90fd5b60405162461bcd60e51b8152600481018390526013602482015272105b1c9958591e48191a5cdd1c9a589d5d1959606a1b6044820152606490fd5b6130379150833d85116116255761161781836132a4565b38612b6d565b60405162461bcd60e51b81526004810183905260176024820152764e6f74207265616368656420756e6c6f636b2074696d6560481b6044820152606490fd5b90508181813d83116130a9575b61309381836132a4565b810103126130a5576040015138612b42565b8580fd5b503d613089565b6064906040519062461bcd60e51b82526004820152601c60248201527f48656c706572206973206e6f742074686520706f6f6c206f776e6572000000006044820152fd5b90508181813d8311613122575b61310b81836132a4565b810103126115425761311c906135e2565b38612b12565b503d613101565b50346101af57806003193601126101af57613142613350565b604080516001600160a01b03939093168352602083019190915290f35b600435906001600160a01b03821682036105d357565b60409060031901126105d3576004359060243590565b90600182811c921680156131bb575b60208310146131a557565b634e487b7160e01b600052602260045260246000fd5b91607f169161319a565b90600092918054916131d68361318b565b91828252600193848116908160001461323857506001146131f8575b50505050565b90919394506000526020928360002092846000945b8386106132245750505050010190388080806131f2565b80548587018301529401938590820161320d565b9294505050602093945060ff191683830152151560051b010190388080806131f2565b6001600160401b03811161155957604052565b606081019081106001600160401b0382111761155957604052565b604081019081106001600160401b0382111761155957604052565b90601f801991011681019081106001600160401b0382111761155957604052565b919082519283825260005b8481106132f1575050826000602080949584010152601f8019910116010190565b6020818301810151848301820152016132d0565b1561330c57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60405163647846a560e01b8152602091906001600160a01b03907f00000000000000000000000000ab10cc7fc8105ad7ea8bbfa1103bd3e80501738216908481600481855afa908115613407578590600092613413575b50604051631a78550160e21b81529192829060049082905afa948515613407576000956133d6575b5050169190565b8181969293963d8311613400575b6133ee81836132a4565b810103126101af5750519238806133cf565b503d6133e4565b6040513d6000823e3d90fd5b9081813d8311613444575b61342881836132a4565b8101031261204257519083821682036101af57508460046133a7565b503d61341e565b1561345257565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b908160209103126105d3575180151581036105d35790565b6001600160401b03811161155957601f01601f191660200190565b610104356001600160a01b03811681036105d35790565b610124356001600160a01b03811681036105d35790565b610144356001600160a01b03811681036105d35790565b6004356001600160a01b03811681036105d35790565b929192613531826134af565b9161353f60405193846132a4565b8294818452818301116105d3578281602093846000960137010152565b6001600160a01b0381161561047a573b156135745750565b604051630b0f5aa160e11b8152602060048201529081906104af9060248301906132c5565b818102929181159184041417156135ac57565b634e487b7160e01b600052601160045260246000fd5b81156135cc570490565b634e487b7160e01b600052601260045260246000fd5b51906001600160a01b03821682036105d357565b908160209103126105d357516001600160a01b03811681036105d3579056fe29001f6e945ad5f9458437d5342e82db11db1e52556f83318116c09a0265d852a164736f6c6343000812000a