ETH Price: $2,636.66 (+0.19%)

Contract

0xf3c7390DBacb2632467Ade808c773581A9C13401
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap By Mx Bridg...180192672023-08-29 9:04:35530 days ago1693299875IN
0xf3c7390D...1A9C13401
0 ETH0.0073039116.9522554
Swap By Mx Bridg...177830322023-07-27 7:51:35563 days ago1690444295IN
0xf3c7390D...1A9C13401
0 ETH0.0088490520.54080172
Swap By Mx Bridg...174154722023-06-05 16:23:11615 days ago1685982191IN
0xf3c7390D...1A9C13401
0 ETH0.04577142145.83527976
Swap By Mx Bridg...173726142023-05-30 15:25:23621 days ago1685460323IN
0xf3c7390D...1A9C13401
0 ETH0.0178770956.96155566
Swap By Mx Bridg...173725532023-05-30 15:13:11621 days ago1685459591IN
0xf3c7390D...1A9C13401
0 ETH0.0153589259.8669347
Swap By Mx Bridg...173688202023-05-30 2:35:47621 days ago1685414147IN
0xf3c7390D...1A9C13401
0 ETH0.0074040223.58953367
Swap By Mx Bridg...173686992023-05-30 2:10:59621 days ago1685412659IN
0xf3c7390D...1A9C13401
0 ETH0.0101885432.46113623
Swap By Mx Bridg...173685422023-05-30 1:39:11621 days ago1685410751IN
0xf3c7390D...1A9C13401
0 ETH0.0073285223.34900009
Swap By Mx Bridg...173682772023-05-30 0:43:59621 days ago1685407439IN
0xf3c7390D...1A9C13401
0 ETH0.0074590223.76476637
Swap By Mx Bridg...173662712023-05-29 17:57:23622 days ago1685383043IN
0xf3c7390D...1A9C13401
0 ETH0.0092618833.77992812
Swap By Mx Bridg...173662532023-05-29 17:53:35622 days ago1685382815IN
0xf3c7390D...1A9C13401
0 ETH0.0099696331.76367902
Swap By Mx Bridg...173657242023-05-29 16:07:11622 days ago1685376431IN
0xf3c7390D...1A9C13401
0 ETH0.0203768964.92164457
Swap By Mx Bridg...173545742023-05-28 2:33:23623 days ago1685241203IN
0xf3c7390D...1A9C13401
0 ETH0.0073711623.85049814
Swap By Mx Bridg...173451472023-05-26 18:48:47624 days ago1685126927IN
0xf3c7390D...1A9C13401
0 ETH0.008807732.69584767
Swap By Mx Bridg...173448462023-05-26 17:47:47625 days ago1685123267IN
0xf3c7390D...1A9C13401
0 ETH0.0124849740.39857858
Swap By Mx Bridg...173447772023-05-26 17:33:59625 days ago1685122439IN
0xf3c7390D...1A9C13401
0 ETH0.0146352347.35263968
Swap By Mx Bridg...173445002023-05-26 16:37:47625 days ago1685119067IN
0xf3c7390D...1A9C13401
0 ETH0.0117557838.03758083
Swap By Mx Bridg...173380322023-05-25 18:47:23625 days ago1685040443IN
0xf3c7390D...1A9C13401
0 ETH0.0105247834.05318635
Swap By Mx Bridg...173377692023-05-25 17:54:23626 days ago1685037263IN
0xf3c7390D...1A9C13401
0 ETH0.0150349648.64596687
Swap By Mx Bridg...173361822023-05-25 12:33:23626 days ago1685018003IN
0xf3c7390D...1A9C13401
0 ETH0.0090658345.59313848
Swap By Mx Bridg...173361372023-05-25 12:24:23626 days ago1685017463IN
0xf3c7390D...1A9C13401
0 ETH0.0012132648.53059484
Swap By Mx Bridg...173334042023-05-25 3:10:23626 days ago1684984223IN
0xf3c7390D...1A9C13401
0 ETH0.0089162328.84980386
Swap By Mx Bridg...173331992023-05-25 2:29:23626 days ago1684981763IN
0xf3c7390D...1A9C13401
0 ETH0.0090691629.34350383
Swap By Mx Bridg...173329732023-05-25 1:43:47626 days ago1684979027IN
0xf3c7390D...1A9C13401
0 ETH0.0075146527.89706299
Swap By Mx Bridg...173329382023-05-25 1:36:47626 days ago1684978607IN
0xf3c7390D...1A9C13401
0 ETH0.0082290726.62537519
View all transactions

Latest 15 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
172761352023-05-17 1:34:47634 days ago1684287287
0xf3c7390D...1A9C13401
0.01 ETH
172733812023-05-16 16:15:47635 days ago1684253747
0xf3c7390D...1A9C13401
0.01 ETH
172732372023-05-16 15:46:35635 days ago1684251995
0xf3c7390D...1A9C13401
0.05 ETH
172240872023-05-09 16:29:59642 days ago1683649799
0xf3c7390D...1A9C13401
0.01 ETH
172193152023-05-09 0:24:35642 days ago1683591875
0xf3c7390D...1A9C13401
0.01 ETH
172189242023-05-08 23:05:47642 days ago1683587147
0xf3c7390D...1A9C13401
0.03 ETH
172128182023-05-08 2:31:11643 days ago1683513071
0xf3c7390D...1A9C13401
0.01 ETH
171392222023-04-27 18:13:35654 days ago1682619215
0xf3c7390D...1A9C13401
0.01 ETH
170897732023-04-20 19:32:11660 days ago1682019131
0xf3c7390D...1A9C13401
0.012 ETH
170366892023-04-13 5:32:47668 days ago1681363967
0xf3c7390D...1A9C13401
0.02 ETH
170333382023-04-12 17:16:11669 days ago1681319771
0xf3c7390D...1A9C13401
0.01 ETH
170287462023-04-12 1:43:23669 days ago1681263803
0xf3c7390D...1A9C13401
0.03 ETH
170286072023-04-12 1:14:59669 days ago1681262099
0xf3c7390D...1A9C13401
0.01 ETH
170258892023-04-11 15:59:59670 days ago1681228799
0xf3c7390D...1A9C13401
0.05 ETH
169977142023-04-07 16:12:47674 days ago1680883967
0xf3c7390D...1A9C13401
0.05 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SwitchMultiversX

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

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

