false
true
0

Contract Address Details

0x35a51Dfc82032682E4Bda8AAcA87B9Bc386C3D27

Token
HERO Token for Veterans (HERO)
Creator
0xe91239–949af6 at 0xb74b78–beae7b
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
271 Transactions
Transfers
0 Transfers
Gas Used
0
Last Balance Update
25913589
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
Hero




Optimization enabled
true
Compiler version
v0.8.26+commit.8a97fa7a




Optimization runs
200
EVM Version
paris




Verified at
2025-11-11T06:48:56.237033Z

Constructor Arguments

0x000000000000000000000000000000000000000000000000000000006914bd10

Arg [0] (uint32) : 1762966800

              

contracts/Pulsechain/Hero.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import { IUniswapV2Router02 } from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import { IUniswapV2Factory } from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import { HeroBuyAndBurn } from "./HeroBuyAndBurn.sol";

/**
 * Standard SafeMath, stripped down to just add/sub/mul/div
 */
library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        return c;
    }
}

interface ITellor {
    function getDataBefore(bytes32 _queryId, uint256 _timestamp)
        external
        view
        returns (
            bool _ifRetrieve,
            bytes memory _value,
            uint _timestampRetrieved
        );
}

interface IERC721Minimal {
    function balanceOf(address owner) external view returns (uint256);
}

struct FeeStructure {
    uint256 heroBurnFee;
    uint256 heroAutoLpFee;
    uint256 vetsAutoLpFee;
    uint256 donationFee;
    uint256 buyAndBurnFee;
    uint256 stakeRewardsFee;
}

contract Hero is ERC20, ERC20Permit, ERC20Votes, Ownable {
    using SafeMath for uint256;

    address public immutable WPLS = 0xA1077a294dDE1B09bB078844df40758a5D0f9a27;
    address public immutable DAI = 0xefD766cCb38EaF1dfd701853BFCe31359239F305;
    address public immutable VETS = 0x4013abBf94A745EfA7cc848989Ee83424A770060;
    HeroBuyAndBurn public buyAndBurn;

    ITellor public tellor =
        ITellor(0xCe9DEa26eB6bEaEc73CFf3BACdF3F9e42BB89951);
    bytes32 public queryId =
        0x1f984b2c7cbcb7f024e5bdd873d8ca5d64e8696ff219ebede2374bf3217c9b75;

    uint8 public constant DECIMALS = 18;
    uint256 public constant INITIAL_SUPPLY = 100_000_000e18;
    uint256 public constant feeDenominator = 10000;

    uint256 public maxTxAmount;
    uint256 public feeDecayTime = 90 days;
    uint256 public baseSellFee = 1200;
    uint256 public minSellFee = 600;
    uint256 public heroBurnFee = 0;
    uint256 public donationFee = 5000;
    uint256 public vetsAutoLpFee = 2000;
    uint256 public heroAutoLpFee = 2000;
    uint256 public buyAndBurnFee = 1000;
    uint256 public stakeRewardsFee = 0;
    uint256 public constant FEE_DENOM = 10000;
    mapping(address user => uint256 startTime) public holderStartTime;

    address public feeDiscountNft;
    bool public feeDiscountEnabled = false;
    uint256 public nftFeeDiscountBps;

    address public autoLiquidityReceiver =
        0x43f31993D6025Ab6c39c82850d09972f908C02a8;
    address public donationReceiver =
        0x94E52915b99FFDD298939f9e0B4a7af80e6789f7;
    address public stakeRewardsReceiver = 0xCFa2b36cc681Ac47f12B1A52d15a690476106a81;

    IUniswapV2Router02 public immutable pulseRouterV1;
    IUniswapV2Router02 public immutable pulseRouterV2;
    address public pulseV2Pair;
    address[] public pairs;

    uint256 public launchedAt;
    bool public swapEnabled = true;
    uint256 public swapThreshold;
    bool private inSwap;

    uint256 public totalHeroBurned;
    uint256 public totalPlsVetsLpAdded;
    uint256 public totalUsdVetsLpAdded;
    uint256 public totalPlsHeroLpAdded;
    uint256 public totalUsdHeroLpAdded;
    uint256 public totalPlsDonated;
    uint256 public totalUsdDonated;
    uint256 public totalPlsBuyAndBurn;
    uint256 public totalPlsStakingRewards;

    modifier swapping() {
        inSwap = true;
        _;
        inSwap = false;
    }

    mapping(address => bool) public isFeeExempt;
    mapping(address => bool) public isTxLimitExempt;
    mapping(address => bool) public isPair;

    event AutoLiquify(uint256 amountWPLS, uint256 amountHero);
    event Launched(uint256 blockNumber, uint256 timestamp);
    event ParameterUpdated();
    event SwapBackSuccess(uint256 amount);
    event SwapBackFailed(string message);
    event TellorUpdated(address indexed tellor, bytes32 queryId);
    event FeeDiscountSettingsUpdated(address indexed nft, bool enabled, uint256 discountBps);

    constructor(uint32 _startTimestamp)
        ERC20("HERO Token for Veterans", "HERO")
        ERC20Permit("HERO Token for Veterans")
        Ownable()
    {
        pulseRouterV1 = IUniswapV2Router02(
            0x98bf93ebf5c380C0e6Ae8e192A7e2AE08edAcc02
        );
        pulseRouterV2 = IUniswapV2Router02(
            0x165C3410fC91EF562C50559f7d2289fEbed552d9
        );
        pulseV2Pair = IUniswapV2Factory(pulseRouterV2.factory()).createPair(
            WPLS,
            address(this)
        );
        pairs.push(pulseV2Pair);
        isPair[pulseV2Pair] = true;

        _approve(address(this), address(pulseRouterV2), type(uint256).max);
        IERC20(VETS).approve(address(pulseRouterV2), type(uint256).max);
        _mint(msg.sender, INITIAL_SUPPLY);
        buyAndBurn = new HeroBuyAndBurn(
            msg.sender,
            _startTimestamp,
            address(this),
            WPLS
        );

        maxTxAmount = INITIAL_SUPPLY;
        swapThreshold = INITIAL_SUPPLY / 1000;

        isFeeExempt[msg.sender] = true;
        isTxLimitExempt[msg.sender] = true;
        isFeeExempt[address(this)] = true;
        isTxLimitExempt[address(this)] = true;
        isFeeExempt[address(buyAndBurn)] = true;
        isTxLimitExempt[address(buyAndBurn)] = true;

        stakeRewardsReceiver = msg.sender;

        emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
    }

    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal override {
        require(
            launchedAt > 0 || tx.origin == owner(),
            "The contract is not launched yet"
        );

        if (inSwap) {
            super._transfer(sender, recipient, amount);
            return;
        }

        _checkTxLimit(sender, recipient, amount);

        if (_shouldSwapBack()) {
            swapBack();
        }

        if (holderStartTime[recipient] == 0) {
            holderStartTime[recipient] = block.timestamp;
        }

        uint256 amountReceived = _shouldTakeFee(sender, recipient)
            ? _takeFee(sender, recipient, amount)
            : amount;

        super._transfer(sender, recipient, amountReceived);
    }

    function _checkTxLimit(
        address sender,
        address recipient,
        uint256 amount
    ) internal view {
        require(
            amount <= maxTxAmount ||
                isTxLimitExempt[sender] ||
                isTxLimitExempt[recipient],
            "TX Limit Exceeded"
        );
    }

    function _shouldTakeFee(address sender, address recipient)
        internal
        view
        returns (bool)
    {
        if (isFeeExempt[sender] || isFeeExempt[recipient] || launchedAt == 0)
            return false;
        for (uint256 i; i < pairs.length; i++) {
            if (sender == pairs[i] || recipient == pairs[i]) return true;
        }
        return false;
    }

    function getTotalFee(
        address user
    ) public view returns (uint256) {
        uint256 lastTime = holderStartTime[user];
        uint256 timeElapsed = block.timestamp > lastTime
            ? block.timestamp - lastTime
            : 0;

        uint256 fee;
        if (timeElapsed >= feeDecayTime) {
            fee = minSellFee;
        } else {
            uint256 discount = baseSellFee.sub(minSellFee).mul(timeElapsed).div(
                feeDecayTime
            );
            fee = baseSellFee.sub(discount);
        }

        if (feeDiscountEnabled && feeDiscountNft != address(0) && nftFeeDiscountBps > 0) {
            try IERC721Minimal(feeDiscountNft).balanceOf(user) returns (uint256 bal) {
                if (bal > 0) {
                    uint256 feeReduction = fee.mul(nftFeeDiscountBps).div(FEE_DENOM);
                    fee = fee.sub(feeReduction);
                }
            } catch {}
        }
        return fee;
    }


    function _takeFee(
        address sender,
        address recipient,
        uint256 amount
    ) internal returns (uint256) {
        bool selling = false;
        for (uint256 i; i < pairs.length; i++) {
            if (recipient == pairs[i]) {
                selling = true;
                break;
            }
        }
        uint256 feeRate = getTotalFee(sender);
        uint256 feeAmount = amount.mul(feeRate).div(FEE_DENOM);
        super._transfer(sender, address(this), feeAmount);
        return amount.sub(feeAmount);
    }

    function _shouldSwapBack() internal view returns (bool) {
        return
            !isPair[msg.sender] &&
            !inSwap &&
            swapEnabled &&
            balanceOf(address(this)) >= swapThreshold;
    }

    function swapBack() internal swapping {
        uint256 amountHeroBurn = swapThreshold.mul(heroBurnFee).div(feeDenominator);
        uint256 amountHeroLp = swapThreshold.mul(heroAutoLpFee.div(2)).div(feeDenominator);

        if (amountHeroBurn > 0) {
            super._burn(address(this), amountHeroBurn);
            totalHeroBurned = totalHeroBurned.add(amountHeroBurn);
        }

        uint256 amountHeroSwap = swapThreshold
            .sub(amountHeroBurn)
            .sub(amountHeroLp);

        uint256 balanceBefore = address(this).balance;

        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = address(WPLS);

        try pulseRouterV2.swapExactTokensForETHSupportingFeeOnTransferTokens(
            amountHeroSwap,
            0,
            path,
            address(this),
            block.timestamp
        ) {
            uint256 amountPls = address(this).balance.sub(balanceBefore);
            uint256 distDenom = feeDenominator.sub(heroBurnFee).sub(heroAutoLpFee.div(2));
            
            uint256 tellorPrice = 0;
            try tellor.getDataBefore(queryId, block.timestamp) returns (bool , bytes memory valueBytes, uint256 ) {
                tellorPrice = abi.decode(valueBytes, (uint256));
            } catch {}
            
            {
                uint256 amountPlsVetsLiquidity = amountPls.mul(vetsAutoLpFee).div(distDenom);
                if (amountPlsVetsLiquidity > 0) {
                address[] memory path2 = new address[](2);
                path2[0] = address(WPLS);
                path2[1] = address(VETS);

                uint256 initialVetsBalance = IERC20(VETS).balanceOf(address(this));

                try pulseRouterV2.swapExactETHForTokens{value: amountPlsVetsLiquidity.div(2)}(
                    0,
                    path2,
                    address(this),
                    block.timestamp
                ) {
                    uint256 vetsReceived = IERC20(VETS).balanceOf(address(this)).sub(initialVetsBalance);
                    try pulseRouterV2.addLiquidityETH{value: amountPlsVetsLiquidity.div(2)}(
                        address(VETS),
                        vetsReceived,
                        0,
                        0,
                        autoLiquidityReceiver,
                        block.timestamp
                    ) {
                        emit AutoLiquify(vetsReceived, amountPlsVetsLiquidity.div(2));
                        totalPlsVetsLpAdded = totalPlsVetsLpAdded.add(amountPlsVetsLiquidity);
                        if (tellorPrice > 0) {
                            totalUsdVetsLpAdded = totalUsdVetsLpAdded.add(amountPlsVetsLiquidity.mul(tellorPrice).div(1e18));
                        }
                    } catch {
                        emit AutoLiquify(0, 0);
                    }
                } catch {}
                }

                uint256 amountPlsHeroLiquidity = amountPls.mul(heroAutoLpFee.div(2)).div(distDenom);
                if (amountPlsHeroLiquidity > 0) {
                    try pulseRouterV2.addLiquidityETH{value: amountPlsHeroLiquidity.div(2)}(
                        address(this),
                        amountHeroLp,
                        0,
                        0,
                        autoLiquidityReceiver,
                        block.timestamp
                    ) {
                    emit AutoLiquify(amountHeroLp, amountPlsHeroLiquidity.div(2));
                    totalPlsHeroLpAdded = totalPlsHeroLpAdded.add(amountPlsHeroLiquidity.mul(2));
                    if (tellorPrice > 0) {
                        totalUsdHeroLpAdded = totalUsdHeroLpAdded.add(amountPlsHeroLiquidity.mul(2).mul(tellorPrice).div(1e18));
                    }
                } catch {
                    emit AutoLiquify(0, 0);
                }
                }

                uint256 amountPlsBuyAndBurn = amountPls.mul(buyAndBurnFee).div(distDenom);
                if (amountPlsBuyAndBurn > 0) {
                    if (amountPlsBuyAndBurn > address(this).balance) {
                        amountPlsBuyAndBurn = address(this).balance;
                    }
                    buyAndBurn.distributePLSForBurning{value: amountPlsBuyAndBurn}();
                    totalPlsBuyAndBurn = totalPlsBuyAndBurn.add(amountPlsBuyAndBurn);
                }

                uint256 amountPlsDonation = amountPls.mul(donationFee).div(distDenom);
                if (amountPlsDonation > 0) {
                    if (amountPlsDonation > address(this).balance) {
                        amountPlsDonation = address(this).balance;
                    }

                    address[] memory dpath = new address[](2);
                    dpath[0] = address(WPLS);
                    dpath[1] = DAI;

                    uint256 daiBefore = IERC20(DAI).balanceOf(address(this));
                    bool swapped = false;
                    try pulseRouterV1.swapExactETHForTokens{value: amountPlsDonation}(
                        0,
                        dpath,
                        address(this),
                        block.timestamp
                    ) {
                        swapped = true;
                    } catch {}

                    if (swapped) {
                        uint256 daiAfter = IERC20(DAI).balanceOf(address(this));
                        uint256 daiReceived = daiAfter.sub(daiBefore);
                        if (daiReceived > 0) {
                            IERC20(DAI).transfer(donationReceiver, daiReceived);
                            totalUsdDonated = totalUsdDonated.add(daiReceived);
                        }
                    } else {
                        (bool success, ) = payable(donationReceiver).call{value: amountPlsDonation, gas: 30000}("");
                        success;
                    }

                    totalPlsDonated = totalPlsDonated.add(amountPlsDonation);
                }

                uint256 amountPlsStakeRewards = amountPls.mul(stakeRewardsFee).div(distDenom);
                if (amountPlsStakeRewards > 0) {
                    if (amountPlsStakeRewards > address(this).balance) {
                        amountPlsStakeRewards = address(this).balance;
                    }
                    (bool success2, ) = payable(stakeRewardsReceiver).call{value: amountPlsStakeRewards, gas: 30000}("");
                    success2;
                    totalPlsStakingRewards = totalPlsStakingRewards.add(amountPlsStakeRewards);
                }
            }

            if (address(this).balance > 0) {
                (bool success, ) = payable(owner()).call{value: address(this).balance, gas: 30000}("");
                success;
            }

            emit SwapBackSuccess(amountHeroSwap);
        } catch Error(string memory e) {
            emit SwapBackFailed(string(abi.encodePacked("SwapBack failed with error ", e)));
        } catch {
            emit SwapBackFailed("SwapBack failed without an error message from PulseX");
        }
    }

    function launch() external onlyOwner {
        require(launchedAt == 0, "Already launched");
        launchedAt = block.timestamp;
        emit Launched(block.number, block.timestamp);
    }

    function setTellor(address _tellor, bytes32 _queryId) external onlyOwner {
        require(_tellor != address(0), "Zero address");
        tellor = ITellor(_tellor);
        queryId = _queryId;
        emit TellorUpdated(_tellor, _queryId);
    }

    function setAutoLiquidityReceiver(address addr) external onlyOwner {
        require(addr != address(0), "Zero address");
        autoLiquidityReceiver = addr;
        emit ParameterUpdated();
    }
    
    function setDonationReceiver(address addr) external onlyOwner {
        require(addr != address(0), "Zero address");
        donationReceiver = addr;
        emit ParameterUpdated();
    }

    function setStakeRewardsReceiver(address addr) external onlyOwner {
        require(addr != address(0), "Zero address");
        stakeRewardsReceiver = addr;
        emit ParameterUpdated();
    }

    function setBuyAndBurnAddress(address addr) external onlyOwner {
        require(addr != address(0), "Zero address");
        buyAndBurn = HeroBuyAndBurn(payable(addr));
        isFeeExempt[addr] = true;
        isTxLimitExempt[addr] = true;
        emit ParameterUpdated();
    }

    function setTxLimit(uint256 amount) external onlyOwner {
        require(amount >= totalSupply() / 2000, "Too low");
        maxTxAmount = amount;
        emit ParameterUpdated();
    }

    function setFeeExempt(address addr, bool ex) external onlyOwner {
        isFeeExempt[addr] = ex;
        emit ParameterUpdated();
    }

    function setTxLimitExempt(address addr, bool ex) external onlyOwner {
        isTxLimitExempt[addr] = ex;
        emit ParameterUpdated();
    }

    function setFeeSettings(
        uint256 _feeDecayTime,
        uint256 _baseSellFee,
        uint256 _minSellFee
    ) external onlyOwner {
        require(_minSellFee <= _baseSellFee, "Min fee must be <= base fee");
        require(_baseSellFee <= 1500, "Base fee must be <= 15%");
        feeDecayTime = _feeDecayTime;
        baseSellFee = _baseSellFee;
        minSellFee = _minSellFee;
        emit ParameterUpdated();
    }

    function setFeeDiscountNft(address nft, uint256 discountBps, bool enabled) external onlyOwner {
        feeDiscountNft = nft;
        nftFeeDiscountBps = discountBps;
        feeDiscountEnabled = enabled;
        require(nftFeeDiscountBps <= FEE_DENOM, "Discount too high");
        emit FeeDiscountSettingsUpdated(feeDiscountNft, feeDiscountEnabled, nftFeeDiscountBps);
    }

    function isEligibleForNftDiscount(address user) external view returns (bool) {
        if (!feeDiscountEnabled || feeDiscountNft == address(0)) return false;
        try IERC721Minimal(feeDiscountNft).balanceOf(user) returns (uint256 bal) {
            return bal > 0;
        } catch {
            return false;
        }
    }

    function setFees(FeeStructure calldata fees) external onlyOwner {
        heroBurnFee = fees.heroBurnFee;
        heroAutoLpFee = fees.heroAutoLpFee;
        vetsAutoLpFee = fees.vetsAutoLpFee;
        donationFee = fees.donationFee;
        buyAndBurnFee = fees.buyAndBurnFee;
        stakeRewardsFee = fees.stakeRewardsFee;
        require(
            fees.heroBurnFee
                .add(fees.heroAutoLpFee)
                .add(fees.vetsAutoLpFee)
                .add(fees.donationFee)
                .add(fees.buyAndBurnFee)
                .add(fees.stakeRewardsFee) == FEE_DENOM,
            "Fees must add up to 100%"
        );
        emit ParameterUpdated();
    }

    function setSwapBackSettings(bool en, uint256 amt) external onlyOwner {
        swapEnabled = en;
        swapThreshold = amt;
        emit ParameterUpdated();
    }

    function addPair(address pair) external onlyOwner {
        require(!isPair[pair], "Exists");
        pairs.push(pair);
        isPair[pair] = true;
        emit ParameterUpdated();
    }

    function removePair(address pair) external onlyOwner {
        require(isPair[pair], "Pair does not exist");
        
        uint256 indexToRemove;
        bool found = false;
        for (uint256 i = 0; i < pairs.length; i++) {
            if (pairs[i] == pair) {
                indexToRemove = i;
                found = true;
                break;
            }
        }
        require(found, "Pair not found in array");
        
        pairs[indexToRemove] = pairs[pairs.length - 1];
        pairs.pop();
        isPair[pair] = false;
        
        emit ParameterUpdated();
    }

    function withdraw() external onlyOwner {
        payable(msg.sender).transfer(address(this).balance);
    }

    function withdrawTokens(address tok, uint256 amt) external onlyOwner {
        require(tok != address(this) && tok != address(0), "Invalid");
        IERC20(tok).transfer(msg.sender, amt);
    }

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal override(ERC20, ERC20Votes) {
        super._afterTokenTransfer(from, to, amount);
    }

    function _mint(address to, uint256 amount)
        internal override(ERC20, ERC20Votes)
    {
        super._mint(to, amount);
    }

    function _burn(address account, uint256 amount)
        internal override(ERC20, ERC20Votes)
    {
        super._burn(account, amount);
    }

    function nonces(address owner)
        public view override(ERC20Permit) returns (uint256)
    {
        return super.nonces(owner);
    }

    function clock() public view override returns (uint48) {
        return uint48(block.number);
    }

    function CLOCK_MODE() public pure override returns (string memory) {
        return "mode=blocknumber&from=default";
    }

    receive() external payable {}
}
        

