ETH Price: $2,592.51 (+0.67%)
Gas: 3 Gwei

Contract

0x41A58b9e3071c855E361693976C07437785cDD79
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60808060188467412023-12-23 6:30:11230 days ago1703313011IN
 Create: ToadRouter04
0 ETH0.1258292823.68085493

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ToadRouter04

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 2000 runs

Other Settings:
paris EvmVersion
File 1 of 32 : ToadRouter04.sol
//SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.20;
import "./IERC20.sol";
import "./ToadswapLibrary.sol";
import "./TransferHelper.sol";
import "./IWETH.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
import "./IToadRouter04.sol";
import "./IPermitDai.sol";
import "./V3/CallbackValidation.sol";
import "./V3/Constants.sol";
import "./V3/TickMath.sol";
import "./V3/Path.sol";
import "./IvETH.sol";
import '@uniswap/v3-core/contracts/libraries/SafeCast.sol';
import "./ToadswapPermits.sol";

/**
 *
 * 
 * ToadRouter04
 * A re-implementation of the Uniswap v2 (and now v3) router with bot-driven meta-transactions and multi-router aggregation. 
 * Bot private keys are all stored on a hardware wallet.
 * ToadRouter03 implements ERC2612 (ERC20Permit) and auto-unwrap functions
 * 
 */
contract ToadRouter04 is IToadRouter04, OwnableUpgradeable, MulticallUpgradeable {
    using Path for bytes;
    using SafeCast for uint256;
    mapping(address => bool) allowedBots;


    address PERMIT2;

    // Threshold for gas withdraw/payout to the runner
    uint256 public gasPayThreshold;
    
    /// @dev Used as the placeholder value for amountInCached, because the computed amount in for an exact output swap
    /// can never actually be this value
    uint256 private DEFAULT_AMOUNT_IN_CACHED;

    /// @dev Transient storage variable used for returning the computed amount in for an exact output swap.
    uint256 private amountInCached;

    bytes32 private callbackDataHash;

    // 0x90a2caf2
    error Unsupported();
    // 0x77efb076
    error Untrusted();
    // 0xaf7f02d5
    error NoAcceptETH();
    // 5397a1f9
    error NotEnoughOutput();
    error InvalidPath();
    error NotEnoughGas();
    error Expired();
    error NonceInvalid();

    event BotAdded(address bot);
    event BotRemoved(address bot);
    event GasPayThresholdUpdated(uint256 newThreshold);

    modifier ensure(uint deadline) {
        if(deadline < block.timestamp) {
            revert Expired();
        }
        _;
    }

    // Anything with the onlyBot modifier is naturally protected from reentrancy, by the nature of onlyBot. If an external contract attempts to reenter, it isn't a trusted bot and the tx reverts. 
    // The only external/public call we have that isn't protected in this manner is the v3 swap callback, which is validated via other methods to ensure it came from a legitimate V3 pool. 
    modifier onlyBot() {
        if(!allowedBots[_msgSender()]) {
            revert Untrusted();
        }
        _;
    }
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        // Disable initializers on the implementation contract, this won't run in the context of the proxy as constructors basically don't exist to them
        _disableInitializers();
    }

    // We added this as we are now using Initializable and an upgradable proxy
    function initialize(address fac, address weth, address permit, address veth) public initializer {
        // Upgradeable inits
        IToadRouter04.initialize(fac, weth, veth);
        __Ownable_init();
        __Multicall_init();
        allowedBots[_msgSender()] = true;
        PERMIT2 = permit;
        // These used to be set up higher but Upgradeability means no
        gasPayThreshold = 100000000000000000;
        DEFAULT_AMOUNT_IN_CACHED = type(uint256).max;
        amountInCached = DEFAULT_AMOUNT_IN_CACHED;


    }

    function modifyGasPayThreshold(uint256 newThreshold) external onlyOwner {
        gasPayThreshold = newThreshold;
        emit GasPayThresholdUpdated(newThreshold);
    }

    function addTrustedBot(address newBot) external onlyOwner {
        allowedBots[newBot] = true;
        emit BotAdded(newBot);
    }

    function removeTrustedBot(address bot) external onlyOwner {
        allowedBots[bot] = false;
        emit BotRemoved(bot);
    }

    receive() external payable {
        // We very particularly reject ETH from untrusted sources, to prevent ETH lock-up in our router.
        if (_msgSender() != WETH && _msgSender() != vETH) {
            revert NoAcceptETH();
        }
    }

    function performPermit2Single(
        address holder,
        IAllowanceTransfer.PermitSingle memory permitSingle,
        bytes calldata signature
    ) public virtual override onlyBot {
        IAllowanceTransfer permitCA = IAllowanceTransfer(PERMIT2);
        permitCA.permit(holder, permitSingle, signature);
    }

    function performPermit2Batch(
        address holder,
        IAllowanceTransfer.PermitBatch memory permitBatch,
        bytes calldata signature
    ) public virtual override onlyBot {
        IAllowanceTransfer permitCA = IAllowanceTransfer(PERMIT2);
        permitCA.permit(holder, permitBatch, signature);
    }

    function performPermit(
        address holder,
        address tok,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override ensure(deadline) onlyBot {
        ToadswapPermits.permit(PERMIT2, holder, tok, deadline, v, r, s);
    }

    function performPermitDai(address holder, address tok, uint256 nonce, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override onlyBot {
        ToadswapPermits.permitDai(PERMIT2, holder, tok, nonce, deadline, v, r, s);
    }

    function stfFirstHop(uint256 amountIn, ToadStructs.DexData memory dex1, address path0, address path1, address sender) internal {
        TransferHelper.safeTransferFrom(PERMIT2, path0, sender, ToadswapLibrary.pairFor(path0, path1, dex1), amountIn);
    }

    function useNonce(uint256 nonce, address account) external virtual override onlyBot {
        if(accountNonces[account] != nonce) {
            revert NonceInvalid();
        }

        accountNonces[account] = accountNonces[account] + 1;
    }


    function swapExactTokensForTokensSupportingFeeOnTransferTokensWithWETHGas(
        uint amountIn,
        uint amountOutMin,
        ToadStructs.AggPath[] calldata path1,
        ToadStructs.AggPath[] calldata path2,
        address to,
        uint deadline,
        ToadStructs.FeeStruct calldata fees,
        ToadStructs.DexData[] calldata dexes
    )
        public
        virtual
        override
        ensure(deadline)
        onlyBot
        returns (uint256 outputAmount)
    {
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        // This does two half-swaps, so we can extract the gas return

        // Swap the first half
        stfFirstHop(amountIn, ToadswapLibrary.getDexId(path1[0], dexes), path1[0].token, path1[1].token, to);
        
        uint256 wethBalanceBefore = IERC20(WETH).balanceOf(address(this));
        // Swap to us
        _swapSupportingFeeOnTransferTokens(path1, address(this), dexes);
        
        if (fees.fee > 0) {
            // Send the fee anyway
            TransferHelper.safeTransfer(WETH, fees.feeReceiver, fees.fee);
        }
        // Accmulate the gas return fee
        wethBalanceBefore = wethBalanceBefore + gasReturn;
        
        // Send the remaining WETH to the next hop - no STF as we are sender
        TransferHelper.safeTransfer(path2[0].token, ToadswapLibrary.pairFor(path2[0].token, path2[1].token, dexes[path1[1].dexId]), IERC20(WETH).balanceOf(address(this)) - wethBalanceBefore);
        // Process WETH remainder
        processWETH();
        // Grab the pre-balance
        uint256 balanceBefore = IERC20(path2[path2.length - 1].token).balanceOf(to);
        // Run the final half of swap to the end user
        _swapSupportingFeeOnTransferTokens(path2, to, dexes);
        // Do the output amount check
        outputAmount = IERC20(path2[path2.length - 1].token).balanceOf(to) - (balanceBefore);
        if(outputAmount < amountOutMin) {
            revert NotEnoughOutput();
        }
    }



    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        ToadStructs.AggPath[] calldata path,
        address to,
        uint deadline,
        ToadStructs.FeeStruct calldata fees,
        uint256 ethFee,
        ToadStructs.AggPath[] calldata gasPath,
        ToadStructs.DexData[] calldata dexes
    )
        public
        virtual
        override
        ensure(deadline)
        onlyBot
        returns (uint256 outputAmount)
    {
        // So ethFee is how much token to swap for the gas price
        {
            uint256 totalFees = ethFee + fees.fee;
            if (totalFees > 0) {
                uint256 gasReturnEth = fees.gasLimit * tx.gasprice;
            
                // Swap the gasReturn tokens from their wallet to us as WETH, unwrap and send to tx origin
                stfFirstHop(
                    totalFees,
                    ToadswapLibrary.getDexId(path[1], dexes),
                    gasPath[0].token,
                    gasPath[1].token,
                    to
                );
                uint256 wethBefore = IERC20(WETH).balanceOf(address(this));
                _swapSupportingFeeOnTransferTokens(gasPath, address(this), dexes);
                uint256 ethVal = IERC20(WETH).balanceOf(address(this)) - wethBefore;
                require(ethVal >= gasReturnEth, "Not enough paid for gas.");
                if (fees.fee > 0) {
                    // Send fee
                    uint256 feePortion = fees.fee*10000 / (totalFees);
                    TransferHelper.safeTransfer(WETH, fees.feeReceiver, ethVal*feePortion/10000);
                }
                processWETH();
            }
            amountIn = amountIn - totalFees;
        }
        // Swap remaining tokens to the path provided
        stfFirstHop(
            amountIn,
            dexes[path[1].dexId],
            path[0].token,
            path[1].token,
            to
        );

        uint balanceBefore = IERC20(path[path.length - 1].token).balanceOf(to);

        _swapSupportingFeeOnTransferTokens(path, to, dexes);
        outputAmount = IERC20(path[path.length - 1].token).balanceOf(to) - (balanceBefore);
        if(outputAmount < amountOutMin) {
            revert NotEnoughOutput();
        }
    }
    
    function processWETH() internal {
        uint256 wethBal = IERC20(WETH).balanceOf(address(this));
        if (wethBal > gasPayThreshold) {
            // Withdraw over threshold
            IWETH(WETH).withdraw(wethBal);
            // Send the gas payout
            // tx.origin here is used, not as authentication, but as the user to repay gas to. Given they paid the gas, they get it.
            TransferHelper.safeTransferETH(tx.origin, wethBal);
        }
    }

 

    function swapExactWETHforTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        ToadStructs.AggPath[] memory path,
        address to,
        uint deadline,
        ToadStructs.FeeStruct calldata fees,
        ToadStructs.DexData[] calldata dexes
    )
        public 
        virtual
        override
        ensure(deadline)
        onlyBot
        returns (uint256 outputAmount)
    {
        // Grab gas limit first
        if(path[0].token != WETH && path[0].token != vETH) {
            revert InvalidPath();
        }
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        if (path[0].token == vETH) {
            // Virtual ETH
            address recipientPair = ToadswapLibrary.pairFor(WETH, path[1].token, ToadswapLibrary.getDexId(path[1], dexes));
            inputVETHHandle(to, gasReturn, amountIn, fees, recipientPair);
            path[0].token = WETH;
        } else {
            if (gasReturn + fees.fee > 0) {

                TransferHelper.safeTransferFrom(
                    PERMIT2,
                    WETH,
                    to,
                    address(this),
                    gasReturn + fees.fee
                );
                if(fees.fee > 0) {
                    TransferHelper.safeTransfer(WETH, fees.feeReceiver, fees.fee);
                }
                processWETH();
            }
            // Send to first pool
            stfFirstHop(
                amountIn - gasReturn - fees.fee,
                dexes[path[1].dexId],
                path[0].token,
                path[1].token,
                to
            );
        }
        // This code is the same
        uint256 balanceBefore = IERC20(path[path.length - 1].token).balanceOf(to);
        _swapSupportingFeeOnTransferTokens(path, to, dexes);
        outputAmount =
            IERC20(path[path.length - 1].token).balanceOf(to) -
            (balanceBefore);
        if(outputAmount < amountOutMin) {
            revert NotEnoughOutput();
        }
    }

    function swapExactTokensForWETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        ToadStructs.AggPath[] calldata path,
        address to,
        uint deadline,
        ToadStructs.FeeStruct calldata fees,
        ToadStructs.DexData[] calldata dexes,
        bool unwrap
    )
        public
        virtual
        override
        ensure(deadline)
        onlyBot
        returns (uint256 outputAmount)
    {
        if(path[path.length - 1].token != WETH) {
            revert InvalidPath();
        }

        uint256 gasReturn = fees.gasLimit * tx.gasprice;

        stfFirstHop(
            amountIn,
            dexes[path[1].dexId],
            path[0].token,
            path[1].token,
            to
        );
        uint256 balBefore = IERC20(WETH).balanceOf(address(this));
        _swapSupportingFeeOnTransferTokens(path, address(this), dexes);
        uint amountOut = IERC20(WETH).balanceOf(address(this)) - balBefore;
        // Adjust output amount to be exclusive of the payout of gas
        outputAmount = amountOut - gasReturn - fees.fee;
        if(outputAmount < amountOutMin) {
            revert NotEnoughOutput();
        }

        outputWETHHandle(unwrap, to, gasReturn, amountOut, fees);

    }

    // Gasloan WETH unwrapper
    function unwrapWETH(
        address to,
        uint256 amount,
        ToadStructs.FeeStruct calldata fees
    ) external virtual override onlyBot {
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        TransferHelper.safeTransferFrom(PERMIT2, WETH, to, address(this), amount);
        // Unwrap occurring, so unwrap all our WETH
        IWETH(WETH).withdraw(IERC20(WETH).balanceOf(address(this)));
        // Send fee
        if (fees.fee > 0) {
            TransferHelper.safeTransferETH(fees.feeReceiver, fees.fee);
        }
        // Send amount that was withdrawn
        TransferHelper.safeTransferETH(to, amount - gasReturn - fees.fee);
        // Send remainder to the tx.origin
        // tx.origin here is used, not as authentication, but as the user to repay gas to. Given they paid the gas, they get it.
        TransferHelper.safeTransferETH(tx.origin, address(this).balance);
    }

    // Pays eth to coinbase for 0 fee txns
    function sendETHToCoinbase() external payable override onlyBot {
        TransferHelper.safeTransferETH(block.coinbase, msg.value);
    }

    
    function unwrapVETH(
        address to,
        uint256 amount,
        ToadStructs.FeeStruct calldata fees
    ) external virtual override onlyBot {
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        IvETH vet = IvETH(vETH);
        vet.approvedWithdraw(to, amount, address(this));
        // tx.origin here is used, not as authentication, but as the user to repay gas to. Given they paid the gas, they get it.
        TransferHelper.safeTransferETH(tx.origin, gasReturn);
        if (fees.fee > 0) {
            TransferHelper.safeTransferETH(fees.feeReceiver, fees.fee);
        }
        TransferHelper.safeTransferETH(to, amount - gasReturn - fees.fee);
    }
    function convertVETHtoWETH(
        address to,
        uint256 amount,
        ToadStructs.FeeStruct calldata fees
    ) external virtual override onlyBot {
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        IvETH vet = IvETH(vETH);
        vet.approvedConvertToWETH9(to, amount, address(this));
        IWETH(WETH).withdraw(fees.fee + gasReturn);
        
        //TransferHelper.safeTransferETH(tx.origin, fees.gasReturn);
        if (fees.fee > 0) {
            TransferHelper.safeTransferETH(fees.feeReceiver, fees.fee);
        }
        // Send the remaining WETH back
        IWETH(WETH).transfer(to, amount - gasReturn - fees.fee);
    }

    function getPriceOut(
        uint256 amountIn,
        ToadStructs.AggPath[] calldata path,
        ToadStructs.DexData[] calldata dexes
    ) public view virtual override returns (uint256[] memory amounts) {
        return ToadswapLibrary.getPriceOut(amountIn, path, dexes);
    }

    function _swapSupportingFeeOnTransferTokens(
        ToadStructs.AggPath[] memory path,
        address _to,
        ToadStructs.DexData[] memory dexes
    ) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (
                path[i].token,
                path[i + 1].token
            );
            (address token0, ) = ToadswapLibrary.sortTokens(input, output);
            IUniswapV2Pair pair = IUniswapV2Pair(
                ToadswapLibrary.pairFor(
                    input,
                    output,
                    dexes[path[i + 1].dexId]
                )
            );
            uint amountInput;
            uint amountOutput;
            {
                // scope to avoid stack too deep errors
                (uint reserve0, uint reserve1, ) = pair.getReserves();
                (uint reserveInput, uint reserveOutput) = input == token0
                    ? (reserve0, reserve1)
                    : (reserve1, reserve0);
                amountInput =
                    IERC20(input).balanceOf(address(pair)) -
                    reserveInput;
                amountOutput = ToadswapLibrary.getAmountOut(
                    amountInput,
                    reserveInput,
                    reserveOutput
                );
            }
            (uint amount0Out, uint amount1Out) = input == token0
                ? (uint(0), amountOutput)
                : (amountOutput, uint(0));
            address to = i < path.length - 2
                ? ToadswapLibrary.pairFor(
                    output,
                    path[i + 2].token,
                    dexes[path[i + 2].dexId]
                )
                : _to;
            pair.swap(amount0Out, amount1Out, to, new bytes(0));
        }
    }

    // **** LIBRARY FUNCTIONS ****
   
    function getAmountsOut(
        uint amountIn,
        ToadStructs.AggPath[] calldata path,
        ToadStructs.DexData[] calldata dexes
    ) external view virtual override returns (uint[] memory amounts) {
        return ToadswapLibrary.getAmountsOut(amountIn, path, dexes, vETH, WETH);
    }

    function getAmountsIn(
        uint amountOut,
        ToadStructs.AggPath[] calldata path,
        ToadStructs.DexData[] calldata dexes
    ) external view virtual override returns (uint[] memory amounts) {
        return ToadswapLibrary.getAmountsIn(amountOut, path, dexes, vETH, WETH);
    }

    // V3-compatible stuff here

    /// @dev Returns the pool for the given token pair and fee. The pool contract may or may not exist.
    function getPool(
        address tokenA,
        address tokenB,
        uint24 fee,
        ToadStructs.DexData memory dex
    ) private pure returns (IUniswapV3Pool) {
        return IUniswapV3Pool(PoolAddress.computeAddress(dex.factory, dex.initcode, PoolAddress.getPoolKey(tokenA, tokenB, fee)));
    }

    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata _data
    ) external {
        // This is one of the only public/external calls that is not privileged, but this call is designed to be called during execution of another transaction. This is why we validate the callback via a hash of the data, which we store.


        if (amount0Delta == 0 && amount1Delta == 0) {
            // swaps entirely within 0-liquidity regions are not supported
            revert Unsupported();
        }
         

        // Validate the expected hash matches the data returned to us
        if(callbackDataHash != keccak256(_data)) {
            revert Untrusted();
        }        
        ToadStructs.SwapCallbackData memory data = abi.decode(_data, (ToadStructs.SwapCallbackData));
        (address tokenIn, address tokenOut, uint24 fee) = data.path.decodeFirstPool();
        // This validates the callback came from a legitimate and trusted V3 pool
        // The verification derives the correct LP pool based on tokenIn, tokenOut, and fee - based on data.dex which identifies the initcodehash/factory pair used to generate this deployment. 
        CallbackValidation.verifyCallback(tokenIn, tokenOut, fee, data.dex);

        (bool isExactInput, uint256 amountToPay) =
            amount0Delta > 0
                ? (tokenIn < tokenOut, uint256(amount0Delta))
                : (tokenOut < tokenIn, uint256(amount1Delta));
        if (isExactInput) {
            pay(tokenIn, data.payer, msg.sender, amountToPay, data.isVeth);
        } else {
            revert Unsupported();
        }
    }

    /// @param token The token to pay
    /// @param payer The entity that must pay
    /// @param recipient The entity that will receive payment
    /// @param value The amount to pay
    function pay(
        address token,
        address payer,
        address recipient,
        uint256 value,
        bool isVeth
    ) internal {
        if (isVeth) {
            // Pay with pre-converted WETH9 from us
            TransferHelper.safeTransfer(WETH, recipient, value);
        } else if (payer == address(this)) {
            // Pay with tokens already in the contract (for the exact input multihop case)
            TransferHelper.safeTransfer(token, recipient, value);
        } else {
            // pull payment via permit2
            TransferHelper.safeTransferFrom(PERMIT2, token, payer, recipient, value);
        }
    }

     /// @dev Performs a single exact input swap
    function exactInputInternal(
        uint256 amountIn,
        address recipient,
        uint160 sqrtPriceLimitX96,
        ToadStructs.SwapCallbackData memory data
    ) private returns (uint256 amountOut) {
        // Input validation on the bot submission prevents manipulation of this
        // find and replace recipient addresses
        if (recipient == Constants.MSG_SENDER) recipient = msg.sender;
        else if (recipient == Constants.ADDRESS_THIS) recipient = address(this);

        (address tokenIn, address tokenOut, uint24 fee) = data.path.decodeFirstPool();

        // Generate the abi encode of the callback data
        bytes memory callbackData = abi.encode(data);
        // Generate a callback data hash
        callbackDataHash = keccak256(callbackData);
        bool zeroForOne = tokenIn < tokenOut;
        (int256 amount0, int256 amount1) =
            getPool(tokenIn, tokenOut, fee, data.dex).swap(
                recipient,
                zeroForOne,
                amountIn.toInt256(),
                sqrtPriceLimitX96 == 0
                    ? (zeroForOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1)
                    : sqrtPriceLimitX96,
                callbackData
            );
            // Clear the callback data hash
        delete(callbackDataHash);
        return uint256(-(zeroForOne ? amount1 : amount0));
    }

    function exactInputGas(address recipient, ToadStructs.FeeStruct memory fees, ToadStructs.GasRepayParams memory repay) internal {
        // No WETH in the hops, so we need to run a sell of our own first off
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        if((gasReturn + fees.fee) == 0) {
            return;
        }
        address payer = recipient;
        uint256 amtOutGas = 0;
        while (true) { 
            bool hasMultiplePools = repay.path.hasMultiplePools();
            repay.amountIn = exactInputInternal(
                repay.amountIn,
                address(this) , // Always pays out to the router, as this will end in WETH9 to be given as gas repay
                0,
                ToadStructs.SwapCallbackData({
                    path: repay.path.getFirstPool(), // only the first pool in the path is necessary
                    payer: payer,
                    isVeth: false,
                    dex: repay.dex
                })
            );
            // decide whether to continue or terminate
            if (hasMultiplePools) {
                payer = address(this);
                repay.path = repay.path.skipToken();
            } else {
                amtOutGas = repay.amountIn;
                break;
            }
        }
        if(amtOutGas < gasReturn + fees.fee) {
            revert NotEnoughGas();
        }
        
        if (fees.fee > 0) {
            // Send the WETH on its own
            TransferHelper.safeTransfer(WETH, fees.feeReceiver, fees.fee);
        }

        processWETH();
    }

    function exactInputSingle(ToadStructs.ExactInputSingleParams memory params, ToadStructs.FeeStruct memory fees, ToadStructs.GasRepayParams memory repay)
        external
        payable
        override
        onlyBot
        returns (uint256 amountOut)
    {
        // Have to mark this beforehand as repay.amountIn changes
        params.amountIn = params.amountIn - repay.amountIn;
        exactInputGas(params.holder, fees, repay);

        // Now, do the swap
        amountOut = exactInputInternal(
            params.amountIn ,
            params.recipient,
            params.sqrtPriceLimitX96,
            ToadStructs.SwapCallbackData({
                path: abi.encodePacked(params.tokenIn, params.fee, params.tokenOut),
                payer: params.holder,
                isVeth: false,
                dex: params.dex
            })
        );
        if(amountOut < params.amountOutMinimum) {
            revert NotEnoughOutput();
        }
    }


    function exactInputSingleWETH(ToadStructs.ExactInputSingleParams memory params, ToadStructs.FeeStruct memory fees)
        external
        payable
        override
        onlyBot
        returns (uint256 amountOut)
    {
        if(params.tokenIn != WETH && params.tokenIn != vETH && params.tokenOut != WETH) {
            revert InvalidPath();
        }
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        // We don't support the swap entire contract balance
        bool isveth = false;
        if(params.tokenIn == WETH) {
            inputWETHHandle(params.holder, gasReturn, fees);
        } else if(params.tokenIn == vETH) {
            // vETH
            inputVETHHandle(params.holder, gasReturn, params.amountIn, fees, address(this));
            isveth = true;
            params.tokenIn = WETH;
            params.amountIn = params.amountIn - gasReturn - fees.fee;

        } 
        // Otherwise, output must be WETH
        if(params.tokenOut == WETH) {
            // Pay to us, so we can interdict and pay the remainder
            amountOut = exactInputInternal(
                params.amountIn,
                address(this),
                params.sqrtPriceLimitX96,
                ToadStructs.SwapCallbackData({
                    path: abi.encodePacked(params.tokenIn, params.fee, params.tokenOut),
                    payer: params.holder,
                    isVeth: isveth,
                    dex: params.dex
                })
            );
            if(amountOut < params.amountOutMinimum) {
            revert NotEnoughOutput();
            }
            outputWETHHandle(params.unwrap, params.recipient, gasReturn, amountOut, fees);

        } else {
            amountOut = exactInputInternal(
                params.amountIn,
                params.recipient,
                params.sqrtPriceLimitX96,
                ToadStructs.SwapCallbackData({
                    path: abi.encodePacked(params.tokenIn, params.fee, params.tokenOut),
                    payer: params.holder,
                    isVeth: isveth,
                    dex: params.dex
                })
            );
            if(amountOut < params.amountOutMinimum) {
                revert NotEnoughOutput();
            }
           
        }


    }

    function exactInput(ToadStructs.ExactInputParams memory params, ToadStructs.FeeStruct memory fees, ToadStructs.GasRepayParams memory repay) external payable override onlyBot returns (uint256 amountOut) {
        
        address payer = params.holder;
        params.amountIn = params.amountIn - repay.amountIn;
        exactInputGas(params.holder, fees, repay);
        while (true) {
            bool hasMultiplePools = params.path.hasMultiplePools();
            
            // the outputs of prior swaps become the inputs to subsequent ones
            params.amountIn = exactInputInternal(
                params.amountIn,
                hasMultiplePools ? address(this) : params.recipient, // for intermediate swaps, this contract custodies
                0,
                ToadStructs.SwapCallbackData({
                    path: params.path.getFirstPool(), // only the first pool in the path is necessary
                    payer: payer,
                    isVeth: false,
                    dex: params.dex
                })
            );

            // decide whether to continue or terminate
            if (hasMultiplePools) {
                payer = address(this);
                params.path = params.path.skipToken();
            } else {
                amountOut = params.amountIn;
                break;
            }
        }
        if(amountOut < params.amountOutMinimum) {
            revert NotEnoughOutput();
        }


    }

    function inputWETHHandle(address holder, uint256 amount, ToadStructs.FeeStruct memory fees) internal {
        // Is weth, so take the payment for gas and fee now
        if(amount + fees.fee > 0) {
            TransferHelper.safeTransferFrom(PERMIT2, WETH, holder, address(this), amount + fees.fee);
            if (fees.fee > 0) {
                // Send the WETH on its own
                TransferHelper.safeTransfer(WETH, fees.feeReceiver, fees.fee);
            }
        }
        
        processWETH();
    }

    function inputVETHHandle(address holder, uint256 gasReturn, uint256 amount, ToadStructs.FeeStruct memory fees, address onward) internal {
        IvETH vet = IvETH(vETH);
        // Pull all to us
        if(gasReturn + fees.fee > 0) {
            vet.approvedTransferFrom(holder, gasReturn + fees.fee, address(this));
        }
        // Send the onward portion as WETH
        if(amount > 0) {
            vet.approvedConvertToWETH9(holder, amount - gasReturn - fees.fee, onward);
        }
        if (fees.fee > 0) {
            vet.transfer(fees.feeReceiver, fees.fee);
        }
        if(vet.balanceOf(address(this)) > gasPayThreshold) {
            // tx.origin here is used, not as authentication, but as the user to repay gas to. Given they paid the gas, they get it.
            vet.approvedWithdraw(address(this), vet.balanceOf(address(this)), tx.origin);
            
        } 
    }

    function outputWETHHandle(bool unwrap, address recipient, uint256 gasReturn, uint256 amountOut, ToadStructs.FeeStruct memory fees) internal {
        // Pay fee
        if (fees.fee > 0) {
            TransferHelper.safeTransfer(WETH, fees.feeReceiver, fees.fee);
        }
        if(unwrap) {
            // Unwrap it all, as we need to pay the user in ETH
            IWETH(WETH).withdraw(IERC20(WETH).balanceOf(address(this)));
            // Send user the ETH
            TransferHelper.safeTransferETH(recipient, amountOut - fees.fee - gasReturn);
            // send the rest to the tx origin 
            // tx.origin here is used, not as authentication, but as the user to repay gas to. Given they paid the gas, they get it.
            TransferHelper.safeTransferETH(tx.origin, address(this).balance);
        } else {
            TransferHelper.safeTransfer(WETH, recipient, amountOut - fees.fee - gasReturn);
            processWETH();
        }
    }

    function exactInputWETH(ToadStructs.ExactInputParams memory params, ToadStructs.FeeStruct memory fees) external payable override onlyBot returns (uint256 amountOut) {
        uint256 gasReturn = fees.gasLimit * tx.gasprice;
        address payer = msg.sender;
        bool hasPaid = false;
        bool isveth = false;
        (address tokenIn, ,) = params.path.decodeFirstPool();
        if(tokenIn == WETH) {
            inputWETHHandle(params.holder, gasReturn, fees);
        } else if (tokenIn == vETH) {

            inputVETHHandle(params.holder, gasReturn, params.amountIn, fees, address(this));
            isveth = true;
            params.path = params.path.replaceFirstPoolAddress(WETH);
        }
        while (true) {
            bool hasMultiplePools = params.path.hasMultiplePools();
            (, address tokenOut,) = params.path.decodeFirstPool();
            
            // the outputs of prior swaps become the inputs to subsequent ones
            params.amountIn = exactInputInternal(
                params.amountIn,
                hasMultiplePools ? address(this) : params.recipient, // for intermediate swaps, this contract custodies
                0,
                ToadStructs.SwapCallbackData({
                    path: params.path.getFirstPool(), // only the first pool in the path is necessary
                    payer: payer,
                    isVeth: isveth,
                    dex: params.dex
                })
            );
            isveth = false;
            if (tokenOut == WETH) {
                // Subtract fees now
                params.amountIn = (params.amountIn - fees.fee - gasReturn);
                if (fees.fee > 0) {
                    TransferHelper.safeTransfer(WETH, fees.feeReceiver, fees.fee);
                }
                hasPaid = true;
            }
            

            // decide whether to continue or terminate
            if (hasMultiplePools) {
                payer = address(this);
                params.path = params.path.skipToken();
            } else {
                amountOut = params.amountIn;
                break;
            }
        }
        processWETH();
        if(amountOut < params.amountOutMinimum) {
            revert NotEnoughOutput();
        }
        if(!hasPaid) {
            revert NotEnoughGas();
        }
    }

}