import "../lib/DataTypes.sol";
import "../dexs/Switch.sol";
import "../interfaces/IMultiversXBridge.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract SwitchMultiversX is Switch {
  error TransferAmountZero();

  using UniversalERC20 for IERC20;
  using SafeERC20 for IERC20;

  address public mxBridgeGate;

  // for recipient param, multiverseX account address should be converedt to bytes32
  // multiversX https://docs.multiversx.com/developers/sc-calls-format/
  // https://slowli.github.io/bech32-buffer/
  struct SwapArgsMxBridge {
    address srcToken;
    address bridgeToken; // in general USDC
    bytes32 id;
    bytes32 bridge;
    bytes32 dstToken;
    bytes32 recipient;
    bytes permit;
    bytes srcParaswapData;
    uint256 amount;
    uint256 estimatedDstTokenAmount;
  }

  event SetMxBridgeGate(
    address indexed originalMxBridgeGate,
    address indexed newMxBridgeGate
  );

  constructor(
    address _weth,
    address _otherToken,
    uint256 _pathCount,
    uint256 _pathSplit,
    address[] memory _factories,
    address _switchViewAddress,
    address _switchEventAddress,
    address _paraswapProxy,
    address _augustusSwapper,
    address _mxBridgeGate
  )
    Switch(
      _weth,
      _otherToken,
      _pathCount,
      _pathSplit,
      _factories,
      _switchViewAddress,
      _switchEventAddress,
      _paraswapProxy,
      _augustusSwapper
    )
  {
    mxBridgeGate = _mxBridgeGate;
  }

  function setMxBridgeGate(address _mxBridgeGate) external onlyOwner {
    address tmp = mxBridgeGate;
    mxBridgeGate = _mxBridgeGate;
    emit SetMxBridgeGate(tmp, _mxBridgeGate);
  }

  function swapByMxBridge(
    SwapArgsMxBridge calldata transferArgs
  ) external payable nonReentrant {
    if (transferArgs.amount <= 0) revert TransferAmountZero();
    IERC20(transferArgs.srcToken).universalTransferFrom(
      msg.sender,
      address(this),
      transferArgs.amount
    );

    uint256 bridgeAmount = transferArgs.amount;
    if (transferArgs.srcToken != transferArgs.bridgeToken) {
      bridgeAmount = _swapInternalWithParaSwap(
        IERC20(transferArgs.srcToken),
        IERC20(transferArgs.bridgeToken),
        bridgeAmount,
        transferArgs.srcParaswapData
      );
    }

    IERC20(transferArgs.bridgeToken).universalApprove(mxBridgeGate, bridgeAmount);

    IMultiversXBridge(mxBridgeGate).deposit(
      transferArgs.bridgeToken,
      bridgeAmount,
      transferArgs.recipient
    );

    _emitCrossChainSwapRequest(transferArgs, bridgeAmount, msg.sender);
  }

  function _emitCrossChainSwapRequest(
    SwapArgsMxBridge calldata transferArgs,
    uint256 returnAmount,
    address sender
  ) internal {
    switchEvent.emitCrosschainSwapRequestForNonEVM(
      transferArgs.id,
      bytes32(0),
      transferArgs.bridge,
      sender,
      transferArgs.srcToken,
      transferArgs.bridgeToken,
      transferArgs.dstToken, // placeholder as multiversX uses bech32
      transferArgs.amount,
      returnAmount,
      transferArgs.estimatedDstTokenAmount,
      DataTypes.SwapStatus.Succeeded
    );
  }
}

File 2 of 21 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _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 21 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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;
    }
}