@openzeppelin/contracts/interfaces/IERC5267.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}
          

@openzeppelin/contracts/interfaces/IERC5805.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5805.sol)

pragma solidity ^0.8.0;

import "../governance/utils/IVotes.sol";
import "./IERC6372.sol";

interface IERC5805 is IERC6372, IVotes {}
          

@openzeppelin/contracts/interfaces/IERC6372.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC6372.sol)

pragma solidity ^0.8.0;

interface IERC6372 {
    /**
     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
     */
    function clock() external view returns (uint48);

    /**
     * @dev Description of the clock
     */
    // solhint-disable-next-line func-name-mixedcase
    function CLOCK_MODE() external view returns (string memory);
}
          

@uniswap/v2-core/contracts/interfaces/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;
}
          

@uniswap/v2-periphery/contracts/interfaces/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);
}
          

@openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

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() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

@openzeppelin/contracts/governance/utils/IVotes.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.0;

/**
 * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
 *
 * _Available since v4.5._
 */
interface IVotes {
    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Returns the current amount of votes that `account` has.
     */
    function getVotes(address account) external view returns (uint256);

    /**
     * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     */
    function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     *
     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
     * Votes that have not been delegated are still part of total supply, even though they would not participate in a
     * vote.
     */
    function getPastTotalSupply(uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the delegate that `account` has chosen.
     */
    function delegates(address account) external view returns (address);

    /**
     * @dev Delegates votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) external;

    /**
     * @dev Delegates votes from signer to `delegatee`.
     */
    function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
}
          

@openzeppelin/contracts/security/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * 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}.
     *
     * 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 default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual 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:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, 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}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, 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}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, 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) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, 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) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, 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;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _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;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _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 Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - 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
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/cryptography/EIP712.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @inheritdoc IERC20Permit
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @inheritdoc IERC20Permit
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @inheritdoc IERC20Permit
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}
          

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Votes.sol)

pragma solidity ^0.8.0;

import "./ERC20Permit.sol";
import "../../../interfaces/IERC5805.sol";
import "../../../utils/math/Math.sol";
import "../../../utils/math/SafeCast.sol";
import "../../../utils/cryptography/ECDSA.sol";

/**
 * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,
 * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.
 *
 * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
 *
 * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
 * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
 * power can be queried through the public accessors {getVotes} and {getPastVotes}.
 *
 * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
 * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
 *
 * _Available since v4.2._
 */
abstract contract ERC20Votes is ERC20Permit, IERC5805 {
    struct Checkpoint {
        uint32 fromBlock;
        uint224 votes;
    }

    bytes32 private constant _DELEGATION_TYPEHASH =
        keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    mapping(address => address) private _delegates;
    mapping(address => Checkpoint[]) private _checkpoints;
    Checkpoint[] private _totalSupplyCheckpoints;

    /**
     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
     */
    function clock() public view virtual override returns (uint48) {
        return SafeCast.toUint48(block.number);
    }

    /**
     * @dev Description of the clock
     */
    // solhint-disable-next-line func-name-mixedcase
    function CLOCK_MODE() public view virtual override returns (string memory) {
        // Check that the clock was not modified
        require(clock() == block.number, "ERC20Votes: broken clock mode");
        return "mode=blocknumber&from=default";
    }

    /**
     * @dev Get the `pos`-th checkpoint for `account`.
     */
    function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
        return _checkpoints[account][pos];
    }

    /**
     * @dev Get number of checkpoints for `account`.
     */
    function numCheckpoints(address account) public view virtual returns (uint32) {
        return SafeCast.toUint32(_checkpoints[account].length);
    }

    /**
     * @dev Get the address `account` is currently delegating to.
     */
    function delegates(address account) public view virtual override returns (address) {
        return _delegates[account];
    }

    /**
     * @dev Gets the current votes balance for `account`
     */
    function getVotes(address account) public view virtual override returns (uint256) {
        uint256 pos = _checkpoints[account].length;
        unchecked {
            return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
        }
    }

    /**
     * @dev Retrieve the number of votes for `account` at the end of `timepoint`.
     *
     * Requirements:
     *
     * - `timepoint` must be in the past
     */
    function getPastVotes(address account, uint256 timepoint) public view virtual override returns (uint256) {
        require(timepoint < clock(), "ERC20Votes: future lookup");
        return _checkpointsLookup(_checkpoints[account], timepoint);
    }

    /**
     * @dev Retrieve the `totalSupply` at the end of `timepoint`. Note, this value is the sum of all balances.
     * It is NOT the sum of all the delegated votes!
     *
     * Requirements:
     *
     * - `timepoint` must be in the past
     */
    function getPastTotalSupply(uint256 timepoint) public view virtual override returns (uint256) {
        require(timepoint < clock(), "ERC20Votes: future lookup");
        return _checkpointsLookup(_totalSupplyCheckpoints, timepoint);
    }

    /**
     * @dev Lookup a value in a list of (sorted) checkpoints.
     */
    function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 timepoint) private view returns (uint256) {
        // We run a binary search to look for the last (most recent) checkpoint taken before (or at) `timepoint`.
        //
        // Initially we check if the block is recent to narrow the search range.
        // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
        // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
        // - If the middle checkpoint is after `timepoint`, we look in [low, mid)
        // - If the middle checkpoint is before or equal to `timepoint`, we look in [mid+1, high)
        // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
        // out of bounds (in which case we're looking too far in the past and the result is 0).
        // Note that if the latest checkpoint available is exactly for `timepoint`, we end up with an index that is
        // past the end of the array, so we technically don't find a checkpoint after `timepoint`, but it works out
        // the same.
        uint256 length = ckpts.length;

        uint256 low = 0;
        uint256 high = length;

        if (length > 5) {
            uint256 mid = length - Math.sqrt(length);
            if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);
            if (_unsafeAccess(ckpts, mid).fromBlock > timepoint) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        unchecked {
            return high == 0 ? 0 : _unsafeAccess(ckpts, high - 1).votes;
        }
    }

    /**
     * @dev Delegate votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) public virtual override {
        _delegate(_msgSender(), delegatee);
    }

    /**
     * @dev Delegates votes from signer to `delegatee`
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= expiry, "ERC20Votes: signature expired");
        address signer = ECDSA.recover(
            _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
            v,
            r,
            s
        );
        require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
        _delegate(signer, delegatee);
    }

    /**
     * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
     */
    function _maxSupply() internal view virtual returns (uint224) {
        return type(uint224).max;
    }

    /**
     * @dev Snapshots the totalSupply after it has been increased.
     */
    function _mint(address account, uint256 amount) internal virtual override {
        super._mint(account, amount);
        require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");

        _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
    }

    /**
     * @dev Snapshots the totalSupply after it has been decreased.
     */
    function _burn(address account, uint256 amount) internal virtual override {
        super._burn(account, amount);

        _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
    }

    /**
     * @dev Move voting power when tokens are transferred.
     *
     * Emits a {IVotes-DelegateVotesChanged} event.
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override {
        super._afterTokenTransfer(from, to, amount);

        _moveVotingPower(delegates(from), delegates(to), amount);
    }

    /**
     * @dev Change delegation for `delegator` to `delegatee`.
     *
     * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.
     */
    function _delegate(address delegator, address delegatee) internal virtual {
        address currentDelegate = delegates(delegator);
        uint256 delegatorBalance = balanceOf(delegator);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveVotingPower(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveVotingPower(address src, address dst, uint256 amount) private {
        if (src != dst && amount > 0) {
            if (src != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
                emit DelegateVotesChanged(src, oldWeight, newWeight);
            }

            if (dst != address(0)) {
                (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
                emit DelegateVotesChanged(dst, oldWeight, newWeight);
            }
        }
    }

    function _writeCheckpoint(
        Checkpoint[] storage ckpts,
        function(uint256, uint256) view returns (uint256) op,
        uint256 delta
    ) private returns (uint256 oldWeight, uint256 newWeight) {
        uint256 pos = ckpts.length;

        unchecked {
            Checkpoint memory oldCkpt = pos == 0 ? Checkpoint(0, 0) : _unsafeAccess(ckpts, pos - 1);

            oldWeight = oldCkpt.votes;
            newWeight = op(oldWeight, delta);

            if (pos > 0 && oldCkpt.fromBlock == clock()) {
                _unsafeAccess(ckpts, pos - 1).votes = SafeCast.toUint224(newWeight);
            } else {
                ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(clock()), votes: SafeCast.toUint224(newWeight)}));
            }
        }
    }

    function _add(uint256 a, uint256 b) private pure returns (uint256) {
        return a + b;
    }

    function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds.
     */
    function _unsafeAccess(Checkpoint[] storage ckpts, uint256 pos) private pure returns (Checkpoint storage result) {
        assembly {
            mstore(0, ckpts.slot)
            result.slot := add(keccak256(0, 0x20), pos)
        }
    }
}
          

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

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/extensions/IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

@openzeppelin/contracts/utils/Counters.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}
          

@openzeppelin/contracts/utils/ShortStrings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}
          

@openzeppelin/contracts/utils/StorageSlot.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

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

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/Strings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/cryptography/ECDSA.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}
          

@openzeppelin/contracts/utils/cryptography/EIP712.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}
          

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}
          

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

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

pragma solidity ^0.8.0;

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

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

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

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

@uniswap/v2-periphery/contracts/interfaces/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/Pulsechain/HeroBuyAndBurn.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

/* === OZ === */
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/* === UNISWAP V2 === */
import {IUniswapV2Router02} from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";


/**
 * @title HeroBuyAndBurn Contract
 * @author BuildTheTech.com
 * @notice This contract receives PLS from a charging contract, and at regular intervals,
 * uses an allocated portion of the PLS to buy HERO tokens and immediately burn them.
 * The process is triggered by any external user, who receives an incentive for doing so.
 */