File 2 of 32 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

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

    function __Ownable_init_unchained() internal onlyInitializing {
        _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);
    }

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

File 3 of 32 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

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

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

File 4 of 32 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 32 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

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

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

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

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

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

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

File 6 of 32 : MulticallUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.5) (utils/Multicall.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
 * careful about sending transactions invoking {multicall}. For example, a relay address that filters function
 * selectors won't filter calls nested within a {multicall} operation.
 *
 * NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
 * If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
 * to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
 * {_msgSender} are not propagated to subcalls.
 *
 * _Available since v4.1._
 */
abstract contract MulticallUpgradeable is Initializable, ContextUpgradeable {
    function __Multicall_init() internal onlyInitializing {
    }

    function __Multicall_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        bytes memory context = msg.sender == _msgSender()
            ? new bytes(0)
            : msg.data[msg.data.length - _contextSuffixLength():];

        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = AddressUpgradeable.functionDelegateCall(address(this), bytes.concat(data[i], context));
        }
        return results;
    }

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

File 7 of 32 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 8 of 32 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 9 of 32 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 10 of 32 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 11 of 32 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 12 of 32 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 13 of 32 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 14 of 32 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 15 of 32 : SafeCast.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Safe casting methods
/// @notice Contains methods for safely casting between types
library SafeCast {
    /// @notice Cast a uint256 to a uint160, revert on overflow
    /// @param y The uint256 to be downcasted
    /// @return z The downcasted integer, now type uint160
    function toUint160(uint256 y) internal pure returns (uint160 z) {
        require((z = uint160(y)) == y);
    }

    /// @notice Cast a int256 to a int128, revert on overflow or underflow
    /// @param y The int256 to be downcasted
    /// @return z The downcasted integer, now type int128
    function toInt128(int256 y) internal pure returns (int128 z) {
        require((z = int128(y)) == y);
    }

    /// @notice Cast a uint256 to a int256, revert on overflow
    /// @param y The uint256 to be casted
    /// @return z The casted integer, now type int256
    function toInt256(uint256 y) internal pure returns (int256 z) {
        require(y < 2**255);
        z = int256(y);
    }
}

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

pragma solidity =0.8.20;

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

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

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

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

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

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

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

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

File 17 of 32 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity =0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
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].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 18 of 32 : IAllowanceTransfer.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.20;

/// @title AllowanceTransfer
/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts
/// @dev Requires user's token approval on the Permit2 contract
interface IAllowanceTransfer {
    /// @notice Thrown when an allowance on a token has expired.
    /// @param deadline The timestamp at which the allowed amount is no longer valid
    error AllowanceExpired(uint256 deadline);

    /// @notice Thrown when an allowance on a token has been depleted.
    /// @param amount The maximum amount allowed
    error InsufficientAllowance(uint256 amount);

    /// @notice Thrown when too many nonces are invalidated.
    error ExcessiveInvalidation();

    /// @notice Emits an event when the owner successfully invalidates an ordered nonce.
    event NonceInvalidation(
        address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce
    );

    /// @notice Emits an event when the owner successfully sets permissions on a token for the spender.
    event Approval(
        address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration
    );

    /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.
    event Permit(
        address indexed owner,
        address indexed token,
        address indexed spender,
        uint160 amount,
        uint48 expiration,
        uint48 nonce
    );

    /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.
    event Lockdown(address indexed owner, address token, address spender);

    /// @notice The permit data for a token
    struct PermitDetails {
        // ERC20 token address
        address token;
        // the maximum amount allowed to spend
        uint160 amount;
        // timestamp at which a spender's token allowances become invalid
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice The permit message signed for a single token allownce
    struct PermitSingle {
        // the permit data for a single token alownce
        PermitDetails details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The permit message signed for multiple token allowances
    struct PermitBatch {
        // the permit data for multiple token allowances
        PermitDetails[] details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The saved permissions
    /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    struct PackedAllowance {
        // amount allowed
        uint160 amount;
        // permission expiry
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice A token spender pair.
    struct TokenSpenderPair {
        // the token the spender is approved
        address token;
        // the spender address
        address spender;
    }

    /// @notice Details for a token transfer.
    struct AllowanceTransferDetails {
        // the owner of the token
        address from;
        // the recipient of the token
        address to;
        // the amount of the token
        uint160 amount;
        // the token to be transferred
        address token;
    }

    /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.
    /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]
    /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.
    function allowance(address, address, address) external view returns (uint160, uint48, uint48);

    /// @notice Approves the spender to use up to amount of the specified token up until the expiration
    /// @param token The token to approve
    /// @param spender The spender address to approve
    /// @param amount The approved amount of the token
    /// @param expiration The timestamp at which the approval is no longer valid
    /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    function approve(address token, address spender, uint160 amount, uint48 expiration) external;

    /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitSingle Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;

    /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitBatch Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;

    /// @notice Transfer approved tokens from one address to another
    /// @param from The address to transfer from
    /// @param to The address of the recipient
    /// @param amount The amount of the token to transfer
    /// @param token The token address to transfer
    /// @dev Requires the from address to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(address from, address to, uint160 amount, address token) external;

    /// @notice Transfer approved tokens in a batch
    /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers
    /// @dev Requires the from addresses to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;

    /// @notice Enables performing a "lockdown" of the sender's Permit2 identity
    /// by batch revoking approvals
    /// @param approvals Array of approvals to revoke.
    function lockdown(TokenSpenderPair[] calldata approvals) external;

    /// @notice Invalidate nonces for a given (token, spender) pair
    /// @param token The token to invalidate nonces for
    /// @param spender The spender to invalidate nonces for
    /// @param newNonce The new nonce to set. Invalidates all nonces less than it.
    /// @dev Can't invalidate more than 2**16 nonces per transaction.
    function invalidateNonces(address token, address spender, uint48 newNonce) external;
}

File 19 of 32 : IPermitDai.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
// Just an interface for Dai's permits
pragma solidity =0.8.20;
abstract contract IPermitDai {
    function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external virtual;
    // Defining details for checking
    function PERMIT_TYPEHASH() public virtual returns (bytes32);
    function nonces(address) public virtual returns (uint256);
}

File 20 of 32 : IToadRouter04.sol
/// SPDX-License-Identifier: NONE
pragma solidity =0.8.20;

import "./ToadStructs.sol";
import "./IPermit2/IAllowanceTransfer.sol";

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


/**
 * IToadRouter04
 * Extends the V3 router with Uniswap V3 capabilities and vETH support
 */
abstract contract IToadRouter04 is Initializable {

    address public vETH;
        
    // IToadRouter01
    string public versionRecipient;


    address public factory;
    address public WETH;


    mapping(address => uint256) public accountNonces;

   function initialize(address fac, address weth, address veth) public onlyInitializing {
        factory = fac;
        WETH = weth;
        vETH = veth;
        versionRecipient =  "3.0.0";
   } 



    function useNonce(uint256 nonce, address account) external virtual;

    function exactInputWETH(ToadStructs.ExactInputParams memory params, ToadStructs.FeeStruct memory fees) external payable virtual returns (uint256 amountOut);
    function exactInputSingleWETH(ToadStructs.ExactInputSingleParams memory params, ToadStructs.FeeStruct memory fees) external payable virtual returns (uint256 amountOut);
    function exactInput(ToadStructs.ExactInputParams memory params, ToadStructs.FeeStruct memory fees, ToadStructs.GasRepayParams memory repay) external payable virtual returns (uint256 amountOut);
    function exactInputSingle(ToadStructs.ExactInputSingleParams memory params, ToadStructs.FeeStruct memory fees, ToadStructs.GasRepayParams memory repay) external payable virtual returns (uint256 amountOut);

    function unwrapVETH(address to, uint256 amount, ToadStructs.FeeStruct calldata fees) external virtual;

    function sendETHToCoinbase() external payable virtual;

    function convertVETHtoWETH(address to, uint256 amount, ToadStructs.FeeStruct calldata fees) external virtual;
    //function swapExactTokensForTokens
        /**
     * Run a permit on a token to the Permit2 contract for max uint256
     * @param holder the token owner
     * @param tok the token to permit
     * @param deadline A deadline to expire by
     * @param v v of the sig
     * @param r r of the sig
     * @param s s of the sig
     */
    function performPermit(address holder, address tok, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual;

    /**
     * Run a permit on a token to the Permit2 contract via the Dai-style permit
     * @param holder the token owner
     * @param tok the token to permit
     * @param deadline A deadline to expire by
     * @param nonce the nonce
     * @param v v of the sig
     * @param r r of the sig
     * @param s s of the sig
     */
    function performPermitDai(address holder, address tok, uint256 nonce, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual;

    /**
     * Run a Permit2 permit on a token to be spent by us
     * @param holder The tokens owner
     * @param permitSingle The struct 
     * @param signature The signature
     */
    function performPermit2Single(address holder, IAllowanceTransfer.PermitSingle memory permitSingle, bytes calldata signature) public virtual;

    /**
     * Run a batch of Permit2 permits on a token to be spent by us
     * @param holder The tokens owner
     * @param permitBatch The struct
     * @param signature The signature
     */
    function performPermit2Batch(address holder, IAllowanceTransfer.PermitBatch memory permitBatch, bytes calldata signature) public virtual;

    function swapExactTokensForTokensSupportingFeeOnTransferTokensWithWETHGas(uint amountIn, uint amountOutMin, ToadStructs.AggPath[] calldata path1, ToadStructs.AggPath[] calldata path2, address to, uint deadline, ToadStructs.FeeStruct calldata fees, ToadStructs.DexData[] calldata dexes) public virtual returns(uint256 outputAmount);

    function swapExactTokensForWETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, ToadStructs.AggPath[] calldata path, address to, uint deadline, ToadStructs.FeeStruct calldata fees, ToadStructs.DexData[] calldata dexes, bool unwrap) public virtual returns(uint256 outputAmount);

    function swapExactWETHforTokensSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, ToadStructs.AggPath[] memory path, address to, uint deadline, ToadStructs.FeeStruct calldata fees, ToadStructs.DexData[] calldata dexes) public virtual returns(uint256 outputAmount);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, ToadStructs.AggPath[] calldata path, address to, uint deadline, ToadStructs.FeeStruct calldata fees, uint256 ethFee, ToadStructs.AggPath[] calldata gasPath, ToadStructs.DexData[] calldata dexes) public virtual returns(uint256 outputAmount);

