ETH Price: $3,405.48 (-0.37%)
Gas: 17 Gwei

Contract

0x9bE264469eF954c139Da4A45Cf76CbCC5e3A6A73
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x61012060158327252022-10-26 14:04:11631 days ago1666793051IN
 Create: Adapter01
0 ETH0.1784676440

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Adapter01

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 35 : Adapter01.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "../../lib/uniswapv2/NewUniswapV2.sol";
import "../../lib/zeroxv4/ZeroxV4.sol";
import "../../lib/zeroxv2/ZeroxV2.sol";
import "../../lib/curve/Curve.sol";
import "../../lib/balancer/Balancer.sol";
import "../../lib/uniswapv3/UniswapV3.sol";
import "../../lib/aavee2/Aavee2.sol";
import "../../lib/oneinchlp/OneInchPool.sol";
import "../../lib/mstable/MStable.sol";
import "../../lib/curve/CurveV2.sol";
import "../IAdapter.sol";

/**
 * @dev This contract will route call to:
 * 1- 0xV4
 * 2- 0xV2
 * 3- Curve
 * 4- UniswapV2Forks
 * 5- Balancer
 * 6- UniswapV3
 * 7- Aavee2
 * 8- OneInchPool
 * 9- MStable
 * 10- CurveV2
 * The above are the indexes
 */