contract HeroBuyAndBurn is ReentrancyGuard, Ownable {
    
    /* ================================================================
                         STATE VARIABLES & CONSTANTS
    ================================================================ */  
    // --- Interval Mechanics ---
    struct Interval {
        uint256 amountAllocated;
        uint256 amountProcessed;
    }
    uint256 public startTimeStamp;
    uint256 public lastBurnIntervalNumber;
    uint256 public lastBurnIntervalStartTimestamp;
    mapping(uint256 => Interval) public plsIntervalsBurn;

    // --- Constants & Immutable ---
    IUniswapV2Router02 public immutable pulseXRouterV1 = IUniswapV2Router02(0x98bf93ebf5c380C0e6Ae8e192A7e2AE08edAcc02);
    IUniswapV2Router02 public immutable pulseXRouterV2 = IUniswapV2Router02(0x165C3410fC91EF562C50559f7d2289fEbed552d9);
    IUniswapV2Router02 public immutable nineinchRouter = IUniswapV2Router02(0xeB45a3c4aedd0F47F345fB4c8A1802BB5740d725);

    address public immutable WPLS;
    address public immutable HERO;
    address private constant DEAD = 0x000000000000000000000000000000000000dEaD;
    
    uint256 public constant incentiveFeeBps = 150;
    uint256 public constant intervalTime = 30 minutes;

    // --- Configurable Settings ---
    uint256 public dailyAllocationBps;

    // --- Balances and Totals ---
    uint256 public totalPlsForBurning;
    uint256 public totalHeroBurned;

    /* ================================================================
                                     EVENTS
    ================================================================ */

    event PlsReceived(address indexed from, uint256 amount);
    event BuyAndBurn(
        uint256 plsUsedForSwap,
        uint256 heroBurned,
        uint256 incentivePaid,
        address indexed caller
    );
    event SettingsUpdated(string setting, uint256 newValue);


    /* ================================================================
                                     ERRORS
    ================================================================ */

    error NotStartedYet();
    error IntervalAlreadyProcessed();
    error InvalidSetting();
    error NoAllocationAvailable();
    error InvalidInput();
    error SwapFailed();

    /* ================================================================
                                   MODIFIERS
    ================================================================ */

    modifier intervalUpdate() {
        _syncTotalPlsForBurning();
        _intervalUpdatePlsForBurning();
        _;
    }

    /* ================================================================
                                  CONSTRUCTOR
    ================================================================ */

    constructor(
        address _initialOwner,
        uint32 _startTimestamp,
        address _heroAddress,
        address _wplsAddress
    ) Ownable() {
        require(_heroAddress != address(0) && _wplsAddress != address(0), "Invalid token address");

        startTimeStamp = _startTimestamp;
        HERO = _heroAddress;
        WPLS = _wplsAddress;

        dailyAllocationBps = 100;
        lastBurnIntervalStartTimestamp = _startTimestamp;

        _transferOwnership(_initialOwner);
    }


    /* ================================================================
                                 CORE LOGIC
    ================================================================ */

    receive() external payable {
        _syncTotalPlsForBurning();
        emit PlsReceived(msg.sender, msg.value);
    }

    function distributePLSForBurning() external payable {
        if (msg.value == 0) revert InvalidInput();

        _syncTotalPlsForBurning();
        emit PlsReceived(msg.sender, msg.value);
    }

    function buyAndBurn(uint256 _deadline) external nonReentrant intervalUpdate {
        Interval storage currentInterval = plsIntervalsBurn[lastBurnIntervalNumber];
        if (currentInterval.amountProcessed != 0) revert IntervalAlreadyProcessed();

        uint256 plsToProcess = currentInterval.amountAllocated;
        if (plsToProcess == 0) revert NoAllocationAvailable();
    
        currentInterval.amountProcessed = currentInterval.amountAllocated;

        uint256 incentiveAmount = (plsToProcess * incentiveFeeBps) / 10_000;
        uint256 plsToSwap = plsToProcess - incentiveAmount;

        uint256 heroBought = _swapPlsForHero(plsToSwap, _deadline);
        if (heroBought == 0) revert SwapFailed();
        _burnHero(heroBought);

        totalPlsForBurning -= plsToProcess;
        totalHeroBurned += heroBought;

        if (incentiveAmount > 0) {
            (bool success, ) = msg.sender.call{value: incentiveAmount}("");
            require(success, "Incentive payment failed");
        }

        emit BuyAndBurn(plsToSwap, heroBought, incentiveAmount, msg.sender);
    }
    
    /* ================================================================
                              INTERNAL FUNCTIONS
    ================================================================ */

    function _intervalUpdatePlsForBurning() internal {
        if (block.timestamp < startTimeStamp) revert NotStartedYet();

        uint256 timeElapsed = block.timestamp - lastBurnIntervalStartTimestamp;
        if (timeElapsed < intervalTime) return;

        uint256 intervals_per_day = (24 hours) / intervalTime;
        
        uint256 missedIntervals = (timeElapsed / intervalTime) - 1;

        uint256 dailyAllocation = (totalPlsForBurning * dailyAllocationBps) / 10_000;
        uint256 amountPerInterval = dailyAllocation / intervals_per_day;
        
        uint256 totalAmountForInterval = amountPerInterval * (missedIntervals + 1);

        if (totalAmountForInterval > totalPlsForBurning) {
            totalAmountForInterval = uint256(totalPlsForBurning);
        }

        uint256 newIntervalNumber = lastBurnIntervalNumber + missedIntervals + 1;
        
        plsIntervalsBurn[newIntervalNumber] = Interval({
            amountAllocated: totalAmountForInterval,
            amountProcessed: 0
        });

        lastBurnIntervalNumber = newIntervalNumber;
        lastBurnIntervalStartTimestamp = lastBurnIntervalStartTimestamp + ((missedIntervals + 1) * uint32(intervalTime));
    }

    function _syncTotalPlsForBurning() internal {
        totalPlsForBurning = address(this).balance;
    }

    function _swapPlsForHero(uint256 _plsAmount, uint256 _deadline) internal returns (uint256) {
        if (_plsAmount == 0) return 0;

        address[] memory path = new address[](2);
        path[0] = WPLS;
        path[1] = HERO;

        address bestRouter = getBestRouter(_plsAmount, path);
        if (bestRouter == address(0)) revert SwapFailed();

        uint256 balanceBefore = IERC20(HERO).balanceOf(address(this));
        IUniswapV2Router02(bestRouter).swapExactETHForTokensSupportingFeeOnTransferTokens{value: _plsAmount}(
            0,
            path,
            address(this),
            _deadline
        );
        uint256 balanceAfter = IERC20(HERO).balanceOf(address(this));
        return balanceAfter - balanceBefore;
    }

    function _burnHero(uint256 _heroAmount) internal {
        IERC20(HERO).transfer(DEAD, _heroAmount);
    }
    
    /* ================================================================
                             OWNER FUNCTIONS
    ================================================================ */
    
    function setDailyAllocationBps(uint256 _newAllocationBps) external onlyOwner {
        if (_newAllocationBps > 2_500) revert InvalidSetting();
        dailyAllocationBps = _newAllocationBps;
        emit SettingsUpdated("DailyAllocationBps", _newAllocationBps);
    }

    function withdrawTokens(address _token, address _to) external onlyOwner {
        uint256 balance = IERC20(_token).balanceOf(address(this));
        require(balance > 0, "No tokens to withdraw");
        IERC20(_token).transfer(_to, balance);
    }

    /* ================================================================
                                VIEW FUNCTIONS
    ================================================================ */

    function getBestRouter(
        uint256 amountIn,
        address[] memory path
    ) public view returns (address bestRouter) {
        address[] memory routers = new address[](3);
        routers[0] = address(pulseXRouterV1);
        routers[1] = address(pulseXRouterV2);
        routers[2] = address(nineinchRouter);

        uint256 bestAmountOut = 0;

        for (uint256 i = 0; i < routers.length; i++) {
            try
                IUniswapV2Router02(routers[i]).getAmountsOut(amountIn, path)
            returns (uint256[] memory amountsOut) {
                uint256 amountOut = amountsOut[amountsOut.length - 1];
                if (amountOut > bestAmountOut) {
                    bestAmountOut = amountOut;
                    bestRouter = routers[i];
                }
            } catch {
                continue;
            }
        }
    }
}
          