    function getPriceOut(uint256 amountIn, ToadStructs.AggPath[] calldata path, ToadStructs.DexData[] calldata dexes) public view virtual returns (uint256[] memory amounts);
    
    function getAmountsOut(uint amountIn, ToadStructs.AggPath[] calldata path, ToadStructs.DexData[] calldata dexes) external view virtual returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, ToadStructs.AggPath[] calldata path, ToadStructs.DexData[] calldata dexes) external view virtual returns (uint[] memory amounts);

    function unwrapWETH(address to, uint256 amount, ToadStructs.FeeStruct calldata fees) external virtual;


}


//swapExactTokensForTokensSupportingFeeOnTransferTokensWithWETHGas(uint256,uint256,(address,uint96)[],(address,uint96)[],address,uint256,(uint256,address,uint96),(bytes32,address)[])

File 21 of 32 : IvETH.sol
// SPDX-License-Identifier: NONE
pragma solidity =0.8.20;


/**
 * @title vETH
 * @author Riley - Two Brothers Crypto ([email protected])
 * @notice Holds Ethereum on behalf of end users to be used in ToadSwap operations without subsequent approvals being required.
 * In essence, a privileged version of WETH9. Implements the WETH9 spec, but with extra functions.
 */
abstract contract IvETH {



    function balanceOf(address account) public virtual view returns (uint);

    function deposit() external virtual payable;

    function withdraw(uint wad) public virtual;

    function convertFromWETH9(uint256 amount, address recipient) external virtual;

    function convertToWETH9(uint256 amount, address recipient) external virtual;

    function addToFullApproval(address account) external virtual;

    function removeFromFullApproval(address account) external virtual;

    /**
     * Performs a WETH9->vETH conversion with pre-deposited WETH9
     * @param amount amount to convert 
     * @param recipient recipient to credit
     */
    function approvedConvertFromWETH9(uint256 amount, address recipient) external virtual;
    /**
     * Performs a vETH->WETH9 conversion on behalf of a user. Approved contracts only.
     * @param user user to perform on behalf of
     * @param amount amount to convert
     * @param recipient recipient wallet to send to
     */
    function approvedConvertToWETH9(address user, uint256 amount, address recipient) external virtual;
    /**
     * Performs a withdrawal on behalf of a user. Approved contracts only.
     * @param user user to perform on behalf of
     * @param amount amount to withdraw
     * @param recipient recipient wallet to send to
     */
    function approvedWithdraw(address user, uint256 amount, address recipient) external virtual;

    function approvedTransferFrom(address user, uint256 amount, address recipient) external virtual;

    function transfer(address to, uint value) public virtual;


}

File 22 of 32 : IWETH.sol
pragma solidity =0.8.20;

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

File 23 of 32 : ToadStructs.sol
// SPDX-License-Identifier: NONE
pragma solidity =0.8.20;

contract ToadStructs {
    /**
     * token: The token
     * dexId: the position of the dex struct in the list provided - should be the same between input and output token 
     
     */
    struct AggPath {
        address token;
        uint96 dexId;
    }
    /**
     * DexData - a list of UniV2 dexes referred to in AggPath - shared between gasPath and path
     * initcode: the initcode to feed the create2 seed
     * factory: the factory address to feed the create2 seed
     */
    struct DexData {
        bytes32 initcode;
        address factory;
    }
    /**
     * FeeStruct - a batch of fees to be paid in gas and optionally to another account
     */
    struct FeeStruct {
        uint256 gasLimit;
        address feeReceiver;
        uint96 fee;
    }


    struct ExactInputSingleParams {
        address holder;
        bool unwrap;
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
        DexData dex;
    }

    struct GasRepayParams {
        bytes path;
        DexData dex;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    struct SwapCallbackData {
        bytes path;
        address payer;
        bool isVeth;
        
        DexData dex;
    }

    struct ExactInputParams {
        address holder;
        bytes path;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        DexData dex;
    }


}

File 24 of 32 : ToadswapLibrary.sol
/**
 * Modified version of the UniswapV2Library to use inbuilt SafeMath
 * Also supports Toad struct stuff
 */
//SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.20;

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';

import './ToadStructs.sol';

library ToadswapLibrary {


    error InsufficientAmount();
    error InsufficientLiquidity();
    error IdenticalAddress();
    error ZeroAddress();
    error InvalidPathLib();

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'ToadswapLibrary: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'ToadswapLibrary: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a UniswapV2 pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        pair = pairFor(tokenA, tokenB, ToadStructs.DexData(hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f', factory));
    }


    function pairFor(address tokenA, address tokenB, ToadStructs.DexData memory dex) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint160(uint256(keccak256(abi.encodePacked(
            hex'ff',
            dex.factory,
            keccak256(abi.encodePacked(token0, token1)),
            dex.initcode // init code hash

        )))));

    }

    function getDexId(ToadStructs.AggPath memory path, ToadStructs.DexData[] memory dexes ) internal pure returns(ToadStructs.DexData memory dex) {
        dex = dexes[path.dexId];
    }


    function getPriceOut(uint256 amountIn, ToadStructs.AggPath[] calldata path, ToadStructs.DexData[] calldata dexes) internal view returns (uint256[] memory amounts) {
        if(path.length < 2) {
            revert InvalidPathLib();
        }
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {

            (uint reserveIn, uint reserveOut) = getReserves(path[i].token, path[i + 1].token, dexes[path[i+1].dexId]);
            amounts[i + 1] = quote(amounts[i], reserveIn, reserveOut);
        }
    }


    // fetches and sorts the reserves for a pair
    function getReserves(address tokenA, address tokenB, ToadStructs.DexData memory dex) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(tokenA, tokenB, dex)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        if (amountA == 0) {
            revert InsufficientAmount();
        }
        if(reserveA == 0 && reserveB == 0) {
            revert InsufficientLiquidity();
        }
    
        amountB = amountA * (reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        if (amountIn == 0) {
            revert InsufficientAmount();
        }
        if(reserveIn == 0 && reserveOut == 0) {
            revert InsufficientLiquidity();
        }
        uint amountInWithFee = amountIn * 997;
        uint numerator = amountInWithFee * reserveOut;
        uint denominator = (reserveIn * 1000) + amountInWithFee;
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        if (amountOut == 0) {
            revert InsufficientAmount();
        }
        if(reserveIn == 0 && reserveOut == 0) {
            revert InsufficientLiquidity();
        }
        uint numerator = reserveIn * amountOut * 1000;
        uint denominator = (reserveOut - amountOut) * 997;
        amountIn = (numerator / denominator) + 1;
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(uint amountIn, ToadStructs.AggPath[] memory path, ToadStructs.DexData[] memory dexes, address vETH, address WETH) internal view returns (uint[] memory amounts) {
        if(path.length < 2) {
            revert InvalidPathLib();
        }
        if(path[0].token == vETH) {
            path[0].token = WETH;
        }
        amounts = new uint[](path.length);
        amounts[0] = amountIn;

        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(path[i].token, path[i + 1].token, dexes[path[i+1].dexId]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }


    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(uint amountOut, ToadStructs.AggPath[] memory path, ToadStructs.DexData[] memory dexes, address vETH, address WETH) internal view returns (uint[] memory amounts) {
        if(path.length < 2) {
            revert InvalidPathLib();
        }
        if(path[0].token == vETH) {
            path[0].token = WETH;
        }
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(path[i - 1].token, path[i].token, dexes[path[i].dexId]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }


}

File 25 of 32 : ToadswapPermits.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity =0.8.20;
import "./IPermitDai.sol";
import "./IERC20Permit.sol";
library ToadswapPermits {
    bytes32 public constant DAI_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb;
    error NotDaiPermit();
    error NotPermittable();
    function permitDai(address PERMIT2, address holder, address tok, uint256 nonce, uint256 deadline, uint8 v, bytes32 r, bytes32 s) internal {
        IPermitDai dpermit = IPermitDai(tok);
        // The Dai-style permit's typehash is always the same
        if(dpermit.PERMIT_TYPEHASH() != DAI_TYPEHASH) {
            revert NotDaiPermit();
        }
        dpermit.permit(holder, PERMIT2, nonce, deadline, true, v, r, s);
    }

    function permit(address PERMIT2, address holder, address tok, uint256 deadline, uint8 v, bytes32 r, bytes32 s) internal {
        // There isn't actually a really easy way to check if an IERC20Permit actually meets the standard
        // So best we can do is try and ensure success on the selector nonces(address) - this will match Permit and Dai Permit
        (bool success, ) = tok.call(abi.encodeWithSelector(0x7ecebe00, holder));
        if(!success) {
            revert NotPermittable();
        }
        IERC20Permit ptok = IERC20Permit(tok);
        ptok.permit(holder, PERMIT2, type(uint256).max, deadline, v, r, s);
    }
}

File 26 of 32 : TransferHelper.sol
//SPDX-License-Identifier: GPL-3.0
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
// Modified by TBC to use Permit2's transferFrom and vETH privs
import "./IPermit2/IAllowanceTransfer.sol";
pragma solidity =0.8.20;
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address permit2, address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint160,address)')));
        IAllowanceTransfer permitter = IAllowanceTransfer(permit2);
        permitter.transferFrom(from, to, uint160(value), token);
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

File 27 of 32 : BytesLib.sol
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity =0.8.20;

library BytesLib {
    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    ) internal pure returns (bytes memory) {
        require(_length + 31 >= _length, 'slice_overflow');
        require(_start + _length >= _start, 'slice_overflow');
        require(_bytes.length >= _start + _length, 'slice_outOfBounds');

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
                case 0 {
                    // Get a location of some free memory and store it in tempBytes as
                    // Solidity does for memory variables.
                    tempBytes := mload(0x40)

                    // The first word of the slice result is potentially a partial
                    // word read from the original array. To read it, we calculate
                    // the length of that partial word and start copying that many
                    // bytes into the array. The first word we copy will start with
                    // data we don't care about, but the last `lengthmod` bytes will
                    // land at the beginning of the contents of the new array. When
                    // we're done copying, we overwrite the full first word with
                    // the actual length of the slice.
                    let lengthmod := and(_length, 31)

                    // The multiplication in the next line is necessary
                    // because when slicing multiples of 32 bytes (lengthmod == 0)
                    // the following copy loop was copying the origin's length
                    // and then ending prematurely not copying everything it should.
                    let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                    let end := add(mc, _length)

                    for {
                        // The multiplication in the next line has the same exact purpose
                        // as the one above.
                        let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                    } lt(mc, end) {
                        mc := add(mc, 0x20)
                        cc := add(cc, 0x20)
                    } {
                        mstore(mc, mload(cc))
                    }

                    mstore(tempBytes, _length)

                    //update free-memory pointer
                    //allocating the array padded to 32 bytes like the compiler does now
                    mstore(0x40, and(add(mc, 31), not(31)))
                }
                //if we want a zero-length slice let's just return a zero-length array
                default {
                    tempBytes := mload(0x40)
                    //zero out the 32 bytes slice we are about to return
                    //we need to do it because Solidity does not garbage collect
                    mstore(tempBytes, 0)

                    mstore(0x40, add(tempBytes, 0x20))
                }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_start + 20 >= _start, 'toAddress_overflow');
        require(_bytes.length >= _start + 20, 'toAddress_outOfBounds');
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {
        require(_start + 3 >= _start, 'toUint24_overflow');
        require(_bytes.length >= _start + 3, 'toUint24_outOfBounds');
        uint24 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x3), _start))
        }

        return tempUint;
    }
}

File 28 of 32 : CallbackValidation.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.20;

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import './PoolAddress.sol';
import "../ToadStructs.sol";
/// @notice Provides validation for callbacks from Uniswap V3 Pools
library CallbackValidation {
    /// @notice Returns the address of a valid Uniswap V3 Pool
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @param dex The dex that represents the V3 factory and initcode
    /// @return pool The V3 pool contract address
    function verifyCallback(
        address tokenA,
        address tokenB,
        uint24 fee,
        ToadStructs.DexData memory dex
    ) internal view returns (IUniswapV3Pool pool) {
        return verifyCallback(PoolAddress.getPoolKey(tokenA, tokenB, fee), dex);
    }

    /// @notice Returns the address of a valid Uniswap V3 Pool
    /// @param poolKey The identifying key of the V3 pool
    /// @return pool The V3 pool contract address
    function verifyCallback( PoolAddress.PoolKey memory poolKey, ToadStructs.DexData memory dex)
        internal
        view
        returns (IUniswapV3Pool pool)
    {
        pool = IUniswapV3Pool(PoolAddress.computeAddress(dex.factory, dex.initcode, poolKey));
        require(msg.sender == address(pool));
    }
}

File 29 of 32 : Constants.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.20;

/// @title Constant state
/// @notice Constant state used by the swap router
library Constants {
    /// @dev Used for identifying cases when this contract's balance of a token is to be used
    uint256 internal constant CONTRACT_BALANCE = 0;

    /// @dev Used as a flag for identifying msg.sender, saves gas by sending more 0 bytes
    address internal constant MSG_SENDER = address(1);

    /// @dev Used as a flag for identifying address(this), saves gas by sending more 0 bytes
    address internal constant ADDRESS_THIS = address(2);
}

File 30 of 32 : Path.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.20;

import './BytesLib.sol';

/// @title Functions for manipulating path data for multihop swaps
library Path {
    using BytesLib for bytes;

    /// @dev The length of the bytes encoded address
    uint256 private constant ADDR_SIZE = 20;
    /// @dev The length of the bytes encoded fee
    uint256 private constant FEE_SIZE = 3;

    /// @dev The offset of a single token address and pool fee
    uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE;
    /// @dev The offset of an encoded pool key
    uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE;
    /// @dev The minimum length of an encoding that contains 2 or more pools
    uint256 private constant MULTIPLE_POOLS_MIN_LENGTH = POP_OFFSET + NEXT_OFFSET;

    /// @notice Returns true iff the path contains two or more pools
    /// @param path The encoded swap path
    /// @return True if path contains two or more pools, otherwise false
    function hasMultiplePools(bytes memory path) internal pure returns (bool) {
        return path.length >= MULTIPLE_POOLS_MIN_LENGTH;
    }

    /// @notice Returns the number of pools in the path
    /// @param path The encoded swap path
    /// @return The number of pools in the path
    function numPools(bytes memory path) internal pure returns (uint256) {
        // Ignore the first token address. From then on every fee and token offset indicates a pool.
        return ((path.length - ADDR_SIZE) / NEXT_OFFSET);
    }

    /// @notice Decodes the first pool in path
    /// @param path The bytes encoded swap path
    /// @return tokenA The first token of the given pool
    /// @return tokenB The second token of the given pool
    /// @return fee The fee level of the pool
    function decodeFirstPool(bytes memory path)
        internal
        pure
        returns (
            address tokenA,
            address tokenB,
            uint24 fee
        )
    {
        tokenA = path.toAddress(0);
        fee = path.toUint24(ADDR_SIZE);
        tokenB = path.toAddress(NEXT_OFFSET);
    }

    /**
     * Replaces the first pool address with the input
     * Added by TBC for ToadSwap
     * @param path path to modify
     * @param inp address to add
     * @return the modified path
     */
    function replaceFirstPoolAddress(bytes memory path, address inp) internal pure returns (bytes memory) {
        bytes20 addr20 = bytes20(inp); 
        for(uint256 i = 0; i < 20; i++) {
            path[i] = addr20[i];
        }
        return path;
    }

    /// @notice Gets the segment corresponding to the first pool in the path
    /// @param path The bytes encoded swap path
    /// @return The segment containing all data necessary to target the first pool in the path
    function getFirstPool(bytes memory path) internal pure returns (bytes memory) {
        return path.slice(0, POP_OFFSET);
    }

    /// @notice Skips a token + fee element from the buffer and returns the remainder
    /// @param path The swap path
    /// @return The remaining token + fee elements in the path
    function skipToken(bytes memory path) internal pure returns (bytes memory) {
        return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET);
    }
}

File 31 of 32 : PoolAddress.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.20;

/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
library PoolAddress {
    bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;

    /// @notice The identifying key of the pool
    struct PoolKey {
        address token0;
        address token1;
        uint24 fee;
    }

    /// @notice Returns PoolKey: the ordered tokens with the matched fee levels
    /// @param tokenA The first token of a pool, unsorted
    /// @param tokenB The second token of a pool, unsorted
    /// @param fee The fee level of the pool
    /// @return Poolkey The pool details with ordered token0 and token1 assignments
    function getPoolKey(
        address tokenA,
        address tokenB,
        uint24 fee
    ) internal pure returns (PoolKey memory) {
        if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
        return PoolKey({token0: tokenA, token1: tokenB, fee: fee});
    }

    /// @notice Deterministically computes the pool address given the factory and PoolKey
    /// @param factory The Uniswap V3 factory contract address
    /// @param key The PoolKey
    /// @return pool The contract address of the V3 pool
    function computeAddress(address factory, bytes32 initcode, PoolKey memory key) internal pure returns (address pool) {
        require(key.token0 < key.token1);
        pool = address(uint160(
            uint256(
                keccak256(
                    abi.encodePacked(
                        hex'ff',
                        factory,
                        keccak256(abi.encode(key.token0, key.token1, key.fee)),
                        initcode
                    )
                )
            ))
        );
    }
}

