ETH Price: $3,422.85 (-0.24%)
Gas: 7 Gwei

Contract

0x487a3428123BD4B103f6838D266A0f86E4eEdAAd
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Configure144876982022-03-30 13:01:46841 days ago1648645306IN
0x487a3428...6E4eEdAAd
0 ETH0.0044176937.82986232
Configure144876832022-03-30 12:58:02841 days ago1648645082IN
0x487a3428...6E4eEdAAd
0 ETH0.0037099831.76953689
0x60806040144876402022-03-30 12:48:35841 days ago1648644515IN
 Create: UniswapAdapter
0 ETH0.0823951736.58152872

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniswapAdapter

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-03-30
*/

// Verified using https://dapp.tools

// hevm: flattened sources of src/adapters/UniswapAdapter.sol
// SPDX-License-Identifier: MIT AND GPL-3.0-or-later
pragma solidity =0.8.11 >=0.8.0 <0.9.0 >=0.8.1 <0.9.0;
pragma experimental ABIEncoderV2;

////// lib/openzeppelin-contracts/contracts/utils/Context.sol
// 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;
    }
}

////// lib/openzeppelin-contracts/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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);
    }
}

////// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

/* pragma solidity ^0.8.0; */

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

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `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);

    /**
     * @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);
}

////// lib/openzeppelin-contracts/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.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 functionCall(target, data, "Address: low-level call failed");
    }

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

////// lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

/* pragma solidity ^0.8.0; */

/* import "../IERC20.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));
        }
    }

    /**
     * @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");
        }
    }
}

////// src/interfaces/IUniswapAdapterCaller.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/**
 * @title Uniswap Adapter Caller Interface
 * @author bayu (github.com/pyk)
 * @notice Contract that interact with Uniswap Adapter should implement this interface.
 */
interface IUniswapAdapterCaller {
    /**
     * @notice Function that will be executed by Uniswap Adapter to finish the flash swap.
     *         The caller will receive _amountOut of the specified tokenOut.
     * @param _wethAmount The amount of WETH that the caller need to send back to the Uniswap Adapter
     * @param _amountOut The amount of of tokenOut transfered to the caller.
     * @param _data Data passed by the caller.
     */
    function onFlashSwapWETHForExactTokens(uint256 _wethAmount, uint256 _amountOut, bytes calldata _data) external;
}

////// src/interfaces/IUniswapV2Pair.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/**
 * @title Uniswap V2 Pair Interface
 * @author bayu (github.com/pyk)
 */
interface IUniswapV2Pair {
    function token1() external view returns (address);
    function token0() external view returns (address);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
}

////// src/interfaces/IUniswapV3Pool.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/**
 * @title Uniswap V3 Pool Interface
 * @author bayu <[email protected]> <https://github.com/pyk>
 */
interface IUniswapV3Pool {
    /// @notice Docs: https://docs.uniswap.org/protocol/reference/core/UniswapV3Pool#swap
    function swap(address _recipient, bool _zeroForOne, int256 _amountSpecified, uint160 _sqrtPriceLimitX96, bytes memory _data) external returns (int256 amount0, int256 amount1);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function fee() external view returns (uint24);
}

////// src/interfaces/IUniswapAdapter.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/* import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */

/* import { IUniswapV2Pair } from "../interfaces/IUniswapV2Pair.sol"; */
/* import { IUniswapV3Pool } from "../interfaces/IUniswapV3Pool.sol"; */
/* import { IUniswapAdapterCaller } from "../interfaces/IUniswapAdapterCaller.sol"; */

/**
 * @title Uniswap Adapter
 * @author bayu <[email protected]> <https://github.com/pyk>
 * @notice Utility contract to interact with Uniswap V2 & V3
 */
interface IUniswapAdapter {
    /// ███ Types ██████████████████████████████████████████████████████████████

    /**
     * @notice The supported Uniswap version
     */
    enum UniswapVersion {
        UniswapV2,
        UniswapV3
    }

    /**
     * @notice Liquidity data for specified token
     * @param version The address of Rise Token
     * @param pair The Uniswap V2 pair address
     * @param pool The Uniswap V3 pool address
     * @param router The Uniswap router address
     */
    struct LiquidityData {
        UniswapVersion version;
        IUniswapV2Pair pair;
        IUniswapV3Pool pool;
        address router;
    }

    /**
     * @notice Parameters to do flash swap WETH->tokenOut
     * @param tokenOut The output token
     * @param caller The flash swap caller
     * @param liquidityData Liquidi
     * @param amountOut The amount of tokenOut that will be received by
     *        this contract
     * @param wethAmount The amount of WETH required to finish the flash swap
     */
    struct FlashSwapWETHForExactTokensParams {
        IERC20 tokenOut;
        IUniswapAdapterCaller caller;
        LiquidityData liquidityData;
        uint256 amountOut;
        uint256 wethAmount;
    }

    /// @notice Flash swap types
    enum FlashSwapType {
        FlashSwapWETHForExactTokens
    }


    /// ███ Events █████████████████████████████████████████████████████████████

    /**
     * @notice Event emitted when token is configured
     * @param liquidityData The liquidity data of the token
     */
    event TokenConfigured(LiquidityData liquidityData);

    /**
     * @notice Event emitted when flash swap succeeded
     * @param params The flash swap params
     */
    event FlashSwapped(FlashSwapWETHForExactTokensParams params);


    /// ███ Errors █████████████████████████████████████████████████████████████

    /// @notice Error is raised when owner use invalid uniswap version
    error InvalidUniswapVersion(uint8 version);

    /// @notice Error is raised when invalid amount
    error InvalidAmount(uint256 amount);

    /// @notice Error is raised when token is not configured
    error TokenNotConfigured(address token);

    /// @notice Error is raised when the callback is called by unkown pair/pool
    error CallerNotAuthorized();

    /// @notice Error is raised when the caller not repay the token
    error CallerNotRepay();

    /// @notice Error is raised when this contract receive invalid amount when flashswap
    error FlashSwapReceivedAmountInvalid(uint256 expected, uint256 got);


    /// ███ Owner actions ██████████████████████████████████████████████████████

    /**
     * @notice Configure the token
     * @param _token The ERC20 token
     * @param _version The Uniswap version (2 or 3)
     * @param _pairOrPool The contract address of the TOKEN/ETH pair or pool
     * @param _router The Uniswap V2 or V3 router address
     */
    function configure(
        address _token,
        UniswapVersion _version,
        address _pairOrPool,
        address _router
    ) external;


    /// ███ Read-only functions ████████████████████████████████████████████████

    /**
     * @notice Returns true if token is configured
     * @param _token The token address
     */
    function isConfigured(address _token) external view returns (bool);

    /// ███ Adapters ███████████████████████████████████████████████████████████

    /**
     * @notice Borrow exact amount of tokenOut and repay it with WETH.
     *         The Uniswap Adapter will call msg.sender#onFlashSwapWETHForExactTokens.
     * @param _tokenOut The address of ERC20 that swapped
     * @param _amountOut The exact amount of tokenOut that will be received by the caller
     */
    function flashSwapWETHForExactTokens(
        address _tokenOut,
        uint256 _amountOut,
        bytes memory _data
    ) external;

    /**
     * @notice Swaps an exact amount of input tokenIn for as many WETH as possible
     * @param _tokenIn tokenIn address
     * @param _amountIn The amount of tokenIn
     * @param _amountOutMin The minimum amount of WETH to be received
     * @return _amountOut The WETH amount received
     */
    function swapExactTokensForWETH(
        address _tokenIn,
        uint256 _amountIn,
        uint256 _amountOutMin
    ) external returns (uint256 _amountOut);

    /**
     * @notice Swaps an exact amount of WETH for as few tokenIn as possible.
     * @param _tokenIn tokenIn address
     * @param _wethAmount The amount of tokenIn
     * @param _amountInMax The minimum amount of WETH to be received
     * @return _amountIn The WETH amount received
     */
    function swapTokensForExactWETH(
        address _tokenIn,
        uint256 _wethAmount,
        uint256 _amountInMax
    ) external returns (uint256 _amountIn);

    /**
     * @notice Swaps an exact amount of WETH for tokenOut
     * @param _tokenOut tokenOut address
     * @param _wethAmount The amount of WETH
     * @param _amountOutMin The minimum amount of WETH to be received
     * @return _amountOut The WETH amount received
     */
    function swapExactWETHForTokens(
        address _tokenOut,
        uint256 _wethAmount,
        uint256 _amountOutMin
    ) external returns (uint256 _amountOut);

}

////// src/interfaces/IUniswapV2Router02.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/**
 * @title Uniswap V2 Router Interface
 * @author bayu <[email protected]> <https://github.com/pyk>
 */
interface IUniswapV2Router02 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);
    function swapTokensForExactTokens(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);
    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint[] memory amounts);
    function getAmountsIn(uint256 amountOut, address[] memory path) external view returns (uint256[] memory amounts);
    function getAmountsOut(uint amountIn, address[] memory path) external view returns (uint[] memory amounts);
}

////// src/interfaces/IUniswapV3SwapRouter.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/**
 * @title Uniswap V3 Swap Router Interface
 * @author bayu <[email protected]> <https://github.com/pyk>
 */

interface IUniswapV3SwapRouter {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }
    function exactInputSingle(ExactInputSingleParams memory params) external returns (uint256 amountOut);
    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }
    function exactOutputSingle(ExactOutputSingleParams memory params) external returns (uint256 amountIn);
}

////// src/interfaces/IWETH9.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/* import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */

/**
 * @title WETH Interface
 * @author bayu <[email protected]> <https://github.com/pyk>
 */
interface IWETH9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

////// src/adapters/UniswapAdapter.sol
/* pragma solidity 0.8.11; */
/* pragma experimental ABIEncoderV2; */

/* import { Ownable } from "lib/openzeppelin-contracts/contracts/access/Ownable.sol"; */
/* import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */
/* import { SafeERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; */

/* import { IUniswapAdapter } from "../interfaces/IUniswapAdapter.sol"; */
/* import { IUniswapV2Router02 } from "../interfaces/IUniswapV2Router02.sol"; */
/* import { IUniswapV2Pair } from "../interfaces/IUniswapV2Pair.sol"; */
/* import { IUniswapV3Pool } from "../interfaces/IUniswapV3Pool.sol"; */
/* import { IUniswapV3SwapRouter } from "../interfaces/IUniswapV3SwapRouter.sol"; */
/* import { IUniswapAdapterCaller } from "../interfaces/IUniswapAdapterCaller.sol"; */

/* import { IWETH9 } from "../interfaces/IWETH9.sol"; */

/**
 * @title Uniswap Adapter
 * @author bayu <[email protected]> <https://github.com/pyk>
 * @notice Utility contract to interact with Uniswap V2 & V3
 */
contract UniswapAdapter is IUniswapAdapter, Ownable {
    /// ███ Libraries ██████████████████████████████████████████████████████████

    using SafeERC20 for IERC20;
    using SafeERC20 for IWETH9;

    /// ███ Storages ███████████████████████████████████████████████████████████

    /// @notice WETH address
    IWETH9 public weth;

    /// @notice Mapping token to their liquidity metadata
    mapping(address => LiquidityData) public liquidities;

    /// @notice Whitelisted pair/pool that can call the callback
    mapping(address => bool) private isValidCallbackCaller;


    /// ███ Constuctors ████████████████████████████████████████████████████████

    constructor(address _weth) {
        weth = IWETH9(_weth);
    }


    /// ███ Owner actions ██████████████████████████████████████████████████████

    /// @inheritdoc IUniswapAdapter
    function configure(address _token, UniswapVersion _version, address _pairOrPool, address _router) external onlyOwner {
        isValidCallbackCaller[_pairOrPool] = true;
        liquidities[_token] = LiquidityData({
            version: _version,
            pool: IUniswapV3Pool(_pairOrPool),
            pair: IUniswapV2Pair(_pairOrPool),
            router: _router
        });
        emit TokenConfigured(liquidities[_token]);
    }


    /// ███ Internal functions █████████████████████████████████████████████████

    /// @notice Executed when flashSwapWETHForExactTokens is triggered
    function onFlashSwapWETHForExactTokens(FlashSwapWETHForExactTokensParams memory _params, bytes memory _data) internal {
        // Transfer the tokenOut to caller
        _params.tokenOut.safeTransfer(address(_params.caller), _params.amountOut);

        // Execute the callback
        uint256 prevBalance = weth.balanceOf(address(this));
        _params.caller.onFlashSwapWETHForExactTokens(_params.wethAmount, _params.amountOut, _data);
        uint256 balance = weth.balanceOf(address(this));

        // Check the balance
        if (balance < prevBalance + _params.wethAmount) revert CallerNotRepay();

        // Transfer the WETH to the Uniswap V2 pair or pool
        if (_params.liquidityData.version == UniswapVersion.UniswapV2) {
            weth.safeTransfer(address(_params.liquidityData.pair), _params.wethAmount);
        } else {
            weth.safeTransfer(address(_params.liquidityData.pool), _params.wethAmount);
        }

        emit FlashSwapped(_params);
    }


    /// ███ Callbacks ██████████████████████████████████████████████████████████

    function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes memory _data) external {
        /// ███ Checks

        // Check caller
        if (!isValidCallbackCaller[msg.sender]) revert CallerNotAuthorized();
        if (_sender != address(this)) revert CallerNotAuthorized();

        /// ███ Interactions

        // Get the data
        (FlashSwapType flashSwapType, bytes memory data) = abi.decode(_data, (FlashSwapType, bytes));

        // Continue execute the function based on the flash swap type
        if (flashSwapType == FlashSwapType.FlashSwapWETHForExactTokens) {
            (FlashSwapWETHForExactTokensParams memory params, bytes memory callData) = abi.decode(data, (FlashSwapWETHForExactTokensParams,bytes));
            // Check the amount out
            uint256 amountOut = _amount0 == 0 ? _amount1 : _amount0;
            if (params.amountOut != amountOut) revert FlashSwapReceivedAmountInvalid(params.amountOut, amountOut);

            // Calculate the WETH amount
            address[] memory path = new address[](2);
            path[0] = address(weth);
            path[1] = address(params.tokenOut);
            params.wethAmount = IUniswapV2Router02(params.liquidityData.router).getAmountsIn(params.amountOut, path)[0];

            onFlashSwapWETHForExactTokens(params, callData);
            return;
        }
    }

    function uniswapV3SwapCallback(int256 _amount0Delta, int256 _amount1Delta, bytes memory _data) external {
        /// ███ Checks

        // Check caller
        if (!isValidCallbackCaller[msg.sender]) revert CallerNotAuthorized();

        /// ███ Interactions

        // Get the data
        (FlashSwapType flashSwapType, bytes memory data) = abi.decode(_data, (FlashSwapType, bytes));

        // Continue execute the function based on the flash swap type
        if (flashSwapType == FlashSwapType.FlashSwapWETHForExactTokens) {
            (FlashSwapWETHForExactTokensParams memory params, bytes memory callData) = abi.decode(data, (FlashSwapWETHForExactTokensParams,bytes));

            // if amount negative then it must be the amountOut, otherwise it's weth amount
            uint256 amountOut = _amount0Delta < 0 ?  uint256(-1 * _amount0Delta) : uint256(-1 * _amount1Delta);
            params.wethAmount = _amount0Delta > 0 ? uint256(_amount0Delta) : uint256(_amount1Delta);

            // Check the amount out
            if (params.amountOut != amountOut) revert FlashSwapReceivedAmountInvalid(params.amountOut, amountOut);

            onFlashSwapWETHForExactTokens(params, callData);
            return;
        }
    }


    /// ███ Read-only functions ████████████████████████████████████████████████

    /// @inheritdoc IUniswapAdapter
    function isConfigured(address _token) public view returns (bool) {
        if (liquidities[_token].router == address(0)) return false;
        return true;
    }

    /// ███ Adapters ███████████████████████████████████████████████████████████

    /// @inheritdoc IUniswapAdapter
    function flashSwapWETHForExactTokens(address _tokenOut, uint256 _amountOut, bytes memory _data) external {
        /// ███ Checks
        if (_amountOut == 0) revert InvalidAmount(0);
        if (!isConfigured(_tokenOut)) revert TokenNotConfigured(_tokenOut);

        // Check the metadata
        LiquidityData memory metadata = liquidities[_tokenOut];

        /// ███ Interactions

        // Initialize the params
        FlashSwapWETHForExactTokensParams memory params = FlashSwapWETHForExactTokensParams({
            tokenOut: IERC20(_tokenOut),
            amountOut: _amountOut,
            caller: IUniswapAdapterCaller(msg.sender),
            liquidityData: metadata,
            wethAmount: 0 // Initialize as zero; It will be updated in the callback
        });
        bytes memory data = abi.encode(FlashSwapType.FlashSwapWETHForExactTokens, abi.encode(params, _data));

        // Flash swap Uniswap V2; The pair address will call uniswapV2Callback function
        if (metadata.version == UniswapVersion.UniswapV2) {
            // Get amountOut for token and weth
            uint256 amount0Out = _tokenOut == metadata.pair.token0() ? _amountOut : 0;
            uint256 amount1Out = _tokenOut == metadata.pair.token1() ? _amountOut : 0;

            // Do the flash swap
            metadata.pair.swap(amount0Out, amount1Out, address(this), data);
            return;
        }

        if (metadata.version == UniswapVersion.UniswapV3) {
            // zeroForOne (true: token0 -> token1) (false: token1 -> token0)
            bool zeroForOne = _tokenOut == metadata.pool.token1() ? true : false;

            // amountSpecified (Exact input: positive) (Exact output: negative)
            int256 amountSpecified = -1 * int256(_amountOut);
            uint160 sqrtPriceLimitX96 = (zeroForOne ? 4295128740 : 1461446703485210103287273052203988822378723970341);

            // Perform swap
            metadata.pool.swap(address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96, data);
            return;
        }
    }

    /// @inheritdoc IUniswapAdapter
    function swapExactTokensForWETH(address _tokenIn, uint256 _amountIn, uint256 _amountOutMin) external returns (uint256 _amountOut) {
        /// ███ Checks
        if (!isConfigured(_tokenIn)) revert TokenNotConfigured(_tokenIn);

        /// ███ Interactions
        LiquidityData memory metadata = liquidities[_tokenIn];
        IERC20(_tokenIn).safeTransferFrom(msg.sender, address(this), _amountIn);
        IERC20(_tokenIn).safeIncreaseAllowance(metadata.router, _amountIn);

        if (metadata.version == UniswapVersion.UniswapV2) {
            // Do the swap
            address[] memory path = new address[](2);
            path[0] = _tokenIn;
            path[1] = address(weth);
            _amountOut = IUniswapV2Router02(metadata.router).swapExactTokensForTokens(_amountIn, _amountOutMin, path, msg.sender, block.timestamp)[1];
        }

        if (metadata.version == UniswapVersion.UniswapV3) {
            // Do the swap
            IUniswapV3SwapRouter.ExactInputSingleParams memory params = IUniswapV3SwapRouter.ExactInputSingleParams({
                tokenIn: _tokenIn,
                tokenOut: address(weth),
                fee: metadata.pool.fee(),
                recipient: msg.sender,
                deadline: block.timestamp,
                amountIn: _amountIn,
                amountOutMinimum: _amountOutMin,
                sqrtPriceLimitX96: 0
            });
            _amountOut = IUniswapV3SwapRouter(metadata.router).exactInputSingle(params);
        }

        return _amountOut;
    }

    /// @inheritdoc IUniswapAdapter
    function swapTokensForExactWETH(address _tokenIn, uint256 _wethAmount, uint256 _amountInMax) external returns (uint256 _amountIn) {
        /// ███ Checks
        if (!isConfigured(_tokenIn)) revert TokenNotConfigured(_tokenIn);

        /// ███ Interactions
        LiquidityData memory metadata = liquidities[_tokenIn];
        IERC20(_tokenIn).safeTransferFrom(msg.sender, address(this), _amountInMax);
        IERC20(_tokenIn).safeIncreaseAllowance(metadata.router, _amountInMax);

        if (metadata.version == UniswapVersion.UniswapV2) {
            // Do the swap
            address[] memory path = new address[](2);
            path[0] = _tokenIn;
            path[1] = address(weth);
            _amountIn = IUniswapV2Router02(metadata.router).swapTokensForExactTokens(_wethAmount, _amountInMax, path, msg.sender, block.timestamp)[1];
        }

        if (metadata.version == UniswapVersion.UniswapV3) {
            // Do the swap
            IUniswapV3SwapRouter.ExactOutputSingleParams memory params = IUniswapV3SwapRouter.ExactOutputSingleParams({
                tokenIn: _tokenIn,
                tokenOut: address(weth),
                fee: metadata.pool.fee(),
                recipient: msg.sender,
                deadline: block.timestamp,
                amountOut: _wethAmount,
                amountInMaximum: _amountInMax,
                sqrtPriceLimitX96: 0
            });
            _amountIn = IUniswapV3SwapRouter(metadata.router).exactOutputSingle(params);
        }

        if (_amountInMax > _amountIn) {
            // Transfer back excess token
            IERC20(_tokenIn).safeTransfer(msg.sender, _amountInMax - _amountIn);
        }
        return _amountIn;
    }

    /// @inheritdoc IUniswapAdapter
    function swapExactWETHForTokens(address _tokenOut, uint256 _wethAmount, uint256 _amountOutMin) external returns (uint256 _amountOut) {
        /// ███ Checks
        if (!isConfigured(_tokenOut)) revert TokenNotConfigured(_tokenOut);

        /// ███ Interactions
        LiquidityData memory metadata = liquidities[_tokenOut];
        IERC20(address(weth)).safeTransferFrom(msg.sender, address(this), _wethAmount);
        weth.safeIncreaseAllowance(metadata.router, _wethAmount);

        if (metadata.version == UniswapVersion.UniswapV2) {
            // Do the swap
            address[] memory path = new address[](2);
            path[0] = address(weth);
            path[1] = _tokenOut;
            _amountOut = IUniswapV2Router02(metadata.router).swapExactTokensForTokens(_wethAmount, _amountOutMin, path, msg.sender, block.timestamp)[1];
        }

        if (metadata.version == UniswapVersion.UniswapV3) {
            // Do the swap
            IUniswapV3SwapRouter.ExactInputSingleParams memory params = IUniswapV3SwapRouter.ExactInputSingleParams({
                tokenIn: address(weth),
                tokenOut: _tokenOut,
                fee: metadata.pool.fee(),
                recipient: msg.sender,
                deadline: block.timestamp,
                amountIn: _wethAmount,
                amountOutMinimum: _amountOutMin,
                sqrtPriceLimitX96: 0
            });
            _amountOut = IUniswapV3SwapRouter(metadata.router).exactInputSingle(params);
        }

        return _amountOut;
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CallerNotAuthorized","type":"error"},{"inputs":[],"name":"CallerNotRepay","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"got","type":"uint256"}],"name":"FlashSwapReceivedAmountInvalid","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"InvalidAmount","type":"error"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"InvalidUniswapVersion","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"TokenNotConfigured","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IERC20","name":"tokenOut","type":"address"},{"internalType":"contract IUniswapAdapterCaller","name":"caller","type":"address"},{"components":[{"internalType":"enum IUniswapAdapter.UniswapVersion","name":"version","type":"uint8"},{"internalType":"contract IUniswapV2Pair","name":"pair","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"router","type":"address"}],"internalType":"struct IUniswapAdapter.LiquidityData","name":"liquidityData","type":"tuple"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"wethAmount","type":"uint256"}],"indexed":false,"internalType":"struct IUniswapAdapter.FlashSwapWETHForExactTokensParams","name":"params","type":"tuple"}],"name":"FlashSwapped","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":[{"components":[{"internalType":"enum IUniswapAdapter.UniswapVersion","name":"version","type":"uint8"},{"internalType":"contract IUniswapV2Pair","name":"pair","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"router","type":"address"}],"indexed":false,"internalType":"struct IUniswapAdapter.LiquidityData","name":"liquidityData","type":"tuple"}],"name":"TokenConfigured","type":"event"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"enum IUniswapAdapter.UniswapVersion","name":"_version","type":"uint8"},{"internalType":"address","name":"_pairOrPool","type":"address"},{"internalType":"address","name":"_router","type":"address"}],"name":"configure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"flashSwapWETHForExactTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isConfigured","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"liquidities","outputs":[{"internalType":"enum IUniswapAdapter.UniswapVersion","name":"version","type":"uint8"},{"internalType":"contract IUniswapV2Pair","name":"pair","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"router","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_amountOutMin","type":"uint256"}],"name":"swapExactTokensForWETH","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_wethAmount","type":"uint256"},{"internalType":"uint256","name":"_amountOutMin","type":"uint256"}],"name":"swapExactWETHForTokens","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"uint256","name":"_wethAmount","type":"uint256"},{"internalType":"uint256","name":"_amountInMax","type":"uint256"}],"name":"swapTokensForExactWETH","outputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_amount0","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV2Call","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"_amount0Delta","type":"int256"},{"internalType":"int256","name":"_amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IWETH9","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620027da380380620027da8339810160408190526200003491620000b5565b6200003f3362000065565b600180546001600160a01b0319166001600160a01b0392909216919091179055620000e7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000c857600080fd5b81516001600160a01b0381168114620000e057600080fd5b9392505050565b6126e380620000f76000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806353d2d99e1161008c5780638da5cb5b116100665780638da5cb5b146101f6578063afdfe55e14610207578063f2fde38b1461021a578063fa461e331461022d57600080fd5b806353d2d99e14610183578063715018a6146101db5780637a4b6914146101e357600080fd5b8063058bc994146100d457806310d1e85c146100fa578063281b72681461010f57806336490ad31461012257806337dc1661146101455780633fc8cef314610158575b600080fd5b6100e76100e2366004611c7e565b610240565b6040519081526020015b60405180910390f35b61010d610108366004611dc4565b6105f1565b005b61010d61011d366004611e27565b610828565b610135610130366004611e80565b610c79565b60405190151581526020016100f1565b61010d610153366004611eaa565b610cad565b60015461016b906001600160a01b031681565b6040516001600160a01b0390911681526020016100f1565b6101cb610191366004611e80565b600260208190526000918252604090912080546001820154919092015460ff8316926001600160a01b036101009091048116928116911684565b6040516100f19493929190611f30565b61010d610e1b565b6100e76101f1366004611c7e565b610e51565b6000546001600160a01b031661016b565b6100e7610215366004611c7e565b6111ec565b61010d610228366004611e80565b611492565b61010d61023b366004611f66565b61152d565b600061024b84610c79565b6102785760405163a5be5e0f60e01b81526001600160a01b03851660048201526024015b60405180910390fd5b6001600160a01b0384166000908152600260205260408082208151608081019092528054829060ff1660018111156102b2576102b2611f06565b60018111156102c3576102c3611f06565b815281546001600160a01b03610100909104811660208301526001830154811660408301526002909201548216606090910152909150610307908616333086611637565b6060810151610321906001600160a01b03871690856116a2565b60008151600181111561033657610336611f06565b141561044d57604080516002808252606082018352600092602083019080368337019050509050858160008151811061037157610371611fa0565b6001600160a01b03928316602091820292909201015260018054835192169183919081106103a1576103a1611fa0565b6001600160a01b0392831660209182029290920101526060830151604051634401edf760e11b8152911690638803dbee906103e89088908890869033904290600401611ffa565b6000604051808303816000875af1158015610407573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261042f9190810190612036565b60018151811061044157610441611fa0565b60200260200101519250505b60018151600181111561046257610462611f06565b14156105c1576000604051806101000160405280876001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316815260200183604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f91906120dc565b62ffffff168152602001336001600160a01b0316815260200142815260200186815260200185815260200160006001600160a01b0316815250905081606001516001600160a01b031663db3e2198826040518263ffffffff1660e01b815260040161057a9190612101565b6020604051808303816000875af1158015610599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bd9190612171565b9250505b818311156105e8576105e8336105d784866121a0565b6001600160a01b0388169190611754565b505b9392505050565b3360009081526003602052604090205460ff166106215760405163c183bcef60e01b815260040160405180910390fd5b6001600160a01b038416301461064a5760405163c183bcef60e01b815260040160405180910390fd5b600080828060200190518101906106619190612228565b9092509050600082801561067757610677611f06565b141561081f5760008082806020019051810190610694919061227d565b915091506000876000146106a857876106aa565b865b9050808360600151146106e0576060830151604051637c71134360e11b815260048101919091526024810182905260440161026f565b604080516002808252606082018352600092602083019080368337505060015482519293506001600160a01b03169183915060009061072157610721611fa0565b60200260200101906001600160a01b031690816001600160a01b03168152505083600001518160018151811061075957610759611fa0565b6001600160a01b0392831660209182029290920101526040808601516060908101519087015191516307c0329d60e21b8152921691631f00ca74916107a291859060040161236b565b600060405180830381865afa1580156107bf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107e79190810190612036565b6000815181106107f9576107f9611fa0565b60200260200101518460800181815250506108148484611789565b505050505050610822565b50505b50505050565b8161084957604051633728b83d60e01b81526000600482015260240161026f565b61085283610c79565b61087a5760405163a5be5e0f60e01b81526001600160a01b038416600482015260240161026f565b6001600160a01b0383166000908152600260205260408082208151608081019092528054829060ff1660018111156108b4576108b4611f06565b60018111156108c5576108c5611f06565b815281546001600160a01b036101009091048116602080840191909152600184015482166040808501919091526002909401548216606093840152835160a08101855291891682523382820152818401859052918101879052600060808201819052925193945092829161093d91859188910161241a565b60408051601f198184030181529082905261095b9291602001612445565b60408051601f19818403018152919052905060008351600181111561098257610982611f06565b1415610b1157600083602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f0919061246e565b6001600160a01b0316876001600160a01b031614610a0f576000610a11565b855b9050600084602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7b919061246e565b6001600160a01b0316886001600160a01b031614610a9a576000610a9c565b865b602086015160405163022c0d9f60e01b81529192506001600160a01b03169063022c0d9f90610ad590859085903090899060040161248b565b600060405180830381600087803b158015610aef57600080fd5b505af1158015610b03573d6000803e3d6000fd5b505050505050505050505050565b600183516001811115610b2657610b26611f06565b141561081f57600083604001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b94919061246e565b6001600160a01b0316876001600160a01b031614610bb3576000610bb6565b60015b90506000610bc6876000196124b8565b9050600082610be95773fffd8963efd1fc6a506488495d951d5263988d25610bf0565b6401000276a45b905085604001516001600160a01b031663128acb0830858585896040518663ffffffff1660e01b8152600401610c2a95949392919061253d565b60408051808303816000875af1158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190612578565b5050505050505050505050565b6001600160a01b03818116600090815260026020819052604082200154909116610ca557506000919050565b506001919050565b6000546001600160a01b03163314610cd75760405162461bcd60e51b815260040161026f9061259c565b6001600160a01b03821660009081526003602052604090819020805460ff1916600190811790915581516080810190925281908590811115610d1b57610d1b611f06565b81526001600160a01b03808516602080840182905260408085019290925285831660609094019390935290871660009081526002909252902081518154829060ff191660018381811115610d7157610d71611f06565b021790555060208281015182546001600160a01b0391821661010002610100600160a81b03199091161783556040808501516001850180549184166001600160a01b03199283161790556060909501516002948501805491841691909616179094558716600090815291905281902090517f0521a19cc658cb2ce5d74543402b2a46db79572181a183be9d4a787ded7d6d0f91610e0d916125d1565b60405180910390a150505050565b6000546001600160a01b03163314610e455760405162461bcd60e51b815260040161026f9061259c565b610e4f60006119c6565b565b6000610e5c84610c79565b610e845760405163a5be5e0f60e01b81526001600160a01b038516600482015260240161026f565b6001600160a01b0384166000908152600260205260408082208151608081019092528054829060ff166001811115610ebe57610ebe611f06565b6001811115610ecf57610ecf611f06565b815281546001600160a01b03610100909104811660208301526001808401548216604084015260029093015481166060909201919091529054919250610f189116333087611637565b6060810151600154610f36916001600160a01b0390911690866116a2565b600081516001811115610f4b57610f4b611f06565b141561107257604080516002808252606082018352600092602083019080368337505060015482519293506001600160a01b031691839150600090610f9257610f92611fa0565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110610fc657610fc6611fa0565b6001600160a01b03928316602091820292909201015260608301516040516338ed173960e01b81529116906338ed17399061100d9088908890869033904290600401611ffa565b6000604051808303816000875af115801561102c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110549190810190612036565b60018151811061106657611066611fa0565b60200260200101519250505b60018151600181111561108757611087611f06565b14156105e8576000604051806101000160405280600160009054906101000a90046001600160a01b03166001600160a01b03168152602001876001600160a01b0316815260200183604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015611110573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113491906120dc565b62ffffff168152602001336001600160a01b0316815260200142815260200186815260200185815260200160006001600160a01b0316815250905081606001516001600160a01b031663414bf389826040518263ffffffff1660e01b815260040161119f9190612101565b6020604051808303816000875af11580156111be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e29190612171565b9695505050505050565b60006111f784610c79565b61121f5760405163a5be5e0f60e01b81526001600160a01b038516600482015260240161026f565b6001600160a01b0384166000908152600260205260408082208151608081019092528054829060ff16600181111561125957611259611f06565b600181111561126a5761126a611f06565b815281546001600160a01b036101009091048116602083015260018301548116604083015260029092015482166060909101529091506112ae908616333087611637565b60608101516112c8906001600160a01b03871690866116a2565b6000815160018111156112dd576112dd611f06565b14156113f457604080516002808252606082018352600092602083019080368337019050509050858160008151811061131857611318611fa0565b6001600160a01b039283166020918202929092010152600180548351921691839190811061134857611348611fa0565b6001600160a01b03928316602091820292909201015260608301516040516338ed173960e01b81529116906338ed17399061138f9088908890869033904290600401611ffa565b6000604051808303816000875af11580156113ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113d69190810190612036565b6001815181106113e8576113e8611fa0565b60200260200101519250505b60018151600181111561140957611409611f06565b14156105e8576000604051806101000160405280876001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316815260200183604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015611110573d6000803e3d6000fd5b6000546001600160a01b031633146114bc5760405162461bcd60e51b815260040161026f9061259c565b6001600160a01b0381166115215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161026f565b61152a816119c6565b50565b3360009081526003602052604090205460ff1661155d5760405163c183bcef60e01b815260040160405180910390fd5b600080828060200190518101906115749190612228565b9092509050600082801561158a5761158a611f06565b141561163057600080828060200190518101906115a7919061227d565b9150915060008088126115c5576115c0876000196124b8565b6115d1565b6115d1886000196124b8565b9050600088136115e157866115e3565b875b60808401526060830151811461161c576060830151604051637c71134360e11b815260048101919091526024810182905260440161026f565b6116268383611789565b5050505050505050565b5050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526108229085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a16565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156116f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117179190612171565b6117219190612616565b6040516001600160a01b03851660248201526044810182905290915061082290859063095ea7b360e01b9060640161166b565b6040516001600160a01b03831660248201526044810182905261178490849063a9059cbb60e01b9060640161166b565b505050565b6020820151606083015183516117aa926001600160a01b0390911691611754565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156117f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118179190612171565b905082602001516001600160a01b0316639978cf4884608001518560600151856040518463ffffffff1660e01b81526004016118559392919061262e565b600060405180830381600087803b15801561186f57600080fd5b505af1158015611883573d6000803e3d6000fd5b50506001546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa1580156118d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f69190612171565b90508360800151826119089190612616565b81101561192857604051632dc01fc160e11b815260040160405180910390fd5b6000604085015151600181111561194157611941611f06565b141561197257604084015160200151608085015160015461196d926001600160a01b0390911691611754565b611997565b60408085015101516080850151600154611997926001600160a01b0390911691611754565b7f14daacbc033867c4bf1c3e0209750e8a964c59c7086e3317256a7d311725eb8e84604051610e0d919061264d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611a6b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ae89092919063ffffffff16565b8051909150156117845780806020019051810190611a89919061265c565b6117845760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161026f565b6060611af78484600085611aff565b949350505050565b606082471015611b605760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161026f565b6001600160a01b0385163b611bb75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161026f565b600080866001600160a01b03168587604051611bd3919061267e565b60006040518083038185875af1925050503d8060008114611c10576040519150601f19603f3d011682016040523d82523d6000602084013e611c15565b606091505b5091509150611c25828286611c30565b979650505050505050565b60608315611c3f5750816105ea565b825115611c4f5782518084602001fd5b8160405162461bcd60e51b815260040161026f919061269a565b6001600160a01b038116811461152a57600080fd5b600080600060608486031215611c9357600080fd5b8335611c9e81611c69565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715611cec57611cec611cb3565b60405290565b6040516080810167ffffffffffffffff81118282101715611cec57611cec611cb3565b604051601f8201601f1916810167ffffffffffffffff81118282101715611d3e57611d3e611cb3565b604052919050565b600067ffffffffffffffff821115611d6057611d60611cb3565b50601f01601f191660200190565b600082601f830112611d7f57600080fd5b8135611d92611d8d82611d46565b611d15565b818152846020838601011115611da757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611dda57600080fd5b8435611de581611c69565b93506020850135925060408501359150606085013567ffffffffffffffff811115611e0f57600080fd5b611e1b87828801611d6e565b91505092959194509250565b600080600060608486031215611e3c57600080fd5b8335611e4781611c69565b925060208401359150604084013567ffffffffffffffff811115611e6a57600080fd5b611e7686828701611d6e565b9150509250925092565b600060208284031215611e9257600080fd5b81356105ea81611c69565b6002811061152a57600080fd5b60008060008060808587031215611ec057600080fd5b8435611ecb81611c69565b93506020850135611edb81611e9d565b92506040850135611eeb81611c69565b91506060850135611efb81611c69565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b60028110611f2c57611f2c611f06565b9052565b60808101611f3e8287611f1c565b6001600160a01b03948516602083015292841660408201529216606090920191909152919050565b600080600060608486031215611f7b57600080fd5b8335925060208401359150604084013567ffffffffffffffff811115611e6a57600080fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015611fef5781516001600160a01b031687529582019590820190600101611fca565b509495945050505050565b85815284602082015260a06040820152600061201960a0830186611fb6565b6001600160a01b0394909416606083015250608001529392505050565b6000602080838503121561204957600080fd5b825167ffffffffffffffff8082111561206157600080fd5b818501915085601f83011261207557600080fd5b81518181111561208757612087611cb3565b8060051b9150612098848301611d15565b81815291830184019184810190888411156120b257600080fd5b938501935b838510156120d0578451825293850193908501906120b7565b98975050505050505050565b6000602082840312156120ee57600080fd5b815162ffffff811681146105ea57600080fd5b610100810161216b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c0808301519084015260e09182015116910152565b92915050565b60006020828403121561218357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156121b2576121b261218a565b500390565b60005b838110156121d25781810151838201526020016121ba565b838111156108225750506000910152565b600082601f8301126121f457600080fd5b8151612202611d8d82611d46565b81815284602083860101111561221757600080fd5b611af78260208301602087016121b7565b6000806040838503121561223b57600080fd5b82516001811061224a57600080fd5b602084015190925067ffffffffffffffff81111561226757600080fd5b612273858286016121e3565b9150509250929050565b60008082840361012081121561229257600080fd5b610100808212156122a257600080fd5b6122aa611cc9565b85516122b581611c69565b815260208601516122c581611c69565b60208201526080603f19840112156122dc57600080fd5b6122e4611cf2565b925060408601516122f481611e9d565b8352606086015161230481611c69565b6020840152608086015161231781611c69565b604084015260a086015161232a81611c69565b8060608501525082604082015260c0860151606082015260e08601516080820152809450508085015191505067ffffffffffffffff81111561226757600080fd5b828152604060208201526000611af76040830184611fb6565b60018060a01b0380825116835280602083015116602084015260408201516123b0604085018251611f1c565b8160208201511660608501528160408201511660808501528160608201511660a08501525050606081015160c0830152608081015160e08301525050565b600081518084526124068160208601602086016121b7565b601f01601f19169290920160200192915050565b60006101206124298386612384565b8061010084015261243c818401856123ee565b95945050505050565b60006001841061245757612457611f06565b83825260406020830152611af760408301846123ee565b60006020828403121561248057600080fd5b81516105ea81611c69565b84815283602082015260018060a01b03831660408201526080606082015260006111e260808301846123ee565b60006001600160ff1b03818413828413808216868404861116156124de576124de61218a565b600160ff1b60008712828116878305891216156124fd576124fd61218a565b600087129250878205871284841616156125195761251961218a565b8785058712818416161561252f5761252f61218a565b505050929093029392505050565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a060808201819052600090611c25908301846123ee565b6000806040838503121561258b57600080fd5b505080516020909101519092909150565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b815460808201906125e58360ff8316611f1c565b60081c6001600160a01b03908116602084015260018401548116604084015260029093015490921660609091015290565b600082198211156126295761262961218a565b500190565b83815282602082015260606040820152600061243c60608301846123ee565b610100810161216b8284612384565b60006020828403121561266e57600080fd5b815180151581146105ea57600080fd5b600082516126908184602087016121b7565b9190910192915050565b6020815260006105ea60208301846123ee56fea264697066735822122025c52370f2192c7301c8d28004d3bfb5efa0fc091ee7891148f0b35c69d1c32364736f6c634300080b0033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806353d2d99e1161008c5780638da5cb5b116100665780638da5cb5b146101f6578063afdfe55e14610207578063f2fde38b1461021a578063fa461e331461022d57600080fd5b806353d2d99e14610183578063715018a6146101db5780637a4b6914146101e357600080fd5b8063058bc994146100d457806310d1e85c146100fa578063281b72681461010f57806336490ad31461012257806337dc1661146101455780633fc8cef314610158575b600080fd5b6100e76100e2366004611c7e565b610240565b6040519081526020015b60405180910390f35b61010d610108366004611dc4565b6105f1565b005b61010d61011d366004611e27565b610828565b610135610130366004611e80565b610c79565b60405190151581526020016100f1565b61010d610153366004611eaa565b610cad565b60015461016b906001600160a01b031681565b6040516001600160a01b0390911681526020016100f1565b6101cb610191366004611e80565b600260208190526000918252604090912080546001820154919092015460ff8316926001600160a01b036101009091048116928116911684565b6040516100f19493929190611f30565b61010d610e1b565b6100e76101f1366004611c7e565b610e51565b6000546001600160a01b031661016b565b6100e7610215366004611c7e565b6111ec565b61010d610228366004611e80565b611492565b61010d61023b366004611f66565b61152d565b600061024b84610c79565b6102785760405163a5be5e0f60e01b81526001600160a01b03851660048201526024015b60405180910390fd5b6001600160a01b0384166000908152600260205260408082208151608081019092528054829060ff1660018111156102b2576102b2611f06565b60018111156102c3576102c3611f06565b815281546001600160a01b03610100909104811660208301526001830154811660408301526002909201548216606090910152909150610307908616333086611637565b6060810151610321906001600160a01b03871690856116a2565b60008151600181111561033657610336611f06565b141561044d57604080516002808252606082018352600092602083019080368337019050509050858160008151811061037157610371611fa0565b6001600160a01b03928316602091820292909201015260018054835192169183919081106103a1576103a1611fa0565b6001600160a01b0392831660209182029290920101526060830151604051634401edf760e11b8152911690638803dbee906103e89088908890869033904290600401611ffa565b6000604051808303816000875af1158015610407573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261042f9190810190612036565b60018151811061044157610441611fa0565b60200260200101519250505b60018151600181111561046257610462611f06565b14156105c1576000604051806101000160405280876001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316815260200183604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050f91906120dc565b62ffffff168152602001336001600160a01b0316815260200142815260200186815260200185815260200160006001600160a01b0316815250905081606001516001600160a01b031663db3e2198826040518263ffffffff1660e01b815260040161057a9190612101565b6020604051808303816000875af1158015610599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bd9190612171565b9250505b818311156105e8576105e8336105d784866121a0565b6001600160a01b0388169190611754565b505b9392505050565b3360009081526003602052604090205460ff166106215760405163c183bcef60e01b815260040160405180910390fd5b6001600160a01b038416301461064a5760405163c183bcef60e01b815260040160405180910390fd5b600080828060200190518101906106619190612228565b9092509050600082801561067757610677611f06565b141561081f5760008082806020019051810190610694919061227d565b915091506000876000146106a857876106aa565b865b9050808360600151146106e0576060830151604051637c71134360e11b815260048101919091526024810182905260440161026f565b604080516002808252606082018352600092602083019080368337505060015482519293506001600160a01b03169183915060009061072157610721611fa0565b60200260200101906001600160a01b031690816001600160a01b03168152505083600001518160018151811061075957610759611fa0565b6001600160a01b0392831660209182029290920101526040808601516060908101519087015191516307c0329d60e21b8152921691631f00ca74916107a291859060040161236b565b600060405180830381865afa1580156107bf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107e79190810190612036565b6000815181106107f9576107f9611fa0565b60200260200101518460800181815250506108148484611789565b505050505050610822565b50505b50505050565b8161084957604051633728b83d60e01b81526000600482015260240161026f565b61085283610c79565b61087a5760405163a5be5e0f60e01b81526001600160a01b038416600482015260240161026f565b6001600160a01b0383166000908152600260205260408082208151608081019092528054829060ff1660018111156108b4576108b4611f06565b60018111156108c5576108c5611f06565b815281546001600160a01b036101009091048116602080840191909152600184015482166040808501919091526002909401548216606093840152835160a08101855291891682523382820152818401859052918101879052600060808201819052925193945092829161093d91859188910161241a565b60408051601f198184030181529082905261095b9291602001612445565b60408051601f19818403018152919052905060008351600181111561098257610982611f06565b1415610b1157600083602001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f0919061246e565b6001600160a01b0316876001600160a01b031614610a0f576000610a11565b855b9050600084602001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7b919061246e565b6001600160a01b0316886001600160a01b031614610a9a576000610a9c565b865b602086015160405163022c0d9f60e01b81529192506001600160a01b03169063022c0d9f90610ad590859085903090899060040161248b565b600060405180830381600087803b158015610aef57600080fd5b505af1158015610b03573d6000803e3d6000fd5b505050505050505050505050565b600183516001811115610b2657610b26611f06565b141561081f57600083604001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b94919061246e565b6001600160a01b0316876001600160a01b031614610bb3576000610bb6565b60015b90506000610bc6876000196124b8565b9050600082610be95773fffd8963efd1fc6a506488495d951d5263988d25610bf0565b6401000276a45b905085604001516001600160a01b031663128acb0830858585896040518663ffffffff1660e01b8152600401610c2a95949392919061253d565b60408051808303816000875af1158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190612578565b5050505050505050505050565b6001600160a01b03818116600090815260026020819052604082200154909116610ca557506000919050565b506001919050565b6000546001600160a01b03163314610cd75760405162461bcd60e51b815260040161026f9061259c565b6001600160a01b03821660009081526003602052604090819020805460ff1916600190811790915581516080810190925281908590811115610d1b57610d1b611f06565b81526001600160a01b03808516602080840182905260408085019290925285831660609094019390935290871660009081526002909252902081518154829060ff191660018381811115610d7157610d71611f06565b021790555060208281015182546001600160a01b0391821661010002610100600160a81b03199091161783556040808501516001850180549184166001600160a01b03199283161790556060909501516002948501805491841691909616179094558716600090815291905281902090517f0521a19cc658cb2ce5d74543402b2a46db79572181a183be9d4a787ded7d6d0f91610e0d916125d1565b60405180910390a150505050565b6000546001600160a01b03163314610e455760405162461bcd60e51b815260040161026f9061259c565b610e4f60006119c6565b565b6000610e5c84610c79565b610e845760405163a5be5e0f60e01b81526001600160a01b038516600482015260240161026f565b6001600160a01b0384166000908152600260205260408082208151608081019092528054829060ff166001811115610ebe57610ebe611f06565b6001811115610ecf57610ecf611f06565b815281546001600160a01b03610100909104811660208301526001808401548216604084015260029093015481166060909201919091529054919250610f189116333087611637565b6060810151600154610f36916001600160a01b0390911690866116a2565b600081516001811115610f4b57610f4b611f06565b141561107257604080516002808252606082018352600092602083019080368337505060015482519293506001600160a01b031691839150600090610f9257610f92611fa0565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110610fc657610fc6611fa0565b6001600160a01b03928316602091820292909201015260608301516040516338ed173960e01b81529116906338ed17399061100d9088908890869033904290600401611ffa565b6000604051808303816000875af115801561102c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110549190810190612036565b60018151811061106657611066611fa0565b60200260200101519250505b60018151600181111561108757611087611f06565b14156105e8576000604051806101000160405280600160009054906101000a90046001600160a01b03166001600160a01b03168152602001876001600160a01b0316815260200183604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015611110573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113491906120dc565b62ffffff168152602001336001600160a01b0316815260200142815260200186815260200185815260200160006001600160a01b0316815250905081606001516001600160a01b031663414bf389826040518263ffffffff1660e01b815260040161119f9190612101565b6020604051808303816000875af11580156111be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e29190612171565b9695505050505050565b60006111f784610c79565b61121f5760405163a5be5e0f60e01b81526001600160a01b038516600482015260240161026f565b6001600160a01b0384166000908152600260205260408082208151608081019092528054829060ff16600181111561125957611259611f06565b600181111561126a5761126a611f06565b815281546001600160a01b036101009091048116602083015260018301548116604083015260029092015482166060909101529091506112ae908616333087611637565b60608101516112c8906001600160a01b03871690866116a2565b6000815160018111156112dd576112dd611f06565b14156113f457604080516002808252606082018352600092602083019080368337019050509050858160008151811061131857611318611fa0565b6001600160a01b039283166020918202929092010152600180548351921691839190811061134857611348611fa0565b6001600160a01b03928316602091820292909201015260608301516040516338ed173960e01b81529116906338ed17399061138f9088908890869033904290600401611ffa565b6000604051808303816000875af11580156113ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113d69190810190612036565b6001815181106113e8576113e8611fa0565b60200260200101519250505b60018151600181111561140957611409611f06565b14156105e8576000604051806101000160405280876001600160a01b03168152602001600160009054906101000a90046001600160a01b03166001600160a01b0316815260200183604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015611110573d6000803e3d6000fd5b6000546001600160a01b031633146114bc5760405162461bcd60e51b815260040161026f9061259c565b6001600160a01b0381166115215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161026f565b61152a816119c6565b50565b3360009081526003602052604090205460ff1661155d5760405163c183bcef60e01b815260040160405180910390fd5b600080828060200190518101906115749190612228565b9092509050600082801561158a5761158a611f06565b141561163057600080828060200190518101906115a7919061227d565b9150915060008088126115c5576115c0876000196124b8565b6115d1565b6115d1886000196124b8565b9050600088136115e157866115e3565b875b60808401526060830151811461161c576060830151604051637c71134360e11b815260048101919091526024810182905260440161026f565b6116268383611789565b5050505050505050565b5050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526108229085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a16565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156116f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117179190612171565b6117219190612616565b6040516001600160a01b03851660248201526044810182905290915061082290859063095ea7b360e01b9060640161166b565b6040516001600160a01b03831660248201526044810182905261178490849063a9059cbb60e01b9060640161166b565b505050565b6020820151606083015183516117aa926001600160a01b0390911691611754565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156117f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118179190612171565b905082602001516001600160a01b0316639978cf4884608001518560600151856040518463ffffffff1660e01b81526004016118559392919061262e565b600060405180830381600087803b15801561186f57600080fd5b505af1158015611883573d6000803e3d6000fd5b50506001546040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa1580156118d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f69190612171565b90508360800151826119089190612616565b81101561192857604051632dc01fc160e11b815260040160405180910390fd5b6000604085015151600181111561194157611941611f06565b141561197257604084015160200151608085015160015461196d926001600160a01b0390911691611754565b611997565b60408085015101516080850151600154611997926001600160a01b0390911691611754565b7f14daacbc033867c4bf1c3e0209750e8a964c59c7086e3317256a7d311725eb8e84604051610e0d919061264d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611a6b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ae89092919063ffffffff16565b8051909150156117845780806020019051810190611a89919061265c565b6117845760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161026f565b6060611af78484600085611aff565b949350505050565b606082471015611b605760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161026f565b6001600160a01b0385163b611bb75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161026f565b600080866001600160a01b03168587604051611bd3919061267e565b60006040518083038185875af1925050503d8060008114611c10576040519150601f19603f3d011682016040523d82523d6000602084013e611c15565b606091505b5091509150611c25828286611c30565b979650505050505050565b60608315611c3f5750816105ea565b825115611c4f5782518084602001fd5b8160405162461bcd60e51b815260040161026f919061269a565b6001600160a01b038116811461152a57600080fd5b600080600060608486031215611c9357600080fd5b8335611c9e81611c69565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715611cec57611cec611cb3565b60405290565b6040516080810167ffffffffffffffff81118282101715611cec57611cec611cb3565b604051601f8201601f1916810167ffffffffffffffff81118282101715611d3e57611d3e611cb3565b604052919050565b600067ffffffffffffffff821115611d6057611d60611cb3565b50601f01601f191660200190565b600082601f830112611d7f57600080fd5b8135611d92611d8d82611d46565b611d15565b818152846020838601011115611da757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611dda57600080fd5b8435611de581611c69565b93506020850135925060408501359150606085013567ffffffffffffffff811115611e0f57600080fd5b611e1b87828801611d6e565b91505092959194509250565b600080600060608486031215611e3c57600080fd5b8335611e4781611c69565b925060208401359150604084013567ffffffffffffffff811115611e6a57600080fd5b611e7686828701611d6e565b9150509250925092565b600060208284031215611e9257600080fd5b81356105ea81611c69565b6002811061152a57600080fd5b60008060008060808587031215611ec057600080fd5b8435611ecb81611c69565b93506020850135611edb81611e9d565b92506040850135611eeb81611c69565b91506060850135611efb81611c69565b939692955090935050565b634e487b7160e01b600052602160045260246000fd5b60028110611f2c57611f2c611f06565b9052565b60808101611f3e8287611f1c565b6001600160a01b03948516602083015292841660408201529216606090920191909152919050565b600080600060608486031215611f7b57600080fd5b8335925060208401359150604084013567ffffffffffffffff811115611e6a57600080fd5b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b83811015611fef5781516001600160a01b031687529582019590820190600101611fca565b509495945050505050565b85815284602082015260a06040820152600061201960a0830186611fb6565b6001600160a01b0394909416606083015250608001529392505050565b6000602080838503121561204957600080fd5b825167ffffffffffffffff8082111561206157600080fd5b818501915085601f83011261207557600080fd5b81518181111561208757612087611cb3565b8060051b9150612098848301611d15565b81815291830184019184810190888411156120b257600080fd5b938501935b838510156120d0578451825293850193908501906120b7565b98975050505050505050565b6000602082840312156120ee57600080fd5b815162ffffff811681146105ea57600080fd5b610100810161216b828480516001600160a01b03908116835260208083015182169084015260408083015162ffffff16908401526060808301518216908401526080808301519084015260a0828101519084015260c0808301519084015260e09182015116910152565b92915050565b60006020828403121561218357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156121b2576121b261218a565b500390565b60005b838110156121d25781810151838201526020016121ba565b838111156108225750506000910152565b600082601f8301126121f457600080fd5b8151612202611d8d82611d46565b81815284602083860101111561221757600080fd5b611af78260208301602087016121b7565b6000806040838503121561223b57600080fd5b82516001811061224a57600080fd5b602084015190925067ffffffffffffffff81111561226757600080fd5b612273858286016121e3565b9150509250929050565b60008082840361012081121561229257600080fd5b610100808212156122a257600080fd5b6122aa611cc9565b85516122b581611c69565b815260208601516122c581611c69565b60208201526080603f19840112156122dc57600080fd5b6122e4611cf2565b925060408601516122f481611e9d565b8352606086015161230481611c69565b6020840152608086015161231781611c69565b604084015260a086015161232a81611c69565b8060608501525082604082015260c0860151606082015260e08601516080820152809450508085015191505067ffffffffffffffff81111561226757600080fd5b828152604060208201526000611af76040830184611fb6565b60018060a01b0380825116835280602083015116602084015260408201516123b0604085018251611f1c565b8160208201511660608501528160408201511660808501528160608201511660a08501525050606081015160c0830152608081015160e08301525050565b600081518084526124068160208601602086016121b7565b601f01601f19169290920160200192915050565b60006101206124298386612384565b8061010084015261243c818401856123ee565b95945050505050565b60006001841061245757612457611f06565b83825260406020830152611af760408301846123ee565b60006020828403121561248057600080fd5b81516105ea81611c69565b84815283602082015260018060a01b03831660408201526080606082015260006111e260808301846123ee565b60006001600160ff1b03818413828413808216868404861116156124de576124de61218a565b600160ff1b60008712828116878305891216156124fd576124fd61218a565b600087129250878205871284841616156125195761251961218a565b8785058712818416161561252f5761252f61218a565b505050929093029392505050565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a060808201819052600090611c25908301846123ee565b6000806040838503121561258b57600080fd5b505080516020909101519092909150565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b815460808201906125e58360ff8316611f1c565b60081c6001600160a01b03908116602084015260018401548116604084015260029093015490921660609091015290565b600082198211156126295761262961218a565b500190565b83815282602082015260606040820152600061243c60608301846123ee565b610100810161216b8284612384565b60006020828403121561266e57600080fd5b815180151581146105ea57600080fd5b600082516126908184602087016121b7565b9190910192915050565b6020815260006105ea60208301846123ee56fea264697066735822122025c52370f2192c7301c8d28004d3bfb5efa0fc091ee7891148f0b35c69d1c32364736f6c634300080b0033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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