Compiler Settings

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint32","name":"_startTimestamp","internalType":"uint32"}]},{"type":"error","name":"InvalidShortString","inputs":[]},{"type":"error","name":"StringTooLong","inputs":[{"type":"string","name":"str","internalType":"string"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"AutoLiquify","inputs":[{"type":"uint256","name":"amountWPLS","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountHero","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"DelegateChanged","inputs":[{"type":"address","name":"delegator","internalType":"address","indexed":true},{"type":"address","name":"fromDelegate","internalType":"address","indexed":true},{"type":"address","name":"toDelegate","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"DelegateVotesChanged","inputs":[{"type":"address","name":"delegate","internalType":"address","indexed":true},{"type":"uint256","name":"previousBalance","internalType":"uint256","indexed":false},{"type":"uint256","name":"newBalance","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EIP712DomainChanged","inputs":[],"anonymous":false},{"type":"event","name":"FeeDiscountSettingsUpdated","inputs":[{"type":"address","name":"nft","internalType":"address","indexed":true},{"type":"bool","name":"enabled","internalType":"bool","indexed":false},{"type":"uint256","name":"discountBps","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Launched","inputs":[{"type":"uint256","name":"blockNumber","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","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":"ParameterUpdated","inputs":[],"anonymous":false},{"type":"event","name":"SwapBackFailed","inputs":[{"type":"string","name":"message","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"SwapBackSuccess","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TellorUpdated","inputs":[{"type":"address","name":"tellor","internalType":"address","indexed":true},{"type":"bytes32","name":"queryId","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"pure","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"CLOCK_MODE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"DAI","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"DECIMALS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DOMAIN_SEPARATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"FEE_DENOM","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"INITIAL_SUPPLY","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"VETS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"WPLS","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addPair","inputs":[{"type":"address","name":"pair","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"autoLiquidityReceiver","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"baseSellFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract HeroBuyAndBurn"}],"name":"buyAndBurn","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"buyAndBurnFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct ERC20Votes.Checkpoint","components":[{"type":"uint32","name":"fromBlock","internalType":"uint32"},{"type":"uint224","name":"votes","internalType":"uint224"}]}],"name":"checkpoints","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint32","name":"pos","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint48","name":"","internalType":"uint48"}],"name":"clock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delegate","inputs":[{"type":"address","name":"delegatee","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delegateBySig","inputs":[{"type":"address","name":"delegatee","internalType":"address"},{"type":"uint256","name":"nonce","internalType":"uint256"},{"type":"uint256","name":"expiry","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"delegates","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"donationFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"donationReceiver","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes1","name":"fields","internalType":"bytes1"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"version","internalType":"string"},{"type":"uint256","name":"chainId","internalType":"uint256"},{"type":"address","name":"verifyingContract","internalType":"address"},{"type":"bytes32","name":"salt","internalType":"bytes32"},{"type":"uint256[]","name":"extensions","internalType":"uint256[]"}],"name":"eip712Domain","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeDecayTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeDenominator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"feeDiscountEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeDiscountNft","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPastTotalSupply","inputs":[{"type":"uint256","name":"timepoint","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPastVotes","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"timepoint","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalFee","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVotes","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"heroAutoLpFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"heroBurnFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"startTime","internalType":"uint256"}],"name":"holderStartTime","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isEligibleForNftDiscount","inputs":[{"type":"address","name":"user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isFeeExempt","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPair","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTxLimitExempt","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"launch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"launchedAt","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxTxAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minSellFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nftFeeDiscountBps","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nonces","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"numCheckpoints","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pairs","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"permit","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IUniswapV2Router02"}],"name":"pulseRouterV1","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IUniswapV2Router02"}],"name":"pulseRouterV2","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pulseV2Pair","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"queryId","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removePair","inputs":[{"type":"address","name":"pair","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAutoLiquidityReceiver","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBuyAndBurnAddress","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDonationReceiver","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeDiscountNft","inputs":[{"type":"address","name":"nft","internalType":"address"},{"type":"uint256","name":"discountBps","internalType":"uint256"},{"type":"bool","name":"enabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeExempt","inputs":[{"type":"address","name":"addr","internalType":"address"},{"type":"bool","name":"ex","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeSettings","inputs":[{"type":"uint256","name":"_feeDecayTime","internalType":"uint256"},{"type":"uint256","name":"_baseSellFee","internalType":"uint256"},{"type":"uint256","name":"_minSellFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFees","inputs":[{"type":"tuple","name":"fees","internalType":"struct FeeStructure","components":[{"type":"uint256","name":"heroBurnFee","internalType":"uint256"},{"type":"uint256","name":"heroAutoLpFee","internalType":"uint256"},{"type":"uint256","name":"vetsAutoLpFee","internalType":"uint256"},{"type":"uint256","name":"donationFee","internalType":"uint256"},{"type":"uint256","name":"buyAndBurnFee","internalType":"uint256"},{"type":"uint256","name":"stakeRewardsFee","internalType":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStakeRewardsReceiver","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSwapBackSettings","inputs":[{"type":"bool","name":"en","internalType":"bool"},{"type":"uint256","name":"amt","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTellor","inputs":[{"type":"address","name":"_tellor","internalType":"address"},{"type":"bytes32","name":"_queryId","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTxLimit","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTxLimitExempt","inputs":[{"type":"address","name":"addr","internalType":"address"},{"type":"bool","name":"ex","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stakeRewardsFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"stakeRewardsReceiver","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"swapEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"swapThreshold","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITellor"}],"name":"tellor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalHeroBurned","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPlsBuyAndBurn","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPlsDonated","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPlsHeroLpAdded","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPlsStakingRewards","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPlsVetsLpAdded","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalUsdDonated","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalUsdHeroLpAdded","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalUsdVetsLpAdded","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"vetsAutoLpFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawTokens","inputs":[{"type":"address","name":"tok","internalType":"address"},{"type":"uint256","name":"amt","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x61020060405273a1077a294dde1b09bb078844df40758a5d0f9a276101605273efd766ccb38eaf1dfd701853bfce31359239f30561018052734013abbf94a745efa7cc848989ee83424a7700606101a052600e80546001600160a01b031990811673ce9dea26eb6beaec73cff3bacdf3f9e42bb89951179091557f1f984b2c7cbcb7f024e5bdd873d8ca5d64e8696ff219ebede2374bf3217c9b75600f556276a7006011556104b0601255610258601355600060148190556113886015556107d060168190556017556103e8601855601955601b805460ff60a01b19169055601d805482167343f31993d6025ab6c39c82850d09972f908c02a8179055601e805482167394e52915b99ffdd298939f9e0b4a7af80e6789f7179055601f805490911673cfa2b36cc681ac47f12b1a52d15a690476106a811790556023805460ff1916600117905534801561015257600080fd5b50604051617c48380380617c4883398101604081905261017191610d90565b6040518060400160405280601781526020017f4845524f20546f6b656e20666f72205665746572616e7300000000000000000081525080604051806040016040528060018152602001603160f81b8152506040518060400160405280601781526020017f4845524f20546f6b656e20666f72205665746572616e73000000000000000000815250604051806040016040528060048152602001634845524f60e01b81525081600390816102249190610e54565b5060046102318282610e54565b5061024191508390506005610677565b61012052610250816006610677565b61014052815160208084019190912060e052815190820120610100524660a0526102dd60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506102f0336106aa565b7398bf93ebf5c380c0e6ae8e192a7e2ae08edacc026101c05273165c3410fc91ef562c50559f7d2289febed552d96101e08190526040805163c45a015560e01b8152905163c45a0155916004808201926020929091908290030181865afa15801561035f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103839190610f12565b610160516040516364e329cb60e11b81526001600160a01b03918216600482015230602482015291169063c9c65396906044016020604051808303816000875af11580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f99190610f12565b602080546001600160a01b039283166001600160a01b0319918216811783556021805460018181019092557f3a6357012c1a3ae0a17d304c9920310382d968ebcc4b1771f41c6b304205b57001805490931690911790915581549092166000908152603190915260409020805460ff191690911790556101e0516104819030906000196106fc565b6101a0516101e05160405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af11580156104d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fd9190610f3b565b50610513336a52b7d2dcc80cd2e4000000610825565b3381306101605160405161052690610d83565b6001600160a01b03948516815263ffffffff90931660208401529083166040830152919091166060820152608001604051809103906000f080158015610570573d6000803e3d6000fd5b50600d80546001600160a01b0319166001600160a01b03929092169190911790556a52b7d2dcc80cd2e400000060108190556105af906103e890610f73565b602455336000818152602f602081815260408084208054600160ff1991821681179092556030808552838720805483168417905530875285855283872080548316841790558085528387208054831684179055600d80546001600160a01b0390811689529686528488208054841685179055549095168652938352818520805490941617909255601f80546001600160a01b0319168517905590516a52b7d2dcc80cd2e40000008152600080516020617c08833981519152910160405180910390a35061102d565b60006020835110156106935761068c83610833565b90506106a4565b8161069e8482610e54565b5060ff90505b92915050565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0383166107635760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6001600160a01b0382166107c45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161075a565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b61082f8282610871565b5050565b600080829050601f8151111561085e578260405163305a27a960e01b815260040161075a9190610f95565b805161086982610fe3565b179392505050565b61087b828261090f565b6001600160e01b0361088d6109c48216565b11156108f45760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201526f766572666c6f77696e6720766f74657360801b606482015260840161075a565b610909600b6124f96109ca60201b17836109dd565b50505050565b6001600160a01b0382166109655760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161075a565b80600260008282546109779190611007565b90915550506001600160a01b03821660008181526020818152604080832080548601905551848152600080516020617c08833981519152910160405180910390a361082f60008383610b50565b60025490565b60006109d68284611007565b9392505050565b82546000908190818115610a2a5760008781526020902082016000190160408051808201909152905463ffffffff8116825264010000000090046001600160e01b03166020820152610a3f565b60408051808201909152600080825260208201525b905080602001516001600160e01b03169350610a5c84868860201c565b9250600082118015610a7c5750805163ffffffff1665ffffffffffff4316145b15610ac157610a8a83610b5f565b60008881526020902083016000190180546001600160e01b03929092166401000000000263ffffffff909216919091179055610b41565b866040518060400160405280610aeb610ade610b5b60201b60201c565b65ffffffffffff16610bcc565b63ffffffff168152602001610aff86610b5f565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b5050935093915050565b505050565b610b4b838383610c31565b4390565b60006001600160e01b03821115610bc85760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b606482015260840161075a565b5090565b600063ffffffff821115610bc85760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b606482015260840161075a565b6001600160a01b03838116600090815260096020526040808220548584168352912054610b4b92918216911683818314801590610c6e5750600081115b15610b4b576001600160a01b03831615610cf3576001600160a01b0383166000908152600a6020908152604082208291610cb29190610d77901b61250517856109dd565b91509150846001600160a01b0316600080516020617c288339815191528383604051610ce8929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610b4b576001600160a01b0382166000908152600a6020908152604082208291610d3291906109ca901b6124f917856109dd565b91509150836001600160a01b0316600080516020617c288339815191528383604051610d68929190918252602082015260400190565b60405180910390a25050505050565b60006109d6828461101a565b611730806164d883390190565b600060208284031215610da257600080fd5b815163ffffffff811681146109d657600080fd5b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610de057607f821691505b602082108103610e0057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610b4b57806000526020600020601f840160051c81016020851015610e2d5750805b601f840160051c820191505b81811015610e4d5760008155600101610e39565b5050505050565b81516001600160401b03811115610e6d57610e6d610db6565b610e8181610e7b8454610dcc565b84610e06565b6020601f821160018114610eb55760008315610e9d5750848201515b600019600385901b1c1916600184901b178455610e4d565b600084815260208120601f198516915b82811015610ee55787850151825560209485019460019092019101610ec5565b5084821015610f035786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b600060208284031215610f2457600080fd5b81516001600160a01b03811681146109d657600080fd5b600060208284031215610f4d57600080fd5b815180151581146109d657600080fd5b634e487b7160e01b600052601160045260246000fd5b600082610f9057634e487b7160e01b600052601260045260246000fd5b500490565b602081526000825180602084015260005b81811015610fc35760208186018101516040868401015201610fa6565b506000604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610e005760001960209190910360031b1b16919050565b808201808211156106a4576106a4610f5d565b818103818111156106a4576106a4610f5d565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e0516153aa61112e60003960008181610970015281816131d701528181613595015281816136cc0152613870015260008181610c4a0152613bec015260008181610f58015281816134be0152818161351e015281816136550152613719015260008181610fcc01528181613b1b01528181613b7b01528181613ca70152613d59015260008181611030015281816131800152818161346a0152613ac70152600061198f0152600061196401526000612948015260006129200152600061287b015260006128a5015260006128cf01526153aa6000f3fe6080604052600436106105065760003560e01c80636ddd171311610297578063a457c2d711610165578063cc34fe2f116100cc578063e0bab4c411610085578063e0bab4c414610fba578063e5e31b1314610fee578063ef8ef56f1461101e578063f1127ed814611052578063f2fde38b1461109c578063f6cf9d7a146110bc57600080fd5b8063cc34fe2f14610efa578063d073a01f14610f10578063d505accf14610f26578063d5cf793314610f46578063dd62ed3e14610f7a578063df20fd4914610f9a57600080fd5b8063b7b22a5d1161011e578063b7b22a5d14610e44578063b91ac78814610e64578063bf56b37114610e84578063c2b7bbb614610e9a578063c3cda52014610eba578063ca33e64c14610eda57600080fd5b8063a457c2d714610d8e578063a69436dd14610dae578063a9059cbb14610dc4578063aa6df29914610de4578063af6c9c1d14610e04578063b15febdc14610e2457600080fd5b80638c232838116102095780638ebfc796116101c25780638ebfc79614610ce057806391ddadf414610d0057806395d89b4114610d23578063996ed2d914610d385780639ab24eb014610d4e5780639f97fdbb14610d6e57600080fd5b80638c23283814610c185780638d5396e914610c385780638d79843214610c6c5780638d7a8ba714610c825780638da5cb5b14610ca25780638e539e8c14610cc057600080fd5b80637ecebe001161025b5780637ecebe0014610b5e57806384b0196e14610b7e5780638587441514610ba65780638b143b2714610bbc5780638b42507f14610bd25780638c0b5e2214610c0257600080fd5b80636ddd171314610aa45780636fcfff4514610abe57806370a0823114610af3578063715018a614610b295780637606150414610b3e57600080fd5b8063365904ec116103d457806345f5163a116103465780635c19a95c116102ff5780635c19a95c146109eb5780635c85974f14610a0b5780636083dab614610a2b57806363b4022c14610a58578063640bbea114610a7857806366ba9f5914610a8e57600080fd5b806345f5163a146108f85780634886c6751461065e5780634bf5d7e9146109185780634f15999a1461095e578063552a378414610992578063587cde1e146109b257600080fd5b80633d082266116103985780633d082266146108505780633d3662a8146108665780633f1be4d41461087c5780633f4218e01461089257806343cb5b29146108c2578063451240a8146108e257600080fd5b8063365904ec146107ba578063385909dc146107db57806339509351146107fb5780633a46b1a81461081b5780633ccfd60b1461083b57600080fd5b806318160ddd1161047857806325e4c4431161043157806325e4c44314610715578063289dcbba146107355780632e0f26251461074b5780632ff2e9dc14610772578063313ce567146107915780633644e515146107a557600080fd5b806318160ddd146106745780631959ad5b14610689578063213ea6bb146106a95780632172ab21146106c957806323b2d780146106df57806323b872dd146106f557600080fd5b8063095ea7b3116104ca578063095ea7b3146105aa5780630d1554bf146105da5780630dd4375514610612578063118d6a9814610628578063138a4c271461063e578063180b0d7e1461065e57600080fd5b806301339c2114610512578063020c7be7146105295780630445b6671461055257806306b091f91461056857806306fdde031461058857600080fd5b3661050d57005b600080fd5b34801561051e57600080fd5b506105276110d2565b005b34801561053557600080fd5b5061053f60275481565b6040519081526020015b60405180910390f35b34801561055e57600080fd5b5061053f60245481565b34801561057457600080fd5b50610527610583366004614a69565b611164565b34801561059457600080fd5b5061059d611239565b6040516105499190614ae3565b3480156105b657600080fd5b506105ca6105c5366004614a69565b6112cb565b6040519015158152602001610549565b3480156105e657600080fd5b506020546105fa906001600160a01b031681565b6040516001600160a01b039091168152602001610549565b34801561061e57600080fd5b5061053f60265481565b34801561063457600080fd5b5061053f602b5481565b34801561064a57600080fd5b50610527610659366004614b04565b6112e5565b34801561066a57600080fd5b5061053f61271081565b34801561068057600080fd5b5060025461053f565b34801561069557600080fd5b50600e546105fa906001600160a01b031681565b3480156106b557600080fd5b50601e546105fa906001600160a01b031681565b3480156106d557600080fd5b5061053f60115481565b3480156106eb57600080fd5b5061053f60135481565b34801561070157600080fd5b506105ca610710366004614b44565b6113bb565b34801561072157600080fd5b50610527610730366004614b81565b6113df565b34801561074157600080fd5b5061053f60175481565b34801561075757600080fd5b50610760601281565b60405160ff9091168152602001610549565b34801561077e57600080fd5b5061053f6a52b7d2dcc80cd2e400000081565b34801561079d57600080fd5b506012610760565b3480156107b157600080fd5b5061053f6114aa565b3480156107c657600080fd5b50601b546105ca90600160a01b900460ff1681565b3480156107e757600080fd5b506105ca6107f6366004614b9c565b6114b9565b34801561080757600080fd5b506105ca610816366004614a69565b61156a565b34801561082757600080fd5b5061053f610836366004614a69565b61158c565b34801561084757600080fd5b5061052761160a565b34801561085c57600080fd5b5061053f60155481565b34801561087257600080fd5b5061053f601c5481565b34801561088857600080fd5b5061053f600f5481565b34801561089e57600080fd5b506105ca6108ad366004614b9c565b602f6020526000908152604090205460ff1681565b3480156108ce57600080fd5b506105276108dd366004614a69565b611641565b3480156108ee57600080fd5b5061053f60145481565b34801561090457600080fd5b50610527610913366004614b9c565b6116c9565b34801561092457600080fd5b5060408051808201909152601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015261059d565b34801561096a57600080fd5b506105fa7f000000000000000000000000000000000000000000000000000000000000000081565b34801561099e57600080fd5b506105276109ad366004614b9c565b61175d565b3480156109be57600080fd5b506105fa6109cd366004614b9c565b6001600160a01b039081166000908152600960205260409020541690565b3480156109f757600080fd5b50610527610a06366004614b9c565b6117c0565b348015610a1757600080fd5b50610527610a26366004614bb7565b6117ca565b348015610a3757600080fd5b5061053f610a46366004614b9c565b601a6020526000908152604090205481565b348015610a6457600080fd5b50610527610a73366004614bd0565b611840565b348015610a8457600080fd5b5061053f602d5481565b348015610a9a57600080fd5b5061053f60195481565b348015610ab057600080fd5b506023546105ca9060ff1681565b348015610aca57600080fd5b50610ade610ad9366004614b9c565b611915565b60405163ffffffff9091168152602001610549565b348015610aff57600080fd5b5061053f610b0e366004614b9c565b6001600160a01b031660009081526020819052604090205490565b348015610b3557600080fd5b50610527611937565b348015610b4a57600080fd5b50601b546105fa906001600160a01b031681565b348015610b6a57600080fd5b5061053f610b79366004614b9c565b61194b565b348015610b8a57600080fd5b50610b93611956565b6040516105499796959493929190614bfc565b348015610bb257600080fd5b5061053f602e5481565b348015610bc857600080fd5b5061053f60185481565b348015610bde57600080fd5b506105ca610bed366004614b9c565b60306020526000908152604090205460ff1681565b348015610c0e57600080fd5b5061053f60105481565b348015610c2457600080fd5b5061053f610c33366004614b9c565b6119df565b348015610c4457600080fd5b506105fa7f000000000000000000000000000000000000000000000000000000000000000081565b348015610c7857600080fd5b5061053f602a5481565b348015610c8e57600080fd5b50610527610c9d366004614c94565b611b48565b348015610cae57600080fd5b50600c546001600160a01b03166105fa565b348015610ccc57600080fd5b5061053f610cdb366004614bb7565b611b8c565b348015610cec57600080fd5b50610527610cfb366004614c94565b611bec565b348015610d0c57600080fd5b5060405165ffffffffffff43168152602001610549565b348015610d2f57600080fd5b5061059d611c30565b348015610d4457600080fd5b5061053f60295481565b348015610d5a57600080fd5b5061053f610d69366004614b9c565b611c3f565b348015610d7a57600080fd5b50610527610d89366004614b9c565b611cc1565b348015610d9a57600080fd5b506105ca610da9366004614a69565b611d24565b348015610dba57600080fd5b5061053f602c5481565b348015610dd057600080fd5b506105ca610ddf366004614a69565b611d9f565b348015610df057600080fd5b50600d546105fa906001600160a01b031681565b348015610e1057600080fd5b50610527610e1f366004614b9c565b611dad565b348015610e3057600080fd5b50601f546105fa906001600160a01b031681565b348015610e5057600080fd5b50610527610e5f366004614b9c565b611fa1565b348015610e7057600080fd5b506105fa610e7f366004614bb7565b612004565b348015610e9057600080fd5b5061053f60225481565b348015610ea657600080fd5b50610527610eb5366004614b9c565b61202e565b348015610ec657600080fd5b50610527610ed5366004614cdc565b612104565b348015610ee657600080fd5b50601d546105fa906001600160a01b031681565b348015610f0657600080fd5b5061053f60165481565b348015610f1c57600080fd5b5061053f60125481565b348015610f3257600080fd5b50610527610f41366004614d34565b61223a565b348015610f5257600080fd5b506105fa7f000000000000000000000000000000000000000000000000000000000000000081565b348015610f8657600080fd5b5061053f610f95366004614d9f565b61239e565b348015610fa657600080fd5b50610527610fb5366004614dd2565b6123c9565b348015610fc657600080fd5b506105fa7f000000000000000000000000000000000000000000000000000000000000000081565b348015610ffa57600080fd5b506105ca611009366004614b9c565b60316020526000908152604090205460ff1681565b34801561102a57600080fd5b506105fa7f000000000000000000000000000000000000000000000000000000000000000081565b34801561105e57600080fd5b5061107261106d366004614df0565b6123ff565b60408051825163ffffffff1681526020928301516001600160e01b03169281019290925201610549565b3480156110a857600080fd5b506105276110b7366004614b9c565b612483565b3480156110c857600080fd5b5061053f60285481565b6110da612511565b602254156111225760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481b185d5b98da195960821b60448201526064015b60405180910390fd5b4260228190556040805143815260208101929092527f87dcd6626ffde0faf682a10e7b64aff36ea73a5470d5fa6cc7ebd372e4b19001910160405180910390a1565b61116c612511565b6001600160a01b038216301480159061118d57506001600160a01b03821615155b6111c35760405162461bcd60e51b8152602060048201526007602482015266125b9d985b1a5960ca1b6044820152606401611119565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af1158015611210573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112349190614e25565b505050565b60606003805461124890614e42565b80601f016020809104026020016040519081016040528092919081815260200182805461127490614e42565b80156112c15780601f10611296576101008083540402835291602001916112c1565b820191906000526020600020905b8154815290600101906020018083116112a457829003601f168201915b5050505050905090565b6000336112d981858561256b565b60019150505b92915050565b6112ed612511565b601b8054601c849055821515600160a01b026001600160a81b03199091166001600160a01b0386161717905561271082111561135f5760405162461bcd60e51b8152602060048201526011602482015270088d2e6c6deeadce840e8dede40d0d2ced607b1b6044820152606401611119565b601b54601c5460408051600160a01b840460ff161515815260208101929092526001600160a01b03909216917f2084f4c849a6a9e4070acdc22ca1b0943f5601408aeb8506dfa00c95730b9a82910160405180910390a2505050565b6000336113c985828561268f565b6113d4858585612709565b506001949350505050565b6113e7612511565b803560148190556020820135601781905560408301356016819055606084013560158190556080850135601881905560a086013560198190556127109561144395919461143d948593909284929183919061280f565b9061280f565b146114905760405162461bcd60e51b815260206004820152601860248201527f46656573206d7573742061646420757020746f203130302500000000000000006044820152606401611119565b60405160008051602061535583398151915290600090a150565b60006114b461286e565b905090565b601b54600090600160a01b900460ff1615806114de5750601b546001600160a01b0316155b156114eb57506000919050565b601b546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a0823190602401602060405180830381865afa925050508015611551575060408051601f3d908101601f1916820190925261154e91810190614e76565b60015b61155d57506000919050565b151592915050565b919050565b6000336112d981858561157d838361239e565b6115879190614ea5565b61256b565b60004365ffffffffffff1682106115e15760405162461bcd60e51b815260206004820152601960248201527804552433230566f7465733a20667574757265206c6f6f6b757603c1b6044820152606401611119565b6001600160a01b0383166000908152600a60205260409020611603908361299c565b9392505050565b611612612511565b60405133904780156108fc02916000818181858888f1935050505015801561163e573d6000803e3d6000fd5b50565b611649612511565b6001600160a01b03821661166f5760405162461bcd60e51b815260040161111990614eb8565b600e80546001600160a01b0319166001600160a01b038416908117909155600f8290556040518281527fa19bcfb90823ce298f3e9253f1eb5f8bc50c220401e4bd74e507ffcc94d392829060200160405180910390a25050565b6116d1612511565b6001600160a01b0381166116f75760405162461bcd60e51b815260040161111990614eb8565b600d80546001600160a01b0319166001600160a01b0383169081179091556000908152602f60209081526040808320805460ff1990811660019081179092556030909352818420805490931617909155516000805160206153558339815191529190a150565b611765612511565b6001600160a01b03811661178b5760405162461bcd60e51b815260040161111990614eb8565b601d80546001600160a01b0319166001600160a01b03831617905560405160008051602061535583398151915290600090a150565b61163e3382612a85565b6117d2612511565b6107d06117de60025490565b6117e89190614ef4565b8110156118215760405162461bcd60e51b8152602060048201526007602482015266546f6f206c6f7760c81b6044820152606401611119565b601081905560405160008051602061535583398151915290600090a150565b611848612511565b818111156118985760405162461bcd60e51b815260206004820152601b60248201527f4d696e20666565206d757374206265203c3d20626173652066656500000000006044820152606401611119565b6105dc8211156118ea5760405162461bcd60e51b815260206004820152601760248201527f4261736520666565206d757374206265203c3d203135250000000000000000006044820152606401611119565b60118390556012829055601381905560405160008051602061535583398151915290600090a1505050565b6001600160a01b0381166000908152600a60205260408120546112df90612afe565b61193f612511565b6119496000612b67565b565b60006112df82612bb9565b60006060808280808361198a7f00000000000000000000000000000000000000000000000000000000000000006005612bd7565b6119b57f00000000000000000000000000000000000000000000000000000000000000006006612bd7565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6001600160a01b0381166000908152601a602052604081205481428210611a07576000611a11565b611a118242614f2c565b905060006011548210611a275750601354611a6a565b6000611a56601154611a5085611a4a601354601254612c8290919063ffffffff16565b90612cc4565b90612d46565b601254909150611a669082612c82565b9150505b601b54600160a01b900460ff168015611a8d5750601b546001600160a01b031615155b8015611a9b57506000601c54115b15611b4057601b546040516370a0823160e01b81526001600160a01b038781166004830152909116906370a0823190602401602060405180830381865afa925050508015611b06575060408051601f3d908101601f19168201909252611b0391810190614e76565b60015b15611b40578015611b3e576000611b2e612710611a50601c5486612cc490919063ffffffff16565b9050611b3a8382612c82565b9250505b505b949350505050565b611b50612511565b6001600160a01b038216600090815260306020526040808220805460ff1916841515179055516000805160206153558339815191529190a15050565b60004365ffffffffffff168210611be15760405162461bcd60e51b815260206004820152601960248201527804552433230566f7465733a20667574757265206c6f6f6b757603c1b6044820152606401611119565b6112df600b8361299c565b611bf4612511565b6001600160a01b0382166000908152602f6020526040808220805460ff1916841515179055516000805160206153558339815191529190a15050565b60606004805461124890614e42565b6001600160a01b0381166000908152600a60205260408120548015611cae576001600160a01b0383166000908152600a6020526040902080546000198301908110611c8c57611c8c614f3f565b60009182526020909120015464010000000090046001600160e01b0316611cb1565b60005b6001600160e01b03169392505050565b611cc9612511565b6001600160a01b038116611cef5760405162461bcd60e51b815260040161111990614eb8565b601e80546001600160a01b0319166001600160a01b03831617905560405160008051602061535583398151915290600090a150565b60003381611d32828661239e565b905083811015611d925760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401611119565b6113d4828686840361256b565b6000336112d9818585612709565b611db5612511565b6001600160a01b03811660009081526031602052604090205460ff16611e135760405162461bcd60e51b815260206004820152601360248201527214185a5c88191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401611119565b600080805b602154811015611e6d57836001600160a01b031660218281548110611e3f57611e3f614f3f565b6000918252602090912001546001600160a01b031603611e655780925060019150611e6d565b600101611e18565b5080611ebb5760405162461bcd60e51b815260206004820152601760248201527f50616972206e6f7420666f756e6420696e2061727261790000000000000000006044820152606401611119565b60218054611ecb90600190614f2c565b81548110611edb57611edb614f3f565b600091825260209091200154602180546001600160a01b039092169184908110611f0757611f07614f3f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506021805480611f4657611f46614f55565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0385168252603190526040808220805460ff19169055516000805160206153558339815191529190a1505050565b611fa9612511565b6001600160a01b038116611fcf5760405162461bcd60e51b815260040161111990614eb8565b601f80546001600160a01b0319166001600160a01b03831617905560405160008051602061535583398151915290600090a150565b6021818154811061201457600080fd5b6000918252602090912001546001600160a01b0316905081565b612036612511565b6001600160a01b03811660009081526031602052604090205460ff16156120885760405162461bcd60e51b815260206004820152600660248201526545786973747360d01b6044820152606401611119565b6021805460018082019092557f3a6357012c1a3ae0a17d304c9920310382d968ebcc4b1771f41c6b304205b5700180546001600160a01b0319166001600160a01b038416908117909155600090815260316020526040808220805460ff191690931790925590516000805160206153558339815191529190a150565b834211156121545760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e617475726520657870697265640000006044820152606401611119565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b0388169181019190915260608101869052608081018590526000906121ce906121c69060a00160405160208183030381529060405280519060200120612d88565b858585612db5565b90506121d981612ddd565b86146122275760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e6365000000000000006044820152606401611119565b6122318188612a85565b50505050505050565b8342111561228a5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401611119565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886122b98c612ddd565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061231482612d88565b9050600061232482878787612db5565b9050896001600160a01b0316816001600160a01b0316146123875760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401611119565b6123928a8a8a61256b565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6123d1612511565b6023805460ff1916831515179055602481905560405160008051602061535583398151915290600090a15050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600a60205260409020805463ffffffff841690811061244357612443614f3f565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b61248b612511565b6001600160a01b0381166124f05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611119565b61163e81612b67565b60006116038284614ea5565b60006116038284614f2c565b600c546001600160a01b031633146119495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611119565b6001600160a01b0383166125cd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611119565b6001600160a01b03821661262e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611119565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600061269b848461239e565b9050600019811461270357818110156126f65760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611119565b612703848484840361256b565b50505050565b600060225411806127245750600c546001600160a01b031632145b6127705760405162461bcd60e51b815260206004820181905260248201527f54686520636f6e7472616374206973206e6f74206c61756e63686564207965746044820152606401611119565b60255460ff161561278657611234838383612e05565b612791838383612faf565b61279961303b565b156127a6576127a661308c565b6001600160a01b0382166000908152601a602052604081205490036127e1576001600160a01b0382166000908152601a602052604090204290555b60006127ed8484613fb0565b6127f75781612802565b612802848484614096565b9050612703848483612e05565b60008061281c8385614ea5565b9050838110156116035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401611119565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156128c757507f000000000000000000000000000000000000000000000000000000000000000046145b156128f157507f000000000000000000000000000000000000000000000000000000000000000090565b6114b4604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b90565b8154600090818160058111156129f65760006129b78461412a565b6129c19085614f2c565b600088815260209020909150869082015463ffffffff1611156129e6578091506129f4565b6129f1816001614ea5565b92505b505b80821015612a43576000612a0a8383614212565b600088815260209020909150869082015463ffffffff161115612a2f57809150612a3d565b612a3a816001614ea5565b92505b506129f6565b8015612a6f576000868152602090208101600019015464010000000090046001600160e01b0316612a72565b60005b6001600160e01b03169695505050505050565b6001600160a01b038281166000818152600960208181526040808420805485845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461270382848361422d565b600063ffffffff821115612b635760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401611119565b5090565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0381166000908152600760205260408120546112df565b606060ff8314612bf157612bea8361436a565b90506112df565b818054612bfd90614e42565b80601f0160208091040260200160405190810160405280929190818152602001828054612c2990614e42565b8015612c765780601f10612c4b57610100808354040283529160200191612c76565b820191906000526020600020905b815481529060010190602001808311612c5957829003601f168201915b505050505090506112df565b600061160383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506143a9565b600082600003612cd6575060006112df565b6000612ce28385614f6b565b905082612cef8583614ef4565b146116035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401611119565b600061160383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506143e3565b60006112df612d9561286e565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612dc687878787614411565b91509150612dd3816144d5565b5095945050505050565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b6001600160a01b038316612e695760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611119565b6001600160a01b038216612ecb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611119565b6001600160a01b03831660009081526020819052604090205481811015612f435760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611119565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361270384848461461f565b60105481111580612fd857506001600160a01b03831660009081526030602052604090205460ff165b80612ffb57506001600160a01b03821660009081526030602052604090205460ff165b6112345760405162461bcd60e51b8152602060048201526011602482015270151608131a5b5a5d08115e18d959591959607a1b6044820152606401611119565b3360009081526031602052604081205460ff1615801561305e575060255460ff16155b801561306c575060235460ff165b80156114b457505060245430600090815260208190526040902054101590565b6025805460ff191660011790556014546024546000916130b49161271091611a509190612cc4565b905060006130e0612710611a506130d76002601754612d4690919063ffffffff16565b60245490612cc4565b90508115613103576130f2308361462a565b6026546130ff908361280f565b6026555b60006131248261311e85602454612c8290919063ffffffff16565b90612c82565b6040805160028082526060820183529293504792600092602083019080368337019050509050308160008151811061315e5761315e614f3f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000000000000000000000000000000000000000000000816001815181106131b2576131b2614f3f565b6001600160a01b03928316602091820292909201015260405163791ac94760e01b81527f00000000000000000000000000000000000000000000000000000000000000009091169063791ac94790613217908690600090869030904290600401614fc7565b600060405180830381600087803b15801561323157600080fd5b505af1925050508015613242575060015b6133525761324e615003565b806308c379a0036132c7575061326261504b565b8061326d57506132c9565b7fc41a20ad8c23d3903584975786330c6ec73ccfcc657629f10237b792268b0e028160405160200161329f91906150d0565b60408051601f19818403018152908290526132b991614ae3565b60405180910390a150613f9f565b505b7fc41a20ad8c23d3903584975786330c6ec73ccfcc657629f10237b792268b0e026040516133459060208082526034908201527f537761704261636b206661696c656420776974686f757420616e206572726f72604082015273040dacae6e6c2ceca40cce4deda40a0ead8e6cab60631b606082015260800190565b60405180910390a1613f9f565b600061335e4784612c82565b9050600061338b61337b6002601754612d4690919063ffffffff16565b60145461311e9061271090612c82565b600e54600f5460405163a792765f60e01b815260048101919091524260248201529192506000916001600160a01b039091169063a792765f90604401600060405180830381865afa92505050801561340557506040513d6000823e601f3d908101601f191682016040526134029190810190615115565b60015b15613424578180602001905181019061341e9190614e76565b93505050505b600061343f83611a5060165487612cc490919063ffffffff16565b90508015613838576040805160028082526060820183526000926020830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061349c5761349c614f3f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000000000000000000000000000000000000000000000816001815181106134f0576134f0614f3f565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201526000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015613565573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135899190614e76565b90506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016637ff36ab56135c5856002612d46565b60008530426040518663ffffffff1660e01b81526004016135e994939291906151cf565b60006040518083038185885af19350505050801561362957506040513d6000823e601f3d908101601f191682016040526136269190810190615204565b60015b1561383557506040516370a0823160e01b81523060048201526000906136c09083906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561369c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311e9190614e76565b90506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663f305d7196136fc866002612d46565b601d546040516001600160e01b031960e085901b168152613754917f000000000000000000000000000000000000000000000000000000000000000091879160009182916001600160a01b03169042906004016152b5565b60606040518083038185885af19350505050801561378f575060408051601f3d908101601f1916820190925261378c918101906152f0565b60015b6137bf576040805160008082526020820152600080516020615335833981519152910160405180910390a1613833565b5060008051602061533583398151915291508290506137df866002612d46565b6040805192835260208301919091520160405180910390a1602754613804908561280f565b60275584156138335761382f613826670de0b6b3a7640000611a508789612cc4565b6028549061280f565b6028555b505b50505b600061385e84611a506138576002601754612d4690919063ffffffff16565b8890612cc4565b905080156139c6576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663f305d7196138a0836002612d46565b601d546040516001600160e01b031960e085901b1681526138d89130918f9160009182916001600160a01b03169042906004016152b5565b60606040518083038185885af193505050508015613913575060408051601f3d908101601f19168201909252613910918101906152f0565b60015b613943576040805160008082526020820152600080516020615335833981519152910160405180910390a16139c6565b5060008051602061533583398151915291508a9050613963836002612d46565b6040805192835260208301919091520160405180910390a1613992613989826002612cc4565b6029549061280f565b60295582156139c6576139c26139b9670de0b6b3a7640000611a5086611a4a866002612cc4565b602a549061280f565b602a555b60006139e185611a5060185489612cc490919063ffffffff16565b90508015613a7657478111156139f45750475b600d60009054906101000a90046001600160a01b03166001600160a01b031663653bb256826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613a4457600080fd5b505af1158015613a58573d6000803e3d6000fd5b5050505050613a7281602d5461280f90919063ffffffff16565b602d555b6000613a9186611a506015548a612cc490919063ffffffff16565b90508015613e515747811115613aa45750475b6040805160028082526060820183526000926020830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000081600081518110613af957613af9614f3f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110613b4d57613b4d614f3f565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201526000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015613bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be69190614e76565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ff36ab58560008630426040518663ffffffff1660e01b8152600401613c3e94939291906151cf565b60006040518083038185885af193505050508015613c7e57506040513d6000823e601f3d908101601f19168201604052613c7b9190810190615204565b60015b15613c895750600190505b8015613de1576040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015613cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1a9190614e76565b90506000613d288285612c82565b90508015613dda57601e5460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015613da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dc89190614e25565b50602c54613dd6908261280f565b602c555b5050613e3d565b601e546040516000916001600160a01b03169061753090879084818181858888f193505050503d8060008114613e33576040519150601f19603f3d011682016040523d82523d6000602084013e613e38565b606091505b505050505b602b54613e4a908561280f565b602b555050505b6000613e6c87611a506019548b612cc490919063ffffffff16565b90508015613eed5747811115613e7f5750475b601f546040516000916001600160a01b03169061753090849084818181858888f193505050503d8060008114613ed1576040519150601f19603f3d011682016040523d82523d6000602084013e613ed6565b606091505b5050602e54909150613ee8908361280f565b602e55505b50505050506000471115613f68576000613f0f600c546001600160a01b031690565b6001600160a01b03164761753090604051600060405180830381858888f193505050503d8060008114613f5e576040519150601f19603f3d011682016040523d82523d6000602084013e613f63565b606091505b505050505b6040518681527fb39214ef4f33ea2d9d329fb67a4f17e7588bf6e00ed15a7967137ba819697a279060200160405180910390a15050505b50506025805460ff19169055505050565b6001600160a01b0382166000908152602f602052604081205460ff1680613fef57506001600160a01b0382166000908152602f602052604090205460ff165b80613ffa5750602254155b15614007575060006112df565b60005b60215481101561408c576021818154811061402757614027614f3f565b6000918252602090912001546001600160a01b038581169116148061407557506021818154811061405a5761405a614f3f565b6000918252602090912001546001600160a01b038481169116145b156140845760019150506112df565b60010161400a565b5060009392505050565b600080805b6021548110156140e857602181815481106140b8576140b8614f3f565b6000918252602090912001546001600160a01b03908116908616036140e057600191506140e8565b60010161409b565b5060006140f4866119df565b90506000614108612710611a508785612cc4565b9050614115873083612e05565b61411f8582612c82565b979650505050505050565b60008160000361413c57506000919050565b6000600161414984614642565b901c6001901b9050600181848161416257614162614ede565b048201901c9050600181848161417a5761417a614ede565b048201901c9050600181848161419257614192614ede565b048201901c905060018184816141aa576141aa614ede565b048201901c905060018184816141c2576141c2614ede565b048201901c905060018184816141da576141da614ede565b048201901c905060018184816141f2576141f2614ede565b048201901c90506116038182858161420c5761420c614ede565b046146d6565b60006142216002848418614ef4565b61160390848416614ea5565b816001600160a01b0316836001600160a01b03161415801561424f5750600081115b15611234576001600160a01b038316156142dd576001600160a01b0383166000908152600a60205260408120819061428a90612505856146ec565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516142d2929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615611234576001600160a01b0382166000908152600a602052604081208190614313906124f9856146ec565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724838360405161435b929190918252602082015260400190565b60405180910390a25050505050565b6060600061437783614856565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600081848411156143cd5760405162461bcd60e51b81526004016111199190614ae3565b5060006143da8486614f2c565b95945050505050565b600081836144045760405162461bcd60e51b81526004016111199190614ae3565b5060006143da8486614ef4565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561444857506000905060036144cc565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561449c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144c5576000600192509250506144cc565b9150600090505b94509492505050565b60008160048111156144e9576144e961531e565b036144f15750565b60018160048111156145055761450561531e565b036145525760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401611119565b60028160048111156145665761456661531e565b036145b35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611119565b60038160048111156145c7576145c761531e565b0361163e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401611119565b61123483838361487e565b61463482826148b0565b612703600b612505836146ec565b600080608083901c1561465757608092831c92015b604083901c1561466957604092831c92015b602083901c1561467b57602092831c92015b601083901c1561468d57601092831c92015b600883901c1561469f57600892831c92015b600483901c156146b157600492831c92015b600283901c156146c357600292831c92015b600183901c156112df5760010192915050565b60008183106146e55781611603565b5090919050565b825460009081908181156147395760008781526020902082016000190160408051808201909152905463ffffffff8116825264010000000090046001600160e01b0316602082015261474e565b60408051808201909152600080825260208201525b905080602001516001600160e01b0316935061476e84868863ffffffff16565b925060008211801561478e5750805163ffffffff1665ffffffffffff4316145b156147d35761479c836149e9565b60008881526020902083016000190180546001600160e01b03929092166401000000000263ffffffff90921691909117905561484c565b8660405180604001604052806147f66147e94390565b65ffffffffffff16612afe565b63ffffffff16815260200161480a866149e9565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b5050935093915050565b600060ff8216601f8111156112df57604051632cd44ac360e21b815260040160405180910390fd5b6001600160a01b038381166000908152600960205260408082205485841683529120546112349291821691168361422d565b6001600160a01b0382166149105760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611119565b6001600160a01b038216600090815260208190526040902054818110156149845760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611119565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36112348360008461461f565b60006001600160e01b03821115612b635760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608401611119565b80356001600160a01b038116811461156557600080fd5b60008060408385031215614a7c57600080fd5b614a8583614a52565b946020939093013593505050565b60005b83811015614aae578181015183820152602001614a96565b50506000910152565b60008151808452614acf816020860160208601614a93565b601f01601f19169290920160200192915050565b6020815260006116036020830184614ab7565b801515811461163e57600080fd5b600080600060608486031215614b1957600080fd5b614b2284614a52565b9250602084013591506040840135614b3981614af6565b809150509250925092565b600080600060608486031215614b5957600080fd5b614b6284614a52565b9250614b7060208501614a52565b929592945050506040919091013590565b600060c0828403128015614b9457600080fd5b509092915050565b600060208284031215614bae57600080fd5b61160382614a52565b600060208284031215614bc957600080fd5b5035919050565b600080600060608486031215614be557600080fd5b505081359360208301359350604090920135919050565b60ff60f81b8816815260e060208201526000614c1b60e0830189614ab7565b8281036040840152614c2d8189614ab7565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501528451808252602080870193509091019060005b81811015614c83578351835260209384019390920191600101614c65565b50909b9a5050505050505050505050565b60008060408385031215614ca757600080fd5b614cb083614a52565b91506020830135614cc081614af6565b809150509250929050565b803560ff8116811461156557600080fd5b60008060008060008060c08789031215614cf557600080fd5b614cfe87614a52565b95506020870135945060408701359350614d1a60608801614ccb565b9598949750929560808101359460a0909101359350915050565b600080600080600080600060e0888a031215614d4f57600080fd5b614d5888614a52565b9650614d6660208901614a52565b95506040880135945060608801359350614d8260808901614ccb565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614db257600080fd5b614dbb83614a52565b9150614dc960208401614a52565b90509250929050565b60008060408385031215614de557600080fd5b8235614a8581614af6565b60008060408385031215614e0357600080fd5b614e0c83614a52565b9150602083013563ffffffff81168114614cc057600080fd5b600060208284031215614e3757600080fd5b815161160381614af6565b600181811c90821680614e5657607f821691505b602082108103612dff57634e487b7160e01b600052602260045260246000fd5b600060208284031215614e8857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156112df576112df614e8f565b6020808252600c908201526b5a65726f206164647265737360a01b604082015260600190565b634e487b7160e01b600052601260045260246000fd5b600082614f1157634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b818103818111156112df576112df614e8f565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b80820281158282048414176112df576112df614e8f565b600081518084526020840193506020830160005b82811015614fbd5781516001600160a01b0316865260209586019590910190600101614f96565b5093949350505050565b85815284602082015260a060408201526000614fe660a0830186614f82565b6001600160a01b0394909416606083015250608001529392505050565b600060033d11156129995760046000803e5060005160e01c90565b601f8201601f1916810167ffffffffffffffff8111828210171561504457615044614f16565b6040525050565b600060443d10156150595790565b6040513d600319016004823e80513d602482011167ffffffffffffffff8211171561508357505090565b808201805167ffffffffffffffff81111561509f575050505090565b3d84016003190182820160200111156150b9575050505090565b6150c86020828501018561501e565b509392505050565b7f537761704261636b206661696c65642077697468206572726f7220000000000081526000825161510881601b850160208701614a93565b91909101601b0192915050565b60008060006060848603121561512a57600080fd5b835161513581614af6565b602085015190935067ffffffffffffffff81111561515257600080fd5b8401601f8101861361516357600080fd5b805167ffffffffffffffff81111561517d5761517d614f16565b604051615194601f8301601f19166020018261501e565b8181528760208385010111156151a957600080fd5b6151ba826020830160208601614a93565b60409690960151949795965093949350505050565b8481526080602082015260006151e86080830186614f82565b6001600160a01b03949094166040830152506060015292915050565b60006020828403121561521657600080fd5b815167ffffffffffffffff81111561522d57600080fd5b8201601f8101841361523e57600080fd5b805167ffffffffffffffff81111561525857615258614f16565b8060051b60405161526c602083018261501e565b91825260208184018101929081018784111561528757600080fd5b6020850194505b838510156152aa5784518082526020958601959093500161528e565b509695505050505050565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b60008060006060848603121561530557600080fd5b5050815160208301516040909301519094929350919050565b634e487b7160e01b600052602160045260246000fdfe424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b45063e1799d428897e6f54bdb61036ad40e2aa67a45b0181c60fe2f15a9d33a084d6a2646970667358221220edb00444406d2f682f1f2b1394d72afc1d859e672f0d7ca63762ad73daab11ed64736f6c634300081a00336101206040527398bf93ebf5c380c0e6ae8e192a7e2ae08edacc0260805273165c3410fc91ef562c50559f7d2289febed552d960a05273eb45a3c4aedd0f47f345fb4c8a1802bb5740d72560c05234801561005957600080fd5b506040516117303803806117308339810160408190526100789161019e565b600160005561008633610130565b6001600160a01b038216158015906100a657506001600160a01b03811615155b6100f65760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420746f6b656e20616464726573730000000000000000000000604482015260640160405180910390fd5b63ffffffff831660028190556001600160a01b0380841661010052821660e052606460065560045561012784610130565b505050506101fd565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b038116811461019957600080fd5b919050565b600080600080608085870312156101b457600080fd5b6101bd85610182565b9350602085015163ffffffff811681146101d657600080fd5b92506101e460408601610182565b91506101f260608601610182565b905092959194509250565b60805160a05160c05160e051610100516114b76102796000396000818161028b01528181610d8601528181610e2501528181610f160152610fc20152600081816104190152610d3201526000818161031101526109060152600081816102dd01526108b2015260008181610207015261085e01526114b76000f3fe6080604052600436106101395760003560e01c8063845a29bd116100ab578063edf436921161006f578063edf43692146103d1578063ef3783c8146103e7578063ef8ef56f14610407578063f2fde38b1461043b578063f38d00f01461045b578063fd3c91441461047157600080fd5b8063845a29bd146103485780638da5cb5b1461035e578063a522ad251461037c578063d531054e1461039c578063e67b5593146103b157600080fd5b80633bba6a36116100fd5780633bba6a361461027957806342da2b4a146102ad578063653bb256146102c357806368aa52b2146102cb5780636d2b4940146102ff578063715018a61461033357600080fd5b80630dd4375514610183578063172eed6a146101ac5780632fc1ad1f146101f557806334e6436c146102415780633b4fc6d11461026357600080fd5b3661017e5761014747600755565b60405134815233907f61c375eabec2af1b13d0b39c77d663c529207991cdd7281c522018fe852282ac9060200160405180910390a2005b600080fd5b34801561018f57600080fd5b5061019960085481565b6040519081526020015b60405180910390f35b3480156101b857600080fd5b506101e06101c73660046110e7565b6005602052600090815260409020805460019091015482565b604080519283526020830191909152016101a3565b34801561020157600080fd5b506102297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a3565b34801561024d57600080fd5b5061026161025c3660046110e7565b610487565b005b34801561026f57600080fd5b5061019960035481565b34801561028557600080fd5b506102297f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b957600080fd5b5061019960065481565b61026161068b565b3480156102d757600080fd5b506102297f000000000000000000000000000000000000000000000000000000000000000081565b34801561030b57600080fd5b506102297f000000000000000000000000000000000000000000000000000000000000000081565b34801561033f57600080fd5b506102616106ec565b34801561035457600080fd5b5061019960075481565b34801561036a57600080fd5b506001546001600160a01b0316610229565b34801561038857600080fd5b5061026161039736600461111c565b610700565b3480156103a857600080fd5b50610199609681565b3480156103bd57600080fd5b506102296103cc3660046111ba565b610836565b3480156103dd57600080fd5b5061019960045481565b3480156103f357600080fd5b506102616104023660046110e7565b610a56565b34801561041357600080fd5b506102297f000000000000000000000000000000000000000000000000000000000000000081565b34801561044757600080fd5b50610261610456366004611268565b610ae4565b34801561046757600080fd5b5061019960025481565b34801561047d57600080fd5b5061019961070881565b61048f610b5a565b61049847600755565b6104a0610bb3565b60035460009081526005602052604090206001810154156104d45760405163d430e93560e01b815260040160405180910390fd5b805460008190036104f85760405163dc49aee160e01b815260040160405180910390fd5b81546001830155600061271061050f6096846112a0565b61051991906112b7565b9050600061052782846112d9565b905060006105358287610cfd565b9050806000036105585760405163081ceff360e41b815260040160405180910390fd5b61056181610fa4565b836007600082825461057391906112d9565b92505081905550806008600082825461058c91906112ec565b9091555050821561063657604051600090339085908381818185875af1925050503d80600081146105d9576040519150601f19603f3d011682016040523d82523d6000602084013e6105de565b606091505b50509050806106345760405162461bcd60e51b815260206004820152601860248201527f496e63656e74697665207061796d656e74206661696c6564000000000000000060448201526064015b60405180910390fd5b505b604080518381526020810183905290810184905233907fec283c32bba1c9c4cc89935f07153bd56d321e23bfa00d19044574f426007e699060600160405180910390a250505050506106886001600055565b50565b346000036106ac5760405163b4fa3fb360e01b815260040160405180910390fd5b6106b547600755565b60405134815233907f61c375eabec2af1b13d0b39c77d663c529207991cdd7281c522018fe852282ac9060200160405180910390a2565b6106f461103b565b6106fe6000611095565b565b61070861103b565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561074f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077391906112ff565b9050600081116107bd5760405162461bcd60e51b81526020600482015260156024820152744e6f20746f6b656e7320746f20776974686472617760581b604482015260640161062b565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561080c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108309190611318565b50505050565b60408051600380825260808201909252600091829190602082016060803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000816000815181106108905761089061133a565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000000000000000000000000000000000000000000000816001815181106108e4576108e461133a565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000000000000000000000000000000000000000000000816002815181106109385761093861133a565b60200260200101906001600160a01b031690816001600160a01b0316815250506000805b8251811015610a4d578281815181106109775761097761133a565b60200260200101516001600160a01b031663d06ca61f87876040518363ffffffff1660e01b81526004016109ac929190611395565b600060405180830381865afa9250505080156109ea57506040513d6000823e601f3d908101601f191682016040526109e791908101906113b6565b60015b15610a455760008160018351610a0091906112d9565b81518110610a1057610a1061133a565b6020026020010151905083811115610a4257809350848381518110610a3757610a3761133a565b602002602001015195505b50505b60010161095c565b50505092915050565b610a5e61103b565b6109c4811115610a815760405163a437275760e01b815260040160405180910390fd5b600681905560408051818152601281830152714461696c79416c6c6f636174696f6e42707360701b60608201526020810183905290517fb222d6ddd0be50f7c54e1b26cab3e46db6b5d305309e8e64752543bb11bf5ea79181900360800190a150565b610aec61103b565b6001600160a01b038116610b515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b61068881611095565b600260005403610bac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161062b565b6002600055565b600254421015610bd657604051631864d7ab60e21b815260040160405180910390fd5b600060045442610be691906112d9565b9050610708811015610bf55750565b6000610c06610708620151806112b7565b905060006001610c18610708856112b7565b610c2291906112d9565b90506000612710600654600754610c3991906112a0565b610c4391906112b7565b90506000610c5184836112b7565b90506000610c608460016112ec565b610c6a90836112a0565b9050600754811115610c7b57506007545b600084600354610c8b91906112ec565b610c969060016112ec565b604080518082018252848152600060208083018281528583526005909152929020905181559051600191820155600382905590915061070890610cda9087906112ec565b610ce491906112a0565b600454610cf191906112ec565b60045550505050505050565b600082600003610d0f57506000610f9e565b6040805160028082526060820183526000926020830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000081600081518110610d6457610d6461133a565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110610db857610db861133a565b60200260200101906001600160a01b031690816001600160a01b0316815250506000610de48583610836565b90506001600160a01b038116610e0d5760405163081ceff360e41b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9891906112ff565b9050816001600160a01b031663b6f9de9587600086308a6040518663ffffffff1660e01b8152600401610ece949392919061144c565b6000604051808303818588803b158015610ee757600080fd5b505af1158015610efb573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506370a082319150602401602060405180830381865afa158015610f67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8b91906112ff565b9050610f9782826112d9565b9450505050505b92915050565b60405163a9059cbb60e01b815261dead6004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015611013573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110379190611318565b5050565b6001546001600160a01b031633146106fe5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161062b565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156110f957600080fd5b5035919050565b80356001600160a01b038116811461111757600080fd5b919050565b6000806040838503121561112f57600080fd5b61113883611100565b915061114660208401611100565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561118e5761118e61114f565b604052919050565b600067ffffffffffffffff8211156111b0576111b061114f565b5060051b60200190565b600080604083850312156111cd57600080fd5b82359150602083013567ffffffffffffffff8111156111eb57600080fd5b8301601f810185136111fc57600080fd5b803561120f61120a82611196565b611165565b8082825260208201915060208360051b85010192508783111561123157600080fd5b6020840193505b8284101561125a5761124984611100565b825260209384019390910190611238565b809450505050509250929050565b60006020828403121561127a57600080fd5b61128382611100565b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610f9e57610f9e61128a565b6000826112d457634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610f9e57610f9e61128a565b80820180821115610f9e57610f9e61128a565b60006020828403121561131157600080fd5b5051919050565b60006020828403121561132a57600080fd5b8151801515811461128357600080fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020840193506020830160005b8281101561138b5781516001600160a01b0316865260209586019590910190600101611364565b5093949350505050565b8281526040602082015260006113ae6040830184611350565b949350505050565b6000602082840312156113c857600080fd5b815167ffffffffffffffff8111156113df57600080fd5b8201601f810184136113f057600080fd5b80516113fe61120a82611196565b8082825260208201915060208360051b85010192508683111561142057600080fd5b6020840193505b82841015611442578351825260209384019390910190611427565b9695505050505050565b8481526080602082015260006114656080830186611350565b6001600160a01b0394909416604083015250606001529291505056fea264697066735822122057d2eb5a051da1e60ae30032334b8f6da63a87ada1f831aa4f11367efe06e31564736f6c634300081a0033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724000000000000000000000000000000000000000000000000000000006914bd10

Deployed ByteCode

0x6080604052600436106105065760003560e01c80636ddd171311610297578063a457c2d711610165578063cc34fe2f116100cc578063e0bab4c411610085578063e0bab4c414610fba578063e5e31b1314610fee578063ef8ef56f1461101e578063f1127ed814611052578063f2fde38b1461109c578063f6cf9d7a146110bc57600080fd5b8063cc34fe2f14610efa578063d073a01f14610f10578063d505accf14610f26578063d5cf793314610f46578063dd62ed3e14610f7a578063df20fd4914610f9a57600080fd5b8063b7b22a5d1161011e578063b7b22a5d14610e44578063b91ac78814610e64578063bf56b37114610e84578063c2b7bbb614610e9a578063c3cda52014610eba578063ca33e64c14610eda57600080fd5b8063a457c2d714610d8e578063a69436dd14610dae578063a9059cbb14610dc4578063aa6df29914610de4578063af6c9c1d14610e04578063b15febdc14610e2457600080fd5b80638c232838116102095780638ebfc796116101c25780638ebfc79614610ce057806391ddadf414610d0057806395d89b4114610d23578063996ed2d914610d385780639ab24eb014610d4e5780639f97fdbb14610d6e57600080fd5b80638c23283814610c185780638d5396e914610c385780638d79843214610c6c5780638d7a8ba714610c825780638da5cb5b14610ca25780638e539e8c14610cc057600080fd5b80637ecebe001161025b5780637ecebe0014610b5e57806384b0196e14610b7e5780638587441514610ba65780638b143b2714610bbc5780638b42507f14610bd25780638c0b5e2214610c0257600080fd5b80636ddd171314610aa45780636fcfff4514610abe57806370a0823114610af3578063715018a614610b295780637606150414610b3e57600080fd5b8063365904ec116103d457806345f5163a116103465780635c19a95c116102ff5780635c19a95c146109eb5780635c85974f14610a0b5780636083dab614610a2b57806363b4022c14610a58578063640bbea114610a7857806366ba9f5914610a8e57600080fd5b806345f5163a146108f85780634886c6751461065e5780634bf5d7e9146109185780634f15999a1461095e578063552a378414610992578063587cde1e146109b257600080fd5b80633d082266116103985780633d082266146108505780633d3662a8146108665780633f1be4d41461087c5780633f4218e01461089257806343cb5b29146108c2578063451240a8146108e257600080fd5b8063365904ec146107ba578063385909dc146107db57806339509351146107fb5780633a46b1a81461081b5780633ccfd60b1461083b57600080fd5b806318160ddd1161047857806325e4c4431161043157806325e4c44314610715578063289dcbba146107355780632e0f26251461074b5780632ff2e9dc14610772578063313ce567146107915780633644e515146107a557600080fd5b806318160ddd146106745780631959ad5b14610689578063213ea6bb146106a95780632172ab21146106c957806323b2d780146106df57806323b872dd146106f557600080fd5b8063095ea7b3116104ca578063095ea7b3146105aa5780630d1554bf146105da5780630dd4375514610612578063118d6a9814610628578063138a4c271461063e578063180b0d7e1461065e57600080fd5b806301339c2114610512578063020c7be7146105295780630445b6671461055257806306b091f91461056857806306fdde031461058857600080fd5b3661050d57005b600080fd5b34801561051e57600080fd5b506105276110d2565b005b34801561053557600080fd5b5061053f60275481565b6040519081526020015b60405180910390f35b34801561055e57600080fd5b5061053f60245481565b34801561057457600080fd5b50610527610583366004614a69565b611164565b34801561059457600080fd5b5061059d611239565b6040516105499190614ae3565b3480156105b657600080fd5b506105ca6105c5366004614a69565b6112cb565b6040519015158152602001610549565b3480156105e657600080fd5b506020546105fa906001600160a01b031681565b6040516001600160a01b039091168152602001610549565b34801561061e57600080fd5b5061053f60265481565b34801561063457600080fd5b5061053f602b5481565b34801561064a57600080fd5b50610527610659366004614b04565b6112e5565b34801561066a57600080fd5b5061053f61271081565b34801561068057600080fd5b5060025461053f565b34801561069557600080fd5b50600e546105fa906001600160a01b031681565b3480156106b557600080fd5b50601e546105fa906001600160a01b031681565b3480156106d557600080fd5b5061053f60115481565b3480156106eb57600080fd5b5061053f60135481565b34801561070157600080fd5b506105ca610710366004614b44565b6113bb565b34801561072157600080fd5b50610527610730366004614b81565b6113df565b34801561074157600080fd5b5061053f60175481565b34801561075757600080fd5b50610760601281565b60405160ff9091168152602001610549565b34801561077e57600080fd5b5061053f6a52b7d2dcc80cd2e400000081565b34801561079d57600080fd5b506012610760565b3480156107b157600080fd5b5061053f6114aa565b3480156107c657600080fd5b50601b546105ca90600160a01b900460ff1681565b3480156107e757600080fd5b506105ca6107f6366004614b9c565b6114b9565b34801561080757600080fd5b506105ca610816366004614a69565b61156a565b34801561082757600080fd5b5061053f610836366004614a69565b61158c565b34801561084757600080fd5b5061052761160a565b34801561085c57600080fd5b5061053f60155481565b34801561087257600080fd5b5061053f601c5481565b34801561088857600080fd5b5061053f600f5481565b34801561089e57600080fd5b506105ca6108ad366004614b9c565b602f6020526000908152604090205460ff1681565b3480156108ce57600080fd5b506105276108dd366004614a69565b611641565b3480156108ee57600080fd5b5061053f60145481565b34801561090457600080fd5b50610527610913366004614b9c565b6116c9565b34801561092457600080fd5b5060408051808201909152601d81527f6d6f64653d626c6f636b6e756d6265722666726f6d3d64656661756c74000000602082015261059d565b34801561096a57600080fd5b506105fa7f000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d981565b34801561099e57600080fd5b506105276109ad366004614b9c565b61175d565b3480156109be57600080fd5b506105fa6109cd366004614b9c565b6001600160a01b039081166000908152600960205260409020541690565b3480156109f757600080fd5b50610527610a06366004614b9c565b6117c0565b348015610a1757600080fd5b50610527610a26366004614bb7565b6117ca565b348015610a3757600080fd5b5061053f610a46366004614b9c565b601a6020526000908152604090205481565b348015610a6457600080fd5b50610527610a73366004614bd0565b611840565b348015610a8457600080fd5b5061053f602d5481565b348015610a9a57600080fd5b5061053f60195481565b348015610ab057600080fd5b506023546105ca9060ff1681565b348015610aca57600080fd5b50610ade610ad9366004614b9c565b611915565b60405163ffffffff9091168152602001610549565b348015610aff57600080fd5b5061053f610b0e366004614b9c565b6001600160a01b031660009081526020819052604090205490565b348015610b3557600080fd5b50610527611937565b348015610b4a57600080fd5b50601b546105fa906001600160a01b031681565b348015610b6a57600080fd5b5061053f610b79366004614b9c565b61194b565b348015610b8a57600080fd5b50610b93611956565b6040516105499796959493929190614bfc565b348015610bb257600080fd5b5061053f602e5481565b348015610bc857600080fd5b5061053f60185481565b348015610bde57600080fd5b506105ca610bed366004614b9c565b60306020526000908152604090205460ff1681565b348015610c0e57600080fd5b5061053f60105481565b348015610c2457600080fd5b5061053f610c33366004614b9c565b6119df565b348015610c4457600080fd5b506105fa7f00000000000000000000000098bf93ebf5c380c0e6ae8e192a7e2ae08edacc0281565b348015610c7857600080fd5b5061053f602a5481565b348015610c8e57600080fd5b50610527610c9d366004614c94565b611b48565b348015610cae57600080fd5b50600c546001600160a01b03166105fa565b348015610ccc57600080fd5b5061053f610cdb366004614bb7565b611b8c565b348015610cec57600080fd5b50610527610cfb366004614c94565b611bec565b348015610d0c57600080fd5b5060405165ffffffffffff43168152602001610549565b348015610d2f57600080fd5b5061059d611c30565b348015610d4457600080fd5b5061053f60295481565b348015610d5a57600080fd5b5061053f610d69366004614b9c565b611c3f565b348015610d7a57600080fd5b50610527610d89366004614b9c565b611cc1565b348015610d9a57600080fd5b506105ca610da9366004614a69565b611d24565b348015610dba57600080fd5b5061053f602c5481565b348015610dd057600080fd5b506105ca610ddf366004614a69565b611d9f565b348015610df057600080fd5b50600d546105fa906001600160a01b031681565b348015610e1057600080fd5b50610527610e1f366004614b9c565b611dad565b348015610e3057600080fd5b50601f546105fa906001600160a01b031681565b348015610e5057600080fd5b50610527610e5f366004614b9c565b611fa1565b348015610e7057600080fd5b506105fa610e7f366004614bb7565b612004565b348015610e9057600080fd5b5061053f60225481565b348015610ea657600080fd5b50610527610eb5366004614b9c565b61202e565b348015610ec657600080fd5b50610527610ed5366004614cdc565b612104565b348015610ee657600080fd5b50601d546105fa906001600160a01b031681565b348015610f0657600080fd5b5061053f60165481565b348015610f1c57600080fd5b5061053f60125481565b348015610f3257600080fd5b50610527610f41366004614d34565b61223a565b348015610f5257600080fd5b506105fa7f0000000000000000000000004013abbf94a745efa7cc848989ee83424a77006081565b348015610f8657600080fd5b5061053f610f95366004614d9f565b61239e565b348015610fa657600080fd5b50610527610fb5366004614dd2565b6123c9565b348015610fc657600080fd5b506105fa7f000000000000000000000000efd766ccb38eaf1dfd701853bfce31359239f30581565b348015610ffa57600080fd5b506105ca611009366004614b9c565b60316020526000908152604090205460ff1681565b34801561102a57600080fd5b506105fa7f000000000000000000000000a1077a294dde1b09bb078844df40758a5d0f9a2781565b34801561105e57600080fd5b5061107261106d366004614df0565b6123ff565b60408051825163ffffffff1681526020928301516001600160e01b03169281019290925201610549565b3480156110a857600080fd5b506105276110b7366004614b9c565b612483565b3480156110c857600080fd5b5061053f60285481565b6110da612511565b602254156111225760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481b185d5b98da195960821b60448201526064015b60405180910390fd5b4260228190556040805143815260208101929092527f87dcd6626ffde0faf682a10e7b64aff36ea73a5470d5fa6cc7ebd372e4b19001910160405180910390a1565b61116c612511565b6001600160a01b038216301480159061118d57506001600160a01b03821615155b6111c35760405162461bcd60e51b8152602060048201526007602482015266125b9d985b1a5960ca1b6044820152606401611119565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af1158015611210573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112349190614e25565b505050565b60606003805461124890614e42565b80601f016020809104026020016040519081016040528092919081815260200182805461127490614e42565b80156112c15780601f10611296576101008083540402835291602001916112c1565b820191906000526020600020905b8154815290600101906020018083116112a457829003601f168201915b5050505050905090565b6000336112d981858561256b565b60019150505b92915050565b6112ed612511565b601b8054601c849055821515600160a01b026001600160a81b03199091166001600160a01b0386161717905561271082111561135f5760405162461bcd60e51b8152602060048201526011602482015270088d2e6c6deeadce840e8dede40d0d2ced607b1b6044820152606401611119565b601b54601c5460408051600160a01b840460ff161515815260208101929092526001600160a01b03909216917f2084f4c849a6a9e4070acdc22ca1b0943f5601408aeb8506dfa00c95730b9a82910160405180910390a2505050565b6000336113c985828561268f565b6113d4858585612709565b506001949350505050565b6113e7612511565b803560148190556020820135601781905560408301356016819055606084013560158190556080850135601881905560a086013560198190556127109561144395919461143d948593909284929183919061280f565b9061280f565b146114905760405162461bcd60e51b815260206004820152601860248201527f46656573206d7573742061646420757020746f203130302500000000000000006044820152606401611119565b60405160008051602061535583398151915290600090a150565b60006114b461286e565b905090565b601b54600090600160a01b900460ff1615806114de5750601b546001600160a01b0316155b156114eb57506000919050565b601b546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a0823190602401602060405180830381865afa925050508015611551575060408051601f3d908101601f1916820190925261154e91810190614e76565b60015b61155d57506000919050565b151592915050565b919050565b6000336112d981858561157d838361239e565b6115879190614ea5565b61256b565b60004365ffffffffffff1682106115e15760405162461bcd60e51b815260206004820152601960248201527804552433230566f7465733a20667574757265206c6f6f6b757603c1b6044820152606401611119565b6001600160a01b0383166000908152600a60205260409020611603908361299c565b9392505050565b611612612511565b60405133904780156108fc02916000818181858888f1935050505015801561163e573d6000803e3d6000fd5b50565b611649612511565b6001600160a01b03821661166f5760405162461bcd60e51b815260040161111990614eb8565b600e80546001600160a01b0319166001600160a01b038416908117909155600f8290556040518281527fa19bcfb90823ce298f3e9253f1eb5f8bc50c220401e4bd74e507ffcc94d392829060200160405180910390a25050565b6116d1612511565b6001600160a01b0381166116f75760405162461bcd60e51b815260040161111990614eb8565b600d80546001600160a01b0319166001600160a01b0383169081179091556000908152602f60209081526040808320805460ff1990811660019081179092556030909352818420805490931617909155516000805160206153558339815191529190a150565b611765612511565b6001600160a01b03811661178b5760405162461bcd60e51b815260040161111990614eb8565b601d80546001600160a01b0319166001600160a01b03831617905560405160008051602061535583398151915290600090a150565b61163e3382612a85565b6117d2612511565b6107d06117de60025490565b6117e89190614ef4565b8110156118215760405162461bcd60e51b8152602060048201526007602482015266546f6f206c6f7760c81b6044820152606401611119565b601081905560405160008051602061535583398151915290600090a150565b611848612511565b818111156118985760405162461bcd60e51b815260206004820152601b60248201527f4d696e20666565206d757374206265203c3d20626173652066656500000000006044820152606401611119565b6105dc8211156118ea5760405162461bcd60e51b815260206004820152601760248201527f4261736520666565206d757374206265203c3d203135250000000000000000006044820152606401611119565b60118390556012829055601381905560405160008051602061535583398151915290600090a1505050565b6001600160a01b0381166000908152600a60205260408120546112df90612afe565b61193f612511565b6119496000612b67565b565b60006112df82612bb9565b60006060808280808361198a7f4845524f20546f6b656e20666f72205665746572616e730000000000000000176005612bd7565b6119b57f31000000000000000000000000000000000000000000000000000000000000016006612bd7565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6001600160a01b0381166000908152601a602052604081205481428210611a07576000611a11565b611a118242614f2c565b905060006011548210611a275750601354611a6a565b6000611a56601154611a5085611a4a601354601254612c8290919063ffffffff16565b90612cc4565b90612d46565b601254909150611a669082612c82565b9150505b601b54600160a01b900460ff168015611a8d5750601b546001600160a01b031615155b8015611a9b57506000601c54115b15611b4057601b546040516370a0823160e01b81526001600160a01b038781166004830152909116906370a0823190602401602060405180830381865afa925050508015611b06575060408051601f3d908101601f19168201909252611b0391810190614e76565b60015b15611b40578015611b3e576000611b2e612710611a50601c5486612cc490919063ffffffff16565b9050611b3a8382612c82565b9250505b505b949350505050565b611b50612511565b6001600160a01b038216600090815260306020526040808220805460ff1916841515179055516000805160206153558339815191529190a15050565b60004365ffffffffffff168210611be15760405162461bcd60e51b815260206004820152601960248201527804552433230566f7465733a20667574757265206c6f6f6b757603c1b6044820152606401611119565b6112df600b8361299c565b611bf4612511565b6001600160a01b0382166000908152602f6020526040808220805460ff1916841515179055516000805160206153558339815191529190a15050565b60606004805461124890614e42565b6001600160a01b0381166000908152600a60205260408120548015611cae576001600160a01b0383166000908152600a6020526040902080546000198301908110611c8c57611c8c614f3f565b60009182526020909120015464010000000090046001600160e01b0316611cb1565b60005b6001600160e01b03169392505050565b611cc9612511565b6001600160a01b038116611cef5760405162461bcd60e51b815260040161111990614eb8565b601e80546001600160a01b0319166001600160a01b03831617905560405160008051602061535583398151915290600090a150565b60003381611d32828661239e565b905083811015611d925760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401611119565b6113d4828686840361256b565b6000336112d9818585612709565b611db5612511565b6001600160a01b03811660009081526031602052604090205460ff16611e135760405162461bcd60e51b815260206004820152601360248201527214185a5c88191bd95cc81b9bdd08195e1a5cdd606a1b6044820152606401611119565b600080805b602154811015611e6d57836001600160a01b031660218281548110611e3f57611e3f614f3f565b6000918252602090912001546001600160a01b031603611e655780925060019150611e6d565b600101611e18565b5080611ebb5760405162461bcd60e51b815260206004820152601760248201527f50616972206e6f7420666f756e6420696e2061727261790000000000000000006044820152606401611119565b60218054611ecb90600190614f2c565b81548110611edb57611edb614f3f565b600091825260209091200154602180546001600160a01b039092169184908110611f0757611f07614f3f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506021805480611f4657611f46614f55565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b0385168252603190526040808220805460ff19169055516000805160206153558339815191529190a1505050565b611fa9612511565b6001600160a01b038116611fcf5760405162461bcd60e51b815260040161111990614eb8565b601f80546001600160a01b0319166001600160a01b03831617905560405160008051602061535583398151915290600090a150565b6021818154811061201457600080fd5b6000918252602090912001546001600160a01b0316905081565b612036612511565b6001600160a01b03811660009081526031602052604090205460ff16156120885760405162461bcd60e51b815260206004820152600660248201526545786973747360d01b6044820152606401611119565b6021805460018082019092557f3a6357012c1a3ae0a17d304c9920310382d968ebcc4b1771f41c6b304205b5700180546001600160a01b0319166001600160a01b038416908117909155600090815260316020526040808220805460ff191690931790925590516000805160206153558339815191529190a150565b834211156121545760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e617475726520657870697265640000006044820152606401611119565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b0388169181019190915260608101869052608081018590526000906121ce906121c69060a00160405160208183030381529060405280519060200120612d88565b858585612db5565b90506121d981612ddd565b86146122275760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e6365000000000000006044820152606401611119565b6122318188612a85565b50505050505050565b8342111561228a5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401611119565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886122b98c612ddd565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061231482612d88565b9050600061232482878787612db5565b9050896001600160a01b0316816001600160a01b0316146123875760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401611119565b6123928a8a8a61256b565b50505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6123d1612511565b6023805460ff1916831515179055602481905560405160008051602061535583398151915290600090a15050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600a60205260409020805463ffffffff841690811061244357612443614f3f565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b61248b612511565b6001600160a01b0381166124f05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611119565b61163e81612b67565b60006116038284614ea5565b60006116038284614f2c565b600c546001600160a01b031633146119495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611119565b6001600160a01b0383166125cd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611119565b6001600160a01b03821661262e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611119565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600061269b848461239e565b9050600019811461270357818110156126f65760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611119565b612703848484840361256b565b50505050565b600060225411806127245750600c546001600160a01b031632145b6127705760405162461bcd60e51b815260206004820181905260248201527f54686520636f6e7472616374206973206e6f74206c61756e63686564207965746044820152606401611119565b60255460ff161561278657611234838383612e05565b612791838383612faf565b61279961303b565b156127a6576127a661308c565b6001600160a01b0382166000908152601a602052604081205490036127e1576001600160a01b0382166000908152601a602052604090204290555b60006127ed8484613fb0565b6127f75781612802565b612802848484614096565b9050612703848483612e05565b60008061281c8385614ea5565b9050838110156116035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401611119565b6000306001600160a01b037f00000000000000000000000035a51dfc82032682e4bda8aaca87b9bc386c3d27161480156128c757507f000000000000000000000000000000000000000000000000000000000000017146145b156128f157507fc5c56f1d078b423901e243476a89203628b870b51c4d23827a6a9e4d608c5beb90565b6114b4604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527fa2d5e7704bb47ef69d37950aeafa5f75fa1e1f50311d6cc6ae19912ef2b125d0918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b90565b8154600090818160058111156129f65760006129b78461412a565b6129c19085614f2c565b600088815260209020909150869082015463ffffffff1611156129e6578091506129f4565b6129f1816001614ea5565b92505b505b80821015612a43576000612a0a8383614212565b600088815260209020909150869082015463ffffffff161115612a2f57809150612a3d565b612a3a816001614ea5565b92505b506129f6565b8015612a6f576000868152602090208101600019015464010000000090046001600160e01b0316612a72565b60005b6001600160e01b03169695505050505050565b6001600160a01b038281166000818152600960208181526040808420805485845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461270382848361422d565b600063ffffffff821115612b635760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b6064820152608401611119565b5090565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0381166000908152600760205260408120546112df565b606060ff8314612bf157612bea8361436a565b90506112df565b818054612bfd90614e42565b80601f0160208091040260200160405190810160405280929190818152602001828054612c2990614e42565b8015612c765780601f10612c4b57610100808354040283529160200191612c76565b820191906000526020600020905b815481529060010190602001808311612c5957829003601f168201915b505050505090506112df565b600061160383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506143a9565b600082600003612cd6575060006112df565b6000612ce28385614f6b565b905082612cef8583614ef4565b146116035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401611119565b600061160383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506143e3565b60006112df612d9561286e565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612dc687878787614411565b91509150612dd3816144d5565b5095945050505050565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b6001600160a01b038316612e695760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611119565b6001600160a01b038216612ecb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611119565b6001600160a01b03831660009081526020819052604090205481811015612f435760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611119565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a361270384848461461f565b60105481111580612fd857506001600160a01b03831660009081526030602052604090205460ff165b80612ffb57506001600160a01b03821660009081526030602052604090205460ff165b6112345760405162461bcd60e51b8152602060048201526011602482015270151608131a5b5a5d08115e18d959591959607a1b6044820152606401611119565b3360009081526031602052604081205460ff1615801561305e575060255460ff16155b801561306c575060235460ff165b80156114b457505060245430600090815260208190526040902054101590565b6025805460ff191660011790556014546024546000916130b49161271091611a509190612cc4565b905060006130e0612710611a506130d76002601754612d4690919063ffffffff16565b60245490612cc4565b90508115613103576130f2308361462a565b6026546130ff908361280f565b6026555b60006131248261311e85602454612c8290919063ffffffff16565b90612c82565b6040805160028082526060820183529293504792600092602083019080368337019050509050308160008151811061315e5761315e614f3f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000a1077a294dde1b09bb078844df40758a5d0f9a27816001815181106131b2576131b2614f3f565b6001600160a01b03928316602091820292909201015260405163791ac94760e01b81527f000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d99091169063791ac94790613217908690600090869030904290600401614fc7565b600060405180830381600087803b15801561323157600080fd5b505af1925050508015613242575060015b6133525761324e615003565b806308c379a0036132c7575061326261504b565b8061326d57506132c9565b7fc41a20ad8c23d3903584975786330c6ec73ccfcc657629f10237b792268b0e028160405160200161329f91906150d0565b60408051601f19818403018152908290526132b991614ae3565b60405180910390a150613f9f565b505b7fc41a20ad8c23d3903584975786330c6ec73ccfcc657629f10237b792268b0e026040516133459060208082526034908201527f537761704261636b206661696c656420776974686f757420616e206572726f72604082015273040dacae6e6c2ceca40cce4deda40a0ead8e6cab60631b606082015260800190565b60405180910390a1613f9f565b600061335e4784612c82565b9050600061338b61337b6002601754612d4690919063ffffffff16565b60145461311e9061271090612c82565b600e54600f5460405163a792765f60e01b815260048101919091524260248201529192506000916001600160a01b039091169063a792765f90604401600060405180830381865afa92505050801561340557506040513d6000823e601f3d908101601f191682016040526134029190810190615115565b60015b15613424578180602001905181019061341e9190614e76565b93505050505b600061343f83611a5060165487612cc490919063ffffffff16565b90508015613838576040805160028082526060820183526000926020830190803683370190505090507f000000000000000000000000a1077a294dde1b09bb078844df40758a5d0f9a278160008151811061349c5761349c614f3f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000004013abbf94a745efa7cc848989ee83424a770060816001815181106134f0576134f0614f3f565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201526000917f0000000000000000000000004013abbf94a745efa7cc848989ee83424a77006016906370a0823190602401602060405180830381865afa158015613565573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135899190614e76565b90506001600160a01b037f000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d916637ff36ab56135c5856002612d46565b60008530426040518663ffffffff1660e01b81526004016135e994939291906151cf565b60006040518083038185885af19350505050801561362957506040513d6000823e601f3d908101601f191682016040526136269190810190615204565b60015b1561383557506040516370a0823160e01b81523060048201526000906136c09083906001600160a01b037f0000000000000000000000004013abbf94a745efa7cc848989ee83424a77006016906370a0823190602401602060405180830381865afa15801561369c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061311e9190614e76565b90506001600160a01b037f000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d91663f305d7196136fc866002612d46565b601d546040516001600160e01b031960e085901b168152613754917f0000000000000000000000004013abbf94a745efa7cc848989ee83424a77006091879160009182916001600160a01b03169042906004016152b5565b60606040518083038185885af19350505050801561378f575060408051601f3d908101601f1916820190925261378c918101906152f0565b60015b6137bf576040805160008082526020820152600080516020615335833981519152910160405180910390a1613833565b5060008051602061533583398151915291508290506137df866002612d46565b6040805192835260208301919091520160405180910390a1602754613804908561280f565b60275584156138335761382f613826670de0b6b3a7640000611a508789612cc4565b6028549061280f565b6028555b505b50505b600061385e84611a506138576002601754612d4690919063ffffffff16565b8890612cc4565b905080156139c6576001600160a01b037f000000000000000000000000165c3410fc91ef562c50559f7d2289febed552d91663f305d7196138a0836002612d46565b601d546040516001600160e01b031960e085901b1681526138d89130918f9160009182916001600160a01b03169042906004016152b5565b60606040518083038185885af193505050508015613913575060408051601f3d908101601f19168201909252613910918101906152f0565b60015b613943576040805160008082526020820152600080516020615335833981519152910160405180910390a16139c6565b5060008051602061533583398151915291508a9050613963836002612d46565b6040805192835260208301919091520160405180910390a1613992613989826002612cc4565b6029549061280f565b60295582156139c6576139c26139b9670de0b6b3a7640000611a5086611a4a866002612cc4565b602a549061280f565b602a555b60006139e185611a5060185489612cc490919063ffffffff16565b90508015613a7657478111156139f45750475b600d60009054906101000a90046001600160a01b03166001600160a01b031663653bb256826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613a4457600080fd5b505af1158015613a58573d6000803e3d6000fd5b5050505050613a7281602d5461280f90919063ffffffff16565b602d555b6000613a9186611a506015548a612cc490919063ffffffff16565b90508015613e515747811115613aa45750475b6040805160028082526060820183526000926020830190803683370190505090507f000000000000000000000000a1077a294dde1b09bb078844df40758a5d0f9a2781600081518110613af957613af9614f3f565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000efd766ccb38eaf1dfd701853bfce31359239f30581600181518110613b4d57613b4d614f3f565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201526000917f000000000000000000000000efd766ccb38eaf1dfd701853bfce31359239f30516906370a0823190602401602060405180830381865afa158015613bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613be69190614e76565b905060007f00000000000000000000000098bf93ebf5c380c0e6ae8e192a7e2ae08edacc026001600160a01b0316637ff36ab58560008630426040518663ffffffff1660e01b8152600401613c3e94939291906151cf565b60006040518083038185885af193505050508015613c7e57506040513d6000823e601f3d908101601f19168201604052613c7b9190810190615204565b60015b15613c895750600190505b8015613de1576040516370a0823160e01b81523060048201526000907f000000000000000000000000efd766ccb38eaf1dfd701853bfce31359239f3056001600160a01b0316906370a0823190602401602060405180830381865afa158015613cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1a9190614e76565b90506000613d288285612c82565b90508015613dda57601e5460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390527f000000000000000000000000efd766ccb38eaf1dfd701853bfce31359239f3059091169063a9059cbb906044016020604051808303816000875af1158015613da4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dc89190614e25565b50602c54613dd6908261280f565b602c555b5050613e3d565b601e546040516000916001600160a01b03169061753090879084818181858888f193505050503d8060008114613e33576040519150601f19603f3d011682016040523d82523d6000602084013e613e38565b606091505b505050505b602b54613e4a908561280f565b602b555050505b6000613e6c87611a506019548b612cc490919063ffffffff16565b90508015613eed5747811115613e7f5750475b601f546040516000916001600160a01b03169061753090849084818181858888f193505050503d8060008114613ed1576040519150601f19603f3d011682016040523d82523d6000602084013e613ed6565b606091505b5050602e54909150613ee8908361280f565b602e55505b50505050506000471115613f68576000613f0f600c546001600160a01b031690565b6001600160a01b03164761753090604051600060405180830381858888f193505050503d8060008114613f5e576040519150601f19603f3d011682016040523d82523d6000602084013e613f63565b606091505b505050505b6040518681527fb39214ef4f33ea2d9d329fb67a4f17e7588bf6e00ed15a7967137ba819697a279060200160405180910390a15050505b50506025805460ff19169055505050565b6001600160a01b0382166000908152602f602052604081205460ff1680613fef57506001600160a01b0382166000908152602f602052604090205460ff165b80613ffa5750602254155b15614007575060006112df565b60005b60215481101561408c576021818154811061402757614027614f3f565b6000918252602090912001546001600160a01b038581169116148061407557506021818154811061405a5761405a614f3f565b6000918252602090912001546001600160a01b038481169116145b156140845760019150506112df565b60010161400a565b5060009392505050565b600080805b6021548110156140e857602181815481106140b8576140b8614f3f565b6000918252602090912001546001600160a01b03908116908616036140e057600191506140e8565b60010161409b565b5060006140f4866119df565b90506000614108612710611a508785612cc4565b9050614115873083612e05565b61411f8582612c82565b979650505050505050565b60008160000361413c57506000919050565b6000600161414984614642565b901c6001901b9050600181848161416257614162614ede565b048201901c9050600181848161417a5761417a614ede565b048201901c9050600181848161419257614192614ede565b048201901c905060018184816141aa576141aa614ede565b048201901c905060018184816141c2576141c2614ede565b048201901c905060018184816141da576141da614ede565b048201901c905060018184816141f2576141f2614ede565b048201901c90506116038182858161420c5761420c614ede565b046146d6565b60006142216002848418614ef4565b61160390848416614ea5565b816001600160a01b0316836001600160a01b03161415801561424f5750600081115b15611234576001600160a01b038316156142dd576001600160a01b0383166000908152600a60205260408120819061428a90612505856146ec565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516142d2929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615611234576001600160a01b0382166000908152600a602052604081208190614313906124f9856146ec565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724838360405161435b929190918252602082015260400190565b60405180910390a25050505050565b6060600061437783614856565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600081848411156143cd5760405162461bcd60e51b81526004016111199190614ae3565b5060006143da8486614f2c565b95945050505050565b600081836144045760405162461bcd60e51b81526004016111199190614ae3565b5060006143da8486614ef4565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561444857506000905060036144cc565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561449c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166144c5576000600192509250506144cc565b9150600090505b94509492505050565b60008160048111156144e9576144e961531e565b036144f15750565b60018160048111156145055761450561531e565b036145525760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401611119565b60028160048111156145665761456661531e565b036145b35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611119565b60038160048111156145c7576145c761531e565b0361163e5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401611119565b61123483838361487e565b61463482826148b0565b612703600b612505836146ec565b600080608083901c1561465757608092831c92015b604083901c1561466957604092831c92015b602083901c1561467b57602092831c92015b601083901c1561468d57601092831c92015b600883901c1561469f57600892831c92015b600483901c156146b157600492831c92015b600283901c156146c357600292831c92015b600183901c156112df5760010192915050565b60008183106146e55781611603565b5090919050565b825460009081908181156147395760008781526020902082016000190160408051808201909152905463ffffffff8116825264010000000090046001600160e01b0316602082015261474e565b60408051808201909152600080825260208201525b905080602001516001600160e01b0316935061476e84868863ffffffff16565b925060008211801561478e5750805163ffffffff1665ffffffffffff4316145b156147d35761479c836149e9565b60008881526020902083016000190180546001600160e01b03929092166401000000000263ffffffff90921691909117905561484c565b8660405180604001604052806147f66147e94390565b65ffffffffffff16612afe565b63ffffffff16815260200161480a866149e9565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b5050935093915050565b600060ff8216601f8111156112df57604051632cd44ac360e21b815260040160405180910390fd5b6001600160a01b038381166000908152600960205260408082205485841683529120546112349291821691168361422d565b6001600160a01b0382166149105760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611119565b6001600160a01b038216600090815260208190526040902054818110156149845760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611119565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36112348360008461461f565b60006001600160e01b03821115612b635760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b6064820152608401611119565b80356001600160a01b038116811461156557600080fd5b60008060408385031215614a7c57600080fd5b614a8583614a52565b946020939093013593505050565b60005b83811015614aae578181015183820152602001614a96565b50506000910152565b60008151808452614acf816020860160208601614a93565b601f01601f19169290920160200192915050565b6020815260006116036020830184614ab7565b801515811461163e57600080fd5b600080600060608486031215614b1957600080fd5b614b2284614a52565b9250602084013591506040840135614b3981614af6565b809150509250925092565b600080600060608486031215614b5957600080fd5b614b6284614a52565b9250614b7060208501614a52565b929592945050506040919091013590565b600060c0828403128015614b9457600080fd5b509092915050565b600060208284031215614bae57600080fd5b61160382614a52565b600060208284031215614bc957600080fd5b5035919050565b600080600060608486031215614be557600080fd5b505081359360208301359350604090920135919050565b60ff60f81b8816815260e060208201526000614c1b60e0830189614ab7565b8281036040840152614c2d8189614ab7565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501528451808252602080870193509091019060005b81811015614c83578351835260209384019390920191600101614c65565b50909b9a5050505050505050505050565b60008060408385031215614ca757600080fd5b614cb083614a52565b91506020830135614cc081614af6565b809150509250929050565b803560ff8116811461156557600080fd5b60008060008060008060c08789031215614cf557600080fd5b614cfe87614a52565b95506020870135945060408701359350614d1a60608801614ccb565b9598949750929560808101359460a0909101359350915050565b600080600080600080600060e0888a031215614d4f57600080fd5b614d5888614a52565b9650614d6660208901614a52565b95506040880135945060608801359350614d8260808901614ccb565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614db257600080fd5b614dbb83614a52565b9150614dc960208401614a52565b90509250929050565b60008060408385031215614de557600080fd5b8235614a8581614af6565b60008060408385031215614e0357600080fd5b614e0c83614a52565b9150602083013563ffffffff81168114614cc057600080fd5b600060208284031215614e3757600080fd5b815161160381614af6565b600181811c90821680614e5657607f821691505b602082108103612dff57634e487b7160e01b600052602260045260246000fd5b600060208284031215614e8857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156112df576112df614e8f565b6020808252600c908201526b5a65726f206164647265737360a01b604082015260600190565b634e487b7160e01b600052601260045260246000fd5b600082614f1157634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b818103818111156112df576112df614e8f565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b80820281158282048414176112df576112df614e8f565b600081518084526020840193506020830160005b82811015614fbd5781516001600160a01b0316865260209586019590910190600101614f96565b5093949350505050565b85815284602082015260a060408201526000614fe660a0830186614f82565b6001600160a01b0394909416606083015250608001529392505050565b600060033d11156129995760046000803e5060005160e01c90565b601f8201601f1916810167ffffffffffffffff8111828210171561504457615044614f16565b6040525050565b600060443d10156150595790565b6040513d600319016004823e80513d602482011167ffffffffffffffff8211171561508357505090565b808201805167ffffffffffffffff81111561509f575050505090565b3d84016003190182820160200111156150b9575050505090565b6150c86020828501018561501e565b509392505050565b7f537761704261636b206661696c65642077697468206572726f7220000000000081526000825161510881601b850160208701614a93565b91909101601b0192915050565b60008060006060848603121561512a57600080fd5b835161513581614af6565b602085015190935067ffffffffffffffff81111561515257600080fd5b8401601f8101861361516357600080fd5b805167ffffffffffffffff81111561517d5761517d614f16565b604051615194601f8301601f19166020018261501e565b8181528760208385010111156151a957600080fd5b6151ba826020830160208601614a93565b60409690960151949795965093949350505050565b8481526080602082015260006151e86080830186614f82565b6001600160a01b03949094166040830152506060015292915050565b60006020828403121561521657600080fd5b815167ffffffffffffffff81111561522d57600080fd5b8201601f8101841361523e57600080fd5b805167ffffffffffffffff81111561525857615258614f16565b8060051b60405161526c602083018261501e565b91825260208184018101929081018784111561528757600080fd5b6020850194505b838510156152aa5784518082526020958601959093500161528e565b509695505050505050565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b60008060006060848603121561530557600080fd5b5050815160208301516040909301519094929350919050565b634e487b7160e01b600052602160045260246000fdfe424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b45063e1799d428897e6f54bdb61036ad40e2aa67a45b0181c60fe2f15a9d33a084d6a2646970667358221220edb00444406d2f682f1f2b1394d72afc1d859e672f0d7ca63762ad73daab11ed64736f6c634300081a0033