contract Adapter01 is
    IAdapter,
    NewUniswapV2,
    ZeroxV4,
    ZeroxV2,
    Curve,
    Balancer,
    UniswapV3,
    Aavee2,
    OneInchPool,
    MStable,
    CurveV2
{
    using SafeMath for uint256;

    /*solhint-disable no-empty-blocks*/
    constructor(
        address _erc20Proxy,
        uint16 _aaveeRefCode,
        address _aaveeLendingPool,
        address _aaveeWethGateway,
        address _weth
    ) public WethProvider(_weth) Aavee2(_aaveeRefCode, _aaveeLendingPool, _aaveeWethGateway) ZeroxV2(_erc20Proxy) {}

    /*solhint-enable no-empty-blocks*/

    function initialize(bytes calldata) external override {
        revert("METHOD NOT IMPLEMENTED");
    }

    function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256,
        Utils.Route[] calldata route
    ) external payable override {
        for (uint256 i = 0; i < route.length; i++) {
            if (route[i].index == 1) {
                //swap on 0xV4
                swapOnZeroXv4(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else if (route[i].index == 2) {
                //swap on 0xV2
                swapOnZeroXv2(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else if (route[i].index == 3) {
                //swap on curve
                swapOnCurve(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else if (route[i].index == 4) {
                //swap on uniswapV2Fork
                swapOnUniswapV2Fork(fromToken, toToken, fromAmount.mul(route[i].percent).div(10000), route[i].payload);
            } else if (route[i].index == 5) {
                //swap on balancer
                swapOnBalancer(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else if (route[i].index == 6) {
                //swap on uniswapv3
                swapOnUniswapV3(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else if (route[i].index == 7) {
                //swap on aavee2
                swapOnAaveeV2(fromToken, toToken, fromAmount.mul(route[i].percent).div(10000), route[i].payload);
            } else if (route[i].index == 8) {
                //swap on oneinch
                swapOnOneInch(fromToken, toToken, fromAmount.mul(route[i].percent).div(10000), route[i].targetExchange);
            } else if (route[i].index == 9) {
                //swap on Mstable
                swapOnMStable(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else if (route[i].index == 10) {
                //swap on CurveV2
                swapOnCurveV2(
                    fromToken,
                    toToken,
                    fromAmount.mul(route[i].percent).div(10000),
                    route[i].targetExchange,
                    route[i].payload
                );
            } else {
                revert("Index not supported");
            }
        }
    }
}

File 2 of 35 : NewUniswapV2.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";

import "./NewUniswapV2Lib.sol";
import "../Utils.sol";
import "../weth/IWETH.sol";

abstract contract NewUniswapV2 {
    using SafeMath for uint256;

    // Pool bits are 255-161: fee, 160: direction flag, 159-0: address
    uint256 constant FEE_OFFSET = 161;
    uint256 constant DIRECTION_FLAG = 0x0000000000000000000000010000000000000000000000000000000000000000;

    struct UniswapV2Data {
        address weth;
        uint256[] pools;
    }

    function swapOnUniswapV2Fork(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        bytes calldata payload
    ) internal {
        UniswapV2Data memory data = abi.decode(payload, (UniswapV2Data));
        _swapOnUniswapV2Fork(address(fromToken), fromAmount, data.weth, data.pools);
    }

    function buyOnUniswapFork(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 amountInMax,
        uint256 amountOut,
        bytes calldata payload
    ) internal {
        UniswapV2Data memory data = abi.decode(payload, (UniswapV2Data));

        _buyOnUniswapFork(address(fromToken), amountInMax, amountOut, data.weth, data.pools);
    }

    function _buyOnUniswapFork(
        address tokenIn,
        uint256 amountInMax,
        uint256 amountOut,
        address weth,
        uint256[] memory pools
    ) private returns (uint256 tokensSold) {
        uint256 pairs = pools.length;

        require(pairs != 0, "At least one pool required");

        uint256[] memory amounts = new uint256[](pairs + 1);

        amounts[pairs] = amountOut;

        for (uint256 i = pairs; i != 0; --i) {
            uint256 p = pools[i - 1];
            amounts[i - 1] = NewUniswapV2Lib.getAmountIn(
                amounts[i],
                address(p),
                p & DIRECTION_FLAG == 0,
                p >> FEE_OFFSET
            );
        }

        tokensSold = amounts[0];
        require(tokensSold <= amountInMax, "UniswapV2Router: INSUFFICIENT_INPUT_AMOUNT");
        bool tokensBoughtEth;

        if (tokenIn == Utils.ethAddress()) {
            IWETH(weth).deposit{ value: tokensSold }();
            require(IWETH(weth).transfer(address(pools[0]), tokensSold));
        } else {
            TransferHelper.safeTransfer(tokenIn, address(pools[0]), tokensSold);
            tokensBoughtEth = weth != address(0);
        }

        for (uint256 i = 0; i < pairs; ++i) {
            uint256 p = pools[i];
            (uint256 amount0Out, uint256 amount1Out) = p & DIRECTION_FLAG == 0
                ? (uint256(0), amounts[i + 1])
                : (amounts[i + 1], uint256(0));
            IUniswapV2Pair(address(p)).swap(
                amount0Out,
                amount1Out,
                i + 1 == pairs ? address(this) : address(pools[i + 1]),
                ""
            );
        }

        if (tokensBoughtEth) {
            IWETH(weth).withdraw(amountOut);
        }
    }

    function _swapOnUniswapV2Fork(
        address tokenIn,
        uint256 amountIn,
        address weth,
        uint256[] memory pools
    ) private returns (uint256 tokensBought) {
        uint256 pairs = pools.length;

        require(pairs != 0, "At least one pool required");

        bool tokensBoughtEth;

        if (tokenIn == Utils.ethAddress()) {
            IWETH(weth).deposit{ value: amountIn }();
            require(IWETH(weth).transfer(address(pools[0]), amountIn));
        } else {
            TransferHelper.safeTransfer(tokenIn, address(pools[0]), amountIn);
            tokensBoughtEth = weth != address(0);
        }

        tokensBought = amountIn;

        for (uint256 i = 0; i < pairs; ++i) {
            uint256 p = pools[i];
            address pool = address(p);
            bool direction = p & DIRECTION_FLAG == 0;

            tokensBought = NewUniswapV2Lib.getAmountOut(tokensBought, pool, direction, p >> FEE_OFFSET);
            (uint256 amount0Out, uint256 amount1Out) = direction
                ? (uint256(0), tokensBought)
                : (tokensBought, uint256(0));
            IUniswapV2Pair(pool).swap(
                amount0Out,
                amount1Out,
                i + 1 == pairs ? address(this) : address(pools[i + 1]),
                ""
            );
        }

        if (tokensBoughtEth) {
            IWETH(weth).withdraw(tokensBought);
        }
    }
}

File 3 of 35 : ZeroxV4.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

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

import "../weth/IWETH.sol";
import "./LibOrderV4.sol";
import "../Utils.sol";
import "../WethProvider.sol";

interface IZeroxV4 {
    function fillRfqOrder(
        // The order
        LibOrderV4.Order calldata order,
        // The signature
        LibOrderV4.Signature calldata signature,
        // How much taker token to fill the order with
        uint128 takerTokenFillAmount
    )
        external
        payable
        returns (
            // How much maker token from the order the taker received.
            uint128,
            uint128
        );
}

abstract contract ZeroxV4 is WethProvider {
    using SafeMath for uint256;

    struct ZeroxV4Data {
        LibOrderV4.Order order;
        LibOrderV4.Signature signature;
    }

    function swapOnZeroXv4(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
        }

        _swapOn0xV4(fromToken, toToken, fromAmount, exchange, payload);
    }

    function buyOnZeroXv4(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmountMax,
        uint256 toAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        ZeroxV4Data memory data = abi.decode(payload, (ZeroxV4Data));

        require(toAmount <= data.order.makerAmount, "insufficient makerAmount");
        uint256 fromAmount = toAmount.mul(data.order.takerAmount).add(data.order.makerAmount - 1).div(
            data.order.makerAmount
        ); // make divide round up
        require(fromAmount <= fromAmountMax, "insufficient fromAmountMax");

        address _fromToken = address(fromToken);
        address _toToken = address(toToken);
        require(_fromToken != _toToken, "fromToken should be different from toToken");

        if (address(fromToken) == Utils.ethAddress()) {
            _fromToken = WETH;
            IWETH(WETH).deposit{ value: fromAmount }();
        } else if (address(toToken) == Utils.ethAddress()) {
            _toToken = WETH;
        }

        require(address(data.order.takerToken) == address(_fromToken), "Invalid from token!!");
        require(address(data.order.makerToken) == address(_toToken), "Invalid to token!!");

        Utils.approve(exchange, address(_fromToken), fromAmount);

        IZeroxV4(exchange).fillRfqOrder(data.order, data.signature, uint128(fromAmount));

        if (address(fromToken) == Utils.ethAddress() || address(toToken) == Utils.ethAddress()) {
            uint256 amount = IERC20(WETH).balanceOf(address(this));
            // Normally will expect 0 when going from ETH
            // (because only amount required was deposited as WETH)
            if (amount > 0) {
                IWETH(WETH).withdraw(amount);
            }
        }
    }

    function _swapOn0xV4(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes memory payload
    ) private {
        ZeroxV4Data memory data = abi.decode(payload, (ZeroxV4Data));

        address _fromToken = address(fromToken);
        address _toToken = address(toToken);
        require(_fromToken != _toToken, "fromToken should be different from toToken");

        if (address(fromToken) == Utils.ethAddress()) {
            _fromToken = WETH;
        } else if (address(toToken) == Utils.ethAddress()) {
            _toToken = WETH;
        }

        require(address(data.order.takerToken) == address(_fromToken), "Invalid from token!!");
        require(address(data.order.makerToken) == address(_toToken), "Invalid to token!!");

        Utils.approve(exchange, address(_fromToken), fromAmount);

        IZeroxV4(exchange).fillRfqOrder(data.order, data.signature, uint128(fromAmount));

        if (address(toToken) == Utils.ethAddress()) {
            uint256 receivedAmount = Utils.tokenBalance(WETH, address(this));
            IWETH(WETH).withdraw(receivedAmount);
        }
    }
}

File 4 of 35 : ZeroxV2.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../weth/IWETH.sol";
import "./LibOrderV2.sol";
import "../Utils.sol";
import "../libraries/LibBytes.sol";
import "../WethProvider.sol";

interface IZeroxV2 {
    function marketSellOrdersNoThrow(
        LibOrderV2.Order[] calldata orders,
        uint256 takerAssetFillAmount,
        bytes[] calldata signatures
    ) external returns (LibOrderV2.FillResults memory);
}

abstract contract ZeroxV2 is WethProvider {
    using LibBytes for bytes;

    struct ZeroxV2Data {
        LibOrderV2.Order[] orders;
        bytes[] signatures;
    }

    address public immutable erc20Proxy;

    constructor(address _erc20Proxy) {
        erc20Proxy = _erc20Proxy;
    }

    function swapOnZeroXv2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
        }

        _swapOn0xV2(fromToken, toToken, fromAmount, exchange, payload);
    }

    function buyOnZeroXv2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        address _fromToken = address(fromToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
            _fromToken = WETH;
        }

        _swapOn0xV2(fromToken, toToken, fromAmount, exchange, payload);

        if (address(fromToken) == Utils.ethAddress()) {
            uint256 remainingAmount = Utils.tokenBalance(address(_fromToken), address(this));
            if (remainingAmount > 0) {
                IWETH(WETH).withdraw(remainingAmount);
            }
        }
    }

    function _swapOn0xV2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes memory payload
    ) private {
        address _fromToken = address(fromToken);
        address _toToken = address(toToken);
        require(_fromToken != _toToken, "fromToken should be different from toToken");

        if (_fromToken == Utils.ethAddress()) {
            _fromToken = WETH;
        } else if (_toToken == Utils.ethAddress()) {
            _toToken = WETH;
        }

        ZeroxV2Data memory data = abi.decode(payload, (ZeroxV2Data));

        for (uint256 i = 0; i < data.orders.length; i++) {
            address srcToken = data.orders[i].takerAssetData.readAddress(16);
            require(srcToken == address(_fromToken), "Invalid from token!!");

            address destToken = data.orders[i].makerAssetData.readAddress(16);
            require(destToken == address(_toToken), "Invalid to token!!");
        }

        Utils.approve(erc20Proxy, address(_fromToken), fromAmount);

        IZeroxV2(exchange).marketSellOrdersNoThrow(data.orders, fromAmount, data.signatures);

        if (address(toToken) == Utils.ethAddress()) {
            uint256 receivedAmount = Utils.tokenBalance(WETH, address(this));
            IWETH(WETH).withdraw(receivedAmount);
        }
    }
}

File 5 of 35 : Curve.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

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

import "./ICurve.sol";
import "../Utils.sol";

contract Curve {
    struct CurveData {
        int128 i;
        int128 j;
        uint256 deadline;
        bool underlyingSwap;
    }

    function swapOnCurve(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        CurveData memory curveData = abi.decode(payload, (CurveData));

        Utils.approve(address(exchange), address(fromToken), fromAmount);

        if (curveData.underlyingSwap) {
            ICurvePool(exchange).exchange_underlying(curveData.i, curveData.j, fromAmount, 1);
        } else {
            if (address(fromToken) == Utils.ethAddress()) {
                ICurveEthPool(exchange).exchange{ value: fromAmount }(curveData.i, curveData.j, fromAmount, 1);
            } else {
                ICurvePool(exchange).exchange(curveData.i, curveData.j, fromAmount, 1);
            }
        }
    }
}

File 6 of 35 : Balancer.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

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

import "../Utils.sol";
import "../weth/IWETH.sol";
import "./IBalancerPool.sol";
import "../WethProvider.sol";

interface IBalancerProxy {
    struct Swap {
        address pool;
        uint256 tokenInParam; // tokenInAmount / maxAmountIn / limitAmountIn
        uint256 tokenOutParam; // minAmountOut / tokenAmountOut / limitAmountOut
        uint256 maxPrice;
    }

    function batchSwapExactIn(
        Swap[] calldata swaps,
        address tokenIn,
        address tokenOut,
        uint256 totalAmountIn,
        uint256 minTotalAmountOut
    ) external returns (uint256 totalAmountOut);

    function batchSwapExactOut(
        Swap[] calldata swaps,
        address tokenIn,
        address tokenOut,
        uint256 maxTotalAmountIn
    ) external returns (uint256 totalAmountIn);

    function batchEthInSwapExactIn(
        Swap[] calldata swaps,
        address tokenOut,
        uint256 minTotalAmountOut
    ) external payable returns (uint256 totalAmountOut);

    function batchEthOutSwapExactIn(
        Swap[] calldata swaps,
        address tokenIn,
        uint256 totalAmountIn,
        uint256 minTotalAmountOut
    ) external returns (uint256 totalAmountOut);

    function batchEthInSwapExactOut(Swap[] calldata swaps, address tokenOut)
        external
        payable
        returns (uint256 totalAmountIn);

    function batchEthOutSwapExactOut(
        Swap[] calldata swaps,
        address tokenIn,
        uint256 maxTotalAmountIn
    ) external returns (uint256 totalAmountIn);
}

abstract contract Balancer is WethProvider {
    using SafeMath for uint256;

    struct BalancerData {
        IBalancerProxy.Swap[] swaps;
    }

    function swapOnBalancer(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address,
        bytes calldata payload
    ) internal {
        BalancerData memory data = abi.decode(payload, (BalancerData));

        address _fromToken = address(fromToken) == Utils.ethAddress() ? WETH : address(fromToken);
        address _toToken = address(toToken) == Utils.ethAddress() ? WETH : address(toToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
        }

        uint256 totalInParam;
        for (uint256 i = 0; i < data.swaps.length; ++i) {
            totalInParam = totalInParam.add(data.swaps[i].tokenInParam);
        }

        for (uint256 i = 0; i < data.swaps.length; ++i) {
            IBalancerProxy.Swap memory _swap = data.swaps[i];
            uint256 adjustedInParam = _swap.tokenInParam.mul(fromAmount).div(totalInParam);
            Utils.approve(_swap.pool, _fromToken, adjustedInParam);
            IBalancerPool(_swap.pool).swapExactAmountIn(
                _fromToken,
                adjustedInParam,
                _toToken,
                _swap.tokenOutParam,
                _swap.maxPrice
            );
        }

        if (address(toToken) == Utils.ethAddress()) {
            IWETH(WETH).withdraw(IERC20(WETH).balanceOf(address(this)));
        }
    }

    function buyOnBalancer(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 toAmount,
        address exchangeProxy,
        bytes calldata payload
    ) internal {
        BalancerData memory data = abi.decode(payload, (BalancerData));

        address _fromToken = address(fromToken) == Utils.ethAddress() ? WETH : address(fromToken);
        address _toToken = address(toToken) == Utils.ethAddress() ? WETH : address(toToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
        }

        _buyOnBalancer(_fromToken, _toToken, fromAmount, toAmount, data);

        if (address(fromToken) == Utils.ethAddress() || address(toToken) == Utils.ethAddress()) {
            IWETH(WETH).withdraw(IERC20(WETH).balanceOf(address(this)));
        }
    }

    function _buyOnBalancer(
        address _fromToken,
        address _toToken,
        uint256 fromAmount,
        uint256 toAmount,
        BalancerData memory data
    ) private {
        uint256 totalInParam;
        uint256 totalOutParam;
        for (uint256 i = 0; i < data.swaps.length; ++i) {
            IBalancerProxy.Swap memory _swap = data.swaps[i];
            totalInParam = totalInParam.add(_swap.tokenInParam);
            totalOutParam = totalOutParam.add(_swap.tokenOutParam);
        }

        for (uint256 i = 0; i < data.swaps.length; ++i) {
            IBalancerProxy.Swap memory _swap = data.swaps[i];
            uint256 adjustedInParam = _swap.tokenInParam.mul(fromAmount).div(totalInParam);
            uint256 adjustedOutParam = _swap.tokenOutParam.mul(toAmount).add(totalOutParam - 1).div(totalOutParam);
            Utils.approve(_swap.pool, _fromToken, adjustedInParam);
            IBalancerPool(_swap.pool).swapExactAmountOut(
                _fromToken,
                adjustedInParam,
                _toToken,
                adjustedOutParam,
                _swap.maxPrice
            );
        }
    }
}

File 7 of 35 : UniswapV3.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./ISwapRouterUniV3.sol";
import "../weth/IWETH.sol";
import "../WethProvider.sol";

abstract contract UniswapV3 is WethProvider {
    struct UniswapV3Data {
        bytes path;
        uint256 deadline;
    }

    function swapOnUniswapV3(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        UniswapV3Data memory data = abi.decode(payload, (UniswapV3Data));

        address _fromToken = address(fromToken) == Utils.ethAddress() ? WETH : address(fromToken);
        address _toToken = address(toToken) == Utils.ethAddress() ? WETH : address(toToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
        }

        Utils.approve(address(exchange), _fromToken, fromAmount);

        ISwapRouterUniV3(exchange).exactInput(
            ISwapRouterUniV3.ExactInputParams({
                path: data.path,
                recipient: address(this),
                deadline: data.deadline,
                amountIn: fromAmount,
                amountOutMinimum: 1
            })
        );

        if (address(toToken) == Utils.ethAddress()) {
            IWETH(WETH).withdraw(IERC20(WETH).balanceOf(address(this)));
        }
    }

    function buyOnUniswapV3(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 toAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        UniswapV3Data memory data = abi.decode(payload, (UniswapV3Data));

        address _fromToken = address(fromToken) == Utils.ethAddress() ? WETH : address(fromToken);
        address _toToken = address(toToken) == Utils.ethAddress() ? WETH : address(toToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
        }

        Utils.approve(address(exchange), _fromToken, fromAmount);

        ISwapRouterUniV3(exchange).exactOutput(
            ISwapRouterUniV3.ExactOutputParams({
                path: data.path,
                recipient: address(this),
                deadline: data.deadline,
                amountOut: toAmount,
                amountInMaximum: fromAmount
            })
        );

        if (address(fromToken) == Utils.ethAddress() || address(toToken) == Utils.ethAddress()) {
            IWETH(WETH).withdraw(IERC20(WETH).balanceOf(address(this)));
        }
    }
}

File 8 of 35 : Aavee2.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

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

interface IWETHGateway {
    function depositETH(
        address lendingPool,
        address onBehalfOf,
        uint16 referralCode
    ) external payable;

    function withdrawETH(
        address lendingPool,
        uint256 amount,
        address onBehalfOf
    ) external;
}

interface IAaveLendingPool {
    function deposit(
        IERC20 asset,
        uint256 amount,
        address onBehalfOf,
        uint16 referralCode
    ) external;

    function withdraw(
        IERC20 asset,
        uint256 amount,
        address to
    ) external returns (uint256);
}

contract Aavee2 {
    struct AaveeData {
        address aToken;
    }

    uint16 public immutable refCode;
    address public immutable lendingPool;
    address public immutable wethGateway;

    constructor(
        uint16 _refCode,
        address _lendingPool,
        address _wethGateway
    ) public {
        refCode = _refCode;
        lendingPool = _lendingPool;
        wethGateway = _wethGateway;
    }

    function swapOnAaveeV2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        bytes calldata payload
    ) internal {
        _swapOnAaveeV2(fromToken, toToken, fromAmount, payload);
    }

    function buyOnAaveeV2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        bytes calldata payload
    ) internal {
        _swapOnAaveeV2(fromToken, toToken, fromAmount, payload);
    }

    function _swapOnAaveeV2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        bytes memory payload
    ) private {
        AaveeData memory data = abi.decode(payload, (AaveeData));

        if (address(fromToken) == address(data.aToken)) {
            if (address(toToken) == Utils.ethAddress()) {
                Utils.approve(wethGateway, address(fromToken), fromAmount);
                IWETHGateway(wethGateway).withdrawETH(lendingPool, fromAmount, address(this));
            } else {
                Utils.approve(lendingPool, address(fromToken), fromAmount);
                IAaveLendingPool(lendingPool).withdraw(toToken, fromAmount, address(this));
            }
        } else if (address(toToken) == address(data.aToken)) {
            if (address(fromToken) == Utils.ethAddress()) {
                IWETHGateway(wethGateway).depositETH{ value: fromAmount }(lendingPool, address(this), refCode);
            } else {
                Utils.approve(lendingPool, address(fromToken), fromAmount);
                IAaveLendingPool(lendingPool).deposit(fromToken, fromAmount, address(this), refCode);
            }
        } else {
            revert("Invalid aToken");
        }
    }
}

File 9 of 35 : OneInchPool.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

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

contract OneInchPool {
    function swapOnOneInch(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange
    ) internal {
        address _fromToken = address(fromToken) == Utils.ethAddress() ? address(0) : address(fromToken);
        address _toToken = address(toToken) == Utils.ethAddress() ? address(0) : address(toToken);

        if (address(fromToken) != Utils.ethAddress()) {
            Utils.approve(address(exchange), _fromToken, fromAmount);
        }

        IOneInchPool(exchange).swap{ value: address(fromToken) == Utils.ethAddress() ? fromAmount : 0 }(
            IERC20(_fromToken),
            IERC20(_toToken),
            fromAmount,
            1,
            address(0)
        );
    }
}

File 10 of 35 : MStable.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

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

contract MStable {
    enum OpType {
        swap,
        mint,
        redeem
    }

    struct MStableData {
        uint256 opType;
    }

    function swapOnMStable(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        MStableData memory data = abi.decode(payload, (MStableData));
        Utils.approve(exchange, address(fromToken), fromAmount);

        if (data.opType == uint256(OpType.mint)) {
            IMStable(exchange).mint(address(fromToken), fromAmount, 1, address(this));
        } else if (data.opType == uint256(OpType.redeem)) {
            IMStable(exchange).redeem(address(toToken), fromAmount, 1, address(this));
        } else if (data.opType == uint256(OpType.swap)) {
            IMStable(exchange).swap(address(fromToken), address(toToken), fromAmount, 1, address(this));
        } else {
            revert("Invalid opType");
        }
    }
}

File 11 of 35 : CurveV2.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./ICurveV2.sol";
import "../Utils.sol";
import "../weth/IWETH.sol";
import "../WethProvider.sol";

abstract contract CurveV2 is WethProvider {
    enum CurveV2SwapType {
        EXCHANGE,
        EXCHANGE_UNDERLYING,
        EXCHANGE_GENERIC_FACTORY_ZAP
    }

    struct CurveV2Data {
        uint256 i;
        uint256 j;
        address originalPoolAddress;
        CurveV2SwapType swapType;
    }

    constructor() {}

    function swapOnCurveV2(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        address exchange,
        bytes calldata payload
    ) internal {
        CurveV2Data memory curveV2Data = abi.decode(payload, (CurveV2Data));

        address _fromToken = address(fromToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(WETH).deposit{ value: fromAmount }();
            _fromToken = WETH;
        }

        Utils.approve(address(exchange), address(_fromToken), fromAmount);
        if (curveV2Data.swapType == CurveV2SwapType.EXCHANGE) {
            ICurveV2Pool(exchange).exchange(curveV2Data.i, curveV2Data.j, fromAmount, 1);
        } else if (curveV2Data.swapType == CurveV2SwapType.EXCHANGE_UNDERLYING) {
            ICurveV2Pool(exchange).exchange_underlying(curveV2Data.i, curveV2Data.j, fromAmount, 1);
        } else if (curveV2Data.swapType == CurveV2SwapType.EXCHANGE_GENERIC_FACTORY_ZAP) {
            IGenericFactoryZap(exchange).exchange(
                curveV2Data.originalPoolAddress,
                curveV2Data.i,
                curveV2Data.j,
                fromAmount,
                1
            );
        }

        if (address(toToken) == Utils.ethAddress()) {
            uint256 receivedAmount = Utils.tokenBalance(WETH, address(this));
            IWETH(WETH).withdraw(receivedAmount);
        }
    }
}

File 12 of 35 : IAdapter.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "../lib/Utils.sol";

interface IAdapter {
    /**
     * @dev Certain adapters needs to be initialized.
     * This method will be called from Augustus
     */
    function initialize(bytes calldata data) external;

    /**
     * @dev The function which performs the swap on an exchange.
     * @param fromToken Address of the source token
     * @param toToken Address of the destination token
     * @param fromAmount Amount of source tokens to be swapped
     * @param networkFee NOT USED - Network fee to be used in this router
     * @param route Route to be followed
     */
    function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 networkFee,
        Utils.Route[] calldata route
    ) external payable;
}

File 13 of 35 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

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

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

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

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

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

File 15 of 35 : NewUniswapV2Lib.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

import "./IUniswapV2Pair.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

library NewUniswapV2Lib {
    using SafeMath for uint256;

    function getReservesByPair(address pair, bool direction)
        internal
        view
        returns (uint256 reserveIn, uint256 reserveOut)
    {
        (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();
        (reserveIn, reserveOut) = direction ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    function getAmountOut(
        uint256 amountIn,
        address pair,
        bool direction,
        uint256 fee
    ) internal view returns (uint256 amountOut) {
        require(amountIn > 0, "UniswapV2Lib: INSUFFICIENT_INPUT_AMOUNT");
        (uint256 reserveIn, uint256 reserveOut) = getReservesByPair(pair, direction);
        uint256 amountInWithFee = amountIn.mul(fee);
        uint256 numerator = amountInWithFee.mul(reserveOut);
        uint256 denominator = reserveIn.mul(10000).add(amountInWithFee);
        amountOut = uint256(numerator / denominator);
    }

    function getAmountIn(
        uint256 amountOut,
        address pair,
        bool direction,
        uint256 fee
    ) internal view returns (uint256 amountIn) {
        require(amountOut > 0, "UniswapV2Lib: INSUFFICIENT_OUTPUT_AMOUNT");
        (uint256 reserveIn, uint256 reserveOut) = getReservesByPair(pair, direction);
        require(reserveOut > amountOut, "UniswapV2Lib: reserveOut should be greater than amountOut");
        uint256 numerator = reserveIn.mul(amountOut).mul(10000);
        uint256 denominator = reserveOut.sub(amountOut).mul(fee);
        amountIn = (numerator / denominator).add(1);
    }
}

File 16 of 35 : Utils.sol
/*solhint-disable avoid-low-level-calls */
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../ITokenTransferProxy.sol";

interface IERC20Permit {
    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

interface IERC20PermitLegacy {
    function permit(
        address holder,
        address spender,
        uint256 nonce,
        uint256 expiry,
        bool allowed,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

library Utils {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);

    uint256 private constant MAX_UINT = type(uint256).max;

    /**
   * @param fromToken Address of the source token
   * @param fromAmount Amount of source tokens to be swapped
   * @param toAmount Minimum destination token amount expected out of this swap
   * @param expectedAmount Expected amount of destination tokens without slippage
   * @param beneficiary Beneficiary address
   * 0 then 100% will be transferred to beneficiary. Pass 10000 for 100%
   * @param path Route to be taken for this swap to take place

   */
    struct SellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.Path[] path;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct BuyData {
        address adapter;
        address fromToken;
        address toToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.Route[] route;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct MegaSwapSellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.MegaSwapPath[] path;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct SimpleData {
        address fromToken;
        address toToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address[] callees;
        bytes exchangeData;
        uint256[] startIndexes;
        uint256[] values;
        address payable beneficiary;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct Adapter {
        address payable adapter;
        uint256 percent;
        uint256 networkFee; //NOT USED
        Route[] route;
    }

    struct Route {
        uint256 index; //Adapter at which index needs to be used
        address targetExchange;
        uint256 percent;
        bytes payload;
        uint256 networkFee; //NOT USED - Network fee is associated with 0xv3 trades
    }

    struct MegaSwapPath {
        uint256 fromAmountPercent;
        Path[] path;
    }

    struct Path {
        address to;
        uint256 totalNetworkFee; //NOT USED - Network fee is associated with 0xv3 trades
        Adapter[] adapters;
    }

    function ethAddress() internal pure returns (address) {
        return ETH_ADDRESS;
    }

    function maxUint() internal pure returns (uint256) {
        return MAX_UINT;
    }

    function approve(
        address addressToApprove,
        address token,
        uint256 amount
    ) internal {
        if (token != ETH_ADDRESS) {
            IERC20 _token = IERC20(token);

            uint256 allowance = _token.allowance(address(this), addressToApprove);

            if (allowance < amount) {
                _token.safeApprove(addressToApprove, 0);
                _token.safeIncreaseAllowance(addressToApprove, MAX_UINT);
            }
        }
    }

    function transferTokens(
        address token,
        address payable destination,
        uint256 amount
    ) internal {
        if (amount > 0) {
            if (token == ETH_ADDRESS) {
                (bool result, ) = destination.call{ value: amount, gas: 10000 }("");
                require(result, "Failed to transfer Ether");
            } else {
                IERC20(token).safeTransfer(destination, amount);
            }
        }
    }

    function tokenBalance(address token, address account) internal view returns (uint256) {
        if (token == ETH_ADDRESS) {
            return account.balance;
        } else {
            return IERC20(token).balanceOf(account);
        }
    }

    function permit(address token, bytes memory permit) internal {
        if (permit.length == 32 * 7) {
            (bool success, ) = token.call(abi.encodePacked(IERC20Permit.permit.selector, permit));
            require(success, "Permit failed");
        }

        if (permit.length == 32 * 8) {
            (bool success, ) = token.call(abi.encodePacked(IERC20PermitLegacy.permit.selector, permit));
            require(success, "Permit failed");
        }
    }

    function transferETH(address payable destination, uint256 amount) internal {
        if (amount > 0) {
            (bool result, ) = destination.call{ value: amount, gas: 10000 }("");
            require(result, "Transfer ETH failed");
        }
    }
}

File 17 of 35 : IWETH.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

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

abstract contract IWETH is IERC20 {
    function deposit() external payable virtual;

    function withdraw(uint256 amount) external virtual;
}

File 18 of 35 : IUniswapV2Pair.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface IUniswapV2Pair {
    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;
}

File 19 of 35 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 20 of 35 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

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

File 21 of 35 : ITokenTransferProxy.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface ITokenTransferProxy {
    function transferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    ) external;
}

File 22 of 35 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 23 of 35 : LibOrderV4.sol
// SPDX-License-Identifier: ISC

/* solium-disable */

pragma solidity 0.7.5;

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

library LibOrderV4 {
    struct Order {
        IERC20 makerToken;
        IERC20 takerToken;
        uint128 makerAmount;
        uint128 takerAmount;
        address maker;
        address taker;
        address txOrigin;
        bytes32 pool;
        uint64 expiry;
        uint256 salt;
    }

    enum SignatureType {
        ILLEGAL,
        INVALID,
        EIP712,
        ETHSIGN
    }

    struct Signature {
        // How to validate the signature.
        SignatureType signatureType;
        // EC Signature data.
        uint8 v;
        // EC Signature data.
        bytes32 r;
        // EC Signature data.
        bytes32 s;
    }
}

File 24 of 35 : WethProvider.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

contract WethProvider {
    /*solhint-disable var-name-mixedcase*/
    address public immutable WETH;

    /*solhint-enable var-name-mixedcase*/

    constructor(address weth) public {
        WETH = weth;
    }
}

File 25 of 35 : LibOrderV2.sol
// SPDX-License-Identifier: ISC

/* solium-disable */

pragma solidity 0.7.5;

//Taken from 0x exchange
library LibOrderV2 {
    /**
     * @dev Order type
     * @param makerAddress Address that created the order.
     * @param takerAddress Address that is allowed to fill the order.
     *                     If set to 0, any address is allowed to fill the order.
     * @param feeRecipientAddress Address that will recieve fees when order is filled.
     * @param senderAddress Address that is allowed to call Exchange contract methods that affect this order.
     *                      If set to 0, any address is allowed to call these methods.
     * @param makerAssetAmount Amount of makerAsset being offered by maker. Must be greater than 0.
     * @param takerAssetAmount Amount of takerAsset being bid on by maker. Must be greater than 0.
     * @param makerFee Amount of ZRX paid to feeRecipient by maker when order is filled.
     *                 If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted
     * @param takerFee Amount of ZRX paid to feeRecipient by taker when order is filled.
     *                 If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.
     * @param expirationTimeSeconds Timestamp in seconds at which order expires.
     * @param salt Arbitrary number to facilitate uniqueness of the order's hash.
     * @param makerAssetData Encoded data that can be decoded by a specified proxy contract
     *                       when transferring makerAsset.
     *                       The last byte references the id of this proxy.
     * @param takerAssetData Encoded data that can be decoded by a specified proxy contract
     *                       when transferring takerAsset.
     *                       The last byte references the id of this proxy.
     */
    struct Order {
        address makerAddress;
        address takerAddress;
        address feeRecipientAddress;
        address senderAddress;
        uint256 makerAssetAmount;
        uint256 takerAssetAmount;
        uint256 makerFee;
        uint256 takerFee;
        uint256 expirationTimeSeconds;
        uint256 salt;
        bytes makerAssetData;
        bytes takerAssetData;
    }

    struct FillResults {
        uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.
        uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.
        uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).
        uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).
    }
}

File 26 of 35 : LibBytes.sol
// SPDX-License-Identifier: ISC

/*
  Copyright 2019 ZeroEx Intl.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

pragma solidity 0.7.5;

import "./LibBytesRichErrors.sol";
import "./LibRichErrors.sol";

library LibBytes {
    using LibBytes for bytes;

    /// @dev Reads an address from a position in a byte array.
    /// @param b Byte array containing an address.
    /// @param index Index in byte array of address.
    /// @return result address from byte array.
    function readAddress(bytes memory b, uint256 index) internal pure returns (address result) {
        if (b.length < index + 20) {
            LibRichErrors.rrevert(
                LibBytesRichErrors.InvalidByteOperationError(
                    LibBytesRichErrors.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
                    b.length,
                    index + 20 // 20 is length of address
                )
            );
        }

        // Add offset to index:
        // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
        // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
        index += 20;

        // Read address from array memory
        assembly {
            // 1. Add index to address of bytes array
            // 2. Load 32-byte word from memory
            // 3. Apply 20-byte mask to obtain address
            result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
        }
        return result;
    }
}

File 27 of 35 : LibBytesRichErrors.sol
// SPDX-License-Identifier: ISC

/*
  Copyright 2019 ZeroEx Intl.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

pragma solidity 0.7.5;

library LibBytesRichErrors {
    enum InvalidByteOperationErrorCodes {
        FromLessThanOrEqualsToRequired,
        ToLessThanOrEqualsLengthRequired,
        LengthGreaterThanZeroRequired,
        LengthGreaterThanOrEqualsFourRequired,
        LengthGreaterThanOrEqualsTwentyRequired,
        LengthGreaterThanOrEqualsThirtyTwoRequired,
        LengthGreaterThanOrEqualsNestedBytesLengthRequired,
        DestinationLengthGreaterThanOrEqualSourceLengthRequired
    }

    // bytes4(keccak256("InvalidByteOperationError(uint8,uint256,uint256)"))
    bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR = 0x28006595;

    // solhint-disable func-name-mixedcase
    function InvalidByteOperationError(
        InvalidByteOperationErrorCodes errorCode,
        uint256 offset,
        uint256 required
    ) internal pure returns (bytes memory) {
        return abi.encodeWithSelector(INVALID_BYTE_OPERATION_ERROR_SELECTOR, errorCode, offset, required);
    }
}

File 28 of 35 : LibRichErrors.sol
// SPDX-License-Identifier: ISC

/*
  Copyright 2019 ZeroEx Intl.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

pragma solidity 0.7.5;

library LibRichErrors {
    // bytes4(keccak256("Error(string)"))
    bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;

    // solhint-disable func-name-mixedcase
    /// @dev ABI encode a standard, string revert error payload.
    ///      This is the same payload that would be included by a `revert(string)`
    ///      solidity statement. It has the function signature `Error(string)`.
    /// @param message The error string.
    /// @return The ABI encoded error.
    function StandardError(string memory message) internal pure returns (bytes memory) {
        return abi.encodeWithSelector(STANDARD_ERROR_SELECTOR, bytes(message));
    }

    // solhint-enable func-name-mixedcase

    /// @dev Reverts an encoded rich revert reason `errorData`.
    /// @param errorData ABI encoded error data.
    function rrevert(bytes memory errorData) internal pure {
        assembly {
            revert(add(errorData, 0x20), mload(errorData))
        }
    }
}

File 29 of 35 : ICurve.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

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

interface IPool {
    function underlying_coins(int128 index) external view returns (address);

    function coins(int128 index) external view returns (address);
}

interface IPoolV3 {
    function underlying_coins(uint256 index) external view returns (address);

    function coins(uint256 index) external view returns (address);
}

interface ICurvePool {
    function exchange_underlying(
        int128 i,
        int128 j,
        uint256 dx,
        uint256 minDy
    ) external;

    function exchange(
        int128 i,
        int128 j,
        uint256 dx,
        uint256 minDy
    ) external;
}

interface ICurveEthPool {
    function exchange(
        int128 i,
        int128 j,
        uint256 dx,
        uint256 minDy
    ) external payable;
}

interface ICompoundPool {
    function exchange_underlying(
        int128 i,
        int128 j,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external;

    function exchange(
        int128 i,
        int128 j,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external;
}

File 30 of 35 : IBalancerPool.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface IBalancerPool {
    function swapExactAmountIn(
        address tokenIn,
        uint256 tokenAmountIn,
        address tokenOut,
        uint256 minAmountOut,
        uint256 maxPrice
    ) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter);

    function swapExactAmountOut(
        address tokenIn,
        uint256 maxAmountIn,
        address tokenOut,
        uint256 tokenAmountOut,
        uint256 maxPrice
    ) external returns (uint256 tokenAmountIn, uint256 spotPriceAfter);
}

File 31 of 35 : ISwapRouterUniV3.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "../Utils.sol";

interface ISwapRouterUniV3 {
    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 32 of 35 : AugustusStorage.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

import "./ITokenTransferProxy.sol";

contract AugustusStorage {
    struct FeeStructure {
        uint256 partnerShare;
        bool noPositiveSlippage;
        bool positiveSlippageToUser;
        uint16 feePercent;
        string partnerId;
        bytes data;
    }

    ITokenTransferProxy internal tokenTransferProxy;
    address payable internal feeWallet;

    mapping(address => FeeStructure) internal registeredPartners;

    mapping(bytes4 => address) internal selectorVsRouter;
    mapping(bytes32 => bool) internal adapterInitialized;
    mapping(bytes32 => bytes) internal adapterVsData;

    mapping(bytes32 => bytes) internal routerData;
    mapping(bytes32 => bool) internal routerInitialized;

    bytes32 public constant WHITELISTED_ROLE = keccak256("WHITELISTED_ROLE");

    bytes32 public constant ROUTER_ROLE = keccak256("ROUTER_ROLE");
}

File 33 of 35 : IOneInchPool.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

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

interface IOneInchPool {
    function swap(
        IERC20 src,
        IERC20 dst,
        uint256 amount,
        uint256 minReturn,
        address referral
    ) external payable returns (uint256 result);
}

File 34 of 35 : IMStable.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface IMStable {
    function mint(
        address _input,
        uint256 _inputQuantity,
        uint256 _minOutputQuantity,
        address _recipient
    ) external virtual returns (uint256 mintOutput);

    function swap(
        address _input,
        address _output,
        uint256 _inputQuantity,
        uint256 _minOutputQuantity,
        address _recipient
    ) external virtual returns (uint256 swapOutput);

    function redeem(
        address _output,
        uint256 _mAssetQuantity,
        uint256 _minOutputQuantity,
        address _recipient
    ) external virtual returns (uint256 outputQuantity);
}

File 35 of 35 : ICurveV2.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface ICurveV2Pool {
    function exchange_underlying(
        uint256 i,
        uint256 j,
        uint256 dx,
        uint256 minDy
    ) external;

    function exchange(
        uint256 i,
        uint256 j,
        uint256 dx,
        uint256 minDy
    ) external;
}

interface IGenericFactoryZap {
    function exchange(
        address _pool,
        uint256 i,
        uint256 j,
        uint256 _dx,
        uint256 _min_dy
    ) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_erc20Proxy","type":"address"},{"internalType":"uint16","name":"_aaveeRefCode","type":"uint16"},{"internalType":"address","name":"_aaveeLendingPool","type":"address"},{"internalType":"address","name":"_aaveeWethGateway","type":"address"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20Proxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lendingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refCode","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"targetExchange","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"networkFee","type":"uint256"}],"internalType":"struct Utils.Route[]","name":"route","type":"tuple[]"}],"name":"swap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"wethGateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101206040523480156200001257600080fd5b506040516200520c3803806200520c833981016040819052620000359162000096565b606090811b6001600160601b031990811660805294811b851660a05260f09390931b6001600160f01b03191660c05290821b831660e052901b16610100526200010c565b80516001600160a01b03811681146200009157600080fd5b919050565b600080600080600060a08688031215620000ae578081fd5b620000b98662000079565b9450602086015161ffff81168114620000d0578182fd5b9350620000e06040870162000079565b9250620000f06060870162000079565b9150620001006080870162000079565b90509295509295909350565b60805160601c60a05160601c60c05160f01c60e05160601c6101005160601c61501b620001f160003980610203528061299452806129f75280612c1b5250806101bb5280612a245280612a8c5280612aef5280612c4a5280612cd25280612d355250806101735280612c6e5280612d6852508061019752806122f75250806101df52806109955280610a9d5280610e0b5280610e715280610ed0528061112f528061127152806112d7528061133652806115095280611a4e5280611acf5280611d0e5280611d735280611e705280611ed45280612106528061216a525061501b6000f3fe6080604052600436106100705760003560e01c8063a59a99731161004e578063a59a9973146100e4578063ad5c4648146100f9578063c5e10eef1461010e578063e76b146c1461012357610070565b8063439fab9114610075578063635677f2146100975780637f555b03146100c2575b600080fd5b34801561008157600080fd5b50610095610090366004613ce0565b610136565b005b3480156100a357600080fd5b506100ac610171565b6040516100b99190614d4a565b60405180910390f35b3480156100ce57600080fd5b506100d7610195565b6040516100b991906146cf565b3480156100f057600080fd5b506100d76101b9565b34801561010557600080fd5b506100d76101dd565b34801561011a57600080fd5b506100d7610201565b610095610131366004613d4d565b610225565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b3c565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005b818110156108525782828281811061023c57fe5b905060200281019061024e9190614e22565b35600114156102f9576102f4878761029461271061028e88888881811061027157fe5b90506020028101906102839190614e22565b8b906040013561085b565b906108d7565b8686868181106102a057fe5b90506020028101906102b29190614e22565b6102c3906040810190602001613ca8565b8787878181106102cf57fe5b90506020028101906102e19190614e22565b6102ef906060810190614db8565b610958565b61084a565b82828281811061030557fe5b90506020028101906103179190614e22565b356002141561039a576102f4878761033a61271061028e88888881811061027157fe5b86868681811061034657fe5b90506020028101906103589190614e22565b610369906040810190602001613ca8565b87878781811061037557fe5b90506020028101906103879190614e22565b610395906060810190614db8565b610a60565b8282828181106103a657fe5b90506020028101906103b89190614e22565b356003141561043b576102f487876103db61271061028e88888881811061027157fe5b8686868181106103e757fe5b90506020028101906103f99190614e22565b61040a906040810190602001613ca8565b87878781811061041657fe5b90506020028101906104289190614e22565b610436906060810190614db8565b610b60565b82828281811061044757fe5b90506020028101906104599190614e22565b35600414156104ad576102f4878761047c61271061028e88888881811061027157fe5b86868681811061048857fe5b905060200281019061049a9190614e22565b6104a8906060810190614db8565b610d87565b8282828181106104b957fe5b90506020028101906104cb9190614e22565b356005141561054e576102f487876104ee61271061028e88888881811061027157fe5b8686868181106104fa57fe5b905060200281019061050c9190614e22565b61051d906040810190602001613ca8565b87878781811061052957fe5b905060200281019061053b9190614e22565b610549906060810190614db8565b610db1565b82828281811061055a57fe5b905060200281019061056c9190614e22565b35600614156105ef576102f4878761058f61271061028e88888881811061027157fe5b86868681811061059b57fe5b90506020028101906105ad9190614e22565b6105be906040810190602001613ca8565b8787878181106105ca57fe5b90506020028101906105dc9190614e22565b6105ea906060810190614db8565b611217565b8282828181106105fb57fe5b905060200281019061060d9190614e22565b3560071415610661576102f4878761063061271061028e88888881811061027157fe5b86868681811061063c57fe5b905060200281019061064e9190614e22565b61065c906060810190614db8565b6115f0565b82828281811061066d57fe5b905060200281019061067f9190614e22565b35600814156106d6576102f487876106a261271061028e88888881811061027157fe5b8686868181106106ae57fe5b90506020028101906106c09190614e22565b6106d1906040810190602001613ca8565b611639565b8282828181106106e257fe5b90506020028101906106f49190614e22565b3560091415610777576102f4878761071761271061028e88888881811061027157fe5b86868681811061072357fe5b90506020028101906107359190614e22565b610746906040810190602001613ca8565b87878781811061075257fe5b90506020028101906107649190614e22565b610772906060810190614db8565b611828565b82828281811061078357fe5b90506020028101906107959190614e22565b35600a1415610818576102f487876107b861271061028e88888881811061027157fe5b8686868181106107c457fe5b90506020028101906107d69190614e22565b6107e7906040810190602001613ca8565b8787878181106107f357fe5b90506020028101906108059190614e22565b610813906060810190614db8565b6119fa565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614be1565b600101610228565b50505050505050565b60008261086a575060006108d1565b8282028284828161087757fe5b04146108ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614f8e6021913960400191505060405180910390fd5b90505b92915050565b600080821161094757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161095057fe5b049392505050565b610960611da8565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610a15577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156109fb57600080fd5b505af1158015610a0f573d6000803e3d6000fd5b50505050505b610a588686868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611dc092505050565b505050505050565b610a68611da8565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610b1d577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b50505050505b610a588686868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061207492505050565b610b68613973565b610b7482840184613f58565b9050610b818488876123d2565b806060015115610c1e57805160208201516040517fa6417ed600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87169263a6417ed692610be7928a90600190600401614a17565b600060405180830381600087803b158015610c0157600080fd5b505af1158015610c15573d6000803e3d6000fd5b50505050610852565b610c26611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610cf057805160208201516040517f3df0212400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871692633df02124928992610cb99291908490600190600401614a17565b6000604051808303818588803b158015610cd257600080fd5b505af1158015610ce6573d6000803e3d6000fd5b5050505050610852565b805160208201516040517f3df0212400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871692633df0212492610d4c928a90600190600401614a17565b600060405180830381600087803b158015610d6657600080fd5b505af1158015610d7a573d6000803e3d6000fd5b5050505050505050505050565b610d8f61399a565b610d9b828401846140c8565b905061085286858360000151846020015161251e565b610db96139b2565b610dc582840184613e39565b90506000610dd1611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614610e095787610e2b565b7f00000000000000000000000000000000000000000000000000000000000000005b90506000610e37611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614610e6f5787610e91565b7f00000000000000000000000000000000000000000000000000000000000000005b9050610e9b611da8565b73ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff161415610f50577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f3657600080fd5b505af1158015610f4a573d6000803e3d6000fd5b50505050505b6000805b845151811015610f9657610f8c85600001518281518110610f7157fe5b6020026020010151602001518361288a90919063ffffffff16565b9150600101610f54565b5060005b8451518110156110b657610fac6139c5565b8551805183908110610fba57fe5b602002602001015190506000610fe18461028e8d856020015161085b90919063ffffffff16565b9050610ff2826000015187836123d2565b8151604080840151606085015191517f8201aa3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90931692638201aa3f92611056928b9287928c92916004016147de565b6040805180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906145a1565b50505050806001019050610f9a565b506110bf611da8565b73ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff16141561120b576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d9082906370a082319061116c9030906004016146cf565b60206040518083038186803b15801561118457600080fd5b505afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc9190614589565b6040518263ffffffff1660e01b81526004016111d89190614d59565b600060405180830381600087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b505050505b50505050505050505050565b61121f613a03565b61122b828401846141ad565b90506000611237611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461126f5787611291565b7f00000000000000000000000000000000000000000000000000000000000000005b9050600061129d611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146112d557876112f7565b7f00000000000000000000000000000000000000000000000000000000000000005b9050611301611da8565b73ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614156113b6577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b15801561139c57600080fd5b505af11580156113b0573d6000803e3d6000fd5b50505050505b6113c18683896123d2565b6040805160a081018252845181523060208083019190915285015181830152606081018990526001608082015290517fc04b8d5900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169163c04b8d599161143e9190600401614c18565b602060405180830381600087803b15801561145857600080fd5b505af115801561146c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114909190614589565b50611499611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614156115e5576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d9082906370a08231906115469030906004016146cf565b60206040518083038186803b15801561155e57600080fd5b505afa158015611572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115969190614589565b6040518263ffffffff1660e01b81526004016115b29190614d59565b600060405180830381600087803b1580156115cc57600080fd5b505af11580156115e0573d6000803e3d6000fd5b505050505b505050505050505050565b61163285858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506128fe92505050565b5050505050565b6000611643611da8565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161461167b578461167e565b60005b9050600061168a611da8565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146116c257846116c5565b60005b90506116cf611da8565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161461170c5761170c8383866123d2565b8273ffffffffffffffffffffffffffffffffffffffff1663d5bcb9b5611730611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461176957600061176b565b855b604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff808816600483015286166024820152604481018990526001606482015260006084820152905160a480830192602092919082900301818588803b1580156117f357600080fd5b505af1158015611807573d6000803e3d6000fd5b50505050506040513d602081101561181e57600080fd5b5050505050505050565b611830613a1d565b61183c8284018461408d565b90506118498488876123d2565b600181511415611904576040517ff74bfe8e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063f74bfe8e906118ac908a908990600190309060040161481f565b602060405180830381600087803b1580156118c657600080fd5b505af11580156118da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fe9190614589565b50610852565b600281511415611967576040517f43bcfab600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906343bcfab6906118ac9089908990600190309060040161481f565b80516119c8576040517fd5bcb9b500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063d5bcb9b5906118ac908a908a908a906001903090600401614771565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614baa565b611a02613a30565b611a0e82840184613fc9565b905086611a19611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415611af1577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ab457600080fd5b505af1158015611ac8573d6000803e3d6000fd5b50505050507f000000000000000000000000000000000000000000000000000000000000000090505b611afc8582886123d2565b600082606001516002811115611b0e57fe5b1415611ba757815160208301516040517f5b41b90800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff881692635b41b90892611b70928b90600190600401614d9d565b600060405180830381600087803b158015611b8a57600080fd5b505af1158015611b9e573d6000803e3d6000fd5b50505050611ccc565b600182606001516002811115611bb957fe5b1415611c1b57815160208301516040517f65b2489b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816926365b2489b92611b70928b90600190600401614d9d565b600282606001516002811115611c2d57fe5b1415611ccc576040808301518351602085015192517f64a1455800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8916936364a1455893611c999390929091908c90600190600401614857565b600060405180830381600087803b158015611cb357600080fd5b505af1158015611cc7573d6000803e3d6000fd5b505050505b611cd4611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141561181e576000611d337f000000000000000000000000000000000000000000000000000000000000000030612df9565b6040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d906115b2908490600401614d59565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b611dc8613a58565b81806020019051810190611ddc9190614455565b9050858573ffffffffffffffffffffffffffffffffffffffff8083169082161415611e33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614a3a565b611e3b611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415611e96577f00000000000000000000000000000000000000000000000000000000000000009150611ef4565b611e9e611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415611ef457507f00000000000000000000000000000000000000000000000000000000000000005b8173ffffffffffffffffffffffffffffffffffffffff1683600001516020015173ffffffffffffffffffffffffffffffffffffffff1614611f61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614ace565b82515173ffffffffffffffffffffffffffffffffffffffff828116911614611fb5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b73565b611fc08583886123d2565b825160208401516040517faa77476c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169263aa77476c92612019928b90600401614c7e565b6040805180830381600087803b15801561203257600080fd5b505af1158015612046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206a9190614557565b5050611cd4611da8565b848473ffffffffffffffffffffffffffffffffffffffff80831690821614156120c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614a3a565b6120d1611da8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561212c577f0000000000000000000000000000000000000000000000000000000000000000915061218a565b612134611da8565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561218a57507f00000000000000000000000000000000000000000000000000000000000000005b612192613a78565b838060200190518101906121a69190614264565b905060005b8151518110156122f15760006121e76010846000015184815181106121cc57fe5b60200260200101516101600151612ef490919063ffffffff16565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461224e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614ace565b600061228060108560000151858151811061226557fe5b60200260200101516101400151612ef490919063ffffffff16565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146122e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b73565b50506001016121ab565b5061231d7f000000000000000000000000000000000000000000000000000000000000000084886123d2565b805160208201516040517fdd1c7d1800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169263dd1c7d1892612377928b9190600401614892565b608060405180830381600087803b15801561239157600080fd5b505af11580156123a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c9919061402e565b50611cd4611da8565b73ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14612519576040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152829060009073ffffffffffffffffffffffffffffffffffffffff83169063dd62ed3e9061245c9030908990600401614716565b60206040518083038186803b15801561247457600080fd5b505afa158015612488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ac9190614589565b905082811015611632576124d873ffffffffffffffffffffffffffffffffffffffff8316866000612f39565b61163273ffffffffffffffffffffffffffffffffffffffff8316867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6130c7565b505050565b80516000908061255a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b05565b6000612564611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156126a7578473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b1580156125df57600080fd5b505af11580156125f3573d6000803e3d6000fd5b50505050508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8560008151811061262157fe5b6020026020010151886040518363ffffffff1660e01b81526004016126479291906146f0565b602060405180830381600087803b15801561266157600080fd5b505af1158015612675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126999190613cc4565b6126a257600080fd5b6126e1565b6126c687856000815181106126b857fe5b60200260200101518861321a565b5073ffffffffffffffffffffffffffffffffffffffff841615155b85925060005b828110156127f45760008582815181106126fd57fe5b60209081029190910101519050807401000000000000000000000000000000000000000081161561273487838360a182901c6133f0565b9650600080826127465788600061274a565b6000895b915091508373ffffffffffffffffffffffffffffffffffffffff1663022c0d9f83838b8a60010114612792578d8a6001018151811061278557fe5b6020026020010151612794565b305b6040518463ffffffff1660e01b81526004016127b293929190614d62565b600060405180830381600087803b1580156127cc57600080fd5b505af11580156127e0573d6000803e3d6000fd5b5050505050505050508060010190506126e7565b508015612880576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861690632e1a7d4d9061284d908690600401614d59565b600060405180830381600087803b15801561286757600080fd5b505af115801561287b573d6000803e3d6000fd5b505050505b5050949350505050565b6000828201838110156108ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b612906613a92565b8180602001905181019061291a9190613df4565b9050806000015173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b815761295c611da8565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612a87576129ba7f000000000000000000000000000000000000000000000000000000000000000086856123d2565b6040517f80500d2000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906380500d2090612a50907f000000000000000000000000000000000000000000000000000000000000000090879030906004016147ae565b600060405180830381600087803b158015612a6a57600080fd5b505af1158015612a7e573d6000803e3d6000fd5b50505050612b7c565b612ab27f000000000000000000000000000000000000000000000000000000000000000086856123d2565b6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906369328dec90612b28908790879030906004016147ae565b602060405180830381600087803b158015612b4257600080fd5b505af1158015612b56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b7a9190614589565b505b611632565b805173ffffffffffffffffffffffffffffffffffffffff85811691161415612dc757612bab611da8565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612ccd576040517f474cf53d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063474cf53d908590612c96907f00000000000000000000000000000000000000000000000000000000000000009030907f00000000000000000000000000000000000000000000000000000000000000009060040161473d565b6000604051808303818588803b158015612caf57600080fd5b505af1158015612cc3573d6000803e3d6000fd5b5050505050612b7c565b612cf87f000000000000000000000000000000000000000000000000000000000000000086856123d2565b6040517fe8eda9df00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063e8eda9df90612d90908890879030907f0000000000000000000000000000000000000000000000000000000000000000906004016149dd565b600060405180830381600087803b158015612daa57600080fd5b505af1158015612dbe573d6000803e3d6000fd5b50505050611632565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614a97565b600073ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612e4b575073ffffffffffffffffffffffffffffffffffffffff8116316108d1565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190612e9d9085906004016146cf565b60206040518083038186803b158015612eb557600080fd5b505afa158015612ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eed9190614589565b90506108d1565b60008160140183511015612f1a57612f1a612f1560048551856014016134aa565b613547565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b801580612fe55750604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612fb757600080fd5b505afa158015612fcb573d6000803e3d6000fd5b505050506040513d6020811015612fe157600080fd5b5051155b61303a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180614fd96036913960400191505060405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905261251990849061354f565b6000613184828573ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30876040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561315257600080fd5b505afa158015613166573d6000803e3d6000fd5b505050506040513d602081101561317c57600080fd5b50519061288a565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061321490859061354f565b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b602083106132f057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016132b3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613352576040519150601f19603f3d011682016040523d82523d6000602084013e613357565b606091505b5091509150818015613385575080511580613385575080806020019051602081101561338257600080fd5b50515b61163257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600080851161344a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614f416027913960400191505060405180910390fd5b6000806134578686613627565b90925090506000613468888661085b565b90506000613476828461085b565b905060006134908361348a8761271061085b565b9061288a565b905080828161349b57fe5b049a9950505050505050505050565b6060632800659560e01b848484604051602401808460078111156134ca57fe5b81526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505b9392505050565b805160208201fd5b60606135b1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166136d99092919063ffffffff16565b805190915015612519578080602001905160208110156135d057600080fd5b5051612519576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614faf602a913960400191505060405180910390fd5b6000806000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561367357600080fd5b505afa158015613687573d6000803e3d6000fd5b505050506040513d606081101561369d57600080fd5b5080516020909101516dffffffffffffffffffffffffffff9182169350169050846136c95780826136cc565b81815b9097909650945050505050565b60606136e884846000856136f0565b949350505050565b60608247101561374b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614f686026913960400191505060405180910390fd5b613754856138ab565b6137bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061382957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016137ec565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461388b576040519150601f19603f3d011682016040523d82523d6000602084013e613890565b606091505b50915091506138a08282866138b5565b979650505050505050565b803b15155b919050565b606083156138c4575081613540565b8251156138d45782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613938578181015183820152602001613920565b50505050905090810190601f1680156139655780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60408051608081018252600080825260208201819052918101829052606081019190915290565b60408051808201909152600081526060602082015290565b6040518060200160405280606081525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081525090565b604051806040016040528060608152602001600081525090565b6040518060200160405280600081525090565b604080516080810182526000808252602082018190529181018290529060608201905b905290565b6040518060400160405280613a6b613aa4565b8152602001613a53613af8565b604051806040016040528060608152602001606081525090565b60408051602081019091526000815290565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915290565b604080516080810190915280600081526000602082018190526040820181905260609091015290565b80516138b081614f0d565b600082601f830112613b3c578081fd5b8151613b4f613b4a82614e83565b614e5f565b818152915060208083019084810160005b84811015613b8957613b77888484518a0101613b94565b84529282019290820190600101613b60565b505050505092915050565b600082601f830112613ba4578081fd5b8151613bb2613b4a82614ea1565b9150808252836020828501011115613bc957600080fd5b613bda816020840160208601614ee1565b5092915050565b8035600f81900b81146138b057600080fd5b600060808284031215613c04578081fd5b6040516080810181811067ffffffffffffffff82111715613c2157fe5b8060405250809150825160048110613c3857600080fd5b8152602083015160ff81168114613c4e57600080fd5b8060208301525060408301516040820152606083015160608201525092915050565b80516fffffffffffffffffffffffffffffffff811681146138b057600080fd5b805167ffffffffffffffff811681146138b057600080fd5b600060208284031215613cb9578081fd5b81356108ce81614f0d565b600060208284031215613cd5578081fd5b81516108ce81614f32565b60008060208385031215613cf2578081fd5b823567ffffffffffffffff80821115613d09578283fd5b818501915085601f830112613d1c578283fd5b813581811115613d2a578384fd5b866020828501011115613d3b578384fd5b60209290920196919550909350505050565b60008060008060008060a08789031215613d65578182fd5b8635613d7081614f0d565b95506020870135613d8081614f0d565b94506040870135935060608701359250608087013567ffffffffffffffff80821115613daa578384fd5b818901915089601f830112613dbd578384fd5b813581811115613dcb578485fd5b8a60208083028501011115613dde578485fd5b6020830194508093505050509295509295509295565b600060208284031215613e05578081fd5b6040516020810181811067ffffffffffffffff82111715613e2257fe5b6040528251613e3081614f0d565b81529392505050565b60006020808385031215613e4b578182fd5b823567ffffffffffffffff80821115613e62578384fd5b8185019150828287031215613e75578384fd5b604080518481018181108482111715613e8a57fe5b8252833583811115613e9a578687fd5b80850194505087601f850112613eae578586fd5b8335613ebc613b4a82614e83565b81815286810190868801608080850289018a018d1015613eda578a8bfd5b8a98505b84891015613f465780828e031215613ef4578a8bfd5b86518181018181108a82111715613f0757fe5b88528235613f1481614f0d565b8152828b01358b8201528783013588820152606080840135908201528452600198909801979289019290810190613ede565b50508352509098975050505050505050565b600060808284031215613f69578081fd5b6040516080810181811067ffffffffffffffff82111715613f8657fe5b604052613f9283613be1565b8152613fa060208401613be1565b6020820152604083013560408201526060830135613fbd81614f32565b60608201529392505050565b600060808284031215613fda578081fd5b6040516080810181811067ffffffffffffffff82111715613ff757fe5b80604052508235815260208301356020820152604083013561401881614f0d565b6040820152606083013560038110613fbd578283fd5b60006080828403121561403f578081fd5b6040516080810181811067ffffffffffffffff8211171561405c57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60006020828403121561409e578081fd5b6040516020810181811067ffffffffffffffff821117156140bb57fe5b6040529135825250919050565b600060208083850312156140da578182fd5b823567ffffffffffffffff808211156140f1578384fd5b9084019060408287031215614104578384fd5b60405160408101818110838211171561411957fe5b604052823561412781614f0d565b81528284013582811115614139578586fd5b80840193505086601f84011261414d578485fd5b8235915061415d613b4a83614e83565b82815284810190848601868502860187018a1015614179578788fd5b8795505b8486101561419b57803583526001959095019491860191860161417d565b50948201949094529695505050505050565b600060208083850312156141bf578182fd5b823567ffffffffffffffff808211156141d6578384fd5b90840190604082870312156141e9578384fd5b6040516040810181811083821117156141fe57fe5b60405282358281111561420f578586fd5b83019150601f82018713614221578485fd5b813561422f613b4a82614ea1565b8181528886838601011115614242578687fd5b8186850187830137908101850195909552938452508101359082015292915050565b600060208284031215614275578081fd5b815167ffffffffffffffff8082111561428c578283fd5b908301906040828603121561429f578283fd5b6040516040810181811083821117156142b457fe5b6040528251828111156142c5578485fd5b8301601f810187136142d5578485fd5b80516142e3613b4a82614e83565b818152602080820191908401885b8481101561442257815186016101807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828f0301121561432f578a8bfd5b61433a610180614e5f565b61434660208301613b21565b815261435460408301613b21565b602082015261436560608301613b21565b604082015261437660808301613b21565b606082015260a0820151608082015260c082015160a082015260e082015160c082015261010082015160e08201526101208201516101008201526101408201516101208201526101608201518a8111156143ce578c8dfd5b6143dd8f602083860101613b94565b610140830152506101808201518a8111156143f6578c8dfd5b6144058f602083860101613b94565b6101608301525085525060209384019391909101906001016142f1565b5050845250505060208301518281111561443a578485fd5b61444687828601613b2c565b60208301525095945050505050565b60008183036101c0811215614468578182fd5b6040516040810181811067ffffffffffffffff8211171561448557fe5b60405261014080831215614497578384fd5b6144a081614e5f565b92506144ab85613b21565b83526144b960208601613b21565b60208401526144ca60408601613c70565b60408401526144db60608601613c70565b60608401526144ec60808601613b21565b60808401526144fd60a08601613b21565b60a084015261450e60c08601613b21565b60c084015260e085015160e084015261010061452b818701613c90565b90840152610120858101519084015282825261454986828701613bf3565b602083015250949350505050565b60008060408385031215614569578182fd5b61457283613c70565b915061458060208401613c70565b90509250929050565b60006020828403121561459a578081fd5b5051919050565b600080604083850312156145b3578182fd5b505080516020909101519092909150565b73ffffffffffffffffffffffffffffffffffffffff169052565b6000815180845260208085018081965082840281019150828601855b85811015614624578284038952614612848351614631565b988501989350908401906001016145fa565b5091979650505050505050565b60008151808452614649816020860160208601614ee1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b80516004811061468757fe5b825260208181015160ff169083015260408082015190830152606090810151910152565b6fffffffffffffffffffffffffffffffff169052565b67ffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff938416815291909216602082015261ffff909116604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff9586168152938516602085015260408401929092526060830152909116608082015260a00190565b73ffffffffffffffffffffffffffffffffffffffff93841681526020810192909252909116604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff958616815260208101949094529190931660408301526060820192909252608081019190915260a00190565b73ffffffffffffffffffffffffffffffffffffffff948516815260208101939093526040830191909152909116606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff959095168552602085019390935260408401919091526060830152608082015260a00190565b606080825284518282018190526000919060809081850190602080820287018401818b01875b848110156149b5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a840301865281516101806148f78583516145c4565b85820151614907878701826145c4565b5060408083015161491a828801826145c4565b50508982015161492c8b8701826145c4565b5081890151858a015260a0808301519086015260c0808301519086015260e08083015190860152610100808301519086015261012080830151908601526101408083015181870183905261498283880182614631565b9250505061016080830151925085820381870152506149a18183614631565b9786019794505050908301906001016148b8565b5050898289015287810360408901526149ce818a6145de565b9b9a5050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff948516815260208101939093529216604082015261ffff909116606082015260800190565b600f94850b81529290930b60208301526040820152606081019190915260800190565b6020808252602a908201527f66726f6d546f6b656e2073686f756c6420626520646966666572656e7420667260408201527f6f6d20746f546f6b656e00000000000000000000000000000000000000000000606082015260800190565b6020808252600e908201527f496e76616c69642061546f6b656e000000000000000000000000000000000000604082015260600190565b60208082526014908201527f496e76616c69642066726f6d20746f6b656e2121000000000000000000000000604082015260600190565b6020808252601a908201527f4174206c65617374206f6e6520706f6f6c207265717569726564000000000000604082015260600190565b60208082526016908201527f4d4554484f44204e4f5420494d504c454d454e54454400000000000000000000604082015260600190565b60208082526012908201527f496e76616c696420746f20746f6b656e21210000000000000000000000000000604082015260600190565b6020808252600e908201527f496e76616c6964206f7054797065000000000000000000000000000000000000604082015260600190565b60208082526013908201527f496e646578206e6f7420737570706f7274656400000000000000000000000000604082015260600190565b600060208252825160a06020840152614c3460c0840182614631565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60006101e082019050614c928286516145c4565b6020850151614ca460208401826145c4565b506040850151614cb760408401826146ab565b506060850151614cca60608401826146ab565b506080850151614cdd60808401826145c4565b5060a0850151614cf060a08401826145c4565b5060c0850151614d0360c08401826145c4565b5060e085015160e083015261010080860151614d21828501826146c1565b50506101208581015190830152614d3c61014083018561467b565b6136e86101c08301846146ab565b61ffff91909116815260200190565b90815260200190565b928352602083019190915273ffffffffffffffffffffffffffffffffffffffff16604082015260806060820181905260009082015260a00190565b93845260208401929092526040830152606082015260800190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614dec578283fd5b83018035915067ffffffffffffffff821115614e06578283fd5b602001915036819003821315614e1b57600080fd5b9250929050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61833603018112614e55578182fd5b9190910192915050565b60405181810167ffffffffffffffff81118282101715614e7b57fe5b604052919050565b600067ffffffffffffffff821115614e9757fe5b5060209081020190565b600067ffffffffffffffff821115614eb557fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015614efc578181015183820152602001614ee4565b838111156132145750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114614f2f57600080fd5b50565b8015158114614f2f57600080fdfe556e697377617056324c69623a20494e53554646494349454e545f494e5055545f414d4f554e54416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000705000a00000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e04000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x6080604052600436106100705760003560e01c8063a59a99731161004e578063a59a9973146100e4578063ad5c4648146100f9578063c5e10eef1461010e578063e76b146c1461012357610070565b8063439fab9114610075578063635677f2146100975780637f555b03146100c2575b600080fd5b34801561008157600080fd5b50610095610090366004613ce0565b610136565b005b3480156100a357600080fd5b506100ac610171565b6040516100b99190614d4a565b60405180910390f35b3480156100ce57600080fd5b506100d7610195565b6040516100b991906146cf565b3480156100f057600080fd5b506100d76101b9565b34801561010557600080fd5b506100d76101dd565b34801561011a57600080fd5b506100d7610201565b610095610131366004613d4d565b610225565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b3c565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000181565b7f00000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef81565b7f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a981565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e0481565b60005b818110156108525782828281811061023c57fe5b905060200281019061024e9190614e22565b35600114156102f9576102f4878761029461271061028e88888881811061027157fe5b90506020028101906102839190614e22565b8b906040013561085b565b906108d7565b8686868181106102a057fe5b90506020028101906102b29190614e22565b6102c3906040810190602001613ca8565b8787878181106102cf57fe5b90506020028101906102e19190614e22565b6102ef906060810190614db8565b610958565b61084a565b82828281811061030557fe5b90506020028101906103179190614e22565b356002141561039a576102f4878761033a61271061028e88888881811061027157fe5b86868681811061034657fe5b90506020028101906103589190614e22565b610369906040810190602001613ca8565b87878781811061037557fe5b90506020028101906103879190614e22565b610395906060810190614db8565b610a60565b8282828181106103a657fe5b90506020028101906103b89190614e22565b356003141561043b576102f487876103db61271061028e88888881811061027157fe5b8686868181106103e757fe5b90506020028101906103f99190614e22565b61040a906040810190602001613ca8565b87878781811061041657fe5b90506020028101906104289190614e22565b610436906060810190614db8565b610b60565b82828281811061044757fe5b90506020028101906104599190614e22565b35600414156104ad576102f4878761047c61271061028e88888881811061027157fe5b86868681811061048857fe5b905060200281019061049a9190614e22565b6104a8906060810190614db8565b610d87565b8282828181106104b957fe5b90506020028101906104cb9190614e22565b356005141561054e576102f487876104ee61271061028e88888881811061027157fe5b8686868181106104fa57fe5b905060200281019061050c9190614e22565b61051d906040810190602001613ca8565b87878781811061052957fe5b905060200281019061053b9190614e22565b610549906060810190614db8565b610db1565b82828281811061055a57fe5b905060200281019061056c9190614e22565b35600614156105ef576102f4878761058f61271061028e88888881811061027157fe5b86868681811061059b57fe5b90506020028101906105ad9190614e22565b6105be906040810190602001613ca8565b8787878181106105ca57fe5b90506020028101906105dc9190614e22565b6105ea906060810190614db8565b611217565b8282828181106105fb57fe5b905060200281019061060d9190614e22565b3560071415610661576102f4878761063061271061028e88888881811061027157fe5b86868681811061063c57fe5b905060200281019061064e9190614e22565b61065c906060810190614db8565b6115f0565b82828281811061066d57fe5b905060200281019061067f9190614e22565b35600814156106d6576102f487876106a261271061028e88888881811061027157fe5b8686868181106106ae57fe5b90506020028101906106c09190614e22565b6106d1906040810190602001613ca8565b611639565b8282828181106106e257fe5b90506020028101906106f49190614e22565b3560091415610777576102f4878761071761271061028e88888881811061027157fe5b86868681811061072357fe5b90506020028101906107359190614e22565b610746906040810190602001613ca8565b87878781811061075257fe5b90506020028101906107649190614e22565b610772906060810190614db8565b611828565b82828281811061078357fe5b90506020028101906107959190614e22565b35600a1415610818576102f487876107b861271061028e88888881811061027157fe5b8686868181106107c457fe5b90506020028101906107d69190614e22565b6107e7906040810190602001613ca8565b8787878181106107f357fe5b90506020028101906108059190614e22565b610813906060810190614db8565b6119fa565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614be1565b600101610228565b50505050505050565b60008261086a575060006108d1565b8282028284828161087757fe5b04146108ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614f8e6021913960400191505060405180910390fd5b90505b92915050565b600080821161094757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161095057fe5b049392505050565b610960611da8565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610a15577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156109fb57600080fd5b505af1158015610a0f573d6000803e3d6000fd5b50505050505b610a588686868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611dc092505050565b505050505050565b610a68611da8565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610b1d577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015610b0357600080fd5b505af1158015610b17573d6000803e3d6000fd5b50505050505b610a588686868686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061207492505050565b610b68613973565b610b7482840184613f58565b9050610b818488876123d2565b806060015115610c1e57805160208201516040517fa6417ed600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87169263a6417ed692610be7928a90600190600401614a17565b600060405180830381600087803b158015610c0157600080fd5b505af1158015610c15573d6000803e3d6000fd5b50505050610852565b610c26611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610cf057805160208201516040517f3df0212400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871692633df02124928992610cb99291908490600190600401614a17565b6000604051808303818588803b158015610cd257600080fd5b505af1158015610ce6573d6000803e3d6000fd5b5050505050610852565b805160208201516040517f3df0212400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871692633df0212492610d4c928a90600190600401614a17565b600060405180830381600087803b158015610d6657600080fd5b505af1158015610d7a573d6000803e3d6000fd5b5050505050505050505050565b610d8f61399a565b610d9b828401846140c8565b905061085286858360000151846020015161251e565b610db96139b2565b610dc582840184613e39565b90506000610dd1611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614610e095787610e2b565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b90506000610e37611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614610e6f5787610e91565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b9050610e9b611da8565b73ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff161415610f50577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f3657600080fd5b505af1158015610f4a573d6000803e3d6000fd5b50505050505b6000805b845151811015610f9657610f8c85600001518281518110610f7157fe5b6020026020010151602001518361288a90919063ffffffff16565b9150600101610f54565b5060005b8451518110156110b657610fac6139c5565b8551805183908110610fba57fe5b602002602001015190506000610fe18461028e8d856020015161085b90919063ffffffff16565b9050610ff2826000015187836123d2565b8151604080840151606085015191517f8201aa3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90931692638201aa3f92611056928b9287928c92916004016147de565b6040805180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906145a1565b50505050806001019050610f9a565b506110bf611da8565b73ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff16141561120b576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21690632e1a7d4d9082906370a082319061116c9030906004016146cf565b60206040518083038186803b15801561118457600080fd5b505afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc9190614589565b6040518263ffffffff1660e01b81526004016111d89190614d59565b600060405180830381600087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b505050505b50505050505050505050565b61121f613a03565b61122b828401846141ad565b90506000611237611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461126f5787611291565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b9050600061129d611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146112d557876112f7565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b9050611301611da8565b73ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614156113b6577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b15801561139c57600080fd5b505af11580156113b0573d6000803e3d6000fd5b50505050505b6113c18683896123d2565b6040805160a081018252845181523060208083019190915285015181830152606081018990526001608082015290517fc04b8d5900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169163c04b8d599161143e9190600401614c18565b602060405180830381600087803b15801561145857600080fd5b505af115801561146c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114909190614589565b50611499611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614156115e5576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21690632e1a7d4d9082906370a08231906115469030906004016146cf565b60206040518083038186803b15801561155e57600080fd5b505afa158015611572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115969190614589565b6040518263ffffffff1660e01b81526004016115b29190614d59565b600060405180830381600087803b1580156115cc57600080fd5b505af11580156115e0573d6000803e3d6000fd5b505050505b505050505050505050565b61163285858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506128fe92505050565b5050505050565b6000611643611da8565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161461167b578461167e565b60005b9050600061168a611da8565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146116c257846116c5565b60005b90506116cf611da8565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161461170c5761170c8383866123d2565b8273ffffffffffffffffffffffffffffffffffffffff1663d5bcb9b5611730611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461176957600061176b565b855b604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff808816600483015286166024820152604481018990526001606482015260006084820152905160a480830192602092919082900301818588803b1580156117f357600080fd5b505af1158015611807573d6000803e3d6000fd5b50505050506040513d602081101561181e57600080fd5b5050505050505050565b611830613a1d565b61183c8284018461408d565b90506118498488876123d2565b600181511415611904576040517ff74bfe8e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063f74bfe8e906118ac908a908990600190309060040161481f565b602060405180830381600087803b1580156118c657600080fd5b505af11580156118da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fe9190614589565b50610852565b600281511415611967576040517f43bcfab600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906343bcfab6906118ac9089908990600190309060040161481f565b80516119c8576040517fd5bcb9b500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063d5bcb9b5906118ac908a908a908a906001903090600401614771565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614baa565b611a02613a30565b611a0e82840184613fc9565b905086611a19611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415611af1577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ab457600080fd5b505af1158015611ac8573d6000803e3d6000fd5b50505050507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290505b611afc8582886123d2565b600082606001516002811115611b0e57fe5b1415611ba757815160208301516040517f5b41b90800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff881692635b41b90892611b70928b90600190600401614d9d565b600060405180830381600087803b158015611b8a57600080fd5b505af1158015611b9e573d6000803e3d6000fd5b50505050611ccc565b600182606001516002811115611bb957fe5b1415611c1b57815160208301516040517f65b2489b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816926365b2489b92611b70928b90600190600401614d9d565b600282606001516002811115611c2d57fe5b1415611ccc576040808301518351602085015192517f64a1455800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8916936364a1455893611c999390929091908c90600190600401614857565b600060405180830381600087803b158015611cb357600080fd5b505af1158015611cc7573d6000803e3d6000fd5b505050505b611cd4611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141561181e576000611d337f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc230612df9565b6040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21690632e1a7d4d906115b2908490600401614d59565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b611dc8613a58565b81806020019051810190611ddc9190614455565b9050858573ffffffffffffffffffffffffffffffffffffffff8083169082161415611e33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614a3a565b611e3b611da8565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415611e96577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29150611ef4565b611e9e611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415611ef457507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b8173ffffffffffffffffffffffffffffffffffffffff1683600001516020015173ffffffffffffffffffffffffffffffffffffffff1614611f61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614ace565b82515173ffffffffffffffffffffffffffffffffffffffff828116911614611fb5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b73565b611fc08583886123d2565b825160208401516040517faa77476c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169263aa77476c92612019928b90600401614c7e565b6040805180830381600087803b15801561203257600080fd5b505af1158015612046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206a9190614557565b5050611cd4611da8565b848473ffffffffffffffffffffffffffffffffffffffff80831690821614156120c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614a3a565b6120d1611da8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561212c577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2915061218a565b612134611da8565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561218a57507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b612192613a78565b838060200190518101906121a69190614264565b905060005b8151518110156122f15760006121e76010846000015184815181106121cc57fe5b60200260200101516101600151612ef490919063ffffffff16565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461224e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614ace565b600061228060108560000151858151811061226557fe5b60200260200101516101400151612ef490919063ffffffff16565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146122e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b73565b50506001016121ab565b5061231d7f00000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef84886123d2565b805160208201516040517fdd1c7d1800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169263dd1c7d1892612377928b9190600401614892565b608060405180830381600087803b15801561239157600080fd5b505af11580156123a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c9919061402e565b50611cd4611da8565b73ffffffffffffffffffffffffffffffffffffffff821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14612519576040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152829060009073ffffffffffffffffffffffffffffffffffffffff83169063dd62ed3e9061245c9030908990600401614716565b60206040518083038186803b15801561247457600080fd5b505afa158015612488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ac9190614589565b905082811015611632576124d873ffffffffffffffffffffffffffffffffffffffff8316866000612f39565b61163273ffffffffffffffffffffffffffffffffffffffff8316867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6130c7565b505050565b80516000908061255a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614b05565b6000612564611da8565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156126a7578473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b1580156125df57600080fd5b505af11580156125f3573d6000803e3d6000fd5b50505050508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8560008151811061262157fe5b6020026020010151886040518363ffffffff1660e01b81526004016126479291906146f0565b602060405180830381600087803b15801561266157600080fd5b505af1158015612675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126999190613cc4565b6126a257600080fd5b6126e1565b6126c687856000815181106126b857fe5b60200260200101518861321a565b5073ffffffffffffffffffffffffffffffffffffffff841615155b85925060005b828110156127f45760008582815181106126fd57fe5b60209081029190910101519050807401000000000000000000000000000000000000000081161561273487838360a182901c6133f0565b9650600080826127465788600061274a565b6000895b915091508373ffffffffffffffffffffffffffffffffffffffff1663022c0d9f83838b8a60010114612792578d8a6001018151811061278557fe5b6020026020010151612794565b305b6040518463ffffffff1660e01b81526004016127b293929190614d62565b600060405180830381600087803b1580156127cc57600080fd5b505af11580156127e0573d6000803e3d6000fd5b5050505050505050508060010190506126e7565b508015612880576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861690632e1a7d4d9061284d908690600401614d59565b600060405180830381600087803b15801561286757600080fd5b505af115801561287b573d6000803e3d6000fd5b505050505b5050949350505050565b6000828201838110156108ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b612906613a92565b8180602001905181019061291a9190613df4565b9050806000015173ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b815761295c611da8565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612a87576129ba7f000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e0486856123d2565b6040517f80500d2000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e0416906380500d2090612a50907f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a990879030906004016147ae565b600060405180830381600087803b158015612a6a57600080fd5b505af1158015612a7e573d6000803e3d6000fd5b50505050612b7c565b612ab27f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a986856123d2565b6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a916906369328dec90612b28908790879030906004016147ae565b602060405180830381600087803b158015612b4257600080fd5b505af1158015612b56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b7a9190614589565b505b611632565b805173ffffffffffffffffffffffffffffffffffffffff85811691161415612dc757612bab611da8565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612ccd576040517f474cf53d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e04169063474cf53d908590612c96907f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a99030907f00000000000000000000000000000000000000000000000000000000000000019060040161473d565b6000604051808303818588803b158015612caf57600080fd5b505af1158015612cc3573d6000803e3d6000fd5b5050505050612b7c565b612cf87f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a986856123d2565b6040517fe8eda9df00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9169063e8eda9df90612d90908890879030907f0000000000000000000000000000000000000000000000000000000000000001906004016149dd565b600060405180830381600087803b158015612daa57600080fd5b505af1158015612dbe573d6000803e3d6000fd5b50505050611632565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890614a97565b600073ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612e4b575073ffffffffffffffffffffffffffffffffffffffff8116316108d1565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190612e9d9085906004016146cf565b60206040518083038186803b158015612eb557600080fd5b505afa158015612ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eed9190614589565b90506108d1565b60008160140183511015612f1a57612f1a612f1560048551856014016134aa565b613547565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b801580612fe55750604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612fb757600080fd5b505afa158015612fcb573d6000803e3d6000fd5b505050506040513d6020811015612fe157600080fd5b5051155b61303a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180614fd96036913960400191505060405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905261251990849061354f565b6000613184828573ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30876040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561315257600080fd5b505afa158015613166573d6000803e3d6000fd5b505050506040513d602081101561317c57600080fd5b50519061288a565b6040805173ffffffffffffffffffffffffffffffffffffffff8616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061321490859061354f565b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b602083106132f057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016132b3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613352576040519150601f19603f3d011682016040523d82523d6000602084013e613357565b606091505b5091509150818015613385575080511580613385575080806020019051602081101561338257600080fd5b50515b61163257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600080851161344a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180614f416027913960400191505060405180910390fd5b6000806134578686613627565b90925090506000613468888661085b565b90506000613476828461085b565b905060006134908361348a8761271061085b565b9061288a565b905080828161349b57fe5b049a9950505050505050505050565b6060632800659560e01b848484604051602401808460078111156134ca57fe5b81526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090505b9392505050565b805160208201fd5b60606135b1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166136d99092919063ffffffff16565b805190915015612519578080602001905160208110156135d057600080fd5b5051612519576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614faf602a913960400191505060405180910390fd5b6000806000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561367357600080fd5b505afa158015613687573d6000803e3d6000fd5b505050506040513d606081101561369d57600080fd5b5080516020909101516dffffffffffffffffffffffffffff9182169350169050846136c95780826136cc565b81815b9097909650945050505050565b60606136e884846000856136f0565b949350505050565b60608247101561374b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614f686026913960400191505060405180910390fd5b613754856138ab565b6137bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061382957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016137ec565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461388b576040519150601f19603f3d011682016040523d82523d6000602084013e613890565b606091505b50915091506138a08282866138b5565b979650505050505050565b803b15155b919050565b606083156138c4575081613540565b8251156138d45782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613938578181015183820152602001613920565b50505050905090810190601f1680156139655780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60408051608081018252600080825260208201819052918101829052606081019190915290565b60408051808201909152600081526060602082015290565b6040518060200160405280606081525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081525090565b604051806040016040528060608152602001600081525090565b6040518060200160405280600081525090565b604080516080810182526000808252602082018190529181018290529060608201905b905290565b6040518060400160405280613a6b613aa4565b8152602001613a53613af8565b604051806040016040528060608152602001606081525090565b60408051602081019091526000815290565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915290565b604080516080810190915280600081526000602082018190526040820181905260609091015290565b80516138b081614f0d565b600082601f830112613b3c578081fd5b8151613b4f613b4a82614e83565b614e5f565b818152915060208083019084810160005b84811015613b8957613b77888484518a0101613b94565b84529282019290820190600101613b60565b505050505092915050565b600082601f830112613ba4578081fd5b8151613bb2613b4a82614ea1565b9150808252836020828501011115613bc957600080fd5b613bda816020840160208601614ee1565b5092915050565b8035600f81900b81146138b057600080fd5b600060808284031215613c04578081fd5b6040516080810181811067ffffffffffffffff82111715613c2157fe5b8060405250809150825160048110613c3857600080fd5b8152602083015160ff81168114613c4e57600080fd5b8060208301525060408301516040820152606083015160608201525092915050565b80516fffffffffffffffffffffffffffffffff811681146138b057600080fd5b805167ffffffffffffffff811681146138b057600080fd5b600060208284031215613cb9578081fd5b81356108ce81614f0d565b600060208284031215613cd5578081fd5b81516108ce81614f32565b60008060208385031215613cf2578081fd5b823567ffffffffffffffff80821115613d09578283fd5b818501915085601f830112613d1c578283fd5b813581811115613d2a578384fd5b866020828501011115613d3b578384fd5b60209290920196919550909350505050565b60008060008060008060a08789031215613d65578182fd5b8635613d7081614f0d565b95506020870135613d8081614f0d565b94506040870135935060608701359250608087013567ffffffffffffffff80821115613daa578384fd5b818901915089601f830112613dbd578384fd5b813581811115613dcb578485fd5b8a60208083028501011115613dde578485fd5b6020830194508093505050509295509295509295565b600060208284031215613e05578081fd5b6040516020810181811067ffffffffffffffff82111715613e2257fe5b6040528251613e3081614f0d565b81529392505050565b60006020808385031215613e4b578182fd5b823567ffffffffffffffff80821115613e62578384fd5b8185019150828287031215613e75578384fd5b604080518481018181108482111715613e8a57fe5b8252833583811115613e9a578687fd5b80850194505087601f850112613eae578586fd5b8335613ebc613b4a82614e83565b81815286810190868801608080850289018a018d1015613eda578a8bfd5b8a98505b84891015613f465780828e031215613ef4578a8bfd5b86518181018181108a82111715613f0757fe5b88528235613f1481614f0d565b8152828b01358b8201528783013588820152606080840135908201528452600198909801979289019290810190613ede565b50508352509098975050505050505050565b600060808284031215613f69578081fd5b6040516080810181811067ffffffffffffffff82111715613f8657fe5b604052613f9283613be1565b8152613fa060208401613be1565b6020820152604083013560408201526060830135613fbd81614f32565b60608201529392505050565b600060808284031215613fda578081fd5b6040516080810181811067ffffffffffffffff82111715613ff757fe5b80604052508235815260208301356020820152604083013561401881614f0d565b6040820152606083013560038110613fbd578283fd5b60006080828403121561403f578081fd5b6040516080810181811067ffffffffffffffff8211171561405c57fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b60006020828403121561409e578081fd5b6040516020810181811067ffffffffffffffff821117156140bb57fe5b6040529135825250919050565b600060208083850312156140da578182fd5b823567ffffffffffffffff808211156140f1578384fd5b9084019060408287031215614104578384fd5b60405160408101818110838211171561411957fe5b604052823561412781614f0d565b81528284013582811115614139578586fd5b80840193505086601f84011261414d578485fd5b8235915061415d613b4a83614e83565b82815284810190848601868502860187018a1015614179578788fd5b8795505b8486101561419b57803583526001959095019491860191860161417d565b50948201949094529695505050505050565b600060208083850312156141bf578182fd5b823567ffffffffffffffff808211156141d6578384fd5b90840190604082870312156141e9578384fd5b6040516040810181811083821117156141fe57fe5b60405282358281111561420f578586fd5b83019150601f82018713614221578485fd5b813561422f613b4a82614ea1565b8181528886838601011115614242578687fd5b8186850187830137908101850195909552938452508101359082015292915050565b600060208284031215614275578081fd5b815167ffffffffffffffff8082111561428c578283fd5b908301906040828603121561429f578283fd5b6040516040810181811083821117156142b457fe5b6040528251828111156142c5578485fd5b8301601f810187136142d5578485fd5b80516142e3613b4a82614e83565b818152602080820191908401885b8481101561442257815186016101807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828f0301121561432f578a8bfd5b61433a610180614e5f565b61434660208301613b21565b815261435460408301613b21565b602082015261436560608301613b21565b604082015261437660808301613b21565b606082015260a0820151608082015260c082015160a082015260e082015160c082015261010082015160e08201526101208201516101008201526101408201516101208201526101608201518a8111156143ce578c8dfd5b6143dd8f602083860101613b94565b610140830152506101808201518a8111156143f6578c8dfd5b6144058f602083860101613b94565b6101608301525085525060209384019391909101906001016142f1565b5050845250505060208301518281111561443a578485fd5b61444687828601613b2c565b60208301525095945050505050565b60008183036101c0811215614468578182fd5b6040516040810181811067ffffffffffffffff8211171561448557fe5b60405261014080831215614497578384fd5b6144a081614e5f565b92506144ab85613b21565b83526144b960208601613b21565b60208401526144ca60408601613c70565b60408401526144db60608601613c70565b60608401526144ec60808601613b21565b60808401526144fd60a08601613b21565b60a084015261450e60c08601613b21565b60c084015260e085015160e084015261010061452b818701613c90565b90840152610120858101519084015282825261454986828701613bf3565b602083015250949350505050565b60008060408385031215614569578182fd5b61457283613c70565b915061458060208401613c70565b90509250929050565b60006020828403121561459a578081fd5b5051919050565b600080604083850312156145b3578182fd5b505080516020909101519092909150565b73ffffffffffffffffffffffffffffffffffffffff169052565b6000815180845260208085018081965082840281019150828601855b85811015614624578284038952614612848351614631565b988501989350908401906001016145fa565b5091979650505050505050565b60008151808452614649816020860160208601614ee1565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b80516004811061468757fe5b825260208181015160ff169083015260408082015190830152606090810151910152565b6fffffffffffffffffffffffffffffffff169052565b67ffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff938416815291909216602082015261ffff909116604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff9586168152938516602085015260408401929092526060830152909116608082015260a00190565b73ffffffffffffffffffffffffffffffffffffffff93841681526020810192909252909116604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff958616815260208101949094529190931660408301526060820192909252608081019190915260a00190565b73ffffffffffffffffffffffffffffffffffffffff948516815260208101939093526040830191909152909116606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff959095168552602085019390935260408401919091526060830152608082015260a00190565b606080825284518282018190526000919060809081850190602080820287018401818b01875b848110156149b5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a840301865281516101806148f78583516145c4565b85820151614907878701826145c4565b5060408083015161491a828801826145c4565b50508982015161492c8b8701826145c4565b5081890151858a015260a0808301519086015260c0808301519086015260e08083015190860152610100808301519086015261012080830151908601526101408083015181870183905261498283880182614631565b9250505061016080830151925085820381870152506149a18183614631565b9786019794505050908301906001016148b8565b5050898289015287810360408901526149ce818a6145de565b9b9a5050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff948516815260208101939093529216604082015261ffff909116606082015260800190565b600f94850b81529290930b60208301526040820152606081019190915260800190565b6020808252602a908201527f66726f6d546f6b656e2073686f756c6420626520646966666572656e7420667260408201527f6f6d20746f546f6b656e00000000000000000000000000000000000000000000606082015260800190565b6020808252600e908201527f496e76616c69642061546f6b656e000000000000000000000000000000000000604082015260600190565b60208082526014908201527f496e76616c69642066726f6d20746f6b656e2121000000000000000000000000604082015260600190565b6020808252601a908201527f4174206c65617374206f6e6520706f6f6c207265717569726564000000000000604082015260600190565b60208082526016908201527f4d4554484f44204e4f5420494d504c454d454e54454400000000000000000000604082015260600190565b60208082526012908201527f496e76616c696420746f20746f6b656e21210000000000000000000000000000604082015260600190565b6020808252600e908201527f496e76616c6964206f7054797065000000000000000000000000000000000000604082015260600190565b60208082526013908201527f496e646578206e6f7420737570706f7274656400000000000000000000000000604082015260600190565b600060208252825160a06020840152614c3460c0840182614631565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60006101e082019050614c928286516145c4565b6020850151614ca460208401826145c4565b506040850151614cb760408401826146ab565b506060850151614cca60608401826146ab565b506080850151614cdd60808401826145c4565b5060a0850151614cf060a08401826145c4565b5060c0850151614d0360c08401826145c4565b5060e085015160e083015261010080860151614d21828501826146c1565b50506101208581015190830152614d3c61014083018561467b565b6136e86101c08301846146ab565b61ffff91909116815260200190565b90815260200190565b928352602083019190915273ffffffffffffffffffffffffffffffffffffffff16604082015260806060820181905260009082015260a00190565b93845260208401929092526040830152606082015260800190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614dec578283fd5b83018035915067ffffffffffffffff821115614e06578283fd5b602001915036819003821315614e1b57600080fd5b9250929050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61833603018112614e55578182fd5b9190910192915050565b60405181810167ffffffffffffffff81118282101715614e7b57fe5b604052919050565b600067ffffffffffffffff821115614e9757fe5b5060209081020190565b600067ffffffffffffffff821115614eb557fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015614efc578181015183820152602001614ee4565b838111156132145750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114614f2f57600080fd5b50565b8015158114614f2f57600080fdfe556e697377617056324c69623a20494e53554646494349454e545f494e5055545f414d4f554e54416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000705000a

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e04000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _erc20Proxy (address): 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF
Arg [1] : _aaveeRefCode (uint16): 1
Arg [2] : _aaveeLendingPool (address): 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9
Arg [3] : _aaveeWethGateway (address): 0xcc9a0B7c43DC2a5F023Bb9b738E45B0Ef6B06E04
Arg [4] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000095e6f48254609a6ee006f7d493c8e5fb97094cef
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9
Arg [3] : 000000000000000000000000cc9a0b7c43dc2a5f023bb9b738e45b0ef6b06e04
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


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.