File 32 of 32 : TickMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.20;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
        require(absTick <= uint256(uint24(MAX_TICK)), 'T');

        uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
        if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
        if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
        if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
        if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
        if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
        if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
        if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
        if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
        if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
        if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
        if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
        if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
        if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
        if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
        if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
        if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
        if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
        if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
        if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

        if (tick > 0) ratio = type(uint256).max / ratio;

        // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
        // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
        // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
        sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        // second inequality must be < because the price can never reach the price at the max tick
        require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
        uint256 ratio = uint256(sqrtPriceX96) << 32;

        uint256 r = ratio;
        uint256 msb = 0;

        assembly {
            let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(5, gt(r, 0xFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(4, gt(r, 0xFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(3, gt(r, 0xFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(2, gt(r, 0xF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(1, gt(r, 0x3))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := gt(r, 0x1)
            msb := or(msb, f)
        }

        if (msb >= 128) r = ratio >> (msb - 127);
        else r = ratio << (127 - msb);

        int256 log_2 = (int256(msb) - 128) << 64;

        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(63, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(62, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(61, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(60, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(59, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(58, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(57, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(56, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(55, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(54, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(53, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(52, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(51, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(50, f))
        }

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

        int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
        int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

        tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[],"name":"InsufficientLiquidity","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidPathLib","type":"error"},{"inputs":[],"name":"NoAcceptETH","type":"error"},{"inputs":[],"name":"NonceInvalid","type":"error"},{"inputs":[],"name":"NotDaiPermit","type":"error"},{"inputs":[],"name":"NotEnoughGas","type":"error"},{"inputs":[],"name":"NotEnoughOutput","type":"error"},{"inputs":[],"name":"NotPermittable","type":"error"},{"inputs":[],"name":"Unsupported","type":"error"},{"inputs":[],"name":"Untrusted","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bot","type":"address"}],"name":"BotAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bot","type":"address"}],"name":"BotRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"GasPayThresholdUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountNonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newBot","type":"address"}],"name":"addTrustedBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"}],"name":"convertVETHtoWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData","name":"dex","type":"tuple"}],"internalType":"struct ToadStructs.ExactInputParams","name":"params","type":"tuple"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"},{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData","name":"dex","type":"tuple"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ToadStructs.GasRepayParams","name":"repay","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"bool","name":"unwrap","type":"bool"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData","name":"dex","type":"tuple"}],"internalType":"struct ToadStructs.ExactInputSingleParams","name":"params","type":"tuple"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"},{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData","name":"dex","type":"tuple"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ToadStructs.GasRepayParams","name":"repay","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"bool","name":"unwrap","type":"bool"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData","name":"dex","type":"tuple"}],"internalType":"struct ToadStructs.ExactInputSingleParams","name":"params","type":"tuple"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"}],"name":"exactInputSingleWETH","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData","name":"dex","type":"tuple"}],"internalType":"struct ToadStructs.ExactInputParams","name":"params","type":"tuple"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"}],"name":"exactInputWETH","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gasPayThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path","type":"tuple[]"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"}],"name":"getAmountsIn","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path","type":"tuple[]"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path","type":"tuple[]"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"}],"name":"getPriceOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fac","type":"address"},{"internalType":"address","name":"weth","type":"address"},{"internalType":"address","name":"veth","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fac","type":"address"},{"internalType":"address","name":"weth","type":"address"},{"internalType":"address","name":"permit","type":"address"},{"internalType":"address","name":"veth","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newThreshold","type":"uint256"}],"name":"modifyGasPayThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"tok","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"performPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint160","name":"amount","type":"uint160"},{"internalType":"uint48","name":"expiration","type":"uint48"},{"internalType":"uint48","name":"nonce","type":"uint48"}],"internalType":"struct IAllowanceTransfer.PermitDetails[]","name":"details","type":"tuple[]"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"sigDeadline","type":"uint256"}],"internalType":"struct IAllowanceTransfer.PermitBatch","name":"permitBatch","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"performPermit2Batch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint160","name":"amount","type":"uint160"},{"internalType":"uint48","name":"expiration","type":"uint48"},{"internalType":"uint48","name":"nonce","type":"uint48"}],"internalType":"struct IAllowanceTransfer.PermitDetails","name":"details","type":"tuple"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"sigDeadline","type":"uint256"}],"internalType":"struct IAllowanceTransfer.PermitSingle","name":"permitSingle","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"performPermit2Single","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"tok","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"performPermitDai","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bot","type":"address"}],"name":"removeTrustedBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sendETHToCoinbase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path","type":"tuple[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"},{"internalType":"uint256","name":"ethFee","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"gasPath","type":"tuple[]"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"}],"name":"swapExactTokensForTokensSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path1","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path2","type":"tuple[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"}],"name":"swapExactTokensForTokensSupportingFeeOnTransferTokensWithWETHGas","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path","type":"tuple[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"},{"internalType":"bool","name":"unwrap","type":"bool"}],"name":"swapExactTokensForWETHSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"dexId","type":"uint96"}],"internalType":"struct ToadStructs.AggPath[]","name":"path","type":"tuple[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"},{"components":[{"internalType":"bytes32","name":"initcode","type":"bytes32"},{"internalType":"address","name":"factory","type":"address"}],"internalType":"struct ToadStructs.DexData[]","name":"dexes","type":"tuple[]"}],"name":"swapExactWETHforTokensSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"outputAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"}],"name":"unwrapVETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint96","name":"fee","type":"uint96"}],"internalType":"struct ToadStructs.FeeStruct","name":"fees","type":"tuple"}],"name":"unwrapWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"useNonce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"versionRecipient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60808060405234620000c6576000549060ff8260081c1662000074575060ff8082160362000038575b604051615edc9081620000cc8239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a13862000028565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe60806040526004361015610023575b361561001957600080fd5b610021613560565b005b60003560e01c8063182327761461026357806322aeedc31461025e5780632630583c14610259578063307ab24b1461025457806331e7d53a1461024f578063412f845b1461024a57806347b647dd14610245578063486ff0cd1461024057806350087bdf1461023b578063580f6da2146102365780635ed95d85146102315780636652dd6d1461022c578063715018a61461022757806379a7d1be1461022257806383a8528d1461021d578063880fbf0a146102185780638da5cb5b146102135780638db7ac9a1461020e5780638feca79414610209578063a739faab14610204578063ac9650d8146101ff578063ad5c4648146101fa578063b23c19e6146101f5578063b43ba431146101f0578063c09d54e5146101eb578063c0c53b8b146101e6578063c45a0155146101e1578063c691368d146101dc578063c890599d146101d7578063d83af687146101d2578063e274de88146101cd578063ec68199d146101c8578063f2fde38b146101c3578063f7789dac146101be578063f8c8765e146101b95763fa461e330361000e57612d95565b612c83565b612b86565b612adf565b61297f565b61275d565b6126eb565b6123e1565b612338565b612311565b6121cf565b61213a565b6120cb565b611f4b565b611ed9565b611e73565b611dc7565b611cbc565b611c36565b611c0f565b611b77565b6119d0565b6118be565b611855565b6116ae565b6111f5565b610fbc565b610f32565b610dac565b610cbf565b610b71565b610a52565b610928565b6107cb565b6105eb565b6104c7565b6001600160a01b0381160361027957565b600080fd5b6064359061028b82610268565b565b6084359061028b82610268565b6004359061028b82610268565b6044359061028b82610268565b60a4359061028b82610268565b610104359061028b82610268565b359061028b82610268565b634e487b7160e01b600052604160045260246000fd5b6080810190811067ffffffffffffffff82111761030c57604052565b6102da565b6060810190811067ffffffffffffffff82111761030c57604052565b67ffffffffffffffff811161030c57604052565b6040810190811067ffffffffffffffff82111761030c57604052565b90601f601f19910116810190811067ffffffffffffffff82111761030c57604052565b60405190610140820182811067ffffffffffffffff82111761030c57604052565b6040519061028b826102f0565b67ffffffffffffffff811161030c5760051b60200190565b359065ffffffffffff8216820361027957565b602319608091011261027957604051906103f2826102f0565b816024356103ff81610268565b815260443561040d81610268565b602082015265ffffffffffff90606435828116810361027957604082015260843591821682036102795760600152565b919082608091031261027957604051610455816102f0565b6060610494818395803561046881610268565b8552602081013561047881610268565b6020860152610489604082016103c6565b6040860152016103c6565b910152565b9181601f840112156102795782359167ffffffffffffffff8311610279576020838186019501011161027957565b3461027957600319606081360112610279576004356104e581610268565b6024359067ffffffffffffffff92838311610279576060908336030112610279576040519161051383610311565b8060040135848111610279578101366023820112156102795760048101359061053b826103ae565b90610549604051928361035d565b82825260209260248484019160071b8301019136831161027957602401905b8282106105b257505050845260449190610584602483016102cf565b9085015201356040830152604435928311610279576105aa610021933690600401610499565b9290916136d9565b846080916105c0368561043d565b815201910190610568565b6084359060ff8216820361027957565b6064359060ff8216820361027957565b346102795760e06003193601126102795760043561060881610268565b6024359061061582610268565b61061d6105cb565b90600092338452609b60205260ff604085205416156107ba576001600160a01b0380609c541691166040517f30adf81f00000000000000000000000000000000000000000000000000000000815260208160048189865af18015610759577fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb91879161078c575b5003610762578492813b1561075e576040517f8fcbaf0c0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015292166024830152604480359083015260648035908301526001608483015260ff90931660a4808301919091523560c4808301919091523560e482015291829081838161010481015b03925af1801561075957610743575080f35b806107506107569261032d565b80610d0b565b80f35b6136cd565b8380fd5b60046040517f698aa7ce000000000000000000000000000000000000000000000000000000008152fd5b6107ad915060203d81116107b3575b6107a5818361035d565b810190613c98565b386106a4565b503d61079b565b6004604051633bf7d83b60e11b8152fd5b346102795760408060031936011261027957602435906107ea82610268565b600091338352609b60205260ff828420541615610872576001600160a01b03169081835260046020526004358184205403610849578183526004602052808320549160018301809311610844578352600460205282205580f35b612f61565b600490517fbc0da7d6000000000000000000000000000000000000000000000000000000008152fd5b60048251633bf7d83b60e11b8152fd5b9181601f840112156102795782359167ffffffffffffffff8311610279576020808501948460061b01011161027957565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c60609101126102795760a490565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c60609101126102795760c490565b8015150361027957565b6024359061028b82610911565b34610279576101406003193601126102795767ffffffffffffffff6044358181116102795761095b903690600401610882565b606435929161096984610268565b610972366108b3565b9361010435938411610279576109c3946109936109b3953690600401610882565b93909261012435956109a487610911565b60843592602435600435614511565b6040519081529081906020820190565b0390f35b906060600319830112610279576004359167ffffffffffffffff9160243583811161027957826109f991600401610882565b9390939260443591821161027957610a1391600401610882565b9091565b6020908160408183019282815285518094520193019160005b828110610a3e575050505090565b835185529381019392810192600101610a30565b3461027957610a60366109c7565b90919260028410610b4757610a74846156b2565b94610a7e86613047565b5260005b610a8b85612f77565b811015610b3957610b3490610b1c610b0b8288610b05610b00610af9610aed6020610ae78c610ad7610ac5610ad0610aca828d8d87613c17565b613c8e565b9b613804565b8a84613c17565b97610ae18d613804565b91613c17565b01613ca7565b6001600160601b031690565b8a8c613c17565b613cb1565b916156e3565b90610b16848b613069565b5161578f565b610b2e610b2883613804565b89613069565b52612fe9565b610a82565b604051806109c38882610a17565b60046040517f2f865df3000000000000000000000000000000000000000000000000000000008152fd5b3461027957610b7f366109c7565b92610bae6001600160a01b039392610ba68560005460101c16938660035416953691610ed6565b953691613c32565b926002855110610b4757610bd2610bc486613047565b51516001600160a01b031690565b1614610c9d575b50610be482516156b2565b92610bf8610bf28551612f77565b85613069565b52610c038251612f77565b805b610c1757604051806109c38682610a17565b80610c7f610c6e610c36610bc4610c30610c9796612f77565b88613069565b610c43610bc48589613069565b610c67610c30610aed6020610c58898d613069565b5101516001600160601b031690565b51916156e3565b90610c798489613069565b5161586e565b610c91610c8b83612f77565b87613069565b52615861565b80610c05565b610cb990610caa84613047565b51906001600160a01b03169052565b38610bd9565b34610279576020600319360112610279577f2515db67647788441643d86a0d6863b38b86519ce9e12032d9a20d3ec9e6fca16020600435610cfe612eb4565b80609d55604051908152a1005b600091031261027957565b90600182811c92168015610d46575b6020831014610d3057565b634e487b7160e01b600052602260045260246000fd5b91607f1691610d25565b60005b838110610d635750506000910152565b8181015183820152602001610d53565b90601f19601f602093610d9181518092818752878088019101610d50565b0116010190565b906020610da9928181520190610d73565b90565b3461027957600080600319360112610e885760405190806001805491610dd183610d16565b80865292828116908115610e5e5750600114610e04575b6109c385610df88187038261035d565b60405191829182610d98565b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b828410610e46575050508101602001610df8826109c3610de8565b80546020858701810191909152909301928101610e2b565b8695506109c396935060209250610df894915060ff191682840152151560051b8201019293610de8565b80fd5b6001600160601b0381160361027957565b919082604091031261027957604051610eb481610341565b60208082948035610ec481610268565b8452013591610ed283610e8b565b0152565b929192610ee2826103ae565b604092610ef18451928361035d565b819581835260208093019160061b84019381851161027957915b848310610f1a57505050505050565b838691610f278486610e9c565b815201920191610f0b565b34610279576101206003193601126102795767ffffffffffffffff604435818111610279573660238201121561027957610f76903690602481600401359101610ed6565b90610f7f61027e565b91610f89366108b3565b9261010435928311610279576109c393610faa6109b3943690600401610882565b939092608435916024356004356141ca565b34610279576020600319360112610279576001600160a01b03600435610fe181610268565b1660005260046020526020604060002054604051908152f35b6084359062ffffff8216820361027957565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedc6040910112610279576040519061104382610341565b61012435825261014435602083610ed283610268565b91908260409103126102795760405161107181610341565b602080829480358452013591610ed283610268565b906101606003198301126102795761110e61109f610380565b926110a861029a565b84526110b261091b565b60208501526110bf6102a7565b60408501526110cc61027e565b60608501526110d9610ffa565b60808501526110e66102b4565b60a085015260c43560c085015260e43560e08501526111036102c1565b61010085015261100c565b610120830152565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9c6060910112610279576040519061114d82610311565b816101643581526101843561116181610268565b602082015260406101a43591610ed283610e8b565b6023196060910112610279576040519061118f82610311565b8160243581526044356111a181610268565b6020820152604060643591610ed283610e8b565b9190826060910312610279576040516111cd81610311565b60408082948035845260208101356111e481610268565b6020850152013591610ed283610e8b565b6101c06003193601126102795761120b36611086565b61121436611116565b600090338252602091609b835260409360ff85832054161561169e5780850180516001600160a01b0316906112606112546003546001600160a01b031690565b6001600160a01b031690565b936001600160a01b0380931685811415908161167c575b508061165d575b6116345761128e86513a90613bec565b9481846112a285516001600160a01b031690565b169182036115a45750506112c786866112c287516001600160a01b031690565b614f8c565b8760608501936112de85516001600160a01b031690565b906112f46112546003546001600160a01b031690565b908216036114695750509061140e929160c0850151906113c1896113b38c61133861132a6101008c01516001600160a01b031690565b97516001600160a01b031690565b9761135a61134c60808d015162ffffff1690565b91516001600160a01b031690565b9151988994850191927fffffff0000000000000000000000000000000000000000000000000000000000602b946bffffffffffffffffffffffff19809460601b16855260e81b16601484015260601b1660178201520190565b03601f19810186528561035d565b6114026113d587516001600160a01b031690565b916113fa610120890151936113e86103a1565b9788526001600160a01b03168c880152565b1515858c0152565b60608401523090614d00565b9360e082015185106114595761144b928261144560a061143689956109c39b99970151151590565b9201516001600160a01b031690565b90615384565b519081529081906020820190565b60048651635397a1f960e01b8152fd5b929350939660e09650611582955061157860c08901519261153a8a61152c61149b60a08301516001600160a01b031690565b976114d260806114c76114b96101008701516001600160a01b031690565b9c516001600160a01b031690565b94015162ffffff1690565b9a519a8b9388850191927fffffff0000000000000000000000000000000000000000000000000000000000602b946bffffffffffffffffffffffff19809460601b16855260e81b16601484015260601b1660178201520190565b03601f19810189528861035d565b61157061154e8b516001600160a01b031690565b6101208c01519461155d6103a1565b998a528901906001600160a01b03169052565b1515868b0152565b6060850152614d00565b9101518110611594576109c39161144b565b60048251635397a1f960e01b8152fd5b546115ba9060101c6001600160a01b0316611254565b036112c7575082516001600160a01b03166115de60c0850191878351883093615014565b6001906116036115f66003546001600160a01b031690565b6001600160a01b03168452565b61162d611611878351612fb3565b611627610aed8c8b01516001600160601b031690565b90612fb3565b90526112c7565b600488517f20db8267000000000000000000000000000000000000000000000000000000008152fd5b50848361167460608701516001600160a01b031690565b16141561127e565b905061169661125483546001600160a01b039060101c1690565b141538611277565b60048551633bf7d83b60e11b8152fd5b346102795760c0600319360112610279576004356116cb81610268565b602435906116d882610268565b604435916116e46105db565b9142841061182b57600093338552609b60205260ff604086205416156107ba57609c546040517f7ecebe0000000000000000000000000000000000000000000000000000000000602082019081526001600160a01b0385811660248401529283169692918891829161176381604481015b03601f19810183528261035d565b519082895af16117716131e3565b50156118015786941691823b156117fd576040517fd505accf0000000000000000000000000000000000000000000000000000000081526001600160a01b0394851660048201529590931660248601526000196044860152606485019290925260ff9091166084808501919091523560a4808501919091523560c4840152829081838160e48101610731565b8480fd5b60046040517f98f2a59c000000000000000000000000000000000000000000000000000000008152fd5b60046040517f203d82d8000000000000000000000000000000000000000000000000000000008152fd5b3461027957600080600319360112610e885761186f612eb4565b806001600160a01b0360375473ffffffffffffffffffffffffffffffffffffffff198116603755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102795760006003193601126102795760206001600160a01b0360005460101c16604051908152f35b67ffffffffffffffff811161030c57601f01601f191660200190565b929192611910826118e8565b9161191e604051938461035d565b829481845281830111610279578281602093846000960137010152565b9080601f8301121561027957816020610da993359101611904565b919060c083820312610279576040519067ffffffffffffffff9060a083018281118482101761030c5760405282948035928311610279576119ac826119a160a094608096850161193b565b865260208301611059565b602085015260608101356040850152828101356060850152013591610ed283610268565b6101e0600319360112610279576119e636611086565b6119ef36611116565b906101c43567ffffffffffffffff811161027957611a11903690600401611956565b9133600052609b60205260409260ff84600020541615611b675760e091611a5b611b549260c0860192611a4984518984015190612fb3565b845286516001600160a01b0316614e4a565b5160a08401516001600160a01b03166101008501516001600160a01b031690611a8d878701516001600160a01b031690565b92611b14611aa1608089015162ffffff1690565b946113b3611ab960608b01516001600160a01b031690565b8b519788936020850191927fffffff0000000000000000000000000000000000000000000000000000000000602b946bffffffffffffffffffffffff19809460601b16855260e81b16601484015260601b1660178201520190565b86516001600160a01b0316611b4461012089015191611b316103a1565b9687526001600160a01b03166020870152565b6000898601526060850152614d00565b9101518110611594579051908152602090f35b60048451633bf7d83b60e11b8152fd5b34610279576101606003193601126102795767ffffffffffffffff60443581811161027957611baa903690600401610882565b9190611bb461027e565b611bbd366108b3565b936101243584811161027957611bd7903690600401610882565b9161014435958611610279576109c396611bf86109b3973690600401610882565b969095610104359360843592602435600435613cdf565b346102795760006003193601126102795760206001600160a01b0360375416604051908152f35b346102795761010060031936011261027957600435611c5481610268565b60c060231936011261027957604051611c6c81610311565b611c75366103d9565b815260a435611c8381610268565b602082015260c435604082015260e4359167ffffffffffffffff831161027957611cb4610021933690600401610499565b9290916135ba565b3461027957611cca366109c7565b919092611cfa6001600160a01b0394611cf28660005460101c16938760035416953691610ed6565b943691613c32565b936002845110610b4757611d10610bc485613047565b1614611db4575b50611d2281516156b2565b92611d2c84613047565b5260005b611d3a8251612f77565b811015611da65780611d95611d84611d58610bc4611da19587613069565b611d67610bc4610c3086613804565b610c67610b28610aed6020610c58611d7e8a613804565b8c613069565b90611d8f8489613069565b5161580a565b610b2e610c8b83613804565b611d30565b604051806109c38682610a17565b611dc190610caa83613047565b38611d17565b600080600319360112610e8857338152609b60205260ff604082205416156107ba576107563441615a22565b602080820190808352835180925260408301928160408460051b8301019501936000915b848310611e275750505050505090565b9091929394958480611e63837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a51610d73565b9801930193019194939290611e17565b346102795760206003193601126102795767ffffffffffffffff6004358181116102795736602382011215610279578060040135918211610279573660248360051b83010111610279576109c3916024611ecd920161307d565b60405191829182611df3565b346102795760006003193601126102795760206001600160a01b0360035416604051908152f35b60a060031982011261027957600435611f1881610268565b9160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc60243593011261027957604490565b3461027957611f5936611f00565b91600092338452609b60205260ff604085205416156107ba57611f7d3a8235613bec565b90611fae84611f94609c546001600160a01b031690565b85611fa76003546001600160a01b031690565b30926159a4565b611fc66112546112546003546001600160a01b031690565b6040516370a0823160e01b81523060048201529490602086602481845afa801561075957879687916120ad575b50813b156120a957604051632e1a7d4d60e01b8152600481019190915295908690602490829084905af19485156107595761205f6120659461162793610aed9361206b99612096575b5060408601956001600160601b0361205388613ca7565b16612075575b50612fb3565b92613ca7565b90615a22565b6107564732615a22565b61208460206120909201613c8e565b612065610aed89613ca7565b38612059565b806107506120a39261032d565b3861203c565b8680fd5b6120c5915060203d81116107b3576107a5818361035d565b38611ff3565b34610279576020600319360112610279577ff98765b2b5e26c3266491f2a9f51d7fdae1c9c7ac2016fade7789d1f9e4ff3a060206001600160a01b0360043561211381610268565b61211b612eb4565b1680600052609b8252604060002060ff198154169055604051908152a1005b34610279576101406003193601126102795767ffffffffffffffff6044358181116102795761216d903690600401610882565b919060643582811161027957612187903690600401610882565b93909161219261028d565b9061219c366108e2565b9161012435958611610279576109c3966121bd6109b3973690600401610882565b96909560a43594602435600435613849565b34610279576060600319360112610279576004356121ec81610268565b6024356121f881610268565b7fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff000060443561223c81610268565b60009485549461225160ff8760081c166132a7565b6001600160a01b03908173ffffffffffffffffffffffffffffffffffffffff1993168360025416176002551690600354161760035560101b169116178155600161229b8154610d16565b601f81116122cb575b507f332e302e3000000000000000000000000000000000000000000000000000000a905580f35b81601f7fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6920160051c8201915b8281106123065750506122a4565b8481550182906122f8565b346102795760006003193601126102795760206001600160a01b0360025416604051908152f35b34610279576000600319360112610279576020609d54604051908152f35b91909160e081840312610279576040519067ffffffffffffffff9060c083018281118482101761030c576040528294813561239081610268565b845260208201359283116102795760a0826123b1838396610494960161193b565b60208701526123c2604082016102cf565b6040870152606081013560608701526080810135608087015201611059565b60806003193601126102795760043567ffffffffffffffff81116102795761240d903690600401612356565b61241636611176565b600091338352602091609b835260409260ff848620541615611b6757838161244084513a90613bec565b933397808096888581019b8c886124578251615ae3565b50509660039261247161125485546001600160a01b031690565b6001600160a01b03998a1690810361266c575061249a8a886112c289516001600160a01b031690565b93879c9b50612521909a91959293969798999a5b6060958685019e8f9461251860a088019a5b8451986124d260428b5110159a615ae3565b50995195508b90508a156126535750506125106124f130965b51615bf5565b968d51946124fd6103a1565b9889528801906001600160a01b03169052565b1515858a0152565b88840152614b9b565b808d52889361253788546001600160a01b031690565b928b168b8416146125d6575b50505060001461257657908b8a8f8f969594612521918a8e612518309461256a8551615cd6565b85529b98999a9b6124c0565b8c8c8c60808d5192612586614100565b015182106125c6571561259d579051908152602090f35b600482517fdd629f86000000000000000000000000000000000000000000000000000000008152fd5b60048351635397a1f960e01b8152fd5b6001600160601b0392939e50908d61260c8a6126078f9561261b960194611627610aed87516001600160601b031690565b612fb3565b9052516001600160601b031690565b168061262f575b505060019a38808f612543565b61264c916126468c8c01516001600160a01b031690565b906158d8565b3880612622565b0151612510906124f1906001600160a01b0316966124eb565b88546126839060101c6001600160a01b0316611254565b146126a1575b93879c9b50612521909a91959293969798999a6124ae565b90506126c56126b786516001600160a01b031690565b8a6060880151893093615014565b6001906126e481516126de86546001600160a01b031690565b90615bb1565b8152612689565b34610279576020600319360112610279577f8ea6dd825d4c0cbaa8c5f268c15b1df21173aae98f549a108b836de11d4971d860206001600160a01b0360043561273381610268565b61273b612eb4565b1680600052609b82526040600020600160ff19825416179055604051908152a1005b346102795761276b36611f00565b9091600092338452609b60205260409060ff828620541615610872576127923a8535613bec565b926127ae61125461125488546001600160a01b039060101c1690565b93843b156120a95783517f4b6c0f2c0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602481018490523060448201529487908690606490829084905af194851561075957879561296c575b5061282c6112546112546003546001600160a01b031690565b908487019161284682612841610aed86613ca7565b61383c565b813b15612968578651632e1a7d4d60e01b8152600481019190915296908790602490829084905af191821561075957611627610aed61205f6128c7946128f89b60209b8e98612955575b506001600160601b036128a287613ca7565b16612935575b506128c16112546112546003546001600160a01b031690565b98612fb3565b935180968195829463a9059cbb60e01b845260048401602090939291936001600160a01b0360408201951681520152565b03925af180156107595761290a575080f35b61292a9060203d811161292e575b612922818361035d565b8101906146da565b5080f35b503d612918565b6129438c61294f9201613c8e565b612065610aed88613ca7565b386128a8565b806107506129629261032d565b38612890565b8780fd5b806107506129799261032d565b38612813565b60a06003193601126102795767ffffffffffffffff600435818111610279576129ac903690600401612356565b906129b636611176565b90608435908111610279576129cf903690600401611956565b91600091338352602092609b845260409360ff85832054161561169e57946129fe84516001600160a01b031690565b90612a2a60609182870195612a1887518a84015190612fb3565b875287516001600160a01b0316614e4a565b8685019660a08601925b612a8489519160428351101592885184600014612ac357612a553092615bf5565b92612a76895191612a646103a1565b9586526001600160a01b031688860152565b898d85015287840152614b9b565b8087529015612aab575090612a8492913090612aa08a51615cd6565b8a5291929350612a34565b86608089929101518110611594579051908152602090f35b612a55612ad98d8d01516001600160a01b031690565b92615bf5565b3461027957602060031936011261027957600435612afc81610268565b612b04612eb4565b6001600160a01b03811615612b1c5761002190612f0c565b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b3461027957612b9436611f00565b91600092338452609b60205260ff604085205416156107ba57612bb83a8235613bec565b90612bd461125461125487546001600160a01b039060101c1690565b93843b15612c7f576040517f88853ca40000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602481018290523060448201529486908690606490829084905af19485156107595761205f6120659461162793610aed9361075699612c6c575b50612c568232615a22565b60408601956001600160601b0361205388613ca7565b80610750612c799261032d565b38612c4b565b8580fd5b3461027957608060031936011261027957600435612ca081610268565b612d09602435612caf81610268565b604435612cbb81610268565b60643591612cc883610268565b60005494612ced60ff8760081c161580978198612d87575b8115612d67575b50613318565b85612d00600160ff196000541617600055565b612d4e57613389565b612d0f57005b612d1f61ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a1005b612d6261010061ff00196000541617600055565b613389565b303b15915081612d79575b5038612ce7565b6001915060ff161438612d72565b600160ff8216109150612ce0565b346102795760606003193601126102795760243560043560443567ffffffffffffffff811161027957612dcc903690600401610499565b90821580612eac575b612e6d5760a054612de7368484611904565b60208151910120036107ba57612dff91810190614a02565b90612e20612e0d8351615ae3565b6060869793979492940151908488615ab3565b506000831315612e9757506001600160a01b03809116908416105b15612e6d5761002192612e656040612e5d60208601516001600160a01b031690565b940151151590565b923391614a8a565b60046040517f90a2caf2000000000000000000000000000000000000000000000000000000008152fd5b91506001600160a01b03808516911610612e3b565b508315612dd5565b6001600160a01b03603754163303612ec857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603754906001600160a01b03809116918273ffffffffffffffffffffffffffffffffffffffff19821617603755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b634e487b7160e01b600052601160045260246000fd5b90600019820191821161084457565b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe820191821161084457565b9190820391821161084457565b6040516020810181811067ffffffffffffffff82111761030c5760405260008152906000368137565b60001981146108445760010190565b634e487b7160e01b600052603260045260246000fd5b6020908161028b93959461303b876040519889958587013784019183830160008152815194859201610d50565b0103808552018361035d565b8051156130545760200190565b612ff8565b8051600110156130545760400190565b80518210156130545760209160051b010190565b90613086612fc0565b90613090816103ae565b9261309e604051948561035d565b818452601f196130ad836103ae565b0160005b81811061315657505060005b8281106130cb575050505090565b8060051b8201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1833603018112156102795782019081359167ffffffffffffffff83116102795760200182360381136102795761313086613151946131369361300e565b30613167565b6131408288613069565b5261314b8187613069565b50612fe9565b6130bd565b8060606020809389010152016130b1565b90610da9916000806040519361317c85610311565b602785527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208601527f206661696c6564000000000000000000000000000000000000000000000000006040860152602081519101845af46131dd6131e3565b91613213565b3d1561320e573d906131f4826118e8565b91613202604051938461035d565b82523d6000602084013e565b606090565b919290156132745750815115613227575090565b3b156132305790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156132875750805190602001fd5b6132a39060405191829162461bcd60e51b835260048301610d98565b0390fd5b156132ae57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b1561331f57565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b939275ffffffffffffffffffffffffffffffffffffffff00007fffffffffffffffffffff0000000000000000000000000000000000000000ffff916000968754946133d960ff8760081c166132a7565b6001600160a01b03908173ffffffffffffffffffffffffffffffffffffffff1993168360025416176002551690600354161760035560101b1691161783556001926134248454610d16565b90601f82116134e6575b50507f332e302e3000000000000000000000000000000000000000000000000000000a909255906134bf9061346161352c565b61346961354f565b613496613489336001600160a01b0316600052609b602052604060002090565b600160ff19825416179055565b6001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19609c541617609c55565b6134d067016345785d8a0000609d55565b6134db600019609e55565b61028b609e54609f55565b848152601f7fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6920160051c8201915b828110613522575061342e565b8181558501613515565b61354660ff60005460081c16613541816132a7565b6132a7565b61028b33612f0c565b61028b60ff60005460081c166132a7565b6001600160a01b03806003541633141590816135a8575b5061357e57565b60046040517faf7f02d5000000000000000000000000000000000000000000000000000000008152fd5b905060005460101c1633141538613577565b919092600092338452609b60205260ff604085205416156107ba576001600160a01b039283609c541692833b15612c7f579161368e86928694604080519a8b998a9889977f2b67b5700000000000000000000000000000000000000000000000000000000089521660048801526136696024880183516060906001600160a01b0380825116845260208201511660208401528165ffffffffffff91826040820151166040860152015116910152565b60208201511660a4870152015160c485015261010060e48501526101048401916136ac565b03925af180156107595761369f5750565b8061075061028b9261032d565b601f8260209493601f19938186528686013760008582860101520116010190565b6040513d6000823e3d90fd5b9291600092338452602091609b835260ff604086205416156107ba576001600160a01b039384609c541694853b156120a9579694939186939188604051998a987f2a2d80d1000000000000000000000000000000000000000000000000000000008a521660048901526060602489015260c4880194825195606060648b015286518091528160e48b01970190885b81811061379d575050508201511660848801526040015160a4870152858303600319016044870152859392849261368e926136ac565b929496985092949681999a506080816137ee8793600195516060906001600160a01b0380825116845260208201511660208401528165ffffffffffff91826040820151166040860152015116910152565b0199019101908b99989694928b98969492613767565b906001820180921161084457565b906002820180921161084457565b90601f820180921161084457565b601701908160171161084457565b9190820180921161084457565b9392959491979896999099421161182b57600097338952602096609b885260409a60ff8c8c20541615613bdc576138cf886138853a8435613bec565b986138ae8d6138a861389f61389a898b613bff565b613c27565b918a3691613c32565b90615682565b6138bb610ac58789613bff565b906138c9610ac5888a613c08565b92613cbc565b6138e76112546112546003546001600160a01b031690565b8c516370a0823160e01b80825230600483015298918b90829060249082905afa90811561075957613964938f8f8f90938f9495613bb9575b506139439061393b613932368b8d610ed6565b918c3691613c32565b90309061476c565b81016001600160601b0361395682613ca7565b16613b8b575b50505061383c565b9161396f8587613bff565b61397890613c8e565b91896139848789613bff565b61398d90613c8e565b92613998888a613c08565b6139a190613c8e565b926139ab91613c08565b016139b590613ca7565b6001600160601b03166139c990868d613c17565b6139d290613cb1565b906139dc926155c6565b6003548c51888152306004820152908a90829060249082906001600160a01b03165afa93841561075957613a2094613a1a928e91613b745750612fb3565b916158d8565b613a28614100565b613a44611254611254610ac5613a3d86612f77565b8688613c17565b89518581526001600160a01b038716600482015297908790899060249082905afa978815610759578998613b2b575b50611254610ac58795899795613aaa613ab396613ad79b613aa461125498613a9c368789610ed6565b933691613c32565b9161476c565b610ae181612f77565b9088518095819482938352600483019190916001600160a01b036020820193169052565b03915afa91821561075957613af39492613b0e575b5050612fb3565b918210613afe575090565b60049051635397a1f960e01b8152fd5b613b249250803d106107b3576107a5818361035d565b3880613aec565b611254919850610ac58795899795613aaa613ab396613ad79b613aa4613b60611254988e803d106107b3576107a5818361035d565b9f9850505096505095975095975050613a73565b61209091508c8d3d106107b3576107a5818361035d565b613a1a610aed61205f613bb195613baa6003546001600160a01b031690565b9501613c8e565b8a388061395c565b613943919550613bd590853d87116107b3576107a5818361035d565b949061391f565b60048c51633bf7d83b60e11b8152fd5b8181029291811591840414171561084457565b90156130545790565b90600110156130545760400190565b91908110156130545760061b0190565b610da9903690610e9c565b929192613c3e826103ae565b604092613c4d8451928361035d565b819581835260208093019160061b84019381851161027957915b848310613c7657505050505050565b838691613c838486611059565b815201920191613c67565b35610da981610268565b90816020910312610279575190565b35610da981610e8b565b610da9903690611059565b9291613cd961028b95926001600160a01b03609c541694836155c6565b926159a4565b91949a97929699989395909a421161182b5733600052602099609b8b5260ff60406000205416156107ba578693613d268792613d20610aed60408701613ca7565b9061383c565b958a8c8b89613eab575b50505050505050613d8c92613d4491612fb3565b613d5f613d58610aed8b610ae78a89613c08565b888a613c17565b90613d6d610ac58887613bff565b90613d86613d7e610ac58a89613c08565b933690611059565b90613cbc565b613da8611254611254610ac5613da187612f77565b8786613c17565b6040516370a0823160e01b8082526001600160a01b038516600483015290949092918890869060249082905afa958615610759578895600097613e6a575b50610ac5613e0d9361125493613aaa6112549489613aa4613e329d9e613a9c368789610ed6565b906040518095819482938352600483019190916001600160a01b036020820193169052565b03915afa90811561075957613e4f93600092613b0e575050612fb3565b908110613e595790565b6004604051635397a1f960e01b8152fd5b613e329750613e0d9361125493613aaa6112549489613aa4613e9b610ac5978e803d106107b3576107a5818361035d565b9d50505094505093509350613de6565b916138a8613ede92613ed661389a613eff97989b999c96613ed08c9f9c3a9035613bec565b9d613c08565b923691613c32565b613eeb610ac58589613bff565b613ef8610ac5868a613c08565b9187613cbc565b613f176112546112546003546001600160a01b031690565b6040516370a0823160e01b80825230600483015295909290918e90849060249082905afa928315610759578e60009461404e575b5050613f6791613f5c913691610ed6565b61393b368d8f613c32565b6003546040519485523060048601526001600160a01b03168c85602481845afa95861561075957613d8c97613fb78f94613fae908d9a613d449a6000916140375750612fb3565b92831015614079565b6001600160601b03613fcb60408301613ca7565b16613feb575b50505050613fdd614100565b9150928438808a8c8b613d30565b6140268161402061402e966140198a614014610aed61400f6040613a1a9a01613ca7565b6140c4565b6140e0565b9201613c8e565b93613bec565b612710900490565b8a388080613fd1565b6120909150883d8a116107b3576107a5818361035d565b613f5c929450613f6793918161406f92903d106107b3576107a5818361035d565b939150918e613f4b565b1561408057565b606460405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768207061696420666f72206761732e00000000000000006044820152fd5b906127106001600160601b038093160291821691820361084457565b81156140ea570490565b634e487b7160e01b600052601260045260246000fd5b6141186112546112546003546001600160a01b031690565b6040516370a0823160e01b8152306004820152602081602481855afa908115610759576000916141ac575b50609d548111614151575050565b813b156102795760006040518093632e1a7d4d60e01b825281838161417e87600483019190602083019252565b03925af19182156107595761028b92614199575b5032615a22565b806107506141a69261032d565b38614192565b6141c4915060203d81116107b3576107a5818361035d565b38614143565b92919495909693421161182b57600094338652602093609b855260409760ff898920541615614501576141ff610bc484613047565b6003546001600160a01b03166001600160a01b039182168183161415806144d2575b6144a9578690888c8c6142353a8835613bec565b95614259611254614248610bc48d613047565b935460101c6001600160a01b031690565b9116036143a857505050506142bb926142b46142ac6142806003546001600160a01b031690565b61428c610bc489613059565b6142a68d6138a88c61429d8d613059565b51923691613c32565b916155c6565b9336906111b5565b9187615014565b6142d96142d06003546001600160a01b031690565b610caa83613047565b6142ef611254611254610bc4610bf28551612f77565b87516370a0823160e01b8082526001600160a01b038616600483015290969093918690889060249082905afa968715610759578897614363575b50611254611254610bc4613ad7979561435361434c8b9997613ab3973691613c32565b888361476c565b61435d8151612f77565b90613069565b613ab3919750611254610bc4613ad7979561435361434c8b9997614396611254978c8d3d106107b3576107a5818361035d565b9d975097995050509597505050614329565b6143e39461441a97610aed938861205f9461162797989a01976143d66143d0610aed8b613ca7565b8661383c565b61441f575b505050612fb3565b6143fd6143f6610aed89610c5888613059565b8987613c17565b9061440a610bc486613047565b90613d86613d7e610bc488613059565b6142d9565b61445490898c61444c614446610aed614440609c546001600160a01b031690565b94613ca7565b8961383c565b9230926159a4565b6001600160601b0361446589613ca7565b1661447d575b5050614475614100565b8c38806143db565b6144966144a2926140196003546001600160a01b031690565b613a1a610aed8a613ca7565b8c3861446b565b60048b517f20db8267000000000000000000000000000000000000000000000000000000008152fd5b506144df610bc486613047565b826144f86112548d546001600160a01b039060101c1690565b91161415614221565b60048951633bf7d83b60e11b8152fd5b9499989695999792919097421161182b5733600052602092609b845260409660ff886000205416156146ca57614553610ac561454c86612f77565b8686613c17565b6001600160a01b036145706112546003546001600160a01b031690565b911603611634576145ba866145863a8f35613bec565b9861459b61454c610aed8a610ae78b8b613c08565b906145a9610ac58989613bff565b90613d86613d7e610ac58b8b613c08565b6145d26112546112546003546001600160a01b031690565b88516370a0823160e01b80825230600483015290959094918790879060249082905afa95861561075957600096614699575b5091613ed661393b9261461995943691610ed6565b826146326112546112546003546001600160a01b031690565b8751928352306004840152829060249082905afa9081156107595761465f93600092613b0e575050612fb3565b9261467b61466d8486612fb3565b611627610aed848c01613ca7565b958610613afe5750614693610da995969736906111b5565b93615384565b614619949391965061393b926146be613ed6928a3d8c116107b3576107a5818361035d565b97929495509250614604565b60048851633bf7d83b60e11b8152fd5b908160209103126102795751610da981610911565b51906dffffffffffffffffffffffffffff8216820361027957565b908160609103126102795761471e816146ef565b91604061472d602084016146ef565b92015163ffffffff811681036102795790565b90610da994936080936001600160a01b0392845260208401521660408201528160608201520190610d73565b929160005b61477b8551612f77565b8110156149fb5761478f610bc48287613069565b90856147a6610bc46147a084613804565b83613069565b610c586147e36112546112546147db6147d5610aed6147c5888c6154ea565b5098602097889161435d8d613804565b8a613069565b5185896155c6565b906040938451917f0902f1ac00000000000000000000000000000000000000000000000000000000835260609160049883858b81895afa93841561075957869560009182966149be575b505092809495614891946dffffffffffffffffffffffffffff8091169716926001600160a01b038091169416841496876000146149b85792935b8c8b518097819482936370a0823160e01b845283019190916001600160a01b036020820193169052565b03915afa801561075957816148b1916148b6956000916149a15750612fb3565b61580a565b911561499957600091935b868c6148cd8151612f86565b82101561498e57614903610aed61491095610c586149099461435d6148fd610bc46148f78a613812565b84613069565b97613812565b8b613069565b51916155c6565b955b61491a612fc0565b90833b156102795761495d60009692879351998a97889687957f022c0d9f0000000000000000000000000000000000000000000000000000000087528601614740565b03925af1918215610759576149769261497b5750612fe9565b614771565b806107506149889261032d565b3861314b565b505050508795614912565b6000936148c1565b6120909150873d89116107b3576107a5818361035d565b93614867565b85965061489195925090816149e792903d106149f4575b6149df818361035d565b81019061470a565b509594909150869061482d565b503d6149d5565b5050509050565b9060208282031261027957813567ffffffffffffffff9283821161027957019060a0828203126102795760405192614a39846102f0565b82359081116102795782614a5483606093614a82960161193b565b85526020810135614a6481610268565b60208601526040810135614a7781610911565b604086015201611059565b606082015290565b9315614aa7575061028b92506001600160a01b03600354166158d8565b6001600160a01b038181163003614ac357505061028b926158d8565b9361028b94609c54166159a4565b6020815260a0614aec835182602085015260c0840190610d73565b92602060606001600160a01b03928383820151166040870152604081015115158287015201518051608086015201511691015290565b9190826040910312610279576020825192015190565b919360a093610da996956001600160a01b0380941685521515602085015260408401521660608201528160808201520190610d73565b7f800000000000000000000000000000000000000000000000000000000000000081146108445760000390565b606092916040916001600160a01b03918483821660018103614cdb575090506000614c0d614c0761125433965b614bd28651615ae3565b9192614bf58c519d8e614bed81611755602082019485614ad1565b51902060a055565b808216908416109c8d98015192614e1e565b93614df3565b93828214614cbd57614c556401000276a4975b8751988997889687957f128acb0800000000000000000000000000000000000000000000000000000000875260048701614b38565b03925af190811561075957610da9926000918293614c8b575b50614c79600060a055565b15614c845750614b6e565b9050614b6e565b909250614caf915060403d8111614cb6575b614ca7818361035d565b810190614b22565b9138614c6e565b503d614c9d565b614c5573fffd8963efd1fc6a506488495d951d5263988d2597614c20565b91939091600214614cf8575b614c0d614c07611254600093614bc8565b309350614ce7565b91839260609460006040946001600160a01b0394858216600181148414614de457503391505b614d6b614d65611254614d398751615ae3565b90614d538d519e8f614bed81611755602082019485614ad1565b8b81168c8416109e8f9a015192614e1e565b95614df3565b958116158314614dda5750828214614dbd57614c556401000276a45b978751988997889687957f128acb0800000000000000000000000000000000000000000000000000000000875260048701614b38565b614c5573fffd8963efd1fc6a506488495d951d5263988d25614d87565b614c559097614c20565b600203614d2657309150614d26565b7f80000000000000000000000000000000000000000000000000000000000000008110156102795790565b614e40614e46939492946001600160a01b039586602086015116945193615da0565b91615dfb565b1690565b929192614e5982513a90613bec565b60409081840192614e7d614e77610aed86516001600160601b031690565b8361383c565b15614f83576000905b875190614eda60428351101591868b01938b614ec9614ea6875193615bf5565b9360208093015192614eb66103a1565b9586528501906001600160a01b03169052565b868984015260608301523090614b9b565b809252600014614ef7575030614ef08851615cd6565b8852614e86565b9050614f189192939495965091613d20610aed86516001600160601b031690565b11614f5a5750516001600160601b031680614f38575b505061028b614100565b614f539161264660206114366003546001600160a01b031690565b3880614f2e565b600490517fdd629f86000000000000000000000000000000000000000000000000000000008152fd5b50505050509050565b919091604082016001600160601b039182825116850180861161084457614fbb575b505050505061028b614100565b6001600160a01b039485609c541686600354169285855116830180931161084457614fe79330926159a4565b51169081614ff7575b8080614fae565b82602061500c946003541692015116906158d8565b388080614ff0565b929060009461503161125487546001600160a01b039060101c1690565b9360409586850193615056615050610aed87516001600160601b031690565b8261383c565b6152e4575b8261522c575b5050505061507690516001600160601b031690565b906001600160601b0382166151a6575b505081516370a0823160e01b8082523060048301526001600160a01b03929092169260209290918381602481885afa908115610759578691615189575b50609d54106150d4575b5050505050565b81519081523060048201528281602481875afa92831561075957859361516a575b5050823b1561075e57517f88853ca4000000000000000000000000000000000000000000000000000000008152306004820152602481019190915232604482015291908290606490829084905af1801561075957615157575b808080806150cd565b806107506151649261032d565b3861514e565b615181929350803d106107b3576107a5818361035d565b9038806150f5565b6151a09150843d86116107b3576107a5818361035d565b386150c3565b602001516001600160a01b038381169116813b15612c7f57845163a9059cbb60e01b81526001600160a01b0390911660048201526001600160601b039092166024830152909190849083908183816044810103925af1918215610759576001600160a01b0392615219575b819250615086565b806107506152269261032d565b38615211565b615243615257916001600160a01b03891694612fb3565b611627610aed87516001600160601b031690565b90823b156152e05787517f4b6c0f2c0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481019290925292909216604483015290919086908390606490829084905af191821561075957615076926152cd575b819281615061565b806107506152da9261032d565b386152c5565b8880fd5b6001600160a01b038716615305614e77610aed88516001600160601b031690565b813b156153805789517f4c6ef4140000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024810191909152306044820152908a908290606490829084905af180156107595761536d575b5061505b565b8061075061537a9261032d565b38615367565b8a80fd5b9291909260408501946001600160601b036153a687516001600160601b031690565b16806154c8575b50501561548d576153cc6112546112546003546001600160a01b031690565b6040516370a0823160e01b81523060048201529490602086602481845afa9586156107595760009661546d575b50803b1561027957604051632e1a7d4d60e01b815260048101969096526000908690602490829084905af192831561075957611627610aed61260793615450986120659761545a575b50516001600160601b031690565b61028b4732615a22565b806107506154679261032d565b38615442565b61548691965060203d81116107b3576107a5818361035d565b94386153f9565b613a1a906126076154c0959493611627610aed6154b26003546001600160a01b031690565b97516001600160601b031690565b61028b614100565b6154e39161264660206114366003546001600160a01b031690565b38806153ad565b90916001600160a01b039182841683821681811461555d57101561555857925b9183161561551457565b606460405162461bcd60e51b815260206004820152601d60248201527f546f6164737761704c6962726172793a205a45524f5f414444524553530000006044820152fd5b61550a565b608460405162461bcd60e51b8152602060048201526024808201527f546f6164737761704c6962726172793a204944454e544943414c5f414444524560448201527f53534553000000000000000000000000000000000000000000000000000000006064820152fd5b906155d0916154ea565b9161567b6001600160a01b039384602084015116936040519060208201926bffffffffffffffffffffffff19809260601b16845260601b1660348201526028815261561a81610311565b51902091516040517fff000000000000000000000000000000000000000000000000000000000000006020820190815260609590951b6bffffffffffffffffffffffff19166021820152603581019390935260558301528160758101611755565b5190201690565b906001600160601b0360206156ae936000826040516156a081610341565b828152015201511690613069565b5190565b906156bc826103ae565b6156c9604051918261035d565b828152601f196156d982946103ae565b0190602036910137565b6004919260606156f385846154ea565b50946157096001600160a01b03938492866155c6565b16604051948580927f0902f1ac0000000000000000000000000000000000000000000000000000000082525afa92831561075957600090819461576d575b5081906dffffffffffffffffffffffffffff80911694169416911614600014610a135791565b829450615788915060603d81116149f4576149df818361035d565b5093615747565b80156157e0578115806157d8575b6157ae57610da99261401491613bec565b60046040517fbb55fd27000000000000000000000000000000000000000000000000000000008152fd5b50821561579d565b60046040517f5945ea56000000000000000000000000000000000000000000000000000000008152fd5b80156157e0578115928380615859575b6157ae576103e580830292830403610844576158369082613bec565b926103e880840293840414171561084457810180911161084457610da9916140e0565b50801561581a565b8015610844576000190190565b919082156157e0578015806158d0575b6157ae578261588c91613bec565b906103e8918281029281840414901517156108445782810392818411610844576103e5808502948504149114171561084457610da9916158cb916140e0565b613804565b50811561587e565b60405163a9059cbb60e01b602082019081526001600160a01b039093166024820152604481019390935260009283929083906159178160648101611755565b51925af16159236131e3565b81615975575b501561593157565b606460405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152fd5b805180159250821561598a575b505038615929565b61599d92506020809183010191016146da565b3880615982565b91939092936001600160a01b0380931693843b156102795760009484869281608496816040519b8c9a8b997f36c78516000000000000000000000000000000000000000000000000000000008b521660048a01521660248801521660448601521660648401525af1801561075957615a195750565b61028b9061032d565b6000918291615a2f612fc0565b91602083519301915af1615a416131e3565b5015615a4957565b608460405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201527f4c454400000000000000000000000000000000000000000000000000000000006064820152fd5b91615ac191615ad893615da0565b602083015192516001600160a01b03938416615dfb565b168033036102795790565b90615af2601483511015615b66565b602082015160601c916017815110615b22576037601782015191615b1a602b82511015615b66565b015160601c91565b606460405162461bcd60e51b815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e64730000000000000000000000006044820152fd5b15615b6d57565b606460405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152fd5b9060601b6bffffffffffffffffffffffff191660005b60148110615bd457505090565b8251811015613054578082615bf0921a60208286010153612fe9565b615bc7565b615c03602b82511015615c8b565b60405190600b8083019101603683015b808310615c2d575050602b8252601f01601f191660405290565b9091825181526020809101920190615c13565b15615c4757565b606460405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b15615c9257565b606460405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b80517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9918282019082821161084457615d1982615d1281613820565b1015615c40565b615d276017615d128461382e565b615d3c8151615d358461382e565b1115615c8b565b81615d565750505050604051600081526020810160405290565b601760405194601f8416801560051b9182828901019687010193010101905b808410615d8d5750508252601f01601f191660405290565b9092835181526020809101930190615d75565b9162ffffff91600060408051615db581610311565b82815282602082015201526001600160a01b039081811682861611615df5575b8160405195615de387610311565b16855216602084015216604082015290565b93615dd5565b906001600160a01b03928381511684602083015116808210156102795762ffffff604061567b9401511660405191602083019384526040830152606082015260608152615e47816102f0565b519020611755604051938492602084019687916bffffffffffffffffffffffff19605594927fff00000000000000000000000000000000000000000000000000000000000000855260601b16600184015260158301526035820152019056fea26469706673582212207a7c6d5d106e715ede6697957a3df70d63085413a8a8f9460b72bbffa3a7ca5b64736f6c63430008140033

