ETH Price: $1,702.00 (+8.56%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap With Parasw...209085262024-10-06 19:12:47197 days ago1728241967IN
0x2a737d2C...8892Ace5d
3 ETH0.001718317.41670674
Swap With Parasw...209006792024-10-05 16:58:11199 days ago1728147491IN
0x2a737d2C...8892Ace5d
6 ETH0.000977765.40957329
Swap With Parasw...208624962024-09-30 9:13:11204 days ago1727687591IN
0x2a737d2C...8892Ace5d
0.002 ETH0.002568588.8
Swap With Parasw...208577782024-09-29 17:25:47205 days ago1727630747IN
0x2a737d2C...8892Ace5d
0 ETH0.001798787.03846011
Swap With Parasw...208540662024-09-29 4:59:59205 days ago1727585999IN
0x2a737d2C...8892Ace5d
0 ETH0.002938226.08642388
Swap With Parasw...208445202024-09-27 21:02:11206 days ago1727470931IN
0x2a737d2C...8892Ace5d
0 ETH0.004589410.31211488
Swap With Parasw...208445062024-09-27 20:59:23206 days ago1727470763IN
0x2a737d2C...8892Ace5d
7 ETH0.0037105910.3
Swap With Parasw...208445012024-09-27 20:58:11206 days ago1727470691IN
0x2a737d2C...8892Ace5d
0 ETH0.004403749.7
Swap With Parasw...208444972024-09-27 20:57:23206 days ago1727470643IN
0x2a737d2C...8892Ace5d
2.9 ETH0.003120189.44361849
Swap With Parasw...208444932024-09-27 20:56:35206 days ago1727470595IN
0x2a737d2C...8892Ace5d
7 ETH0.003483689.66900708
Swap With Parasw...208444892024-09-27 20:55:47206 days ago1727470547IN
0x2a737d2C...8892Ace5d
0 ETH0.0049201910.3
Swap With Parasw...208444872024-09-27 20:55:23206 days ago1727470523IN
0x2a737d2C...8892Ace5d
0 ETH0.0030223310.8442603
Swap With Parasw...208444822024-09-27 20:54:23206 days ago1727470463IN
0x2a737d2C...8892Ace5d
0.64 ETH0.0024439511.29619611
Swap With Parasw...208444762024-09-27 20:53:11206 days ago1727470391IN
0x2a737d2C...8892Ace5d
7.2 ETH0.0037526710.41738965
Swap With Parasw...208444702024-09-27 20:51:59206 days ago1727470319IN
0x2a737d2C...8892Ace5d
0 ETH0.004910810.79506555
Swap With Parasw...208444642024-09-27 20:50:47206 days ago1727470247IN
0x2a737d2C...8892Ace5d
0 ETH0.0050263110.5
Swap With Parasw...208444552024-09-27 20:48:59206 days ago1727470139IN
0x2a737d2C...8892Ace5d
2.97 ETH0.0039612711.37993863
Swap With Parasw...208444462024-09-27 20:47:11206 days ago1727470031IN
0x2a737d2C...8892Ace5d
3.7 ETH0.0035905310.86708546
Swap With Parasw...208444392024-09-27 20:45:47206 days ago1727469947IN
0x2a737d2C...8892Ace5d
0 ETH0.0047040411.18003796
Swap With Parasw...208444362024-09-27 20:45:11206 days ago1727469911IN
0x2a737d2C...8892Ace5d
3.7 ETH0.0039751711.03333123
Swap With Parasw...208444322024-09-27 20:44:23206 days ago1727469863IN
0x2a737d2C...8892Ace5d
0 ETH0.0035416112.33814363
Swap With Parasw...208444312024-09-27 20:44:11206 days ago1727469851IN
0x2a737d2C...8892Ace5d
0 ETH0.0048683311.2455512
Swap With Parasw...208444262024-09-27 20:43:11206 days ago1727469791IN
0x2a737d2C...8892Ace5d
0.66 ETH0.0025581611.82344458
Swap With Parasw...208444232024-09-27 20:42:35206 days ago1727469755IN
0x2a737d2C...8892Ace5d
3.6 ETH0.0040597711.3
Swap With Parasw...208444122024-09-27 20:40:23206 days ago1727469623IN
0x2a737d2C...8892Ace5d
0 ETH0.0038228310.78788607
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer*209085262024-10-06 19:12:47197 days ago1728241967
0x2a737d2C...8892Ace5d
3 ETH
Transfer*209006792024-10-05 16:58:11199 days ago1728147491
0x2a737d2C...8892Ace5d
6 ETH
Transfer*208624962024-09-30 9:13:11204 days ago1727687591
0x2a737d2C...8892Ace5d
0.002 ETH
Transfer208577782024-09-29 17:25:47205 days ago1727630747
0x2a737d2C...8892Ace5d
0.09525603 ETH
Transfer208577782024-09-29 17:25:47205 days ago1727630747
0x2a737d2C...8892Ace5d
0.09525603 ETH
Transfer*208445062024-09-27 20:59:23206 days ago1727470763
0x2a737d2C...8892Ace5d
6.986 ETH
Collect Token Fe...208445062024-09-27 20:59:23206 days ago1727470763
0x2a737d2C...8892Ace5d
0.014 ETH
Transfer*208444972024-09-27 20:57:23206 days ago1727470643
0x2a737d2C...8892Ace5d
2.8942 ETH
Collect Token Fe...208444972024-09-27 20:57:23206 days ago1727470643
0x2a737d2C...8892Ace5d
0.0058 ETH
Transfer*208444932024-09-27 20:56:35206 days ago1727470595
0x2a737d2C...8892Ace5d
6.986 ETH
Collect Token Fe...208444932024-09-27 20:56:35206 days ago1727470595
0x2a737d2C...8892Ace5d
0.014 ETH
Transfer208444872024-09-27 20:55:23206 days ago1727470523
0x2a737d2C...8892Ace5d
0.63069675 ETH
Transfer208444872024-09-27 20:55:23206 days ago1727470523
0x2a737d2C...8892Ace5d
0.63069675 ETH
Transfer*208444822024-09-27 20:54:23206 days ago1727470463
0x2a737d2C...8892Ace5d
0.63872 ETH
Collect Token Fe...208444822024-09-27 20:54:23206 days ago1727470463
0x2a737d2C...8892Ace5d
0.00128 ETH
Transfer*208444762024-09-27 20:53:11206 days ago1727470391
0x2a737d2C...8892Ace5d
7.1856 ETH
Collect Token Fe...208444762024-09-27 20:53:11206 days ago1727470391
0x2a737d2C...8892Ace5d
0.0144 ETH
Transfer*208444552024-09-27 20:48:59206 days ago1727470139
0x2a737d2C...8892Ace5d
2.96406 ETH
Collect Token Fe...208444552024-09-27 20:48:59206 days ago1727470139
0x2a737d2C...8892Ace5d
0.00594 ETH
Transfer*208444462024-09-27 20:47:11206 days ago1727470031
0x2a737d2C...8892Ace5d
3.6926 ETH
Collect Token Fe...208444462024-09-27 20:47:11206 days ago1727470031
0x2a737d2C...8892Ace5d
0.0074 ETH
Transfer*208444362024-09-27 20:45:11206 days ago1727469911
0x2a737d2C...8892Ace5d
3.6926 ETH
Collect Token Fe...208444362024-09-27 20:45:11206 days ago1727469911
0x2a737d2C...8892Ace5d
0.0074 ETH
Transfer208444322024-09-27 20:44:23206 days ago1727469863
0x2a737d2C...8892Ace5d
0.64641713 ETH
Transfer208444322024-09-27 20:44:23206 days ago1727469863
0x2a737d2C...8892Ace5d
0.64641713 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Switch

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : Switch.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

import "../core/ISwitchView.sol";
import "../core/SwitchRoot.sol";
import "../interfaces/ISwitchEvent.sol";
import "../interfaces/IFeeCollector.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Switch is Ownable, SwitchRoot, ReentrancyGuard {
    using UniswapExchangeLib for IUniswapExchange;
    using UniversalERC20 for IERC20;
    using SafeERC20 for IERC20;

    ISwitchView public switchView;
    ISwitchEvent public switchEvent;
    address public reward;
    address public paraswapProxy;
    address public augustusSwapper;

    address public feeCollector;
    uint256 public maxPartnerFeeRate = 1000; // max partner fee rate is 10%
    uint256 public defaultSwingCut = 1500; // swing takes a cut of 15% from partner fee by default

    uint256 public constant FEE_BASE = 10000;

    struct SwapArgs {
        IERC20 fromToken;
        IERC20 destToken;
        uint256 amount;
        uint256 expectedReturn;
        uint256 minReturn;
        address partner;
        uint256 partnerFeeRate;
        address recipient;
        uint256[] distribution;
    }

    event RewardSet(address reward);
    event FeeCollectorSet(address feeCollector);
    event MaxPartnerFeeRateSet(uint256 maxPartnerFeeRate);
    event DefaultSwingCutSet(uint256 defaultSwingCut);
    event SwitchEventSet(ISwitchEvent switchEvent);
    event ParaswapProxySet(address paraswapProxy);
    event AugustusSwapperSet(address augustusSwapper);

    constructor(
        address _weth,
        address _otherToken,
        uint256 _pathCount,
        uint256 _pathSplit,
        address[] memory _factories,
        address _switchViewAddress,
        address _switchEventAddress,
        address _paraswapProxy,
        address _augustusSwapper,
        address _feeCollector
    ) SwitchRoot(_weth, _otherToken, _pathCount, _pathSplit, _factories)
        public
    {
        switchView = ISwitchView(_switchViewAddress);
        switchEvent = ISwitchEvent(_switchEventAddress);
        paraswapProxy = _paraswapProxy;
        augustusSwapper = _augustusSwapper;
        feeCollector = _feeCollector;
        reward = msg.sender;
    }

    fallback() external payable {
        // solium-disable-next-line security/no-tx-origin
        require(msg.sender != tx.origin);
    }

    function setReward(address _reward) external onlyOwner {
        reward = _reward;
        emit RewardSet(_reward);
    }

    function setFeeCollector(address _feeCollector) external onlyOwner {
        feeCollector = _feeCollector;
        emit FeeCollectorSet(_feeCollector);
    }

    function setMaxPartnerFeeRate(uint256 _maxPartnerFeeRate) external onlyOwner {
        require(_maxPartnerFeeRate <= 5000, "too large");
        maxPartnerFeeRate = _maxPartnerFeeRate;
        emit MaxPartnerFeeRateSet(_maxPartnerFeeRate);
    }

    function setDefaultSwingCut(uint256 _defaultSwingCut) external onlyOwner {
        defaultSwingCut = _defaultSwingCut;
        emit DefaultSwingCutSet(_defaultSwingCut);
    }

    function setSwitchEvent(ISwitchEvent _switchEvent) external onlyOwner {
        switchEvent = _switchEvent;
        emit SwitchEventSet(_switchEvent);
    }

    function setParaswapProxy(address _paraswapProxy) external onlyOwner {
        paraswapProxy = _paraswapProxy;
        emit ParaswapProxySet(_paraswapProxy);
    }

    function setAugustusSwapper(address _augustusSwapper) external onlyOwner {
        augustusSwapper = _augustusSwapper;
        emit AugustusSwapperSet(_augustusSwapper);
    }

    function getTokenBalance(address token) external view onlyOwner returns(uint256 amount) {
        amount = IERC20(token).universalBalanceOf(address(this));
    }

    function transferToken(address token, uint256 amount, address recipient) external onlyOwner {
        IERC20(token).universalTransfer(recipient, amount);
    }

    function getExpectedReturn(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 parts
    )
        public
        override
        view
        returns (
            uint256 returnAmount,
            uint256[] memory distribution
        )
    {
        (returnAmount, distribution) = switchView.getExpectedReturn(fromToken, destToken, amount, parts);
    }

    function swap(
        SwapArgs calldata swapArgs
    )
        public
        payable
        nonReentrant
        returns (uint256 returnAmount)
    {
        require(swapArgs.expectedReturn >= swapArgs.minReturn, "expectedReturn must be equal or larger than minReturn");
        if (swapArgs.fromToken == swapArgs.destToken) {
            revert("it's not allowed to swap with same token");
        }

        uint256 parts = 0;
        uint256 lastNonZeroIndex = 0;
        for (uint i = 0; i < swapArgs.distribution.length; i++) {
            if (swapArgs.distribution[i] > 0) {
                parts += swapArgs.distribution[i];
                lastNonZeroIndex = i;
            }
        }

        if (parts == 0) {
            if (swapArgs.fromToken.isETH()) {
                payable(msg.sender).transfer(msg.value);
                return msg.value;
            }
            return swapArgs.amount;
        }

        swapArgs.fromToken.universalTransferFrom(msg.sender, address(this), swapArgs.amount);
        uint256 amountAfterFee = _getAmountAfterFee(swapArgs.fromToken, swapArgs.amount, swapArgs.partner, swapArgs.partnerFeeRate);
        returnAmount = _swapInternalForSingleSwap(swapArgs.distribution, amountAfterFee, parts, lastNonZeroIndex, swapArgs.fromToken, swapArgs.destToken);
        if (returnAmount > 0) {
            require(returnAmount >= swapArgs.minReturn, "Switch: Return amount was not enough");

            if (returnAmount > swapArgs.expectedReturn) {
                swapArgs.destToken.universalTransfer(swapArgs.recipient, swapArgs.expectedReturn);
                swapArgs.destToken.universalTransfer(reward, returnAmount - swapArgs.expectedReturn);
                switchEvent.emitSwapped(msg.sender, swapArgs.recipient, swapArgs.fromToken, swapArgs.destToken, swapArgs.amount, swapArgs.expectedReturn, returnAmount - swapArgs.expectedReturn);
            } else {
                swapArgs.destToken.universalTransfer(swapArgs.recipient, returnAmount);
                switchEvent.emitSwapped(msg.sender, swapArgs.recipient, swapArgs.fromToken, swapArgs.destToken, swapArgs.amount, returnAmount, 0);
            }
        } else {
            if (swapArgs.fromToken.universalBalanceOf(address(this)) > swapArgs.amount) {
                swapArgs.fromToken.universalTransfer(msg.sender, swapArgs.amount);
            } else {
                swapArgs.fromToken.universalTransfer(msg.sender, swapArgs.fromToken.universalBalanceOf(address(this)));
            }
        }
    }

    function swapWithParaswap(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 destAmount,
        address partner,
        uint256 partnerFeeRate,
        address recipient,
        bytes memory callData
    )
        public
        payable
        nonReentrant
    {
        if (fromToken == destToken) {
            revert("it's not allowed to swap with same token");
        }
        fromToken.universalTransferFrom(msg.sender, address(this), amount);
        uint256 amountAfterFee = _getAmountAfterFee(IERC20(fromToken), amount, partner, partnerFeeRate);
        _swapInternalWithParaSwap(fromToken, destToken, amountAfterFee, recipient, callData);
    }


    function getFeeInfo(
        uint256 amount,
        address partner,
        uint256 partnerFeeRate
    )
        public
        view
        returns (
            uint256 partnerFee,
            uint256 remainAmount
        )
    {
        partnerFee = partnerFeeRate * amount / FEE_BASE;
        remainAmount = amount - partnerFee;
    }

    function _swapInternalWithParaSwap(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        address recipient,
        bytes memory callData
    )
        internal
        returns (
            uint256 totalAmount
        )
    {
        if (fromToken == destToken) {
            revert("it's not allowed to swap with same token");
        }

        _callParaswap(fromToken, amount, callData);
        totalAmount = destToken.universalBalanceOf(address(this));
        if (totalAmount > 0) {
            destToken.universalTransfer(recipient, totalAmount);
        }
        switchEvent.emitSwapped(msg.sender, recipient, fromToken, destToken, amount, totalAmount, 0);
    }

    function _callParaswap(
        IERC20 token,
        uint256 amount,
        bytes memory callData
    )
        internal
    {
        uint256 ethAmountToTransfert = 0;
        if (token.isETH()) {
            require(address(this).balance >= amount, "ETH balance is insufficient");
            ethAmountToTransfert = amount;
        } else {
            token.universalApprove(paraswapProxy, amount);
        }

        (bool success,) = augustusSwapper.call{ value: ethAmountToTransfert }(callData);
        require(success, "Paraswap execution failed");
    }

    function _swapInternalForSingleSwap(
        uint256[] memory distribution,
        uint256 amount,
        uint256 parts,
        uint256 lastNonZeroIndex,
        IERC20 fromToken,
        IERC20 destToken
    )
        internal
        returns (
            uint256 totalAmount
        )
    {
        require(distribution.length <= dexCount*pathCount, "Switch: Distribution array should not exceed factories array size");

        uint256 remainingAmount = amount;
        uint256 swappedAmount = 0;
        for (uint i = 0; i < distribution.length; i++) {
            if (distribution[i] == 0) {
                continue;
            }
            uint256 swapAmount = amount * distribution[i] / parts;
            if (i == lastNonZeroIndex) {
                swapAmount = remainingAmount;
            }
            remainingAmount -= swapAmount;
            if (i % pathCount == 0) {
                swappedAmount = _swap(fromToken, destToken, swapAmount, IUniswapFactory(factories[i/pathCount]));
            } else if (i % pathCount == 1) {
                swappedAmount = _swapETH(fromToken, destToken, swapAmount, IUniswapFactory(factories[i/pathCount]));
            } else {
                swappedAmount = _swapOtherToken(fromToken, destToken, swapAmount, IUniswapFactory(factories[i/pathCount]));
            }
            totalAmount += swappedAmount;
        }
    }

    function _getAmountAfterFee(
        IERC20 token,
        uint256 amount,
        address partner,
        uint256 partnerFeeRate
    )
        internal
        returns (
            uint256 amountAfterFee
        )
    {
        require(partnerFeeRate <= maxPartnerFeeRate, "partnerFeeRate too large");
        amountAfterFee = amount;
        if (partnerFeeRate > 0) {
            uint256 swingCut = IFeeCollector(feeCollector).getPartnerSwingCut(partner) == 0 ? defaultSwingCut : IFeeCollector(feeCollector).getPartnerSwingCut(partner);
            uint256 swingFee = partnerFeeRate * amount * defaultSwingCut / (FEE_BASE * FEE_BASE);
            uint256 partnerFee = partnerFeeRate * amount / FEE_BASE - swingFee;
            if (IERC20(token).isETH()) {
                IFeeCollector(feeCollector).collectTokenFees{ value: partnerFee + swingFee }(address(token), partnerFee, swingFee, partner);
            } else {
                IERC20(token).safeApprove(feeCollector, 0);
                IERC20(token).safeApprove(feeCollector, partnerFee + swingFee);
                IFeeCollector(feeCollector).collectTokenFees(address(token), partnerFee, swingFee, partner);
            }
            amountAfterFee = amount - partnerFeeRate * amount / FEE_BASE;
        }
    }

    // Swap helpers
    function _swapInternal(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        IUniswapFactory factory
    )
        internal
        returns (
            uint256 returnAmount
        )
    {
        if (fromToken.isETH()) {
            weth.deposit{value: amount}();
        }

        IERC20 fromTokenReal = fromToken.isETH() ? weth : fromToken;
        IERC20 toTokenReal = destToken.isETH() ? weth : destToken;
        IUniswapExchange exchange = factory.getPair(fromTokenReal, toTokenReal);
        bool needSync;
        bool needSkim;
        (returnAmount, needSync, needSkim) = exchange.getReturn(fromTokenReal, toTokenReal, amount);
        if (needSync) {
            exchange.sync();
        } else if (needSkim) {
            exchange.skim(0x46Fd07da395799F113a7584563b8cB886F33c2bc);
        }

        fromTokenReal.universalTransfer(address(exchange), amount);
        if (uint160(address(fromTokenReal)) < uint160(address(toTokenReal))) {
            exchange.swap(0, returnAmount, address(this), "");
        } else {
            exchange.swap(returnAmount, 0, address(this), "");
        }

        if (destToken.isETH()) {
            weth.withdraw(weth.balanceOf(address(this)));
        }
    }

    function _swapOverMid(
        IERC20 fromToken,
        IERC20 midToken,
        IERC20 destToken,
        uint256 amount,
        IUniswapFactory factory
    )
        internal
        returns (
            uint256 returnAmount
        )
    {
        returnAmount = _swapInternal(
            midToken,
            destToken,
            _swapInternal(
                fromToken,
                midToken,
                amount,
                factory
            ),
            factory
        );
    }

    function _swap(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        IUniswapFactory factory
    )
        internal
        returns (
            uint256 returnAmount
        )
    {
        returnAmount = _swapInternal(
            fromToken,
            destToken,
            amount,
            factory
        );
    }

    function _swapETH(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        IUniswapFactory factory
    )
        internal
        returns (
            uint256 returnAmount
        )
    {
        returnAmount = _swapOverMid(
            fromToken,
            weth,
            destToken,
            amount,
            factory
        );
    }

    function _swapOtherToken(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        IUniswapFactory factory
    )
        internal
        returns (
            uint256 returnAmount
        )
    {
        returnAmount = _swapOverMid(
            fromToken,
            otherToken,
            destToken,
            amount,
            factory
        );
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

File 4 of 20 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 5 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 6 of 20 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library 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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 20 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 9 of 20 : ISwitchView.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

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

abstract contract ISwitchView {

    struct ReturnArgs {
        IERC20 fromToken;
        IERC20 destToken;
        uint256 amount;
        uint256 parts;
    }

    struct CalculateArgs {
        IERC20 fromToken;
        IERC20 destToken;
        IUniswapFactory factory;
        uint256 amount;
        uint256 parts;
    }

    function getExpectedReturn(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 parts
    )
        public
        virtual
        view
        returns (
            uint256 returnAmount,
            uint256[] memory distribution
        );
}

File 10 of 20 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

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

abstract contract IWETH is IERC20 {
    function deposit() external virtual payable;
    function withdraw(uint256 amount) virtual external;
}

File 11 of 20 : SwitchRoot.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

import "./ISwitchView.sol";
import "./IWETH.sol";
import "../lib/DisableFlags.sol";
import "../lib/UniversalERC20.sol";
import "../interfaces/IUniswapFactory.sol";
import "../lib/UniswapExchangeLib.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

abstract contract SwitchRoot is Ownable, ISwitchView {
    using DisableFlags for uint256;
    using UniversalERC20 for IERC20;
    using UniversalERC20 for IWETH;
    using UniswapExchangeLib for IUniswapExchange;

    address public ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
    address public ZERO_ADDRESS = address(0);

    uint256 public dexCount;
    uint256 public pathCount;
    uint256 public pathSplit;
    IWETH public weth; // chain's native token
    IWETH public otherToken; //could be weth on a non-eth chain or other mid token(like busd)

    address[] public factories;

    int256 internal constant VERY_NEGATIVE_VALUE = -1e72;

    constructor(address _weth, address _otherToken, uint256 _pathCount, uint256 _pathSplit, address[] memory _factories) {
        weth = IWETH(_weth);
        otherToken = IWETH(_otherToken);
        pathCount = _pathCount;
        pathSplit = _pathSplit;
        dexCount = _factories.length;
        for (uint256 i = 0; i < _factories.length; i++) {
            factories.push(_factories[i]);
        }
    }

    event WETHSet(address _weth);
    event OtherTokenSet(address _otherToken);
    event PathCountSet(uint256 _pathCount);
    event PathSplitSet(uint256 _pathSplit);
    event FactoriesSet(address[] _factories);

    function setWETH(address _weth) external onlyOwner {
        weth = IWETH(_weth);
        emit WETHSet(_weth);
    }

    function setOtherToken(address _otherToken) external onlyOwner {
        otherToken = IWETH(_otherToken);
        emit OtherTokenSet(_otherToken);
    }

    function setPathCount(uint256 _pathCount) external onlyOwner {
        pathCount = _pathCount;
        emit PathCountSet(_pathCount);
    }

    function setPathSplit(uint256 _pathSplit) external onlyOwner {
        pathSplit = _pathSplit;
        emit PathSplitSet(_pathSplit);
    }

    function setFactories(address[] memory _factories) external onlyOwner {
        dexCount = _factories.length;
        for (uint256 i = 0; i < _factories.length; i++) {
            factories.push(_factories[i]);
        }
        emit FactoriesSet(_factories);
    }

    function _findBestDistribution(
        uint256 s,                // parts
        int256[][] memory amounts // exchangesReturns
    )
        internal
        view
        returns (
            int256 returnAmount,
            uint256[] memory distribution
        )
    {
        uint256 n = amounts.length;

        int256[][] memory answer = new int256[][](n); // int[n][s+1]
        uint256[][] memory parent = new uint256[][](n); // int[n][s+1]

        for (uint i = 0; i < n; i++) {
            answer[i] = new int256[](s + 1);
            parent[i] = new uint256[](s + 1);
        }

        for (uint j = 0; j <= s; j++) {
            answer[0][j] = amounts[0][j];
            for (uint i = 1; i < n; i++) {
                answer[i][j] = -1e72;
            }
            parent[0][j] = 0;
        }

        for (uint i = 1; i < n; i++) {
            for (uint j = 0; j <= s; j++) {
                answer[i][j] = answer[i - 1][j];
                parent[i][j] = j;

                for (uint k = 1; k <= j; k++) {
                    if (answer[i - 1][j - k] + amounts[i][k] > answer[i][j]) {
                        answer[i][j] = answer[i - 1][j - k] + amounts[i][k];
                        parent[i][j] = j - k;
                    }
                }
            }
        }

        distribution = new uint256[](dexCount*pathCount*pathSplit);

        uint256 partsLeft = s;
        unchecked {
            for (uint curExchange = n - 1; partsLeft > 0; curExchange--) {
                distribution[curExchange] = partsLeft - parent[curExchange][partsLeft];
                partsLeft = parent[curExchange][partsLeft];
            }
        }

        returnAmount = (answer[n - 1][s] == VERY_NEGATIVE_VALUE) ? int256(0) : answer[n - 1][s];
    }

    function _linearInterpolation(
        uint256 value,
        uint256 parts
    )
        internal
        pure
        returns (uint256[] memory rets)
    {
        rets = new uint256[](parts);
        for (uint i = 0; i < parts; i++) {
            rets[i] = value * (i + 1) / parts;
        }
    }

    function _tokensEqual(
        IERC20 tokenA,
        IERC20 tokenB
    )
        internal
        pure
        returns (bool)
    {
        return ((tokenA.isETH() && tokenB.isETH()) || tokenA == tokenB);
    }
}

File 12 of 20 : IFeeCollector.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

interface IFeeCollector {
    function collectTokenFees(
        address tokenAddress,
        uint256 partnerFee,
        uint256 swingFee,
        address partnerAddress
    ) payable external;
    function getPartnerSwingCut(address partnerAddress) external view returns (uint256);
}

File 13 of 20 : ISwitchEvent.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

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

interface ISwitchEvent {
    function emitSwapped(
        address from,
        address recipient,
        IERC20 fromToken,
        IERC20 destToken,
        uint256 fromAmount,
        uint256 destAmount,
        uint256 reward
    ) external;

    function emitParaswapSwapped(
        address from,
        IERC20 fromToken,
        uint256 fromAmount
    ) external;

    function emitCrosschainSwapRequest(
        bytes32 id,
        bytes32 bridgeTransferId,
        bytes32 bridge, // bridge slug
        address from, // user address
        address fromToken, // source token on sending chain
        address bridgeToken, // bridge token on sending chain
        address destToken, // dest token on receiving chain
        uint256 fromAmount, // source token amount on sending chain
        uint256 bridgeAmount, // swapped amount on sending chain
        uint256 dstAmount, // estimated amount of dest token on receiving chain
        DataTypes.SwapStatus status
    ) external;

    function emitCrosschainContractCallRequest(
        bytes32 id,
        bytes32 bridgeTransferId,
        bytes32 bridge, // bridge slug
        address from, // user address
        address toContractAddress, // The address of the contract to interact with
        address toApprovalAddress, // the approval address for contract call
        address fromToken, // source token on sending chain
        address callToken, // contract call token on receiving chain
        uint256 fromAmount, // source token amount on sending chain
        uint256 estimatedCallAmount, // estimated amount of contract call token on receiving chain
        DataTypes.ContractCallStatus status
    ) external;

    function emitCrosschainSwapDone(
        bytes32 id,
        bytes32 bridge,
        address from, // user address
        address bridgeToken, // source token on receiving chain
        address destToken, // dest token on receiving chain
        uint256 bridgeAmount, // bridge token amount on receiving chain
        uint256 destAmount, //dest token amount on receiving chain
        DataTypes.SwapStatus status
    ) external;

    function emitCrosschainContractCallDone(
        bytes32 id,
        bytes32 bridge,
        address from, // user address
        address toContractAddress, // The address of the contract to interact with
        address toApprovalAddress, // the approval address for contract call
        address bridgeToken, // source token on receiving chain
        address callToken, // call token on receiving chain
        uint256 bridgeAmount, // bridge token amount on receiving chain
        uint256 estimatedCallAmount, //dest token amount on receiving chain
        DataTypes.ContractCallStatus status
    ) external;

    function emitSingleChainContractCallDone(
        address from, // user address
        address toContractAddress, // The address of the contract to interact with
        address toApprovalAddress, // the approval address for contract call
        address fromToken, // source token on receiving chain
        address callToken, // call token on receiving chain
        uint256 fromAmount, // from token amount on receiving chain
        uint256 callAmount, //dest token amount on receiving chain
        DataTypes.ContractCallStatus status
    ) external;
}

File 14 of 20 : IUniswapExchange.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

interface IUniswapExchange {
    function getReserves() external view returns(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;
}

File 15 of 20 : IUniswapFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

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

interface IUniswapFactory {
    function getPair(IERC20 tokenA, IERC20 tokenB) external view returns (IUniswapExchange pair);
}

File 16 of 20 : DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
/**
 * @title DataTypes
 * @dev Definition of shared types
 */
library DataTypes {
    /// @notice Type for representing a swapping status type
    enum SwapStatus {
        Null,
        Succeeded,
        Failed,
        Fallback
    }

    enum ContractCallStatus {
        Null,
        Succeeded,
        Failed,
        Fallback
    }

    /// @notice Type for representing a paraswap usage status
    enum ParaswapUsageStatus {
        None,
        OnSrcChain,
        OnDestChain,
        Both
    }

    /// @notice Split Swap params
    struct SplitSwapInfo {
        uint256 amount;
        address swapContract;
        address spender;
        bytes swapData;
    }

    /// @notice Swap params
    struct SwapInfo {
        address srcToken;
        address dstToken;
    }

    struct ContractCallInfo {
        address toContractAddress; // The address of the contract to interact with.
        address toApprovalAddress; // the approval address for contract call
        address contractOutputsToken; // Some contract interactions will output a token (e.g. staking)
        uint32 toContractGasLimit; // The estimated gas used by the destination call.
        bytes toContractCallData; // The callData to be sent to the contract for the interaction on the destination chain.
    }

    struct ContractCallRequest {
        bytes32 id;
        bytes32 bridge;
        address srcToken;
        address bridgeToken;
        address callToken;
        address recipient;
        uint256 srcAmount;
        uint256 bridgeDstAmount;
        uint256 estimatedCallAmount;
        uint256[] dstDistribution;
        bytes dstParaswapData;
        ContractCallInfo callInfo;
        ParaswapUsageStatus paraswapUsageStatus;
    }
}

File 17 of 20 : DisableFlags.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

library DisableFlags {
    function check(
        uint256 flags,
        uint256 flag
    )
        internal
        pure
        returns (bool)
    {
        return (flags & flag) != 0;
    }
}

File 18 of 20 : Math.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

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

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

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

File 19 of 20 : UniswapExchangeLib.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

import "../interfaces/IUniswapExchange.sol";
import "./Math.sol";
import "./UniversalERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

library UniswapExchangeLib {
    using Math for uint256;
    using UniversalERC20 for IERC20;

    function getReturn(
        IUniswapExchange exchange,
        IERC20 fromToken,
        IERC20 destToken,
        uint amountIn
    )
        internal
        view
        returns (uint256 result, bool needSync, bool needSkim)
    {
        uint256 reserveIn = fromToken.universalBalanceOf(address(exchange));
        uint256 reserveOut = destToken.universalBalanceOf(address(exchange));
        (uint112 reserve0, uint112 reserve1,) = exchange.getReserves();
        if (fromToken > destToken) {
            (reserve0, reserve1) = (reserve1, reserve0);
        }
        needSync = (reserveIn < reserve0 || reserveOut < reserve1);
        needSkim = !needSync && (reserveIn > reserve0 || reserveOut > reserve1);

        uint256 amountInWithFee = amountIn * 997;
        uint256 numerator = amountInWithFee * Math.min(reserveOut, reserve1);
        uint256 denominator = Math.min(reserveIn, reserve0) * 1000 + amountInWithFee;
        result = (denominator == 0) ? 0 : numerator / denominator;
    }
}

File 20 of 20 : UniversalERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

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

library UniversalERC20 {

    using SafeERC20 for IERC20;

    address private constant ZERO_ADDRESS = address(0x0000000000000000000000000000000000000000);
    address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);

    function universalTransfer(
        IERC20 token,
        address to,
        uint256 amount
    )
        internal
        returns (bool)
    {
        if (amount == 0) {
            return true;
        }
        if (isETH(token)) {
            payable(to).transfer(amount);
            return true;
        } else {
            token.safeTransfer(to, amount);
            return true;
        }
    }

    function universalTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 amount
    )
        internal
    {
        if (amount == 0) {
            return;
        }

        if (isETH(token)) {
            require(from == msg.sender && msg.value >= amount, "Wrong useage of ETH.universalTransferFrom()");
            if (to != address(this)) {
                payable(to).transfer(amount);
            }
            // commented following lines for passing celer fee properly.
//            if (msg.value > amount) {
//                payable(msg.sender).transfer(msg.value - amount);
//            }
        } else {
            token.safeTransferFrom(from, to, amount);
        }
    }

    function universalTransferFromSenderToThis(
        IERC20 token,
        uint256 amount
    )
        internal
    {
        if (amount == 0) {
            return;
        }

        if (isETH(token)) {
            if (msg.value > amount) {
                // Return remainder if exist
                payable(msg.sender).transfer(msg.value - amount);
            }
        } else {
            token.safeTransferFrom(msg.sender, address(this), amount);
        }
    }

    function universalApprove(
        IERC20 token,
        address to,
        uint256 amount
    )
        internal
    {
        if (!isETH(token)) {
            if (amount == 0) {
                token.safeApprove(to, 0);
                return;
            }

            uint256 approvedAmount = token.allowance(address(this), to);
            if (approvedAmount > 0) {
                token.safeApprove(to, 0);
            }
            token.safeApprove(to, amount);
        }
    }

    function universalBalanceOf(IERC20 token, address who) internal view returns (uint256) {
        if (isETH(token)) {
            return who.balance;
        } else {
            return token.balanceOf(who);
        }
    }

    function isETH(IERC20 token) internal pure returns(bool) {
        return (address(token) == address(ZERO_ADDRESS) || address(token) == address(ETH_ADDRESS));
    }

    // function notExist(IERC20 token) internal pure returns(bool) {
    //     return (address(token) == address(-1));
    // }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_otherToken","type":"address"},{"internalType":"uint256","name":"_pathCount","type":"uint256"},{"internalType":"uint256","name":"_pathSplit","type":"uint256"},{"internalType":"address[]","name":"_factories","type":"address[]"},{"internalType":"address","name":"_switchViewAddress","type":"address"},{"internalType":"address","name":"_switchEventAddress","type":"address"},{"internalType":"address","name":"_paraswapProxy","type":"address"},{"internalType":"address","name":"_augustusSwapper","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"augustusSwapper","type":"address"}],"name":"AugustusSwapperSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"defaultSwingCut","type":"uint256"}],"name":"DefaultSwingCutSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_factories","type":"address[]"}],"name":"FactoriesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeCollector","type":"address"}],"name":"FeeCollectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxPartnerFeeRate","type":"uint256"}],"name":"MaxPartnerFeeRateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_otherToken","type":"address"}],"name":"OtherTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"paraswapProxy","type":"address"}],"name":"ParaswapProxySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_pathCount","type":"uint256"}],"name":"PathCountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_pathSplit","type":"uint256"}],"name":"PathSplitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"}],"name":"RewardSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ISwitchEvent","name":"switchEvent","type":"address"}],"name":"SwitchEventSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_weth","type":"address"}],"name":"WETHSet","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZERO_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"augustusSwapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultSwingCut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"factories","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"parts","type":"uint256"}],"name":"getExpectedReturn","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"}],"name":"getFeeInfo","outputs":[{"internalType":"uint256","name":"partnerFee","type":"uint256"},{"internalType":"uint256","name":"remainAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenBalance","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPartnerFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"otherToken","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paraswapProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pathCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pathSplit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reward","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_augustusSwapper","type":"address"}],"name":"setAugustusSwapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultSwingCut","type":"uint256"}],"name":"setDefaultSwingCut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_factories","type":"address[]"}],"name":"setFactories","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPartnerFeeRate","type":"uint256"}],"name":"setMaxPartnerFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_otherToken","type":"address"}],"name":"setOtherToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_paraswapProxy","type":"address"}],"name":"setParaswapProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pathCount","type":"uint256"}],"name":"setPathCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pathSplit","type":"uint256"}],"name":"setPathSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reward","type":"address"}],"name":"setReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISwitchEvent","name":"_switchEvent","type":"address"}],"name":"setSwitchEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"name":"setWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"expectedReturn","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"internalType":"struct Switch.SwapArgs","name":"swapArgs","type":"tuple"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"swapWithParaswap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"switchEvent","outputs":[{"internalType":"contract ISwitchEvent","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"switchView","outputs":[{"internalType":"contract ISwitchView","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080604052600180546001600160a01b031990811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee179091556002805490911690556103e86010556105dc6011553480156200004f57600080fd5b50604051620034ad380380620034ad833981016040819052620000729162000238565b89898989896200008233620001b5565b600680546001600160a01b038088166001600160a01b031992831617909255600780549287169290911691909117905560048390556005829055805160035560005b815181101562000135576008828281518110620000e557620000e5620003ad565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806200012c81620003c3565b915050620000c4565b505060016009555050600a80546001600160a01b03199081166001600160a01b03998a1617909155600b80548216978916979097179096555050600d8054851693861693909317909255600e80548416918516919091179055600f805483169190931617909155600c805433921691909117905550620003ed9350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200021d57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b6000806000806000806000806000806101408b8d0312156200025957600080fd5b620002648b62000205565b99506200027460208c0162000205565b60408c015160608d015160808e0151929b5090995097506001600160401b0380821115620002a157600080fd5b818d0191508d601f830112620002b657600080fd5b815181811115620002cb57620002cb62000222565b604051601f19603f8360051b011681018181108482111715620002f257620002f262000222565b6040528181526020808201935060059290921b8401909101908f8211156200031957600080fd5b6020840193505b818410156200034657620003348462000205565b83526020938401939092019162000320565b98506200035a9250505060a08c0162000205565b94506200036a60c08c0162000205565b93506200037a60e08c0162000205565b92506200038b6101008c0162000205565b91506200039c6101208c0162000205565b90509295989b9194979a5092959850565b634e487b7160e01b600052603260045260246000fd5b6000600019821415620003e657634e487b7160e01b600052601160045260246000fd5b5060010190565b6130b080620003fd6000396000f3fe6080604052600436106102255760003560e01c80638da5cb5b11610123578063c415b95c116100ab578063e8984c5f1161006f578063e8984c5f14610649578063ea15afc314610669578063ecefc70514610689578063f2fde38b1461069f578063f640d508146106bf57610225565b8063c415b95c146105ab578063c93d732d146105cb578063d6821ed8146105de578063e37c425014610613578063e5932c401461062957610225565b8063a85f3298116100f2578063a85f329814610515578063ab30469514610535578063ae551c661461054b578063b4c76fe01461056b578063b9d52d3c1461058b57610225565b80638da5cb5b146104a157806390f3f208146104bf578063a42dce80146104d5578063a734f06e146104f557610225565b8063538ba4f9116101b15780636076a0b4116101755780636076a0b414610415578063672383c414610443578063715018a6146104635780638928a29f146104785780638c821e901461048b57610225565b8063538ba4f91461037557806353fd7bf1146103955780635b18075e146103b55780635b769f3c146103d55780635c3d258f146103f557610225565b80633fc8cef3116101f85780633fc8cef3146102df578063433b3c05146102ff5780634399fa561461031f57806348c4d7811461033f57806352b721f81461035f57610225565b8063228cb7331461023457806323a9495e1461027157806331428a87146102915780633aecd0e3146102b1575b3332141561023257600080fd5b005b34801561024057600080fd5b50600c54610254906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561027d57600080fd5b5061023261028c366004612920565b6106df565b34801561029d57600080fd5b50600a54610254906001600160a01b031681565b3480156102bd57600080fd5b506102d16102cc36600461294e565b610723565b604051908152602001610268565b3480156102eb57600080fd5b50600654610254906001600160a01b031681565b34801561030b57600080fd5b50600754610254906001600160a01b031681565b34801561032b57600080fd5b50600b54610254906001600160a01b031681565b34801561034b57600080fd5b5061023261035a366004612920565b610746565b34801561036b57600080fd5b506102d160115481565b34801561038157600080fd5b50600254610254906001600160a01b031681565b3480156103a157600080fd5b506102326103b036600461294e565b6107c6565b3480156103c157600080fd5b50600d54610254906001600160a01b031681565b3480156103e157600080fd5b506102326103f036600461294e565b61081c565b34801561040157600080fd5b50610232610410366004612920565b610872565b34801561042157600080fd5b5061043561043036600461296b565b6108af565b6040516102689291906129b1565b34801561044f57600080fd5b5061025461045e366004612920565b610958565b34801561046f57600080fd5b50610232610982565b610232610486366004612a46565b610996565b34801561049757600080fd5b506102d160045481565b3480156104ad57600080fd5b506000546001600160a01b0316610254565b3480156104cb57600080fd5b506102d160055481565b3480156104e157600080fd5b506102326104f036600461294e565b610a18565b34801561050157600080fd5b50600154610254906001600160a01b031681565b34801561052157600080fd5b50610232610530366004612920565b610a6e565b34801561054157600080fd5b506102d160035481565b34801561055757600080fd5b50600e54610254906001600160a01b031681565b34801561057757600080fd5b5061023261058636600461294e565b610aab565b34801561059757600080fd5b506102326105a636600461294e565b610b01565b3480156105b757600080fd5b50600f54610254906001600160a01b031681565b6102d16105d9366004612b43565b610b57565b3480156105ea57600080fd5b506105fe6105f9366004612b7f565b611080565b60408051928352602083019190915201610268565b34801561061f57600080fd5b506102d160105481565b34801561063557600080fd5b5061023261064436600461294e565b6110b0565b34801561065557600080fd5b5061023261066436600461294e565b611106565b34801561067557600080fd5b50610232610684366004612bdb565b61115c565b34801561069557600080fd5b506102d161271081565b3480156106ab57600080fd5b506102326106ba36600461294e565b611206565b3480156106cb57600080fd5b506102326106da366004612c6f565b61127f565b6106e76112a1565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b600061072d6112a1565b6107406001600160a01b038316306112fb565b92915050565b61074e6112a1565b6113888111156107915760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b60448201526064015b60405180910390fd5b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b90602001610718565b6107ce6112a1565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610718565b6108246112a1565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610718565b61087a6112a1565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c5590602001610718565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b15801561090f57600080fd5b505afa158015610923573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261094b9190810190612cb1565b9097909650945050505050565b6008818154811061096857600080fd5b6000918252602090912001546001600160a01b0316905081565b61098a6112a1565b610994600061139c565b565b61099e6113ec565b866001600160a01b0316886001600160a01b031614156109d05760405162461bcd60e51b815260040161078890612d4e565b6109e56001600160a01b038916333089611446565b60006109f389888787611538565b9050610a028989838686611886565b5050610a0e6001600955565b5050505050505050565b610a206112a1565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d490602001610718565b610a766112a1565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610718565b610ab36112a1565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610718565b610b096112a1565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc29290602001610718565b6000610b616113ec565b816080013582606001351015610bd75760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b6064820152608401610788565b610be7604083016020840161294e565b6001600160a01b0316610bfd602084018461294e565b6001600160a01b03161415610c245760405162461bcd60e51b815260040161078890612d4e565b60008060005b610c38610100860186612d96565b9050811015610cb6576000610c51610100870187612d96565b83818110610c6157610c61612de7565b905060200201351115610ca457610c7c610100860186612d96565b82818110610c8c57610c8c612de7565b9050602002013583610c9e9190612e13565b92508091505b80610cae81612e2b565b915050610c2a565b5081610d2357610cda610ccc602086018661294e565b6001600160a01b031661196e565b15610d165760405133903480156108fc02916000818181858888f19350505050158015610d0b573d6000803e3d6000fd5b503492505050611071565b5050506040810135611071565b610d4b33306040870135610d3a602089018961294e565b6001600160a01b0316929190611446565b6000610d7c610d5d602087018761294e565b6040870135610d7260c0890160a08a0161294e565b8860c00135611538565b9050610de8610d8f610100870187612d96565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250879150869050610dd360208b018b61294e565b610de360408c0160208d0161294e565b6119a7565b93508315611002578460800135841015610e505760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610788565b8460600135841115610f7257610e95610e70610100870160e0880161294e565b6060870135610e856040890160208a0161294e565b6001600160a01b03169190611bd7565b50600c54610ec4906001600160a01b0316610eb4606088013587612e46565b610e856040890160208a0161294e565b50600b546001600160a01b031663391fdc2433610ee8610100890160e08a0161294e565b610ef560208a018a61294e565b610f0560408b0160208c0161294e565b60408b013560608c0135610f19818d612e46565b6040518863ffffffff1660e01b8152600401610f3b9796959493929190612e5d565b600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b5050505061106d565b610f97610f86610100870160e0880161294e565b85610e856040890160208a0161294e565b50600b546001600160a01b031663391fdc2433610fbb610100890160e08a0161294e565b610fc860208a018a61294e565b610fd860408b0160208c0161294e565b8a604001358a60006040518863ffffffff1660e01b8152600401610f3b9796959493929190612e5d565b604085013561102730611018602089018961294e565b6001600160a01b0316906112fb565b111561104957611043336040870135610e85602089018961294e565b5061106d565b61106b3361105e3061101860208a018a61294e565b610e85602089018961294e565b505b5050505b61107b6001600955565b919050565b6000806127106110908685612ea1565b61109a9190612ed6565b91506110a68286612e46565b9050935093915050565b6110b86112a1565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610718565b61110e6112a1565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b90602001610718565b6111646112a1565b805160035560005b81518110156111d657600882828151811061118957611189612de7565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806111ce81612e2b565b91505061116c565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d3816040516107189190612eea565b61120e6112a1565b6001600160a01b0381166112735760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610788565b61127c8161139c565b50565b6112876112a1565b61129b6001600160a01b0384168284611bd7565b50505050565b6000546001600160a01b031633146109945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610788565b60006113068361196e565b1561131c57506001600160a01b03811631610740565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561135d57600080fd5b505afa158015611371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113959190612f37565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002600954141561143f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610788565b6002600955565b806114505761129b565b6114598461196e565b15611523576001600160a01b038316331480156114765750803410155b6114d65760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610788565b6001600160a01b038216301461151e576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561151c573d6000803e3d6000fd5b505b61129b565b61129b6001600160a01b038516848484611c52565b600060105482111561158c5760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c6172676500000000000000006044820152606401610788565b5082811561187e57600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b1580156115da57600080fd5b505afa1580156115ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116129190612f37565b1561169957600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b15801561165c57600080fd5b505afa158015611670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116949190612f37565b61169d565b6011545b905060006116ad61271080612ea1565b6011546116ba8887612ea1565b6116c49190612ea1565b6116ce9190612ed6565b90506000816127106116e08988612ea1565b6116ea9190612ed6565b6116f49190612e46565b9050611708886001600160a01b031661196e565b1561179b57600f546001600160a01b031663eedd56e16117288484612e13565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b15801561177d57600080fd5b505af1158015611791573d6000803e3d6000fd5b5050505050611857565b600f546117b6906001600160a01b038a811691166000611cbd565b600f546117e1906001600160a01b03166117d08484612e13565b6001600160a01b038b169190611cbd565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b15801561183e57600080fd5b505af1158015611852573d6000803e3d6000fd5b505050505b6127106118648887612ea1565b61186e9190612ed6565b6118789088612e46565b93505050505b949350505050565b6000846001600160a01b0316866001600160a01b031614156118ba5760405162461bcd60e51b815260040161078890612d4e565b6118c5868584611de6565b6118d86001600160a01b038616306112fb565b905080156118f6576118f46001600160a01b0386168483611bd7565b505b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061193390339087908b908b908b908990600090600401612e5d565b600060405180830381600087803b15801561194d57600080fd5b505af1158015611961573d6000803e3d6000fd5b5050505095945050505050565b60006001600160a01b038216158061074057506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b60006004546003546119b99190612ea1565b87511115611a395760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610788565b856000805b8951811015611bca57898181518110611a5957611a59612de7565b602002602001015160001415611a6e57611bb8565b6000888b8381518110611a8357611a83612de7565b60200260200101518b611a969190612ea1565b611aa09190612ed6565b905087821415611aad5750825b611ab78185612e46565b935060045482611ac79190612f50565b611b1257611b0b878783600860045487611ae19190612ed6565b81548110611af157611af1612de7565b6000918252602090912001546001600160a01b0316611f2a565b9250611baa565b600454611b1f9083612f50565b60011415611b6757611b0b878783600860045487611b3d9190612ed6565b81548110611b4d57611b4d612de7565b6000918252602090912001546001600160a01b0316611f41565b611ba7878783600860045487611b7d9190612ed6565b81548110611b8d57611b8d612de7565b6000918252602090912001546001600160a01b0316611f5e565b92505b611bb48386612e13565b9450505b80611bc281612e2b565b915050611a3e565b5050509695505050505050565b600081611be657506001611395565b611bef8461196e565b15611c34576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015611c2a573d6000803e3d6000fd5b5060019050611395565b611c486001600160a01b0385168484611f7b565b5060019392505050565b6040516001600160a01b038085166024830152831660448201526064810182905261129b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fab565b801580611d465750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611d0c57600080fd5b505afa158015611d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d449190612f37565b155b611db15760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610788565b6040516001600160a01b038316602482015260448101829052611de190849063095ea7b360e01b90606401611c86565b505050565b6000611dfa846001600160a01b031661196e565b15611e565782471015611e4f5760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610788565b5081611e70565b600d54611e70906001600160a01b03868116911685612080565b600e546040516000916001600160a01b0316908390611e90908690612f90565b60006040518083038185875af1925050503d8060008114611ecd576040519150601f19603f3d011682016040523d82523d6000602084013e611ed2565b606091505b5050905080611f235760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610788565b5050505050565b6000611f388585858561215b565b95945050505050565b600654600090611f389086906001600160a01b03168686866125c7565b600754600090611f389086906001600160a01b03168686866125c7565b6040516001600160a01b038316602482015260448101829052611de190849063a9059cbb60e01b90606401611c86565b6000612000826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125ea9092919063ffffffff16565b90508051600014806120215750808060200190518101906120219190612fac565b611de15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610788565b6120898361196e565b611de157806120a757611de16001600160a01b038416836000611cbd565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b1580156120f257600080fd5b505afa158015612106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212a9190612f37565b90508015612147576121476001600160a01b038516846000611cbd565b61129b6001600160a01b0385168484611cbd565b600061216f856001600160a01b031661196e565b156121de57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b1580156121c457600080fd5b505af11580156121d8573d6000803e3d6000fd5b50505050505b60006121f2866001600160a01b031661196e565b6121fc5785612209565b6006546001600160a01b03165b9050600061221f866001600160a01b031661196e565b6122295785612236565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b15801561228557600080fd5b505afa158015612299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bd9190612fce565b90506000806122d76001600160a01b03841686868b6125f9565b91975092509050811561233c57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561231f57600080fd5b505af1158015612333573d6000803e3d6000fd5b505050506123b0565b80156123b05760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b15801561239757600080fd5b505af11580156123ab573d6000803e3d6000fd5b505050505b6123c46001600160a01b038616848a611bd7565b50836001600160a01b0316856001600160a01b031610156124595760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561243c57600080fd5b505af1158015612450573d6000803e3d6000fd5b505050506124cf565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b1580156124b657600080fd5b505af11580156124ca573d6000803e3d6000fd5b505050505b6124e1896001600160a01b031661196e565b156125ba576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b15801561253157600080fd5b505afa158015612545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125699190612f37565b6040518263ffffffff1660e01b815260040161258791815260200190565b600060405180830381600087803b1580156125a157600080fd5b505af11580156125b5573d6000803e3d6000fd5b505050505b5050505050949350505050565b60006125e085856125da8989888861215b565b8561215b565b9695505050505050565b606061187e8484600085612794565b60008080806126116001600160a01b038816896112fb565b905060006126286001600160a01b0388168a6112fb565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561266657600080fd5b505afa15801561267a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269e9190613002565b5091509150886001600160a01b03168a6001600160a01b031611156126bf57905b816001600160701b03168410806126de5750806001600160701b031683105b9550851580156127085750816001600160701b03168411806127085750806001600160701b031683115b94506000612718896103e5612ea1565b9050600061272f85846001600160701b031661286f565b6127399083612ea1565b905060008261275188876001600160701b031661286f565b61275d906103e8612ea1565b6127679190612e13565b9050801561277e576127798183612ed6565b612781565b60005b9950505050505050509450945094915050565b6060824710156127f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610788565b600080866001600160a01b031685876040516128119190612f90565b60006040518083038185875af1925050503d806000811461284e576040519150601f19603f3d011682016040523d82523d6000602084013e612853565b606091505b509150915061286487838387612885565b979650505050505050565b600081831061287e5781611395565b5090919050565b606083156128f15782516128ea576001600160a01b0385163b6128ea5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610788565b508161187e565b61187e83838151156129065781518083602001fd5b8060405162461bcd60e51b81526004016107889190613047565b60006020828403121561293257600080fd5b5035919050565b6001600160a01b038116811461127c57600080fd5b60006020828403121561296057600080fd5b813561139581612939565b6000806000806080858703121561298157600080fd5b843561298c81612939565b9350602085013561299c81612939565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156129f2578451835293830193918301916001016129d6565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612a3e57612a3e6129ff565b604052919050565b600080600080600080600080610100898b031215612a6357600080fd5b8835612a6e81612939565b9750602089810135612a7f81612939565b975060408a0135965060608a0135955060808a0135612a9d81612939565b945060a08a0135935060c08a0135612ab481612939565b925060e08a013567ffffffffffffffff80821115612ad157600080fd5b818c0191508c601f830112612ae557600080fd5b813581811115612af757612af76129ff565b612b09601f8201601f19168501612a15565b91508082528d84828501011115612b1f57600080fd5b80848401858401376000848284010152508093505050509295985092959890939650565b600060208284031215612b5557600080fd5b813567ffffffffffffffff811115612b6c57600080fd5b8201610120818503121561139557600080fd5b600080600060608486031215612b9457600080fd5b833592506020840135612ba681612939565b929592945050506040919091013590565b600067ffffffffffffffff821115612bd157612bd16129ff565b5060051b60200190565b60006020808385031215612bee57600080fd5b823567ffffffffffffffff811115612c0557600080fd5b8301601f81018513612c1657600080fd5b8035612c29612c2482612bb7565b612a15565b81815260059190911b82018301908381019087831115612c4857600080fd5b928401925b82841015612864578335612c6081612939565b82529284019290840190612c4d565b600080600060608486031215612c8457600080fd5b8335612c8f81612939565b9250602084013591506040840135612ca681612939565b809150509250925092565b60008060408385031215612cc457600080fd5b8251915060208084015167ffffffffffffffff811115612ce357600080fd5b8401601f81018613612cf457600080fd5b8051612d02612c2482612bb7565b81815260059190911b82018301908381019088831115612d2157600080fd5b928401925b82841015612d3f57835182529284019290840190612d26565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e19843603018112612dad57600080fd5b83018035915067ffffffffffffffff821115612dc857600080fd5b6020019150600581901b3603821315612de057600080fd5b9250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115612e2657612e26612dfd565b500190565b6000600019821415612e3f57612e3f612dfd565b5060010190565b600082821015612e5857612e58612dfd565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000816000190483118215151615612ebb57612ebb612dfd565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612ee557612ee5612ec0565b500490565b6020808252825182820181905260009190848201906040850190845b81811015612f2b5783516001600160a01b031683529284019291840191600101612f06565b50909695505050505050565b600060208284031215612f4957600080fd5b5051919050565b600082612f5f57612f5f612ec0565b500690565b60005b83811015612f7f578181015183820152602001612f67565b8381111561129b5750506000910152565b60008251612fa2818460208701612f64565b9190910192915050565b600060208284031215612fbe57600080fd5b8151801515811461139557600080fd5b600060208284031215612fe057600080fd5b815161139581612939565b80516001600160701b038116811461107b57600080fd5b60008060006060848603121561301757600080fd5b61302084612feb565b925061302e60208501612feb565b9150604084015163ffffffff81168114612ca657600080fd5b6020815260008251806020840152613066816040850160208701612f64565b601f01601f1916919091016040019291505056fea2646970667358221220afe86324f312081babe37bf668056bdad7f6daf586b0a94eeaeeb320c6aa130764736f6c63430008090033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001400000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d00000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c

Deployed Bytecode

0x6080604052600436106102255760003560e01c80638da5cb5b11610123578063c415b95c116100ab578063e8984c5f1161006f578063e8984c5f14610649578063ea15afc314610669578063ecefc70514610689578063f2fde38b1461069f578063f640d508146106bf57610225565b8063c415b95c146105ab578063c93d732d146105cb578063d6821ed8146105de578063e37c425014610613578063e5932c401461062957610225565b8063a85f3298116100f2578063a85f329814610515578063ab30469514610535578063ae551c661461054b578063b4c76fe01461056b578063b9d52d3c1461058b57610225565b80638da5cb5b146104a157806390f3f208146104bf578063a42dce80146104d5578063a734f06e146104f557610225565b8063538ba4f9116101b15780636076a0b4116101755780636076a0b414610415578063672383c414610443578063715018a6146104635780638928a29f146104785780638c821e901461048b57610225565b8063538ba4f91461037557806353fd7bf1146103955780635b18075e146103b55780635b769f3c146103d55780635c3d258f146103f557610225565b80633fc8cef3116101f85780633fc8cef3146102df578063433b3c05146102ff5780634399fa561461031f57806348c4d7811461033f57806352b721f81461035f57610225565b8063228cb7331461023457806323a9495e1461027157806331428a87146102915780633aecd0e3146102b1575b3332141561023257600080fd5b005b34801561024057600080fd5b50600c54610254906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561027d57600080fd5b5061023261028c366004612920565b6106df565b34801561029d57600080fd5b50600a54610254906001600160a01b031681565b3480156102bd57600080fd5b506102d16102cc36600461294e565b610723565b604051908152602001610268565b3480156102eb57600080fd5b50600654610254906001600160a01b031681565b34801561030b57600080fd5b50600754610254906001600160a01b031681565b34801561032b57600080fd5b50600b54610254906001600160a01b031681565b34801561034b57600080fd5b5061023261035a366004612920565b610746565b34801561036b57600080fd5b506102d160115481565b34801561038157600080fd5b50600254610254906001600160a01b031681565b3480156103a157600080fd5b506102326103b036600461294e565b6107c6565b3480156103c157600080fd5b50600d54610254906001600160a01b031681565b3480156103e157600080fd5b506102326103f036600461294e565b61081c565b34801561040157600080fd5b50610232610410366004612920565b610872565b34801561042157600080fd5b5061043561043036600461296b565b6108af565b6040516102689291906129b1565b34801561044f57600080fd5b5061025461045e366004612920565b610958565b34801561046f57600080fd5b50610232610982565b610232610486366004612a46565b610996565b34801561049757600080fd5b506102d160045481565b3480156104ad57600080fd5b506000546001600160a01b0316610254565b3480156104cb57600080fd5b506102d160055481565b3480156104e157600080fd5b506102326104f036600461294e565b610a18565b34801561050157600080fd5b50600154610254906001600160a01b031681565b34801561052157600080fd5b50610232610530366004612920565b610a6e565b34801561054157600080fd5b506102d160035481565b34801561055757600080fd5b50600e54610254906001600160a01b031681565b34801561057757600080fd5b5061023261058636600461294e565b610aab565b34801561059757600080fd5b506102326105a636600461294e565b610b01565b3480156105b757600080fd5b50600f54610254906001600160a01b031681565b6102d16105d9366004612b43565b610b57565b3480156105ea57600080fd5b506105fe6105f9366004612b7f565b611080565b60408051928352602083019190915201610268565b34801561061f57600080fd5b506102d160105481565b34801561063557600080fd5b5061023261064436600461294e565b6110b0565b34801561065557600080fd5b5061023261066436600461294e565b611106565b34801561067557600080fd5b50610232610684366004612bdb565b61115c565b34801561069557600080fd5b506102d161271081565b3480156106ab57600080fd5b506102326106ba36600461294e565b611206565b3480156106cb57600080fd5b506102326106da366004612c6f565b61127f565b6106e76112a1565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b600061072d6112a1565b6107406001600160a01b038316306112fb565b92915050565b61074e6112a1565b6113888111156107915760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b60448201526064015b60405180910390fd5b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b90602001610718565b6107ce6112a1565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610718565b6108246112a1565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610718565b61087a6112a1565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c5590602001610718565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b15801561090f57600080fd5b505afa158015610923573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261094b9190810190612cb1565b9097909650945050505050565b6008818154811061096857600080fd5b6000918252602090912001546001600160a01b0316905081565b61098a6112a1565b610994600061139c565b565b61099e6113ec565b866001600160a01b0316886001600160a01b031614156109d05760405162461bcd60e51b815260040161078890612d4e565b6109e56001600160a01b038916333089611446565b60006109f389888787611538565b9050610a028989838686611886565b5050610a0e6001600955565b5050505050505050565b610a206112a1565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d490602001610718565b610a766112a1565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610718565b610ab36112a1565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610718565b610b096112a1565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc29290602001610718565b6000610b616113ec565b816080013582606001351015610bd75760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b6064820152608401610788565b610be7604083016020840161294e565b6001600160a01b0316610bfd602084018461294e565b6001600160a01b03161415610c245760405162461bcd60e51b815260040161078890612d4e565b60008060005b610c38610100860186612d96565b9050811015610cb6576000610c51610100870187612d96565b83818110610c6157610c61612de7565b905060200201351115610ca457610c7c610100860186612d96565b82818110610c8c57610c8c612de7565b9050602002013583610c9e9190612e13565b92508091505b80610cae81612e2b565b915050610c2a565b5081610d2357610cda610ccc602086018661294e565b6001600160a01b031661196e565b15610d165760405133903480156108fc02916000818181858888f19350505050158015610d0b573d6000803e3d6000fd5b503492505050611071565b5050506040810135611071565b610d4b33306040870135610d3a602089018961294e565b6001600160a01b0316929190611446565b6000610d7c610d5d602087018761294e565b6040870135610d7260c0890160a08a0161294e565b8860c00135611538565b9050610de8610d8f610100870187612d96565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250879150869050610dd360208b018b61294e565b610de360408c0160208d0161294e565b6119a7565b93508315611002578460800135841015610e505760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610788565b8460600135841115610f7257610e95610e70610100870160e0880161294e565b6060870135610e856040890160208a0161294e565b6001600160a01b03169190611bd7565b50600c54610ec4906001600160a01b0316610eb4606088013587612e46565b610e856040890160208a0161294e565b50600b546001600160a01b031663391fdc2433610ee8610100890160e08a0161294e565b610ef560208a018a61294e565b610f0560408b0160208c0161294e565b60408b013560608c0135610f19818d612e46565b6040518863ffffffff1660e01b8152600401610f3b9796959493929190612e5d565b600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b5050505061106d565b610f97610f86610100870160e0880161294e565b85610e856040890160208a0161294e565b50600b546001600160a01b031663391fdc2433610fbb610100890160e08a0161294e565b610fc860208a018a61294e565b610fd860408b0160208c0161294e565b8a604001358a60006040518863ffffffff1660e01b8152600401610f3b9796959493929190612e5d565b604085013561102730611018602089018961294e565b6001600160a01b0316906112fb565b111561104957611043336040870135610e85602089018961294e565b5061106d565b61106b3361105e3061101860208a018a61294e565b610e85602089018961294e565b505b5050505b61107b6001600955565b919050565b6000806127106110908685612ea1565b61109a9190612ed6565b91506110a68286612e46565b9050935093915050565b6110b86112a1565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610718565b61110e6112a1565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b90602001610718565b6111646112a1565b805160035560005b81518110156111d657600882828151811061118957611189612de7565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806111ce81612e2b565b91505061116c565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d3816040516107189190612eea565b61120e6112a1565b6001600160a01b0381166112735760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610788565b61127c8161139c565b50565b6112876112a1565b61129b6001600160a01b0384168284611bd7565b50505050565b6000546001600160a01b031633146109945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610788565b60006113068361196e565b1561131c57506001600160a01b03811631610740565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561135d57600080fd5b505afa158015611371573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113959190612f37565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002600954141561143f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610788565b6002600955565b806114505761129b565b6114598461196e565b15611523576001600160a01b038316331480156114765750803410155b6114d65760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610788565b6001600160a01b038216301461151e576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561151c573d6000803e3d6000fd5b505b61129b565b61129b6001600160a01b038516848484611c52565b600060105482111561158c5760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c6172676500000000000000006044820152606401610788565b5082811561187e57600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b1580156115da57600080fd5b505afa1580156115ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116129190612f37565b1561169957600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b15801561165c57600080fd5b505afa158015611670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116949190612f37565b61169d565b6011545b905060006116ad61271080612ea1565b6011546116ba8887612ea1565b6116c49190612ea1565b6116ce9190612ed6565b90506000816127106116e08988612ea1565b6116ea9190612ed6565b6116f49190612e46565b9050611708886001600160a01b031661196e565b1561179b57600f546001600160a01b031663eedd56e16117288484612e13565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b15801561177d57600080fd5b505af1158015611791573d6000803e3d6000fd5b5050505050611857565b600f546117b6906001600160a01b038a811691166000611cbd565b600f546117e1906001600160a01b03166117d08484612e13565b6001600160a01b038b169190611cbd565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b15801561183e57600080fd5b505af1158015611852573d6000803e3d6000fd5b505050505b6127106118648887612ea1565b61186e9190612ed6565b6118789088612e46565b93505050505b949350505050565b6000846001600160a01b0316866001600160a01b031614156118ba5760405162461bcd60e51b815260040161078890612d4e565b6118c5868584611de6565b6118d86001600160a01b038616306112fb565b905080156118f6576118f46001600160a01b0386168483611bd7565b505b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061193390339087908b908b908b908990600090600401612e5d565b600060405180830381600087803b15801561194d57600080fd5b505af1158015611961573d6000803e3d6000fd5b5050505095945050505050565b60006001600160a01b038216158061074057506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b60006004546003546119b99190612ea1565b87511115611a395760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610788565b856000805b8951811015611bca57898181518110611a5957611a59612de7565b602002602001015160001415611a6e57611bb8565b6000888b8381518110611a8357611a83612de7565b60200260200101518b611a969190612ea1565b611aa09190612ed6565b905087821415611aad5750825b611ab78185612e46565b935060045482611ac79190612f50565b611b1257611b0b878783600860045487611ae19190612ed6565b81548110611af157611af1612de7565b6000918252602090912001546001600160a01b0316611f2a565b9250611baa565b600454611b1f9083612f50565b60011415611b6757611b0b878783600860045487611b3d9190612ed6565b81548110611b4d57611b4d612de7565b6000918252602090912001546001600160a01b0316611f41565b611ba7878783600860045487611b7d9190612ed6565b81548110611b8d57611b8d612de7565b6000918252602090912001546001600160a01b0316611f5e565b92505b611bb48386612e13565b9450505b80611bc281612e2b565b915050611a3e565b5050509695505050505050565b600081611be657506001611395565b611bef8461196e565b15611c34576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015611c2a573d6000803e3d6000fd5b5060019050611395565b611c486001600160a01b0385168484611f7b565b5060019392505050565b6040516001600160a01b038085166024830152831660448201526064810182905261129b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fab565b801580611d465750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611d0c57600080fd5b505afa158015611d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d449190612f37565b155b611db15760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610788565b6040516001600160a01b038316602482015260448101829052611de190849063095ea7b360e01b90606401611c86565b505050565b6000611dfa846001600160a01b031661196e565b15611e565782471015611e4f5760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610788565b5081611e70565b600d54611e70906001600160a01b03868116911685612080565b600e546040516000916001600160a01b0316908390611e90908690612f90565b60006040518083038185875af1925050503d8060008114611ecd576040519150601f19603f3d011682016040523d82523d6000602084013e611ed2565b606091505b5050905080611f235760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610788565b5050505050565b6000611f388585858561215b565b95945050505050565b600654600090611f389086906001600160a01b03168686866125c7565b600754600090611f389086906001600160a01b03168686866125c7565b6040516001600160a01b038316602482015260448101829052611de190849063a9059cbb60e01b90606401611c86565b6000612000826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125ea9092919063ffffffff16565b90508051600014806120215750808060200190518101906120219190612fac565b611de15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610788565b6120898361196e565b611de157806120a757611de16001600160a01b038416836000611cbd565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b1580156120f257600080fd5b505afa158015612106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212a9190612f37565b90508015612147576121476001600160a01b038516846000611cbd565b61129b6001600160a01b0385168484611cbd565b600061216f856001600160a01b031661196e565b156121de57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b1580156121c457600080fd5b505af11580156121d8573d6000803e3d6000fd5b50505050505b60006121f2866001600160a01b031661196e565b6121fc5785612209565b6006546001600160a01b03165b9050600061221f866001600160a01b031661196e565b6122295785612236565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b15801561228557600080fd5b505afa158015612299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bd9190612fce565b90506000806122d76001600160a01b03841686868b6125f9565b91975092509050811561233c57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561231f57600080fd5b505af1158015612333573d6000803e3d6000fd5b505050506123b0565b80156123b05760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b15801561239757600080fd5b505af11580156123ab573d6000803e3d6000fd5b505050505b6123c46001600160a01b038616848a611bd7565b50836001600160a01b0316856001600160a01b031610156124595760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561243c57600080fd5b505af1158015612450573d6000803e3d6000fd5b505050506124cf565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b1580156124b657600080fd5b505af11580156124ca573d6000803e3d6000fd5b505050505b6124e1896001600160a01b031661196e565b156125ba576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b15801561253157600080fd5b505afa158015612545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125699190612f37565b6040518263ffffffff1660e01b815260040161258791815260200190565b600060405180830381600087803b1580156125a157600080fd5b505af11580156125b5573d6000803e3d6000fd5b505050505b5050505050949350505050565b60006125e085856125da8989888861215b565b8561215b565b9695505050505050565b606061187e8484600085612794565b60008080806126116001600160a01b038816896112fb565b905060006126286001600160a01b0388168a6112fb565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561266657600080fd5b505afa15801561267a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269e9190613002565b5091509150886001600160a01b03168a6001600160a01b031611156126bf57905b816001600160701b03168410806126de5750806001600160701b031683105b9550851580156127085750816001600160701b03168411806127085750806001600160701b031683115b94506000612718896103e5612ea1565b9050600061272f85846001600160701b031661286f565b6127399083612ea1565b905060008261275188876001600160701b031661286f565b61275d906103e8612ea1565b6127679190612e13565b9050801561277e576127798183612ed6565b612781565b60005b9950505050505050509450945094915050565b6060824710156127f55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610788565b600080866001600160a01b031685876040516128119190612f90565b60006040518083038185875af1925050503d806000811461284e576040519150601f19603f3d011682016040523d82523d6000602084013e612853565b606091505b509150915061286487838387612885565b979650505050505050565b600081831061287e5781611395565b5090919050565b606083156128f15782516128ea576001600160a01b0385163b6128ea5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610788565b508161187e565b61187e83838151156129065781518083602001fd5b8060405162461bcd60e51b81526004016107889190613047565b60006020828403121561293257600080fd5b5035919050565b6001600160a01b038116811461127c57600080fd5b60006020828403121561296057600080fd5b813561139581612939565b6000806000806080858703121561298157600080fd5b843561298c81612939565b9350602085013561299c81612939565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156129f2578451835293830193918301916001016129d6565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612a3e57612a3e6129ff565b604052919050565b600080600080600080600080610100898b031215612a6357600080fd5b8835612a6e81612939565b9750602089810135612a7f81612939565b975060408a0135965060608a0135955060808a0135612a9d81612939565b945060a08a0135935060c08a0135612ab481612939565b925060e08a013567ffffffffffffffff80821115612ad157600080fd5b818c0191508c601f830112612ae557600080fd5b813581811115612af757612af76129ff565b612b09601f8201601f19168501612a15565b91508082528d84828501011115612b1f57600080fd5b80848401858401376000848284010152508093505050509295985092959890939650565b600060208284031215612b5557600080fd5b813567ffffffffffffffff811115612b6c57600080fd5b8201610120818503121561139557600080fd5b600080600060608486031215612b9457600080fd5b833592506020840135612ba681612939565b929592945050506040919091013590565b600067ffffffffffffffff821115612bd157612bd16129ff565b5060051b60200190565b60006020808385031215612bee57600080fd5b823567ffffffffffffffff811115612c0557600080fd5b8301601f81018513612c1657600080fd5b8035612c29612c2482612bb7565b612a15565b81815260059190911b82018301908381019087831115612c4857600080fd5b928401925b82841015612864578335612c6081612939565b82529284019290840190612c4d565b600080600060608486031215612c8457600080fd5b8335612c8f81612939565b9250602084013591506040840135612ca681612939565b809150509250925092565b60008060408385031215612cc457600080fd5b8251915060208084015167ffffffffffffffff811115612ce357600080fd5b8401601f81018613612cf457600080fd5b8051612d02612c2482612bb7565b81815260059190911b82018301908381019088831115612d2157600080fd5b928401925b82841015612d3f57835182529284019290840190612d26565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e19843603018112612dad57600080fd5b83018035915067ffffffffffffffff821115612dc857600080fd5b6020019150600581901b3603821315612de057600080fd5b9250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115612e2657612e26612dfd565b500190565b6000600019821415612e3f57612e3f612dfd565b5060010190565b600082821015612e5857612e58612dfd565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000816000190483118215151615612ebb57612ebb612dfd565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612ee557612ee5612ec0565b500490565b6020808252825182820181905260009190848201906040850190845b81811015612f2b5783516001600160a01b031683529284019291840191600101612f06565b50909695505050505050565b600060208284031215612f4957600080fd5b5051919050565b600082612f5f57612f5f612ec0565b500690565b60005b83811015612f7f578181015183820152602001612f67565b8381111561129b5750506000910152565b60008251612fa2818460208701612f64565b9190910192915050565b600060208284031215612fbe57600080fd5b8151801515811461139557600080fd5b600060208284031215612fe057600080fd5b815161139581612939565b80516001600160701b038116811461107b57600080fd5b60008060006060848603121561301757600080fd5b61302084612feb565b925061302e60208501612feb565b9150604084015163ffffffff81168114612ca657600080fd5b6020815260008251806020840152613066816040850160208701612f64565b601f01601f1916919091016040019291505056fea2646970667358221220afe86324f312081babe37bf668056bdad7f6daf586b0a94eeaeeb320c6aa130764736f6c63430008090033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001400000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d00000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c

-----Decoded View---------------
Arg [0] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _otherToken (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [2] : _pathCount (uint256): 2
Arg [3] : _pathSplit (uint256): 2
Arg [4] : _factories (address[]): 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac,0x115934131916C8b277DD010Ee02de363c09d037c
Arg [5] : _switchViewAddress (address): 0x6B4AAFE0A2C03B223b73a681b544b1617A976CcB
Arg [6] : _switchEventAddress (address): 0x410f724847C92Bc3CdACBCD4922F1D7833Ec280A
Arg [7] : _paraswapProxy (address): 0x216B4B4Ba9F3e719726886d34a177484278Bfcae
Arg [8] : _augustusSwapper (address): 0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57
Arg [9] : _feeCollector (address): 0x28B9089b5f2724c1898E7dbb04a96C8C177fE46d

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 0000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb
Arg [6] : 000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a
Arg [7] : 000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae
Arg [8] : 000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57
Arg [9] : 00000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
Arg [12] : 000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac
Arg [13] : 000000000000000000000000115934131916c8b277dd010ee02de363c09d037c


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  ]
[ 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.