File 4 of 21 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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 21 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-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;

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

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

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

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

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

    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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 7 of 21 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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
     * ====
     *
     * [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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

    ISwitchView public switchView;
    ISwitchEvent public switchEvent;
    address public reward;
    address private paraswapProxy;
    address private augustusSwapper;
    address public tradeFeeReceiver;
    uint256 public tradeFeeRate;
    mapping (address => uint256) public partnerFeeRates;

    uint256 public constant FEE_BASE = 10000;

    event RewardSet(address reward);
    event SwitchEventSet(address switchEvent);
    event SwitchViewSet(address switchView);
    event PartnerFeeSet(address partner, uint256 feeRate);
    event TradeFeeSet(uint256 tradeFee);
    event TradeFeeReceiverSet(address tradeFeeReceiver);
    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
    ) SwitchRoot(_weth, _otherToken, _pathCount, _pathSplit, _factories)
        public
    {
        switchView = ISwitchView(_switchViewAddress);
        switchEvent = ISwitchEvent(_switchEventAddress);
        paraswapProxy = _paraswapProxy;
        augustusSwapper = _augustusSwapper;
        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 setSwitchEvent(address _switchEvent) external onlyOwner {
        switchEvent = ISwitchEvent(_switchEvent);
        emit SwitchEventSet(_switchEvent);
    }

    function setSwitchView(address _switchView) external onlyOwner {
        switchView = ISwitchView(_switchView);
        emit SwitchViewSet(_switchView);
    }

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

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

    function setPartnerFeeRate(address _partner, uint256 _feeRate) external onlyOwner {
        partnerFeeRates[_partner] = _feeRate;
        emit PartnerFeeSet(_partner, _feeRate);
    }

    function setTradeFeeRate(uint256 _tradeFeeRate) external onlyOwner {
        tradeFeeRate = _tradeFeeRate;
        emit TradeFeeSet(_tradeFeeRate);
    }

    function setTradeFeeReceiver(address _tradeFeeReceiver) external onlyOwner {
        tradeFeeReceiver = _tradeFeeReceiver;
        emit TradeFeeReceiverSet(_tradeFeeReceiver);
    }

    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(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 expectedReturn,
        uint256 minReturn,
        address recipient,
        uint256[] memory distribution
    )
        public
        payable
        nonReentrant
        returns (uint256 returnAmount)
    {
        require(expectedReturn >= minReturn, "expectedReturn must be equal or larger than minReturn");
        if (fromToken == destToken) {
            revert("it's not allowed to swap with same token");
        }

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

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

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

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

    function swapWithParaswap(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 destAmount,
        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);
        _callParaswap(fromToken, amount, callData);
        switchEvent.emitSwapped(msg.sender, recipient, fromToken, destToken, amount, destAmount, 0);
    }

    function getFeeInfo(
        uint256 amount,
        address partner
    )
        public
        view
        returns (
            uint256 tradeRate,
            uint256 partnerFeeRate,
            uint256 tradeFee,
            uint256 partnerFee,
            uint256 remainAmount
        )
    {
        tradeRate = tradeFeeRate;
        tradeFee = 0;
        partnerFeeRate = partnerFeeRates[partner];
        partnerFee = 0;
        if (tradeFeeRate > 0) {
            tradeFee = tradeFeeRate * amount / FEE_BASE;
        }
        if (partnerFeeRates[partner] > 0) {
            partnerFee = partnerFeeRates[partner] * amount / FEE_BASE;
        }
        remainAmount = amount - tradeFee - partnerFee;
    }

    function getTradeFee(
        uint256 amount
    )
        public
        view
        returns (
            uint256 feeRate,
            uint256 tradeFee,
            uint256 remainAmount
        )
    {
        feeRate = tradeFeeRate;
        tradeFee = 0;
        if (tradeFeeRate > 0) {
            tradeFee = tradeFeeRate * amount / FEE_BASE;
        }
        remainAmount = amount - tradeFee;
    }

    function getPartnerFee(
        uint256 amount,
        address partner
    )
        public
        view
        returns (
            uint256 feeRate,
            uint256 partnerFee,
            uint256 remainAmount
        )
    {
        feeRate = partnerFeeRates[partner];
        partnerFee = 0;
        if (partnerFeeRates[partner] > 0) {
            partnerFee = partnerFeeRates[partner] * amount / FEE_BASE;
        }
        remainAmount = amount - partnerFee;
    }

    function _swapInternalWithParaSwap(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        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));
        switchEvent.emitSwapped(msg.sender, address(this), 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
    )
        internal
        returns (
            uint256 amountAfterFee
        )
    {
        amountAfterFee = amount;
        if (tradeFeeRate > 0) {
            token.universalTransfer(tradeFeeReceiver, tradeFeeRate * amount / FEE_BASE);
            amountAfterFee = amount - tradeFeeRate * amount / FEE_BASE;
        }
        if (partnerFeeRates[partner] > 0) {
            token.universalTransfer(partner, partnerFeeRates[partner] * amount / FEE_BASE);
            amountAfterFee = amount - partnerFeeRates[partner] * 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 13 of 21 : IMultiversXBridge.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;

interface IMultiversXBridge {
  function deposit(address token, uint256 amount, bytes32 dstAddress) external;
}

File 14 of 21 : 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 emitCrosschainSwapRequestForNonEVM(
        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
        bytes32 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 emitCrosschainDepositRequest(
        bytes32 id,
        bytes32 bridgeTransferId,
        bytes32 bridge, // bridge slug
        address from, // user address
        address depositContract, // contract address for deposit
        address toApprovalAddress, // the approval address for deposit
        address fromToken, // source token on sending chain
        address depositToken, // dest token on receiving chain
        uint256 fromAmount, // source token amount on sending chain
        uint256 depositAmount, // estimated amount of dest token on receiving chain
        DataTypes.DepositStatus 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 emitCrosschainDepositDone(
        bytes32 id,
        bytes32 bridge,
        address from, // user address
        address depositContract, // contract address for deposit
        address toApprovalAddress, // the approval address for deposit
        address bridgeToken, // source token on receiving chain
        address depositToken, // dest token on receiving chain
        uint256 bridgeAmount, // bridge token amount on receiving chain
        uint256 depositAmount, //dest token amount on receiving chain
        DataTypes.DepositStatus status
    ) external;
}

File 15 of 21 : 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 16 of 21 : 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 17 of 21 : 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 DepositStatus {
        Null,
        Succeeded,
        Failed,
        Fallback
    }

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

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

File 18 of 21 : 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 19 of 21 : 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 20 of 21 : 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 21 of 21 : 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 < amount) {
                token.safeIncreaseAllowance(to, amount - approvedAmount);
            } else if (approvedAmount > amount) {
                token.safeDecreaseAllowance(to, approvedAmount - 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

[{"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":"_mxBridgeGate","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"TransferAmountZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"augustusSwapper","type":"address"}],"name":"AugustusSwapperSet","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":"_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":"address","name":"partner","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeRate","type":"uint256"}],"name":"PartnerFeeSet","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":true,"internalType":"address","name":"originalMxBridgeGate","type":"address"},{"indexed":true,"internalType":"address","name":"newMxBridgeGate","type":"address"}],"name":"SetMxBridgeGate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"switchEvent","type":"address"}],"name":"SwitchEventSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"switchView","type":"address"}],"name":"SwitchViewSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tradeFeeReceiver","type":"address"}],"name":"TradeFeeReceiverSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tradeFee","type":"uint256"}],"name":"TradeFeeSet","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":"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":[{"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"}],"name":"getFeeInfo","outputs":[{"internalType":"uint256","name":"tradeRate","type":"uint256"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"uint256","name":"tradeFee","type":"uint256"},{"internalType":"uint256","name":"partnerFee","type":"uint256"},{"internalType":"uint256","name":"remainAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"partner","type":"address"}],"name":"getPartnerFee","outputs":[{"internalType":"uint256","name":"feeRate","type":"uint256"},{"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":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getTradeFee","outputs":[{"internalType":"uint256","name":"feeRate","type":"uint256"},{"internalType":"uint256","name":"tradeFee","type":"uint256"},{"internalType":"uint256","name":"remainAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mxBridgeGate","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[{"internalType":"address","name":"","type":"address"}],"name":"partnerFeeRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address[]","name":"_factories","type":"address[]"}],"name":"setFactories","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_mxBridgeGate","type":"address"}],"name":"setMxBridgeGate","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":"address","name":"_partner","type":"address"},{"internalType":"uint256","name":"_feeRate","type":"uint256"}],"name":"setPartnerFeeRate","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":"address","name":"_switchEvent","type":"address"}],"name":"setSwitchEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_switchView","type":"address"}],"name":"setSwitchView","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tradeFeeRate","type":"uint256"}],"name":"setTradeFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tradeFeeReceiver","type":"address"}],"name":"setTradeFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"name":"setWETH","outputs":[],"stateMutability":"nonpayable","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":"expectedReturn","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"bridgeToken","type":"address"},{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"bytes32","name":"bridge","type":"bytes32"},{"internalType":"bytes32","name":"dstToken","type":"bytes32"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"bytes","name":"srcParaswapData","type":"bytes"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"estimatedDstTokenAmount","type":"uint256"}],"internalType":"struct SwitchMultiversX.SwapArgsMxBridge","name":"transferArgs","type":"tuple"}],"name":"swapByMxBridge","outputs":[],"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":"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":[],"name":"tradeFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradeFeeReceiver","outputs":[{"internalType":"address","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"}]

6080604052600180546001600160a01b031990811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee179091556002805490911690553480156200004357600080fd5b506040516200388738038062003887833981016040819052620000669162000240565b89898989898989898988888888886200007f33620001bd565b600680546001600160a01b038088166001600160a01b031992831617909255600780549287169290911691909117905560048390556005829055805160035560005b815181101562000132576008828281518110620000e257620000e2620003b5565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806200012981620003cb565b915050620000c1565b505060016009555050600a80546001600160a01b03199081166001600160a01b0398891617909155600b80548216968816969096179095555050600d8054841692851692909217909155600e80548316918416919091179055600c80543390831617905560128054909116979091169690961790955550620003f59c50505050505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200022557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b6000806000806000806000806000806101408b8d0312156200026157600080fd5b6200026c8b6200020d565b99506200027c60208c016200020d565b60408c015160608d015160808e0151929b5090995097506001600160401b0380821115620002a957600080fd5b818d0191508d601f830112620002be57600080fd5b815181811115620002d357620002d36200022a565b604051601f19603f8360051b011681018181108482111715620002fa57620002fa6200022a565b6040528181526020808201935060059290921b8401909101908f8211156200032157600080fd5b6020840193505b818410156200034e576200033c846200020d565b83526020938401939092019162000328565b9850620003629250505060a08c016200020d565b94506200037260c08c016200020d565b93506200038260e08c016200020d565b9250620003936101008c016200020d565b9150620003a46101208c016200020d565b90509295989b9194979a5092959850565b634e487b7160e01b600052603260045260246000fd5b6000600019821415620003ee57634e487b7160e01b600052601160045260246000fd5b5060010190565b61348280620004056000396000f3fe6080604052600436106102515760003560e01c806390f3f20811610139578063b4c76fe0116100b6578063e8984c5f1161007a578063e8984c5f1461070d578063ea15afc31461072d578063ecefc7051461074d578063f2fde38b14610763578063f640d50814610783578063fd5763ed146107a357610251565b8063b4c76fe01461067a578063b9d52d3c1461069a578063bbe8caa2146106ba578063c047b967146106cd578063e5932c40146106ed57610251565b8063a85f3298116100fd578063a85f3298146105bc578063aa64b6b6146105dc578063aab6344214610624578063ab30469514610644578063b093ea3d1461065a57610251565b806390f3f208146104fe5780639eb3386214610514578063a25ba2721461054f578063a35098491461057c578063a734f06e1461059c57610251565b80634399fa56116101d25780636076a0b4116101965780636076a0b414610451578063672383c41461047f5780636b04b9cf1461049f578063715018a6146104b55780638c821e90146104ca5780638da5cb5b146104e057610251565b80634399fa56146103be578063538ba4f9146103de57806353fd7bf1146103fe5780635b769f3c1461041e578063606354a21461043e57610251565b806331428a871161021957806331428a871461031e5780633aecd0e31461033e5780633fc8cef31461035e57806341a50aff1461037e578063433b3c051461039e57610251565b806312e4a6d914610260578063228cb7331461028657806323a9495e146102be57806327223658146102de5780632730d1f9146102fe575b3332141561025e57600080fd5b005b61027361026e366004612bfa565b6107c3565b6040519081526020015b60405180910390f35b34801561029257600080fd5b50600c546102a6906001600160a01b031681565b6040516001600160a01b03909116815260200161027d565b3480156102ca57600080fd5b5061025e6102d9366004612ce7565b610b50565b3480156102ea57600080fd5b506012546102a6906001600160a01b031681565b34801561030a57600080fd5b5061025e610319366004612ce7565b610b94565b34801561032a57600080fd5b50600a546102a6906001600160a01b031681565b34801561034a57600080fd5b50610273610359366004612d00565b610bd1565b34801561036a57600080fd5b506006546102a6906001600160a01b031681565b34801561038a57600080fd5b5061025e610399366004612d00565b610bf4565b3480156103aa57600080fd5b506007546102a6906001600160a01b031681565b3480156103ca57600080fd5b50600b546102a6906001600160a01b031681565b3480156103ea57600080fd5b506002546102a6906001600160a01b031681565b34801561040a57600080fd5b5061025e610419366004612d00565b610c4a565b34801561042a57600080fd5b5061025e610439366004612d00565b610ca0565b61025e61044c366004612d1d565b610cf6565b34801561045d57600080fd5b5061047161046c366004612d59565b610ec7565b60405161027d929190612d9f565b34801561048b57600080fd5b506102a661049a366004612ce7565b610f70565b3480156104ab57600080fd5b5061027360105481565b3480156104c157600080fd5b5061025e610f9a565b3480156104d657600080fd5b5061027360045481565b3480156104ec57600080fd5b506000546001600160a01b03166102a6565b34801561050a57600080fd5b5061027360055481565b34801561052057600080fd5b5061053461052f366004612ce7565b610fae565b6040805193845260208401929092529082015260600161027d565b34801561055b57600080fd5b5061027361056a366004612d00565b60116020526000908152604090205481565b34801561058857600080fd5b5061025e610597366004612d00565b610fea565b3480156105a857600080fd5b506001546102a6906001600160a01b031681565b3480156105c857600080fd5b5061025e6105d7366004612ce7565b611044565b3480156105e857600080fd5b506105fc6105f7366004612ded565b611081565b604080519586526020860194909452928401919091526060830152608082015260a00161027d565b34801561063057600080fd5b5061025e61063f366004612e1d565b611138565b34801561065057600080fd5b5061027360035481565b34801561066657600080fd5b5061025e610675366004612d00565b611198565b34801561068657600080fd5b5061025e610695366004612d00565b6111ee565b3480156106a657600080fd5b5061025e6106b5366004612d00565b611244565b61025e6106c8366004612e49565b61129a565b3480156106d957600080fd5b50600f546102a6906001600160a01b031681565b3480156106f957600080fd5b5061025e610708366004612d00565b611375565b34801561071957600080fd5b5061025e610728366004612d00565b6113cb565b34801561073957600080fd5b5061025e610748366004612f28565b611421565b34801561075957600080fd5b5061027361271081565b34801561076f57600080fd5b5061025e61077e366004612d00565b6114cb565b34801561078f57600080fd5b5061025e61079e366004612fb7565b611541565b3480156107af57600080fd5b506105346107be366004612ded565b611563565b60006107cd6115cc565b838510156108405760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b60648201526084015b60405180910390fd5b866001600160a01b0316886001600160a01b031614156108725760405162461bcd60e51b815260040161083790612ff9565b60008060005b84518110156108e057600085828151811061089557610895613041565b602002602001015111156108ce578481815181106108b5576108b5613041565b6020026020010151836108c8919061306d565b92508091505b806108d881613085565b915050610878565b508161093e576108f88a6001600160a01b0316611626565b156109345760405133903480156108fc02916000818181858888f19350505050158015610929573d6000803e3d6000fd5b503492505050610b3b565b8792505050610b3b565b6109536001600160a01b038b1633308b61165f565b610961848984848e8e611751565b92508215610ada57858310156109c55760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610837565b86831115610a88576109e16001600160a01b038a168689611981565b50600c54610a0d906001600160a01b03166109fc89866130a0565b6001600160a01b038c169190611981565b50600b546001600160a01b031663391fdc2433878d8d8d8d610a2f818c6130a0565b6040518863ffffffff1660e01b8152600401610a5197969594939291906130b7565b600060405180830381600087803b158015610a6b57600080fd5b505af1158015610a7f573d6000803e3d6000fd5b50505050610b38565b610a9c6001600160a01b038a168685611981565b50600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc2490610a5190339089908f908f908f908b906000906004016130b7565b87610aee6001600160a01b038c16306119fd565b1115610b0e57610b086001600160a01b038b16338a611981565b50610b38565b610b3633610b256001600160a01b038d16306119fd565b6001600160a01b038d169190611981565b505b50505b610b456001600955565b979650505050505050565b610b58611a97565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b610b9c611a97565b60108190556040518181527f1ce638f7798b6e448ecff4c806c7c01d3fedb23354b03f03994f5161b12bad6290602001610b89565b6000610bdb611a97565b610bee6001600160a01b038316306119fd565b92915050565b610bfc611a97565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527fdbb52d2fa1eb07f3cd614ab9d25e4e2e7c4bdbd87c42d7cbdb01f47c87798e0090602001610b89565b610c52611a97565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610b89565b610ca8611a97565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610b89565b610cfe6115cc565b600081610100013511610d24576040516329a1e53760e01b815260040160405180910390fd5b610d4d3330610100840135610d3c6020860186612d00565b6001600160a01b031692919061165f565b610100810135610d636040830160208401612d00565b6001600160a01b0316610d796020840184612d00565b6001600160a01b031614610df257610def610d976020840184612d00565b610da76040850160208601612d00565b83610db560e08701876130fb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611af192505050565b90505b601254610e23906001600160a01b031682610e136040860160208701612d00565b6001600160a01b03169190611bbb565b6012546001600160a01b03166326b3293f610e446040850160208601612d00565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810184905260a08501356044820152606401600060405180830381600087803b158015610e9657600080fd5b505af1158015610eaa573d6000803e3d6000fd5b50505050610eb9828233611cba565b50610ec46001600955565b50565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b158015610f2757600080fd5b505afa158015610f3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f639190810190613149565b9097909650945050505050565b60088181548110610f8057600080fd5b6000918252602090912001546001600160a01b0316905081565b610fa2611a97565b610fac6000611d66565b565b6010546000808215610fd85761271084601054610fcb91906131e6565b610fd5919061321b565b91505b610fe282856130a0565b929491935050565b610ff2611a97565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5f6b12132015daadd6cc667dddf38dae7caa14bd5e83de49ea0a2b1f966e28e190600090a35050565b61104c611a97565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610b89565b6010546001600160a01b03821660009081526011602052604081205490808084156110c457612710876010546110b791906131e6565b6110c1919061321b565b92505b6001600160a01b03861660009081526011602052604090205415611117576001600160a01b0386166000908152601160205260409020546127109061110a9089906131e6565b611114919061321b565b91505b8161112284896130a0565b61112c91906130a0565b90509295509295909350565b611140611a97565b6001600160a01b038216600081815260116020908152604091829020849055815192835282018390527faa250df52ec091332afeb1962e6f687f71cbd33df714ef26cce6b8e6fc21b798910160405180910390a15050565b6111a0611a97565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1cdc2c4f610a09b40b373d300776d6c11f3032b5036fce4447ea1600cef941c690602001610b89565b6111f6611a97565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610b89565b61124c611a97565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc29290602001610b89565b6112a26115cc565b846001600160a01b0316866001600160a01b031614156112d45760405162461bcd60e51b815260040161083790612ff9565b6112e96001600160a01b03871633308761165f565b6112f4868583611db6565b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061133190339086908b908b908b908b906000906004016130b7565b600060405180830381600087803b15801561134b57600080fd5b505af115801561135f573d6000803e3d6000fd5b5050505061136d6001600955565b505050505050565b61137d611a97565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610b89565b6113d3611a97565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b90602001610b89565b611429611a97565b805160035560005b815181101561149b57600882828151811061144e5761144e613041565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b039092169190911790558061149381613085565b915050611431565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d381604051610b89919061322f565b6114d3611a97565b6001600160a01b0381166115385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610837565b610ec481611d66565b611549611a97565b61155d6001600160a01b0384168284611981565b50505050565b6001600160a01b038116600090815260116020526040812054908082156115b9576001600160a01b038416600090815260116020526040902054612710906115ac9087906131e6565b6115b6919061321b565b91505b6115c382866130a0565b90509250925092565b6002600954141561161f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610837565b6002600955565b60006001600160a01b0382161580610bee57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b806116695761155d565b61167284611626565b1561173c576001600160a01b0383163314801561168f5750803410155b6116ef5760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610837565b6001600160a01b0382163014611737576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611735573d6000803e3d6000fd5b505b61155d565b61155d6001600160a01b038516848484611efa565b600060045460035461176391906131e6565b875111156117e35760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610837565b856000805b89518110156119745789818151811061180357611803613041565b60200260200101516000141561181857611962565b6000888b838151811061182d5761182d613041565b60200260200101518b61184091906131e6565b61184a919061321b565b9050878214156118575750825b61186181856130a0565b935060045482611871919061327c565b6118bc576118b587878360086004548761188b919061321b565b8154811061189b5761189b613041565b6000918252602090912001546001600160a01b0316611f65565b9250611954565b6004546118c9908361327c565b60011415611911576118b58787836008600454876118e7919061321b565b815481106118f7576118f7613041565b6000918252602090912001546001600160a01b0316611f7c565b611951878783600860045487611927919061321b565b8154811061193757611937613041565b6000918252602090912001546001600160a01b0316611f99565b92505b61195e838661306d565b9450505b8061196c81613085565b9150506117e8565b5050509695505050505050565b600081611990575060016119f6565b61199984611626565b156119de576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156119d4573d6000803e3d6000fd5b50600190506119f6565b6119f26001600160a01b0385168484611fb6565b5060015b9392505050565b6000611a0883611626565b15611a1e57506001600160a01b03811631610bee565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b158015611a5f57600080fd5b505afa158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f69190613290565b6000546001600160a01b03163314610fac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610837565b6000836001600160a01b0316856001600160a01b03161415611b255760405162461bcd60e51b815260040161083790612ff9565b611b30858484611db6565b611b436001600160a01b038516306119fd565b600b54604051630e47f70960e21b81529192506001600160a01b03169063391fdc2490611b8190339030908a908a908a9089906000906004016130b7565b600060405180830381600087803b158015611b9b57600080fd5b505af1158015611baf573d6000803e3d6000fd5b50505050949350505050565b611bc483611626565b611be25780611be757611be26001600160a01b038416836000611fe6565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015611c3257600080fd5b505afa158015611c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6a9190613290565b905081811015611c935761173783611c8283856130a0565b6001600160a01b038716919061210a565b8181111561155d5761155d83611ca984846130a0565b6001600160a01b03871691906121cb565b600b546001600160a01b031663a77773a660408501356000606087013585611ce560208a018a612d00565b611cf560408b0160208c01612d00565b8a608001358b61010001358b8d610120013560016040518c63ffffffff1660e01b8152600401611d2f9b9a999897969594939291906132a9565b600060405180830381600087803b158015611d4957600080fd5b505af1158015611d5d573d6000803e3d6000fd5b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611dca846001600160a01b0316611626565b15611e265782471015611e1f5760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610837565b5081611e40565b600d54611e40906001600160a01b03868116911685611bbb565b600e546040516000916001600160a01b0316908390611e6090869061335d565b60006040518083038185875af1925050503d8060008114611e9d576040519150601f19603f3d011682016040523d82523d6000602084013e611ea2565b606091505b5050905080611ef35760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610837565b5050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261155d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122e6565b6000611f73858585856123b8565b95945050505050565b600654600090611f739086906001600160a01b0316868686612824565b600754600090611f739086906001600160a01b0316868686612824565b6040516001600160a01b038316602482015260448101829052611be290849063a9059cbb60e01b90606401611f2e565b80158061206f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561203557600080fd5b505afa158015612049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206d9190613290565b155b6120da5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610837565b6040516001600160a01b038316602482015260448101829052611be290849063095ea7b360e01b90606401611f2e565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561215657600080fd5b505afa15801561216a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218e9190613290565b612198919061306d565b6040516001600160a01b03851660248201526044810182905290915061155d90859063095ea7b360e01b90606401611f2e565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561221657600080fd5b505afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224e9190613290565b9050818110156122b25760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b6064820152608401610837565b6040516001600160a01b03841660248201528282036044820181905290611ef390869063095ea7b360e01b90606401611f2e565b600061233b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128479092919063ffffffff16565b805190915015611be257808060200190518101906123599190613379565b611be25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610837565b60006123cc856001600160a01b0316611626565b1561243b57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561242157600080fd5b505af1158015612435573d6000803e3d6000fd5b50505050505b600061244f866001600160a01b0316611626565b6124595785612466565b6006546001600160a01b03165b9050600061247c866001600160a01b0316611626565b6124865785612493565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b1580156124e257600080fd5b505afa1580156124f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251a919061339b565b90506000806125346001600160a01b03841686868b61285e565b91975092509050811561259957826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561257c57600080fd5b505af1158015612590573d6000803e3d6000fd5b5050505061260d565b801561260d5760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b1580156125f457600080fd5b505af1158015612608573d6000803e3d6000fd5b505050505b6126216001600160a01b038616848a611981565b50836001600160a01b0316856001600160a01b031610156126b65760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561269957600080fd5b505af11580156126ad573d6000803e3d6000fd5b5050505061272c565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561271357600080fd5b505af1158015612727573d6000803e3d6000fd5b505050505b61273e896001600160a01b0316611626565b15612817576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b15801561278e57600080fd5b505afa1580156127a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c69190613290565b6040518263ffffffff1660e01b81526004016127e491815260200190565b600060405180830381600087803b1580156127fe57600080fd5b505af1158015612812573d6000803e3d6000fd5b505050505b5050505050949350505050565b600061283d8585612837898988886123b8565b856123b8565b9695505050505050565b606061285684846000856129f9565b949350505050565b60008080806128766001600160a01b038816896119fd565b9050600061288d6001600160a01b0388168a6119fd565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290391906133d4565b5091509150886001600160a01b03168a6001600160a01b0316111561292457905b816001600160701b03168410806129435750806001600160701b031683105b95508515801561296d5750816001600160701b031684118061296d5750806001600160701b031683115b9450600061297d896103e56131e6565b9050600061299485846001600160701b0316612ac9565b61299e90836131e6565b90506000826129b688876001600160701b0316612ac9565b6129c2906103e86131e6565b6129cc919061306d565b905080156129e3576129de818361321b565b6129e6565b60005b9950505050505050509450945094915050565b606082471015612a5a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610837565b600080866001600160a01b03168587604051612a76919061335d565b60006040518083038185875af1925050503d8060008114612ab3576040519150601f19603f3d011682016040523d82523d6000602084013e612ab8565b606091505b5091509150610b4587838387612adf565b6000818310612ad857816119f6565b5090919050565b60608315612b4b578251612b44576001600160a01b0385163b612b445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610837565b5081612856565b6128568383815115612b605781518083602001fd5b8060405162461bcd60e51b81526004016108379190613419565b6001600160a01b0381168114610ec457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612bce57612bce612b8f565b604052919050565b600067ffffffffffffffff821115612bf057612bf0612b8f565b5060051b60200190565b600080600080600080600060e0888a031215612c1557600080fd5b8735612c2081612b7a565b9650602088810135612c3181612b7a565b965060408901359550606089013594506080890135935060a0890135612c5681612b7a565b925060c089013567ffffffffffffffff811115612c7257600080fd5b8901601f81018b13612c8357600080fd5b8035612c96612c9182612bd6565b612ba5565b81815260059190911b8201830190838101908d831115612cb557600080fd5b928401925b82841015612cd357833582529284019290840190612cba565b809550505050505092959891949750929550565b600060208284031215612cf957600080fd5b5035919050565b600060208284031215612d1257600080fd5b81356119f681612b7a565b600060208284031215612d2f57600080fd5b813567ffffffffffffffff811115612d4657600080fd5b820161014081850312156119f657600080fd5b60008060008060808587031215612d6f57600080fd5b8435612d7a81612b7a565b93506020850135612d8a81612b7a565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015612de057845183529383019391830191600101612dc4565b5090979650505050505050565b60008060408385031215612e0057600080fd5b823591506020830135612e1281612b7a565b809150509250929050565b60008060408385031215612e3057600080fd5b8235612e3b81612b7a565b946020939093013593505050565b60008060008060008060c08789031215612e6257600080fd5b8635612e6d81612b7a565b9550602087810135612e7e81612b7a565b955060408801359450606088013593506080880135612e9c81612b7a565b925060a088013567ffffffffffffffff80821115612eb957600080fd5b818a0191508a601f830112612ecd57600080fd5b813581811115612edf57612edf612b8f565b612ef1601f8201601f19168501612ba5565b91508082528b84828501011115612f0757600080fd5b80848401858401376000848284010152508093505050509295509295509295565b60006020808385031215612f3b57600080fd5b823567ffffffffffffffff811115612f5257600080fd5b8301601f81018513612f6357600080fd5b8035612f71612c9182612bd6565b81815260059190911b82018301908381019087831115612f9057600080fd5b928401925b82841015610b45578335612fa881612b7a565b82529284019290840190612f95565b600080600060608486031215612fcc57600080fd5b8335612fd781612b7a565b9250602084013591506040840135612fee81612b7a565b809150509250925092565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561308057613080613057565b500190565b600060001982141561309957613099613057565b5060010190565b6000828210156130b2576130b2613057565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000808335601e1984360301811261311257600080fd5b83018035915067ffffffffffffffff82111561312d57600080fd5b60200191503681900382131561314257600080fd5b9250929050565b6000806040838503121561315c57600080fd5b8251915060208084015167ffffffffffffffff81111561317b57600080fd5b8401601f8101861361318c57600080fd5b805161319a612c9182612bd6565b81815260059190911b820183019083810190888311156131b957600080fd5b928401925b828410156131d7578351825292840192908401906131be565b80955050505050509250929050565b600081600019048311821515161561320057613200613057565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261322a5761322a613205565b500490565b6020808252825182820181905260009190848201906040850190845b818110156132705783516001600160a01b03168352928401929184019160010161324b565b50909695505050505050565b60008261328b5761328b613205565b500690565b6000602082840312156132a257600080fd5b5051919050565b8b8152602081018b9052604081018a90526001600160a01b0389811660608301528881166080830152871660a082015260c0810186905260e081018590526101008101849052610120810183905261016081016004831061331a57634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b60005b8381101561334c578181015183820152602001613334565b8381111561155d5750506000910152565b6000825161336f818460208701613331565b9190910192915050565b60006020828403121561338b57600080fd5b815180151581146119f657600080fd5b6000602082840312156133ad57600080fd5b81516119f681612b7a565b80516001600160701b03811681146133cf57600080fd5b919050565b6000806000606084860312156133e957600080fd5b6133f2846133b8565b9250613400602085016133b8565b9150604084015163ffffffff81168114612fee57600080fd5b6020815260008251806020840152613438816040850160208701613331565b601f01601f1916919091016040019291505056fea26469706673582212206a79bc6e1f51c728e0850ce8f928ff3a958321b055784ea5a33824d808c04c8864736f6c63430008090033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000140000000000000000000000000652073f67c83096eb2a5052c35e1a9fa1d3550f5000000000000000000000000ed7f63ef67ccbb9b33682d334182ef50abd68426000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000092a26975433a61cf1134802586aa669bab8b69f300000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c

Deployed Bytecode

0x6080604052600436106102515760003560e01c806390f3f20811610139578063b4c76fe0116100b6578063e8984c5f1161007a578063e8984c5f1461070d578063ea15afc31461072d578063ecefc7051461074d578063f2fde38b14610763578063f640d50814610783578063fd5763ed146107a357610251565b8063b4c76fe01461067a578063b9d52d3c1461069a578063bbe8caa2146106ba578063c047b967146106cd578063e5932c40146106ed57610251565b8063a85f3298116100fd578063a85f3298146105bc578063aa64b6b6146105dc578063aab6344214610624578063ab30469514610644578063b093ea3d1461065a57610251565b806390f3f208146104fe5780639eb3386214610514578063a25ba2721461054f578063a35098491461057c578063a734f06e1461059c57610251565b80634399fa56116101d25780636076a0b4116101965780636076a0b414610451578063672383c41461047f5780636b04b9cf1461049f578063715018a6146104b55780638c821e90146104ca5780638da5cb5b146104e057610251565b80634399fa56146103be578063538ba4f9146103de57806353fd7bf1146103fe5780635b769f3c1461041e578063606354a21461043e57610251565b806331428a871161021957806331428a871461031e5780633aecd0e31461033e5780633fc8cef31461035e57806341a50aff1461037e578063433b3c051461039e57610251565b806312e4a6d914610260578063228cb7331461028657806323a9495e146102be57806327223658146102de5780632730d1f9146102fe575b3332141561025e57600080fd5b005b61027361026e366004612bfa565b6107c3565b6040519081526020015b60405180910390f35b34801561029257600080fd5b50600c546102a6906001600160a01b031681565b6040516001600160a01b03909116815260200161027d565b3480156102ca57600080fd5b5061025e6102d9366004612ce7565b610b50565b3480156102ea57600080fd5b506012546102a6906001600160a01b031681565b34801561030a57600080fd5b5061025e610319366004612ce7565b610b94565b34801561032a57600080fd5b50600a546102a6906001600160a01b031681565b34801561034a57600080fd5b50610273610359366004612d00565b610bd1565b34801561036a57600080fd5b506006546102a6906001600160a01b031681565b34801561038a57600080fd5b5061025e610399366004612d00565b610bf4565b3480156103aa57600080fd5b506007546102a6906001600160a01b031681565b3480156103ca57600080fd5b50600b546102a6906001600160a01b031681565b3480156103ea57600080fd5b506002546102a6906001600160a01b031681565b34801561040a57600080fd5b5061025e610419366004612d00565b610c4a565b34801561042a57600080fd5b5061025e610439366004612d00565b610ca0565b61025e61044c366004612d1d565b610cf6565b34801561045d57600080fd5b5061047161046c366004612d59565b610ec7565b60405161027d929190612d9f565b34801561048b57600080fd5b506102a661049a366004612ce7565b610f70565b3480156104ab57600080fd5b5061027360105481565b3480156104c157600080fd5b5061025e610f9a565b3480156104d657600080fd5b5061027360045481565b3480156104ec57600080fd5b506000546001600160a01b03166102a6565b34801561050a57600080fd5b5061027360055481565b34801561052057600080fd5b5061053461052f366004612ce7565b610fae565b6040805193845260208401929092529082015260600161027d565b34801561055b57600080fd5b5061027361056a366004612d00565b60116020526000908152604090205481565b34801561058857600080fd5b5061025e610597366004612d00565b610fea565b3480156105a857600080fd5b506001546102a6906001600160a01b031681565b3480156105c857600080fd5b5061025e6105d7366004612ce7565b611044565b3480156105e857600080fd5b506105fc6105f7366004612ded565b611081565b604080519586526020860194909452928401919091526060830152608082015260a00161027d565b34801561063057600080fd5b5061025e61063f366004612e1d565b611138565b34801561065057600080fd5b5061027360035481565b34801561066657600080fd5b5061025e610675366004612d00565b611198565b34801561068657600080fd5b5061025e610695366004612d00565b6111ee565b3480156106a657600080fd5b5061025e6106b5366004612d00565b611244565b61025e6106c8366004612e49565b61129a565b3480156106d957600080fd5b50600f546102a6906001600160a01b031681565b3480156106f957600080fd5b5061025e610708366004612d00565b611375565b34801561071957600080fd5b5061025e610728366004612d00565b6113cb565b34801561073957600080fd5b5061025e610748366004612f28565b611421565b34801561075957600080fd5b5061027361271081565b34801561076f57600080fd5b5061025e61077e366004612d00565b6114cb565b34801561078f57600080fd5b5061025e61079e366004612fb7565b611541565b3480156107af57600080fd5b506105346107be366004612ded565b611563565b60006107cd6115cc565b838510156108405760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b60648201526084015b60405180910390fd5b866001600160a01b0316886001600160a01b031614156108725760405162461bcd60e51b815260040161083790612ff9565b60008060005b84518110156108e057600085828151811061089557610895613041565b602002602001015111156108ce578481815181106108b5576108b5613041565b6020026020010151836108c8919061306d565b92508091505b806108d881613085565b915050610878565b508161093e576108f88a6001600160a01b0316611626565b156109345760405133903480156108fc02916000818181858888f19350505050158015610929573d6000803e3d6000fd5b503492505050610b3b565b8792505050610b3b565b6109536001600160a01b038b1633308b61165f565b610961848984848e8e611751565b92508215610ada57858310156109c55760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610837565b86831115610a88576109e16001600160a01b038a168689611981565b50600c54610a0d906001600160a01b03166109fc89866130a0565b6001600160a01b038c169190611981565b50600b546001600160a01b031663391fdc2433878d8d8d8d610a2f818c6130a0565b6040518863ffffffff1660e01b8152600401610a5197969594939291906130b7565b600060405180830381600087803b158015610a6b57600080fd5b505af1158015610a7f573d6000803e3d6000fd5b50505050610b38565b610a9c6001600160a01b038a168685611981565b50600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc2490610a5190339089908f908f908f908b906000906004016130b7565b87610aee6001600160a01b038c16306119fd565b1115610b0e57610b086001600160a01b038b16338a611981565b50610b38565b610b3633610b256001600160a01b038d16306119fd565b6001600160a01b038d169190611981565b505b50505b610b456001600955565b979650505050505050565b610b58611a97565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b610b9c611a97565b60108190556040518181527f1ce638f7798b6e448ecff4c806c7c01d3fedb23354b03f03994f5161b12bad6290602001610b89565b6000610bdb611a97565b610bee6001600160a01b038316306119fd565b92915050565b610bfc611a97565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527fdbb52d2fa1eb07f3cd614ab9d25e4e2e7c4bdbd87c42d7cbdb01f47c87798e0090602001610b89565b610c52611a97565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610b89565b610ca8611a97565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610b89565b610cfe6115cc565b600081610100013511610d24576040516329a1e53760e01b815260040160405180910390fd5b610d4d3330610100840135610d3c6020860186612d00565b6001600160a01b031692919061165f565b610100810135610d636040830160208401612d00565b6001600160a01b0316610d796020840184612d00565b6001600160a01b031614610df257610def610d976020840184612d00565b610da76040850160208601612d00565b83610db560e08701876130fb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611af192505050565b90505b601254610e23906001600160a01b031682610e136040860160208701612d00565b6001600160a01b03169190611bbb565b6012546001600160a01b03166326b3293f610e446040850160208601612d00565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810184905260a08501356044820152606401600060405180830381600087803b158015610e9657600080fd5b505af1158015610eaa573d6000803e3d6000fd5b50505050610eb9828233611cba565b50610ec46001600955565b50565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b158015610f2757600080fd5b505afa158015610f3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f639190810190613149565b9097909650945050505050565b60088181548110610f8057600080fd5b6000918252602090912001546001600160a01b0316905081565b610fa2611a97565b610fac6000611d66565b565b6010546000808215610fd85761271084601054610fcb91906131e6565b610fd5919061321b565b91505b610fe282856130a0565b929491935050565b610ff2611a97565b601280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5f6b12132015daadd6cc667dddf38dae7caa14bd5e83de49ea0a2b1f966e28e190600090a35050565b61104c611a97565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610b89565b6010546001600160a01b03821660009081526011602052604081205490808084156110c457612710876010546110b791906131e6565b6110c1919061321b565b92505b6001600160a01b03861660009081526011602052604090205415611117576001600160a01b0386166000908152601160205260409020546127109061110a9089906131e6565b611114919061321b565b91505b8161112284896130a0565b61112c91906130a0565b90509295509295909350565b611140611a97565b6001600160a01b038216600081815260116020908152604091829020849055815192835282018390527faa250df52ec091332afeb1962e6f687f71cbd33df714ef26cce6b8e6fc21b798910160405180910390a15050565b6111a0611a97565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1cdc2c4f610a09b40b373d300776d6c11f3032b5036fce4447ea1600cef941c690602001610b89565b6111f6611a97565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610b89565b61124c611a97565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc29290602001610b89565b6112a26115cc565b846001600160a01b0316866001600160a01b031614156112d45760405162461bcd60e51b815260040161083790612ff9565b6112e96001600160a01b03871633308761165f565b6112f4868583611db6565b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061133190339086908b908b908b908b906000906004016130b7565b600060405180830381600087803b15801561134b57600080fd5b505af115801561135f573d6000803e3d6000fd5b5050505061136d6001600955565b505050505050565b61137d611a97565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610b89565b6113d3611a97565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b90602001610b89565b611429611a97565b805160035560005b815181101561149b57600882828151811061144e5761144e613041565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b039092169190911790558061149381613085565b915050611431565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d381604051610b89919061322f565b6114d3611a97565b6001600160a01b0381166115385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610837565b610ec481611d66565b611549611a97565b61155d6001600160a01b0384168284611981565b50505050565b6001600160a01b038116600090815260116020526040812054908082156115b9576001600160a01b038416600090815260116020526040902054612710906115ac9087906131e6565b6115b6919061321b565b91505b6115c382866130a0565b90509250925092565b6002600954141561161f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610837565b6002600955565b60006001600160a01b0382161580610bee57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b806116695761155d565b61167284611626565b1561173c576001600160a01b0383163314801561168f5750803410155b6116ef5760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610837565b6001600160a01b0382163014611737576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611735573d6000803e3d6000fd5b505b61155d565b61155d6001600160a01b038516848484611efa565b600060045460035461176391906131e6565b875111156117e35760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610837565b856000805b89518110156119745789818151811061180357611803613041565b60200260200101516000141561181857611962565b6000888b838151811061182d5761182d613041565b60200260200101518b61184091906131e6565b61184a919061321b565b9050878214156118575750825b61186181856130a0565b935060045482611871919061327c565b6118bc576118b587878360086004548761188b919061321b565b8154811061189b5761189b613041565b6000918252602090912001546001600160a01b0316611f65565b9250611954565b6004546118c9908361327c565b60011415611911576118b58787836008600454876118e7919061321b565b815481106118f7576118f7613041565b6000918252602090912001546001600160a01b0316611f7c565b611951878783600860045487611927919061321b565b8154811061193757611937613041565b6000918252602090912001546001600160a01b0316611f99565b92505b61195e838661306d565b9450505b8061196c81613085565b9150506117e8565b5050509695505050505050565b600081611990575060016119f6565b61199984611626565b156119de576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156119d4573d6000803e3d6000fd5b50600190506119f6565b6119f26001600160a01b0385168484611fb6565b5060015b9392505050565b6000611a0883611626565b15611a1e57506001600160a01b03811631610bee565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b158015611a5f57600080fd5b505afa158015611a73573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f69190613290565b6000546001600160a01b03163314610fac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610837565b6000836001600160a01b0316856001600160a01b03161415611b255760405162461bcd60e51b815260040161083790612ff9565b611b30858484611db6565b611b436001600160a01b038516306119fd565b600b54604051630e47f70960e21b81529192506001600160a01b03169063391fdc2490611b8190339030908a908a908a9089906000906004016130b7565b600060405180830381600087803b158015611b9b57600080fd5b505af1158015611baf573d6000803e3d6000fd5b50505050949350505050565b611bc483611626565b611be25780611be757611be26001600160a01b038416836000611fe6565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015611c3257600080fd5b505afa158015611c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6a9190613290565b905081811015611c935761173783611c8283856130a0565b6001600160a01b038716919061210a565b8181111561155d5761155d83611ca984846130a0565b6001600160a01b03871691906121cb565b600b546001600160a01b031663a77773a660408501356000606087013585611ce560208a018a612d00565b611cf560408b0160208c01612d00565b8a608001358b61010001358b8d610120013560016040518c63ffffffff1660e01b8152600401611d2f9b9a999897969594939291906132a9565b600060405180830381600087803b158015611d4957600080fd5b505af1158015611d5d573d6000803e3d6000fd5b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611dca846001600160a01b0316611626565b15611e265782471015611e1f5760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610837565b5081611e40565b600d54611e40906001600160a01b03868116911685611bbb565b600e546040516000916001600160a01b0316908390611e6090869061335d565b60006040518083038185875af1925050503d8060008114611e9d576040519150601f19603f3d011682016040523d82523d6000602084013e611ea2565b606091505b5050905080611ef35760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610837565b5050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261155d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122e6565b6000611f73858585856123b8565b95945050505050565b600654600090611f739086906001600160a01b0316868686612824565b600754600090611f739086906001600160a01b0316868686612824565b6040516001600160a01b038316602482015260448101829052611be290849063a9059cbb60e01b90606401611f2e565b80158061206f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561203557600080fd5b505afa158015612049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206d9190613290565b155b6120da5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610837565b6040516001600160a01b038316602482015260448101829052611be290849063095ea7b360e01b90606401611f2e565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561215657600080fd5b505afa15801561216a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061218e9190613290565b612198919061306d565b6040516001600160a01b03851660248201526044810182905290915061155d90859063095ea7b360e01b90606401611f2e565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561221657600080fd5b505afa15801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224e9190613290565b9050818110156122b25760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b6064820152608401610837565b6040516001600160a01b03841660248201528282036044820181905290611ef390869063095ea7b360e01b90606401611f2e565b600061233b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166128479092919063ffffffff16565b805190915015611be257808060200190518101906123599190613379565b611be25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610837565b60006123cc856001600160a01b0316611626565b1561243b57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561242157600080fd5b505af1158015612435573d6000803e3d6000fd5b50505050505b600061244f866001600160a01b0316611626565b6124595785612466565b6006546001600160a01b03165b9050600061247c866001600160a01b0316611626565b6124865785612493565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b1580156124e257600080fd5b505afa1580156124f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251a919061339b565b90506000806125346001600160a01b03841686868b61285e565b91975092509050811561259957826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561257c57600080fd5b505af1158015612590573d6000803e3d6000fd5b5050505061260d565b801561260d5760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b1580156125f457600080fd5b505af1158015612608573d6000803e3d6000fd5b505050505b6126216001600160a01b038616848a611981565b50836001600160a01b0316856001600160a01b031610156126b65760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561269957600080fd5b505af11580156126ad573d6000803e3d6000fd5b5050505061272c565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561271357600080fd5b505af1158015612727573d6000803e3d6000fd5b505050505b61273e896001600160a01b0316611626565b15612817576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b15801561278e57600080fd5b505afa1580156127a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c69190613290565b6040518263ffffffff1660e01b81526004016127e491815260200190565b600060405180830381600087803b1580156127fe57600080fd5b505af1158015612812573d6000803e3d6000fd5b505050505b5050505050949350505050565b600061283d8585612837898988886123b8565b856123b8565b9695505050505050565b606061285684846000856129f9565b949350505050565b60008080806128766001600160a01b038816896119fd565b9050600061288d6001600160a01b0388168a6119fd565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290391906133d4565b5091509150886001600160a01b03168a6001600160a01b0316111561292457905b816001600160701b03168410806129435750806001600160701b031683105b95508515801561296d5750816001600160701b031684118061296d5750806001600160701b031683115b9450600061297d896103e56131e6565b9050600061299485846001600160701b0316612ac9565b61299e90836131e6565b90506000826129b688876001600160701b0316612ac9565b6129c2906103e86131e6565b6129cc919061306d565b905080156129e3576129de818361321b565b6129e6565b60005b9950505050505050509450945094915050565b606082471015612a5a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610837565b600080866001600160a01b03168587604051612a76919061335d565b60006040518083038185875af1925050503d8060008114612ab3576040519150601f19603f3d011682016040523d82523d6000602084013e612ab8565b606091505b5091509150610b4587838387612adf565b6000818310612ad857816119f6565b5090919050565b60608315612b4b578251612b44576001600160a01b0385163b612b445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610837565b5081612856565b6128568383815115612b605781518083602001fd5b8060405162461bcd60e51b81526004016108379190613419565b6001600160a01b0381168114610ec457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612bce57612bce612b8f565b604052919050565b600067ffffffffffffffff821115612bf057612bf0612b8f565b5060051b60200190565b600080600080600080600060e0888a031215612c1557600080fd5b8735612c2081612b7a565b9650602088810135612c3181612b7a565b965060408901359550606089013594506080890135935060a0890135612c5681612b7a565b925060c089013567ffffffffffffffff811115612c7257600080fd5b8901601f81018b13612c8357600080fd5b8035612c96612c9182612bd6565b612ba5565b81815260059190911b8201830190838101908d831115612cb557600080fd5b928401925b82841015612cd357833582529284019290840190612cba565b809550505050505092959891949750929550565b600060208284031215612cf957600080fd5b5035919050565b600060208284031215612d1257600080fd5b81356119f681612b7a565b600060208284031215612d2f57600080fd5b813567ffffffffffffffff811115612d4657600080fd5b820161014081850312156119f657600080fd5b60008060008060808587031215612d6f57600080fd5b8435612d7a81612b7a565b93506020850135612d8a81612b7a565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015612de057845183529383019391830191600101612dc4565b5090979650505050505050565b60008060408385031215612e0057600080fd5b823591506020830135612e1281612b7a565b809150509250929050565b60008060408385031215612e3057600080fd5b8235612e3b81612b7a565b946020939093013593505050565b60008060008060008060c08789031215612e6257600080fd5b8635612e6d81612b7a565b9550602087810135612e7e81612b7a565b955060408801359450606088013593506080880135612e9c81612b7a565b925060a088013567ffffffffffffffff80821115612eb957600080fd5b818a0191508a601f830112612ecd57600080fd5b813581811115612edf57612edf612b8f565b612ef1601f8201601f19168501612ba5565b91508082528b84828501011115612f0757600080fd5b80848401858401376000848284010152508093505050509295509295509295565b60006020808385031215612f3b57600080fd5b823567ffffffffffffffff811115612f5257600080fd5b8301601f81018513612f6357600080fd5b8035612f71612c9182612bd6565b81815260059190911b82018301908381019087831115612f9057600080fd5b928401925b82841015610b45578335612fa881612b7a565b82529284019290840190612f95565b600080600060608486031215612fcc57600080fd5b8335612fd781612b7a565b9250602084013591506040840135612fee81612b7a565b809150509250925092565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561308057613080613057565b500190565b600060001982141561309957613099613057565b5060010190565b6000828210156130b2576130b2613057565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000808335601e1984360301811261311257600080fd5b83018035915067ffffffffffffffff82111561312d57600080fd5b60200191503681900382131561314257600080fd5b9250929050565b6000806040838503121561315c57600080fd5b8251915060208084015167ffffffffffffffff81111561317b57600080fd5b8401601f8101861361318c57600080fd5b805161319a612c9182612bd6565b81815260059190911b820183019083810190888311156131b957600080fd5b928401925b828410156131d7578351825292840192908401906131be565b80955050505050509250929050565b600081600019048311821515161561320057613200613057565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261322a5761322a613205565b500490565b6020808252825182820181905260009190848201906040850190845b818110156132705783516001600160a01b03168352928401929184019160010161324b565b50909695505050505050565b60008261328b5761328b613205565b500690565b6000602082840312156132a257600080fd5b5051919050565b8b8152602081018b9052604081018a90526001600160a01b0389811660608301528881166080830152871660a082015260c0810186905260e081018590526101008101849052610120810183905261016081016004831061331a57634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b60005b8381101561334c578181015183820152602001613334565b8381111561155d5750506000910152565b6000825161336f818460208701613331565b9190910192915050565b60006020828403121561338b57600080fd5b815180151581146119f657600080fd5b6000602082840312156133ad57600080fd5b81516119f681612b7a565b80516001600160701b03811681146133cf57600080fd5b919050565b6000806000606084860312156133e957600080fd5b6133f2846133b8565b9250613400602085016133b8565b9150604084015163ffffffff81168114612fee57600080fd5b6020815260008251806020840152613438816040850160208701613331565b601f01601f1916919091016040019291505056fea26469706673582212206a79bc6e1f51c728e0850ce8f928ff3a958321b055784ea5a33824d808c04c8864736f6c63430008090033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000140000000000000000000000000652073f67c83096eb2a5052c35e1a9fa1d3550f5000000000000000000000000ed7f63ef67ccbb9b33682d334182ef50abd68426000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000092a26975433a61cf1134802586aa669bab8b69f300000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c

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

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 000000000000000000000000652073f67c83096eb2a5052c35e1a9fa1d3550f5
Arg [6] : 000000000000000000000000ed7f63ef67ccbb9b33682d334182ef50abd68426
Arg [7] : 000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae
Arg [8] : 000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57
Arg [9] : 00000000000000000000000092a26975433a61cf1134802586aa669bab8b69f3
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.