Deployed Bytecode

0x60806040526004361015610023575b361561001957600080fd5b610021613560565b005b60003560e01c8063182327761461026357806322aeedc31461025e5780632630583c14610259578063307ab24b1461025457806331e7d53a1461024f578063412f845b1461024a57806347b647dd14610245578063486ff0cd1461024057806350087bdf1461023b578063580f6da2146102365780635ed95d85146102315780636652dd6d1461022c578063715018a61461022757806379a7d1be1461022257806383a8528d1461021d578063880fbf0a146102185780638da5cb5b146102135780638db7ac9a1461020e5780638feca79414610209578063a739faab14610204578063ac9650d8146101ff578063ad5c4648146101fa578063b23c19e6146101f5578063b43ba431146101f0578063c09d54e5146101eb578063c0c53b8b146101e6578063c45a0155146101e1578063c691368d146101dc578063c890599d146101d7578063d83af687146101d2578063e274de88146101cd578063ec68199d146101c8578063f2fde38b146101c3578063f7789dac146101be578063f8c8765e146101b95763fa461e330361000e57612d95565b612c83565b612b86565b612adf565b61297f565b61275d565b6126eb565b6123e1565b612338565b612311565b6121cf565b61213a565b6120cb565b611f4b565b611ed9565b611e73565b611dc7565b611cbc565b611c36565b611c0f565b611b77565b6119d0565b6118be565b611855565b6116ae565b6111f5565b610fbc565b610f32565b610dac565b610cbf565b610b71565b610a52565b610928565b6107cb565b6105eb565b6104c7565b6001600160a01b0381160361027957565b600080fd5b6064359061028b82610268565b565b6084359061028b82610268565b6004359061028b82610268565b6044359061028b82610268565b60a4359061028b82610268565b610104359061028b82610268565b359061028b82610268565b634e487b7160e01b600052604160045260246000fd5b6080810190811067ffffffffffffffff82111761030c57604052565b6102da565b6060810190811067ffffffffffffffff82111761030c57604052565b67ffffffffffffffff811161030c57604052565b6040810190811067ffffffffffffffff82111761030c57604052565b90601f601f19910116810190811067ffffffffffffffff82111761030c57604052565b60405190610140820182811067ffffffffffffffff82111761030c57604052565b6040519061028b826102f0565b67ffffffffffffffff811161030c5760051b60200190565b359065ffffffffffff8216820361027957565b602319608091011261027957604051906103f2826102f0565b816024356103ff81610268565b815260443561040d81610268565b602082015265ffffffffffff90606435828116810361027957604082015260843591821682036102795760600152565b919082608091031261027957604051610455816102f0565b6060610494818395803561046881610268565b8552602081013561047881610268565b6020860152610489604082016103c6565b6040860152016103c6565b910152565b9181601f840112156102795782359167ffffffffffffffff8311610279576020838186019501011161027957565b3461027957600319606081360112610279576004356104e581610268565b6024359067ffffffffffffffff92838311610279576060908336030112610279576040519161051383610311565b8060040135848111610279578101366023820112156102795760048101359061053b826103ae565b90610549604051928361035d565b82825260209260248484019160071b8301019136831161027957602401905b8282106105b257505050845260449190610584602483016102cf565b9085015201356040830152604435928311610279576105aa610021933690600401610499565b9290916136d9565b846080916105c0368561043d565b815201910190610568565b6084359060ff8216820361027957565b6064359060ff8216820361027957565b346102795760e06003193601126102795760043561060881610268565b6024359061061582610268565b61061d6105cb565b90600092338452609b60205260ff604085205416156107ba576001600160a01b0380609c541691166040517f30adf81f00000000000000000000000000000000000000000000000000000000815260208160048189865af18015610759577fea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb91879161078c575b5003610762578492813b1561075e576040517f8fcbaf0c0000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015292166024830152604480359083015260648035908301526001608483015260ff90931660a4808301919091523560c4808301919091523560e482015291829081838161010481015b03925af1801561075957610743575080f35b806107506107569261032d565b80610d0b565b80f35b6136cd565b8380fd5b60046040517f698aa7ce000000000000000000000000000000000000000000000000000000008152fd5b6107ad915060203d81116107b3575b6107a5818361035d565b810190613c98565b386106a4565b503d61079b565b6004604051633bf7d83b60e11b8152fd5b346102795760408060031936011261027957602435906107ea82610268565b600091338352609b60205260ff828420541615610872576001600160a01b03169081835260046020526004358184205403610849578183526004602052808320549160018301809311610844578352600460205282205580f35b612f61565b600490517fbc0da7d6000000000000000000000000000000000000000000000000000000008152fd5b60048251633bf7d83b60e11b8152fd5b9181601f840112156102795782359167ffffffffffffffff8311610279576020808501948460061b01011161027957565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5c60609101126102795760a490565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c60609101126102795760c490565b8015150361027957565b6024359061028b82610911565b34610279576101406003193601126102795767ffffffffffffffff6044358181116102795761095b903690600401610882565b606435929161096984610268565b610972366108b3565b9361010435938411610279576109c3946109936109b3953690600401610882565b93909261012435956109a487610911565b60843592602435600435614511565b6040519081529081906020820190565b0390f35b906060600319830112610279576004359167ffffffffffffffff9160243583811161027957826109f991600401610882565b9390939260443591821161027957610a1391600401610882565b9091565b6020908160408183019282815285518094520193019160005b828110610a3e575050505090565b835185529381019392810192600101610a30565b3461027957610a60366109c7565b90919260028410610b4757610a74846156b2565b94610a7e86613047565b5260005b610a8b85612f77565b811015610b3957610b3490610b1c610b0b8288610b05610b00610af9610aed6020610ae78c610ad7610ac5610ad0610aca828d8d87613c17565b613c8e565b9b613804565b8a84613c17565b97610ae18d613804565b91613c17565b01613ca7565b6001600160601b031690565b8a8c613c17565b613cb1565b916156e3565b90610b16848b613069565b5161578f565b610b2e610b2883613804565b89613069565b52612fe9565b610a82565b604051806109c38882610a17565b60046040517f2f865df3000000000000000000000000000000000000000000000000000000008152fd5b3461027957610b7f366109c7565b92610bae6001600160a01b039392610ba68560005460101c16938660035416953691610ed6565b953691613c32565b926002855110610b4757610bd2610bc486613047565b51516001600160a01b031690565b1614610c9d575b50610be482516156b2565b92610bf8610bf28551612f77565b85613069565b52610c038251612f77565b805b610c1757604051806109c38682610a17565b80610c7f610c6e610c36610bc4610c30610c9796612f77565b88613069565b610c43610bc48589613069565b610c67610c30610aed6020610c58898d613069565b5101516001600160601b031690565b51916156e3565b90610c798489613069565b5161586e565b610c91610c8b83612f77565b87613069565b52615861565b80610c05565b610cb990610caa84613047565b51906001600160a01b03169052565b38610bd9565b34610279576020600319360112610279577f2515db67647788441643d86a0d6863b38b86519ce9e12032d9a20d3ec9e6fca16020600435610cfe612eb4565b80609d55604051908152a1005b600091031261027957565b90600182811c92168015610d46575b6020831014610d3057565b634e487b7160e01b600052602260045260246000fd5b91607f1691610d25565b60005b838110610d635750506000910152565b8181015183820152602001610d53565b90601f19601f602093610d9181518092818752878088019101610d50565b0116010190565b906020610da9928181520190610d73565b90565b3461027957600080600319360112610e885760405190806001805491610dd183610d16565b80865292828116908115610e5e5750600114610e04575b6109c385610df88187038261035d565b60405191829182610d98565b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b828410610e46575050508101602001610df8826109c3610de8565b80546020858701810191909152909301928101610e2b565b8695506109c396935060209250610df894915060ff191682840152151560051b8201019293610de8565b80fd5b6001600160601b0381160361027957565b919082604091031261027957604051610eb481610341565b60208082948035610ec481610268565b8452013591610ed283610e8b565b0152565b929192610ee2826103ae565b604092610ef18451928361035d565b819581835260208093019160061b84019381851161027957915b848310610f1a57505050505050565b838691610f278486610e9c565b815201920191610f0b565b34610279576101206003193601126102795767ffffffffffffffff604435818111610279573660238201121561027957610f76903690602481600401359101610ed6565b90610f7f61027e565b91610f89366108b3565b9261010435928311610279576109c393610faa6109b3943690600401610882565b939092608435916024356004356141ca565b34610279576020600319360112610279576001600160a01b03600435610fe181610268565b1660005260046020526020604060002054604051908152f35b6084359062ffffff8216820361027957565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedc6040910112610279576040519061104382610341565b61012435825261014435602083610ed283610268565b91908260409103126102795760405161107181610341565b602080829480358452013591610ed283610268565b906101606003198301126102795761110e61109f610380565b926110a861029a565b84526110b261091b565b60208501526110bf6102a7565b60408501526110cc61027e565b60608501526110d9610ffa565b60808501526110e66102b4565b60a085015260c43560c085015260e43560e08501526111036102c1565b61010085015261100c565b610120830152565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9c6060910112610279576040519061114d82610311565b816101643581526101843561116181610268565b602082015260406101a43591610ed283610e8b565b6023196060910112610279576040519061118f82610311565b8160243581526044356111a181610268565b6020820152604060643591610ed283610e8b565b9190826060910312610279576040516111cd81610311565b60408082948035845260208101356111e481610268565b6020850152013591610ed283610e8b565b6101c06003193601126102795761120b36611086565b61121436611116565b600090338252602091609b835260409360ff85832054161561169e5780850180516001600160a01b0316906112606112546003546001600160a01b031690565b6001600160a01b031690565b936001600160a01b0380931685811415908161167c575b508061165d575b6116345761128e86513a90613bec565b9481846112a285516001600160a01b031690565b169182036115a45750506112c786866112c287516001600160a01b031690565b614f8c565b8760608501936112de85516001600160a01b031690565b906112f46112546003546001600160a01b031690565b908216036114695750509061140e929160c0850151906113c1896113b38c61133861132a6101008c01516001600160a01b031690565b97516001600160a01b031690565b9761135a61134c60808d015162ffffff1690565b91516001600160a01b031690565b9151988994850191927fffffff0000000000000000000000000000000000000000000000000000000000602b946bffffffffffffffffffffffff19809460601b16855260e81b16601484015260601b1660178201520190565b03601f19810186528561035d565b6114026113d587516001600160a01b031690565b916113fa610120890151936113e86103a1565b9788526001600160a01b03168c880152565b1515858c0152565b60608401523090614d00565b9360e082015185106114595761144b928261144560a061143689956109c39b99970151151590565b9201516001600160a01b031690565b90615384565b519081529081906020820190565b60048651635397a1f960e01b8152fd5b929350939660e09650611582955061157860c08901519261153a8a61152c61149b60a08301516001600160a01b031690565b976114d260806114c76114b96101008701516001600160a01b031690565b9c516001600160a01b031690565b94015162ffffff1690565b9a519a8b9388850191927fffffff0000000000000000000000000000000000000000000000000000000000602b946bffffffffffffffffffffffff19809460601b16855260e81b16601484015260601b1660178201520190565b03601f19810189528861035d565b61157061154e8b516001600160a01b031690565b6101208c01519461155d6103a1565b998a528901906001600160a01b03169052565b1515868b0152565b6060850152614d00565b9101518110611594576109c39161144b565b60048251635397a1f960e01b8152fd5b546115ba9060101c6001600160a01b0316611254565b036112c7575082516001600160a01b03166115de60c0850191878351883093615014565b6001906116036115f66003546001600160a01b031690565b6001600160a01b03168452565b61162d611611878351612fb3565b611627610aed8c8b01516001600160601b031690565b90612fb3565b90526112c7565b600488517f20db8267000000000000000000000000000000000000000000000000000000008152fd5b50848361167460608701516001600160a01b031690565b16141561127e565b905061169661125483546001600160a01b039060101c1690565b141538611277565b60048551633bf7d83b60e11b8152fd5b346102795760c0600319360112610279576004356116cb81610268565b602435906116d882610268565b604435916116e46105db565b9142841061182b57600093338552609b60205260ff604086205416156107ba57609c546040517f7ecebe0000000000000000000000000000000000000000000000000000000000602082019081526001600160a01b0385811660248401529283169692918891829161176381604481015b03601f19810183528261035d565b519082895af16117716131e3565b50156118015786941691823b156117fd576040517fd505accf0000000000000000000000000000000000000000000000000000000081526001600160a01b0394851660048201529590931660248601526000196044860152606485019290925260ff9091166084808501919091523560a4808501919091523560c4840152829081838160e48101610731565b8480fd5b60046040517f98f2a59c000000000000000000000000000000000000000000000000000000008152fd5b60046040517f203d82d8000000000000000000000000000000000000000000000000000000008152fd5b3461027957600080600319360112610e885761186f612eb4565b806001600160a01b0360375473ffffffffffffffffffffffffffffffffffffffff198116603755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102795760006003193601126102795760206001600160a01b0360005460101c16604051908152f35b67ffffffffffffffff811161030c57601f01601f191660200190565b929192611910826118e8565b9161191e604051938461035d565b829481845281830111610279578281602093846000960137010152565b9080601f8301121561027957816020610da993359101611904565b919060c083820312610279576040519067ffffffffffffffff9060a083018281118482101761030c5760405282948035928311610279576119ac826119a160a094608096850161193b565b865260208301611059565b602085015260608101356040850152828101356060850152013591610ed283610268565b6101e0600319360112610279576119e636611086565b6119ef36611116565b906101c43567ffffffffffffffff811161027957611a11903690600401611956565b9133600052609b60205260409260ff84600020541615611b675760e091611a5b611b549260c0860192611a4984518984015190612fb3565b845286516001600160a01b0316614e4a565b5160a08401516001600160a01b03166101008501516001600160a01b031690611a8d878701516001600160a01b031690565b92611b14611aa1608089015162ffffff1690565b946113b3611ab960608b01516001600160a01b031690565b8b519788936020850191927fffffff0000000000000000000000000000000000000000000000000000000000602b946bffffffffffffffffffffffff19809460601b16855260e81b16601484015260601b1660178201520190565b86516001600160a01b0316611b4461012089015191611b316103a1565b9687526001600160a01b03166020870152565b6000898601526060850152614d00565b9101518110611594579051908152602090f35b60048451633bf7d83b60e11b8152fd5b34610279576101606003193601126102795767ffffffffffffffff60443581811161027957611baa903690600401610882565b9190611bb461027e565b611bbd366108b3565b936101243584811161027957611bd7903690600401610882565b9161014435958611610279576109c396611bf86109b3973690600401610882565b969095610104359360843592602435600435613cdf565b346102795760006003193601126102795760206001600160a01b0360375416604051908152f35b346102795761010060031936011261027957600435611c5481610268565b60c060231936011261027957604051611c6c81610311565b611c75366103d9565b815260a435611c8381610268565b602082015260c435604082015260e4359167ffffffffffffffff831161027957611cb4610021933690600401610499565b9290916135ba565b3461027957611cca366109c7565b919092611cfa6001600160a01b0394611cf28660005460101c16938760035416953691610ed6565b943691613c32565b936002845110610b4757611d10610bc485613047565b1614611db4575b50611d2281516156b2565b92611d2c84613047565b5260005b611d3a8251612f77565b811015611da65780611d95611d84611d58610bc4611da19587613069565b611d67610bc4610c3086613804565b610c67610b28610aed6020610c58611d7e8a613804565b8c613069565b90611d8f8489613069565b5161580a565b610b2e610c8b83613804565b611d30565b604051806109c38682610a17565b611dc190610caa83613047565b38611d17565b600080600319360112610e8857338152609b60205260ff604082205416156107ba576107563441615a22565b602080820190808352835180925260408301928160408460051b8301019501936000915b848310611e275750505050505090565b9091929394958480611e63837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc086600196030187528a51610d73565b9801930193019194939290611e17565b346102795760206003193601126102795767ffffffffffffffff6004358181116102795736602382011215610279578060040135918211610279573660248360051b83010111610279576109c3916024611ecd920161307d565b60405191829182611df3565b346102795760006003193601126102795760206001600160a01b0360035416604051908152f35b60a060031982011261027957600435611f1881610268565b9160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc60243593011261027957604490565b3461027957611f5936611f00565b91600092338452609b60205260ff604085205416156107ba57611f7d3a8235613bec565b90611fae84611f94609c546001600160a01b031690565b85611fa76003546001600160a01b031690565b30926159a4565b611fc66112546112546003546001600160a01b031690565b6040516370a0823160e01b81523060048201529490602086602481845afa801561075957879687916120ad575b50813b156120a957604051632e1a7d4d60e01b8152600481019190915295908690602490829084905af19485156107595761205f6120659461162793610aed9361206b99612096575b5060408601956001600160601b0361205388613ca7565b16612075575b50612fb3565b92613ca7565b90615a22565b6107564732615a22565b61208460206120909201613c8e565b612065610aed89613ca7565b38612059565b806107506120a39261032d565b3861203c565b8680fd5b6120c5915060203d81116107b3576107a5818361035d565b38611ff3565b34610279576020600319360112610279577ff98765b2b5e26c3266491f2a9f51d7fdae1c9c7ac2016fade7789d1f9e4ff3a060206001600160a01b0360043561211381610268565b61211b612eb4565b1680600052609b8252604060002060ff198154169055604051908152a1005b34610279576101406003193601126102795767ffffffffffffffff6044358181116102795761216d903690600401610882565b919060643582811161027957612187903690600401610882565b93909161219261028d565b9061219c366108e2565b9161012435958611610279576109c3966121bd6109b3973690600401610882565b96909560a43594602435600435613849565b34610279576060600319360112610279576004356121ec81610268565b6024356121f881610268565b7fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff000060443561223c81610268565b60009485549461225160ff8760081c166132a7565b6001600160a01b03908173ffffffffffffffffffffffffffffffffffffffff1993168360025416176002551690600354161760035560101b169116178155600161229b8154610d16565b601f81116122cb575b507f332e302e3000000000000000000000000000000000000000000000000000000a905580f35b81601f7fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6920160051c8201915b8281106123065750506122a4565b8481550182906122f8565b346102795760006003193601126102795760206001600160a01b0360025416604051908152f35b34610279576000600319360112610279576020609d54604051908152f35b91909160e081840312610279576040519067ffffffffffffffff9060c083018281118482101761030c576040528294813561239081610268565b845260208201359283116102795760a0826123b1838396610494960161193b565b60208701526123c2604082016102cf565b6040870152606081013560608701526080810135608087015201611059565b60806003193601126102795760043567ffffffffffffffff81116102795761240d903690600401612356565b61241636611176565b600091338352602091609b835260409260ff848620541615611b6757838161244084513a90613bec565b933397808096888581019b8c886124578251615ae3565b50509660039261247161125485546001600160a01b031690565b6001600160a01b03998a1690810361266c575061249a8a886112c289516001600160a01b031690565b93879c9b50612521909a91959293969798999a5b6060958685019e8f9461251860a088019a5b8451986124d260428b5110159a615ae3565b50995195508b90508a156126535750506125106124f130965b51615bf5565b968d51946124fd6103a1565b9889528801906001600160a01b03169052565b1515858a0152565b88840152614b9b565b808d52889361253788546001600160a01b031690565b928b168b8416146125d6575b50505060001461257657908b8a8f8f969594612521918a8e612518309461256a8551615cd6565b85529b98999a9b6124c0565b8c8c8c60808d5192612586614100565b015182106125c6571561259d579051908152602090f35b600482517fdd629f86000000000000000000000000000000000000000000000000000000008152fd5b60048351635397a1f960e01b8152fd5b6001600160601b0392939e50908d61260c8a6126078f9561261b960194611627610aed87516001600160601b031690565b612fb3565b9052516001600160601b031690565b168061262f575b505060019a38808f612543565b61264c916126468c8c01516001600160a01b031690565b906158d8565b3880612622565b0151612510906124f1906001600160a01b0316966124eb565b88546126839060101c6001600160a01b0316611254565b146126a1575b93879c9b50612521909a91959293969798999a6124ae565b90506126c56126b786516001600160a01b031690565b8a6060880151893093615014565b6001906126e481516126de86546001600160a01b031690565b90615bb1565b8152612689565b34610279576020600319360112610279577f8ea6dd825d4c0cbaa8c5f268c15b1df21173aae98f549a108b836de11d4971d860206001600160a01b0360043561273381610268565b61273b612eb4565b1680600052609b82526040600020600160ff19825416179055604051908152a1005b346102795761276b36611f00565b9091600092338452609b60205260409060ff828620541615610872576127923a8535613bec565b926127ae61125461125488546001600160a01b039060101c1690565b93843b156120a95783517f4b6c0f2c0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602481018490523060448201529487908690606490829084905af194851561075957879561296c575b5061282c6112546112546003546001600160a01b031690565b908487019161284682612841610aed86613ca7565b61383c565b813b15612968578651632e1a7d4d60e01b8152600481019190915296908790602490829084905af191821561075957611627610aed61205f6128c7946128f89b60209b8e98612955575b506001600160601b036128a287613ca7565b16612935575b506128c16112546112546003546001600160a01b031690565b98612fb3565b935180968195829463a9059cbb60e01b845260048401602090939291936001600160a01b0360408201951681520152565b03925af180156107595761290a575080f35b61292a9060203d811161292e575b612922818361035d565b8101906146da565b5080f35b503d612918565b6129438c61294f9201613c8e565b612065610aed88613ca7565b386128a8565b806107506129629261032d565b38612890565b8780fd5b806107506129799261032d565b38612813565b60a06003193601126102795767ffffffffffffffff600435818111610279576129ac903690600401612356565b906129b636611176565b90608435908111610279576129cf903690600401611956565b91600091338352602092609b845260409360ff85832054161561169e57946129fe84516001600160a01b031690565b90612a2a60609182870195612a1887518a84015190612fb3565b875287516001600160a01b0316614e4a565b8685019660a08601925b612a8489519160428351101592885184600014612ac357612a553092615bf5565b92612a76895191612a646103a1565b9586526001600160a01b031688860152565b898d85015287840152614b9b565b8087529015612aab575090612a8492913090612aa08a51615cd6565b8a5291929350612a34565b86608089929101518110611594579051908152602090f35b612a55612ad98d8d01516001600160a01b031690565b92615bf5565b3461027957602060031936011261027957600435612afc81610268565b612b04612eb4565b6001600160a01b03811615612b1c5761002190612f0c565b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b3461027957612b9436611f00565b91600092338452609b60205260ff604085205416156107ba57612bb83a8235613bec565b90612bd461125461125487546001600160a01b039060101c1690565b93843b15612c7f576040517f88853ca40000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602481018290523060448201529486908690606490829084905af19485156107595761205f6120659461162793610aed9361075699612c6c575b50612c568232615a22565b60408601956001600160601b0361205388613ca7565b80610750612c799261032d565b38612c4b565b8580fd5b3461027957608060031936011261027957600435612ca081610268565b612d09602435612caf81610268565b604435612cbb81610268565b60643591612cc883610268565b60005494612ced60ff8760081c161580978198612d87575b8115612d67575b50613318565b85612d00600160ff196000541617600055565b612d4e57613389565b612d0f57005b612d1f61ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a1005b612d6261010061ff00196000541617600055565b613389565b303b15915081612d79575b5038612ce7565b6001915060ff161438612d72565b600160ff8216109150612ce0565b346102795760606003193601126102795760243560043560443567ffffffffffffffff811161027957612dcc903690600401610499565b90821580612eac575b612e6d5760a054612de7368484611904565b60208151910120036107ba57612dff91810190614a02565b90612e20612e0d8351615ae3565b6060869793979492940151908488615ab3565b506000831315612e9757506001600160a01b03809116908416105b15612e6d5761002192612e656040612e5d60208601516001600160a01b031690565b940151151590565b923391614a8a565b60046040517f90a2caf2000000000000000000000000000000000000000000000000000000008152fd5b91506001600160a01b03808516911610612e3b565b508315612dd5565b6001600160a01b03603754163303612ec857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603754906001600160a01b03809116918273ffffffffffffffffffffffffffffffffffffffff19821617603755167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b634e487b7160e01b600052601160045260246000fd5b90600019820191821161084457565b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe820191821161084457565b9190820391821161084457565b6040516020810181811067ffffffffffffffff82111761030c5760405260008152906000368137565b60001981146108445760010190565b634e487b7160e01b600052603260045260246000fd5b6020908161028b93959461303b876040519889958587013784019183830160008152815194859201610d50565b0103808552018361035d565b8051156130545760200190565b612ff8565b8051600110156130545760400190565b80518210156130545760209160051b010190565b90613086612fc0565b90613090816103ae565b9261309e604051948561035d565b818452601f196130ad836103ae565b0160005b81811061315657505060005b8281106130cb575050505090565b8060051b8201357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1833603018112156102795782019081359167ffffffffffffffff83116102795760200182360381136102795761313086613151946131369361300e565b30613167565b6131408288613069565b5261314b8187613069565b50612fe9565b6130bd565b8060606020809389010152016130b1565b90610da9916000806040519361317c85610311565b602785527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208601527f206661696c6564000000000000000000000000000000000000000000000000006040860152602081519101845af46131dd6131e3565b91613213565b3d1561320e573d906131f4826118e8565b91613202604051938461035d565b82523d6000602084013e565b606090565b919290156132745750815115613227575090565b3b156132305790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156132875750805190602001fd5b6132a39060405191829162461bcd60e51b835260048301610d98565b0390fd5b156132ae57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b1561331f57565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b939275ffffffffffffffffffffffffffffffffffffffff00007fffffffffffffffffffff0000000000000000000000000000000000000000ffff916000968754946133d960ff8760081c166132a7565b6001600160a01b03908173ffffffffffffffffffffffffffffffffffffffff1993168360025416176002551690600354161760035560101b1691161783556001926134248454610d16565b90601f82116134e6575b50507f332e302e3000000000000000000000000000000000000000000000000000000a909255906134bf9061346161352c565b61346961354f565b613496613489336001600160a01b0316600052609b602052604060002090565b600160ff19825416179055565b6001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19609c541617609c55565b6134d067016345785d8a0000609d55565b6134db600019609e55565b61028b609e54609f55565b848152601f7fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6920160051c8201915b828110613522575061342e565b8181558501613515565b61354660ff60005460081c16613541816132a7565b6132a7565b61028b33612f0c565b61028b60ff60005460081c166132a7565b6001600160a01b03806003541633141590816135a8575b5061357e57565b60046040517faf7f02d5000000000000000000000000000000000000000000000000000000008152fd5b905060005460101c1633141538613577565b919092600092338452609b60205260ff604085205416156107ba576001600160a01b039283609c541692833b15612c7f579161368e86928694604080519a8b998a9889977f2b67b5700000000000000000000000000000000000000000000000000000000089521660048801526136696024880183516060906001600160a01b0380825116845260208201511660208401528165ffffffffffff91826040820151166040860152015116910152565b60208201511660a4870152015160c485015261010060e48501526101048401916136ac565b03925af180156107595761369f5750565b8061075061028b9261032d565b601f8260209493601f19938186528686013760008582860101520116010190565b6040513d6000823e3d90fd5b9291600092338452602091609b835260ff604086205416156107ba576001600160a01b039384609c541694853b156120a9579694939186939188604051998a987f2a2d80d1000000000000000000000000000000000000000000000000000000008a521660048901526060602489015260c4880194825195606060648b015286518091528160e48b01970190885b81811061379d575050508201511660848801526040015160a4870152858303600319016044870152859392849261368e926136ac565b929496985092949681999a506080816137ee8793600195516060906001600160a01b0380825116845260208201511660208401528165ffffffffffff91826040820151166040860152015116910152565b0199019101908b99989694928b98969492613767565b906001820180921161084457565b906002820180921161084457565b90601f820180921161084457565b601701908160171161084457565b9190820180921161084457565b9392959491979896999099421161182b57600097338952602096609b885260409a60ff8c8c20541615613bdc576138cf886138853a8435613bec565b986138ae8d6138a861389f61389a898b613bff565b613c27565b918a3691613c32565b90615682565b6138bb610ac58789613bff565b906138c9610ac5888a613c08565b92613cbc565b6138e76112546112546003546001600160a01b031690565b8c516370a0823160e01b80825230600483015298918b90829060249082905afa90811561075957613964938f8f8f90938f9495613bb9575b506139439061393b613932368b8d610ed6565b918c3691613c32565b90309061476c565b81016001600160601b0361395682613ca7565b16613b8b575b50505061383c565b9161396f8587613bff565b61397890613c8e565b91896139848789613bff565b61398d90613c8e565b92613998888a613c08565b6139a190613c8e565b926139ab91613c08565b016139b590613ca7565b6001600160601b03166139c990868d613c17565b6139d290613cb1565b906139dc926155c6565b6003548c51888152306004820152908a90829060249082906001600160a01b03165afa93841561075957613a2094613a1a928e91613b745750612fb3565b916158d8565b613a28614100565b613a44611254611254610ac5613a3d86612f77565b8688613c17565b89518581526001600160a01b038716600482015297908790899060249082905afa978815610759578998613b2b575b50611254610ac58795899795613aaa613ab396613ad79b613aa461125498613a9c368789610ed6565b933691613c32565b9161476c565b610ae181612f77565b9088518095819482938352600483019190916001600160a01b036020820193169052565b03915afa91821561075957613af39492613b0e575b5050612fb3565b918210613afe575090565b60049051635397a1f960e01b8152fd5b613b249250803d106107b3576107a5818361035d565b3880613aec565b611254919850610ac58795899795613aaa613ab396613ad79b613aa4613b60611254988e803d106107b3576107a5818361035d565b9f9850505096505095975095975050613a73565b61209091508c8d3d106107b3576107a5818361035d565b613a1a610aed61205f613bb195613baa6003546001600160a01b031690565b9501613c8e565b8a388061395c565b613943919550613bd590853d87116107b3576107a5818361035d565b949061391f565b60048c51633bf7d83b60e11b8152fd5b8181029291811591840414171561084457565b90156130545790565b90600110156130545760400190565b91908110156130545760061b0190565b610da9903690610e9c565b929192613c3e826103ae565b604092613c4d8451928361035d565b819581835260208093019160061b84019381851161027957915b848310613c7657505050505050565b838691613c838486611059565b815201920191613c67565b35610da981610268565b90816020910312610279575190565b35610da981610e8b565b610da9903690611059565b9291613cd961028b95926001600160a01b03609c541694836155c6565b926159a4565b91949a97929699989395909a421161182b5733600052602099609b8b5260ff60406000205416156107ba578693613d268792613d20610aed60408701613ca7565b9061383c565b958a8c8b89613eab575b50505050505050613d8c92613d4491612fb3565b613d5f613d58610aed8b610ae78a89613c08565b888a613c17565b90613d6d610ac58887613bff565b90613d86613d7e610ac58a89613c08565b933690611059565b90613cbc565b613da8611254611254610ac5613da187612f77565b8786613c17565b6040516370a0823160e01b8082526001600160a01b038516600483015290949092918890869060249082905afa958615610759578895600097613e6a575b50610ac5613e0d9361125493613aaa6112549489613aa4613e329d9e613a9c368789610ed6565b906040518095819482938352600483019190916001600160a01b036020820193169052565b03915afa90811561075957613e4f93600092613b0e575050612fb3565b908110613e595790565b6004604051635397a1f960e01b8152fd5b613e329750613e0d9361125493613aaa6112549489613aa4613e9b610ac5978e803d106107b3576107a5818361035d565b9d50505094505093509350613de6565b916138a8613ede92613ed661389a613eff97989b999c96613ed08c9f9c3a9035613bec565b9d613c08565b923691613c32565b613eeb610ac58589613bff565b613ef8610ac5868a613c08565b9187613cbc565b613f176112546112546003546001600160a01b031690565b6040516370a0823160e01b80825230600483015295909290918e90849060249082905afa928315610759578e60009461404e575b5050613f6791613f5c913691610ed6565b61393b368d8f613c32565b6003546040519485523060048601526001600160a01b03168c85602481845afa95861561075957613d8c97613fb78f94613fae908d9a613d449a6000916140375750612fb3565b92831015614079565b6001600160601b03613fcb60408301613ca7565b16613feb575b50505050613fdd614100565b9150928438808a8c8b613d30565b6140268161402061402e966140198a614014610aed61400f6040613a1a9a01613ca7565b6140c4565b6140e0565b9201613c8e565b93613bec565b612710900490565b8a388080613fd1565b6120909150883d8a116107b3576107a5818361035d565b613f5c929450613f6793918161406f92903d106107b3576107a5818361035d565b939150918e613f4b565b1561408057565b606460405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768207061696420666f72206761732e00000000000000006044820152fd5b906127106001600160601b038093160291821691820361084457565b81156140ea570490565b634e487b7160e01b600052601260045260246000fd5b6141186112546112546003546001600160a01b031690565b6040516370a0823160e01b8152306004820152602081602481855afa908115610759576000916141ac575b50609d548111614151575050565b813b156102795760006040518093632e1a7d4d60e01b825281838161417e87600483019190602083019252565b03925af19182156107595761028b92614199575b5032615a22565b806107506141a69261032d565b38614192565b6141c4915060203d81116107b3576107a5818361035d565b38614143565b92919495909693421161182b57600094338652602093609b855260409760ff898920541615614501576141ff610bc484613047565b6003546001600160a01b03166001600160a01b039182168183161415806144d2575b6144a9578690888c8c6142353a8835613bec565b95614259611254614248610bc48d613047565b935460101c6001600160a01b031690565b9116036143a857505050506142bb926142b46142ac6142806003546001600160a01b031690565b61428c610bc489613059565b6142a68d6138a88c61429d8d613059565b51923691613c32565b916155c6565b9336906111b5565b9187615014565b6142d96142d06003546001600160a01b031690565b610caa83613047565b6142ef611254611254610bc4610bf28551612f77565b87516370a0823160e01b8082526001600160a01b038616600483015290969093918690889060249082905afa968715610759578897614363575b50611254611254610bc4613ad7979561435361434c8b9997613ab3973691613c32565b888361476c565b61435d8151612f77565b90613069565b613ab3919750611254610bc4613ad7979561435361434c8b9997614396611254978c8d3d106107b3576107a5818361035d565b9d975097995050509597505050614329565b6143e39461441a97610aed938861205f9461162797989a01976143d66143d0610aed8b613ca7565b8661383c565b61441f575b505050612fb3565b6143fd6143f6610aed89610c5888613059565b8987613c17565b9061440a610bc486613047565b90613d86613d7e610bc488613059565b6142d9565b61445490898c61444c614446610aed614440609c546001600160a01b031690565b94613ca7565b8961383c565b9230926159a4565b6001600160601b0361446589613ca7565b1661447d575b5050614475614100565b8c38806143db565b6144966144a2926140196003546001600160a01b031690565b613a1a610aed8a613ca7565b8c3861446b565b60048b517f20db8267000000000000000000000000000000000000000000000000000000008152fd5b506144df610bc486613047565b826144f86112548d546001600160a01b039060101c1690565b91161415614221565b60048951633bf7d83b60e11b8152fd5b9499989695999792919097421161182b5733600052602092609b845260409660ff886000205416156146ca57614553610ac561454c86612f77565b8686613c17565b6001600160a01b036145706112546003546001600160a01b031690565b911603611634576145ba866145863a8f35613bec565b9861459b61454c610aed8a610ae78b8b613c08565b906145a9610ac58989613bff565b90613d86613d7e610ac58b8b613c08565b6145d26112546112546003546001600160a01b031690565b88516370a0823160e01b80825230600483015290959094918790879060249082905afa95861561075957600096614699575b5091613ed661393b9261461995943691610ed6565b826146326112546112546003546001600160a01b031690565b8751928352306004840152829060249082905afa9081156107595761465f93600092613b0e575050612fb3565b9261467b61466d8486612fb3565b611627610aed848c01613ca7565b958610613afe5750614693610da995969736906111b5565b93615384565b614619949391965061393b926146be613ed6928a3d8c116107b3576107a5818361035d565b97929495509250614604565b60048851633bf7d83b60e11b8152fd5b908160209103126102795751610da981610911565b51906dffffffffffffffffffffffffffff8216820361027957565b908160609103126102795761471e816146ef565b91604061472d602084016146ef565b92015163ffffffff811681036102795790565b90610da994936080936001600160a01b0392845260208401521660408201528160608201520190610d73565b929160005b61477b8551612f77565b8110156149fb5761478f610bc48287613069565b90856147a6610bc46147a084613804565b83613069565b610c586147e36112546112546147db6147d5610aed6147c5888c6154ea565b5098602097889161435d8d613804565b8a613069565b5185896155c6565b906040938451917f0902f1ac00000000000000000000000000000000000000000000000000000000835260609160049883858b81895afa93841561075957869560009182966149be575b505092809495614891946dffffffffffffffffffffffffffff8091169716926001600160a01b038091169416841496876000146149b85792935b8c8b518097819482936370a0823160e01b845283019190916001600160a01b036020820193169052565b03915afa801561075957816148b1916148b6956000916149a15750612fb3565b61580a565b911561499957600091935b868c6148cd8151612f86565b82101561498e57614903610aed61491095610c586149099461435d6148fd610bc46148f78a613812565b84613069565b97613812565b8b613069565b51916155c6565b955b61491a612fc0565b90833b156102795761495d60009692879351998a97889687957f022c0d9f0000000000000000000000000000000000000000000000000000000087528601614740565b03925af1918215610759576149769261497b5750612fe9565b614771565b806107506149889261032d565b3861314b565b505050508795614912565b6000936148c1565b6120909150873d89116107b3576107a5818361035d565b93614867565b85965061489195925090816149e792903d106149f4575b6149df818361035d565b81019061470a565b509594909150869061482d565b503d6149d5565b5050509050565b9060208282031261027957813567ffffffffffffffff9283821161027957019060a0828203126102795760405192614a39846102f0565b82359081116102795782614a5483606093614a82960161193b565b85526020810135614a6481610268565b60208601526040810135614a7781610911565b604086015201611059565b606082015290565b9315614aa7575061028b92506001600160a01b03600354166158d8565b6001600160a01b038181163003614ac357505061028b926158d8565b9361028b94609c54166159a4565b6020815260a0614aec835182602085015260c0840190610d73565b92602060606001600160a01b03928383820151166040870152604081015115158287015201518051608086015201511691015290565b9190826040910312610279576020825192015190565b919360a093610da996956001600160a01b0380941685521515602085015260408401521660608201528160808201520190610d73565b7f800000000000000000000000000000000000000000000000000000000000000081146108445760000390565b606092916040916001600160a01b03918483821660018103614cdb575090506000614c0d614c0761125433965b614bd28651615ae3565b9192614bf58c519d8e614bed81611755602082019485614ad1565b51902060a055565b808216908416109c8d98015192614e1e565b93614df3565b93828214614cbd57614c556401000276a4975b8751988997889687957f128acb0800000000000000000000000000000000000000000000000000000000875260048701614b38565b03925af190811561075957610da9926000918293614c8b575b50614c79600060a055565b15614c845750614b6e565b9050614b6e565b909250614caf915060403d8111614cb6575b614ca7818361035d565b810190614b22565b9138614c6e565b503d614c9d565b614c5573fffd8963efd1fc6a506488495d951d5263988d2597614c20565b91939091600214614cf8575b614c0d614c07611254600093614bc8565b309350614ce7565b91839260609460006040946001600160a01b0394858216600181148414614de457503391505b614d6b614d65611254614d398751615ae3565b90614d538d519e8f614bed81611755602082019485614ad1565b8b81168c8416109e8f9a015192614e1e565b95614df3565b958116158314614dda5750828214614dbd57614c556401000276a45b978751988997889687957f128acb0800000000000000000000000000000000000000000000000000000000875260048701614b38565b614c5573fffd8963efd1fc6a506488495d951d5263988d25614d87565b614c559097614c20565b600203614d2657309150614d26565b7f80000000000000000000000000000000000000000000000000000000000000008110156102795790565b614e40614e46939492946001600160a01b039586602086015116945193615da0565b91615dfb565b1690565b929192614e5982513a90613bec565b60409081840192614e7d614e77610aed86516001600160601b031690565b8361383c565b15614f83576000905b875190614eda60428351101591868b01938b614ec9614ea6875193615bf5565b9360208093015192614eb66103a1565b9586528501906001600160a01b03169052565b868984015260608301523090614b9b565b809252600014614ef7575030614ef08851615cd6565b8852614e86565b9050614f189192939495965091613d20610aed86516001600160601b031690565b11614f5a5750516001600160601b031680614f38575b505061028b614100565b614f539161264660206114366003546001600160a01b031690565b3880614f2e565b600490517fdd629f86000000000000000000000000000000000000000000000000000000008152fd5b50505050509050565b919091604082016001600160601b039182825116850180861161084457614fbb575b505050505061028b614100565b6001600160a01b039485609c541686600354169285855116830180931161084457614fe79330926159a4565b51169081614ff7575b8080614fae565b82602061500c946003541692015116906158d8565b388080614ff0565b929060009461503161125487546001600160a01b039060101c1690565b9360409586850193615056615050610aed87516001600160601b031690565b8261383c565b6152e4575b8261522c575b5050505061507690516001600160601b031690565b906001600160601b0382166151a6575b505081516370a0823160e01b8082523060048301526001600160a01b03929092169260209290918381602481885afa908115610759578691615189575b50609d54106150d4575b5050505050565b81519081523060048201528281602481875afa92831561075957859361516a575b5050823b1561075e57517f88853ca4000000000000000000000000000000000000000000000000000000008152306004820152602481019190915232604482015291908290606490829084905af1801561075957615157575b808080806150cd565b806107506151649261032d565b3861514e565b615181929350803d106107b3576107a5818361035d565b9038806150f5565b6151a09150843d86116107b3576107a5818361035d565b386150c3565b602001516001600160a01b038381169116813b15612c7f57845163a9059cbb60e01b81526001600160a01b0390911660048201526001600160601b039092166024830152909190849083908183816044810103925af1918215610759576001600160a01b0392615219575b819250615086565b806107506152269261032d565b38615211565b615243615257916001600160a01b03891694612fb3565b611627610aed87516001600160601b031690565b90823b156152e05787517f4b6c0f2c0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152602481019290925292909216604483015290919086908390606490829084905af191821561075957615076926152cd575b819281615061565b806107506152da9261032d565b386152c5565b8880fd5b6001600160a01b038716615305614e77610aed88516001600160601b031690565b813b156153805789517f4c6ef4140000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024810191909152306044820152908a908290606490829084905af180156107595761536d575b5061505b565b8061075061537a9261032d565b38615367565b8a80fd5b9291909260408501946001600160601b036153a687516001600160601b031690565b16806154c8575b50501561548d576153cc6112546112546003546001600160a01b031690565b6040516370a0823160e01b81523060048201529490602086602481845afa9586156107595760009661546d575b50803b1561027957604051632e1a7d4d60e01b815260048101969096526000908690602490829084905af192831561075957611627610aed61260793615450986120659761545a575b50516001600160601b031690565b61028b4732615a22565b806107506154679261032d565b38615442565b61548691965060203d81116107b3576107a5818361035d565b94386153f9565b613a1a906126076154c0959493611627610aed6154b26003546001600160a01b031690565b97516001600160601b031690565b61028b614100565b6154e39161264660206114366003546001600160a01b031690565b38806153ad565b90916001600160a01b039182841683821681811461555d57101561555857925b9183161561551457565b606460405162461bcd60e51b815260206004820152601d60248201527f546f6164737761704c6962726172793a205a45524f5f414444524553530000006044820152fd5b61550a565b608460405162461bcd60e51b8152602060048201526024808201527f546f6164737761704c6962726172793a204944454e544943414c5f414444524560448201527f53534553000000000000000000000000000000000000000000000000000000006064820152fd5b906155d0916154ea565b9161567b6001600160a01b039384602084015116936040519060208201926bffffffffffffffffffffffff19809260601b16845260601b1660348201526028815261561a81610311565b51902091516040517fff000000000000000000000000000000000000000000000000000000000000006020820190815260609590951b6bffffffffffffffffffffffff19166021820152603581019390935260558301528160758101611755565b5190201690565b906001600160601b0360206156ae936000826040516156a081610341565b828152015201511690613069565b5190565b906156bc826103ae565b6156c9604051918261035d565b828152601f196156d982946103ae565b0190602036910137565b6004919260606156f385846154ea565b50946157096001600160a01b03938492866155c6565b16604051948580927f0902f1ac0000000000000000000000000000000000000000000000000000000082525afa92831561075957600090819461576d575b5081906dffffffffffffffffffffffffffff80911694169416911614600014610a135791565b829450615788915060603d81116149f4576149df818361035d565b5093615747565b80156157e0578115806157d8575b6157ae57610da99261401491613bec565b60046040517fbb55fd27000000000000000000000000000000000000000000000000000000008152fd5b50821561579d565b60046040517f5945ea56000000000000000000000000000000000000000000000000000000008152fd5b80156157e0578115928380615859575b6157ae576103e580830292830403610844576158369082613bec565b926103e880840293840414171561084457810180911161084457610da9916140e0565b50801561581a565b8015610844576000190190565b919082156157e0578015806158d0575b6157ae578261588c91613bec565b906103e8918281029281840414901517156108445782810392818411610844576103e5808502948504149114171561084457610da9916158cb916140e0565b613804565b50811561587e565b60405163a9059cbb60e01b602082019081526001600160a01b039093166024820152604481019390935260009283929083906159178160648101611755565b51925af16159236131e3565b81615975575b501561593157565b606460405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152fd5b805180159250821561598a575b505038615929565b61599d92506020809183010191016146da565b3880615982565b91939092936001600160a01b0380931693843b156102795760009484869281608496816040519b8c9a8b997f36c78516000000000000000000000000000000000000000000000000000000008b521660048a01521660248801521660448601521660648401525af1801561075957615a195750565b61028b9061032d565b6000918291615a2f612fc0565b91602083519301915af1615a416131e3565b5015615a4957565b608460405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201527f4c454400000000000000000000000000000000000000000000000000000000006064820152fd5b91615ac191615ad893615da0565b602083015192516001600160a01b03938416615dfb565b168033036102795790565b90615af2601483511015615b66565b602082015160601c916017815110615b22576037601782015191615b1a602b82511015615b66565b015160601c91565b606460405162461bcd60e51b815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e64730000000000000000000000006044820152fd5b15615b6d57565b606460405162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e647300000000000000000000006044820152fd5b9060601b6bffffffffffffffffffffffff191660005b60148110615bd457505090565b8251811015613054578082615bf0921a60208286010153612fe9565b615bc7565b615c03602b82511015615c8b565b60405190600b8083019101603683015b808310615c2d575050602b8252601f01601f191660405290565b9091825181526020809101920190615c13565b15615c4757565b606460405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b15615c9257565b606460405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b80517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9918282019082821161084457615d1982615d1281613820565b1015615c40565b615d276017615d128461382e565b615d3c8151615d358461382e565b1115615c8b565b81615d565750505050604051600081526020810160405290565b601760405194601f8416801560051b9182828901019687010193010101905b808410615d8d5750508252601f01601f191660405290565b9092835181526020809101930190615d75565b9162ffffff91600060408051615db581610311565b82815282602082015201526001600160a01b039081811682861611615df5575b8160405195615de387610311565b16855216602084015216604082015290565b93615dd5565b906001600160a01b03928381511684602083015116808210156102795762ffffff604061567b9401511660405191602083019384526040830152606082015260608152615e47816102f0565b519020611755604051938492602084019687916bffffffffffffffffffffffff19605594927fff00000000000000000000000000000000000000000000000000000000000000855260601b16600184015260158301526035820152019056fea26469706673582212207a7c6d5d106e715ede6697957a3df70d63085413a8a8f9460b72bbffa3a7ca5b64736f6c63430008140033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.