Contract

0x9d32645062c7Fb3113fF4904317b61eBE3c0d208

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

-

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Token Transfers found.

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

Contract Source Code Verified (Exact Match)

Contract Name:
UniswapV3Adapter

Compiler Version
v0.8.27+commit.40a35a09

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
File 1 of 15 : UniswapV3Adapter.sol
//       ╟╗                                                                      ╔╬
//       ╞╬╬                                                                    ╬╠╬
//      ╔╣╬╬╬                                                                  ╠╠╠╠╦
//     ╬╬╬╬╬╩                                                                  ╘╠╠╠╠╬
//    ║╬╬╬╬╬                                                                    ╘╠╠╠╠╬
//    ╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬      ╒╬╬╬╬╬╬╬╜   ╠╠╬╬╬╬╬╬╬         ╠╬╬╬╬╬╬╬    ╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╠
//    ╙╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╕    ╬╬╬╬╬╬╬╜   ╣╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬   ╬╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╩
//     ╙╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬  ╔╬╬╬╬╬╬╬    ╔╠╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬╬╬╬╬╠╠╠╠╝╙
//               ╘╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬    ╒╠╠╠╬╠╬╩╬╬╬╬╬╬       ╠╬╬╬╬╬╬╬╣╬╬╬╬╬╬╬╙
//                 ╣╬╬╬╬╬╬╬╬╬╬╠╣     ╣╬╠╠╠╬╩ ╚╬╬╬╬╬╬      ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                  ╣╬╬╬╬╬╬╬╬╬╣     ╣╬╠╠╠╬╬   ╣╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                   ╟╬╬╬╬╬╬╬╩      ╬╬╠╠╠╠╬╬╬╬╬╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╒╬╬╠╠╬╠╠╬╬╬╬╬╬╬╬╬╬╬╬    ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╬╬╬╠╠╠╠╝╝╝╝╝╝╝╠╬╬╬╬╬╬   ╠╬╬╬╬╬╬╬  ╚╬╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬    ╣╬╬╬╬╠╠╩       ╘╬╬╬╬╬╬╬  ╠╬╬╬╬╬╬╬   ╙╬╬╬╬╬╬╬╬
//

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "./UniswapV3AdapterBase.sol";

contract UniswapV3Adapter is UniswapV3AdapterBase {

    constructor(
        string memory _name,
        uint256 _swapGasEstimate,
        uint256 _quoterGasLimit,
        address _quoter,
        address _factory,
        uint24[] memory _defaultFees
    ) UniswapV3AdapterBase(_name, _swapGasEstimate, _quoterGasLimit, _quoter, _factory, _defaultFees) {
    }

    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata
    ) external {
        if (amount0Delta > 0) {
            IERC20(IUniV3Pool(msg.sender).token0()).transfer(msg.sender, uint256(amount0Delta));
        } else {
            IERC20(IUniV3Pool(msg.sender).token1()).transfer(msg.sender, uint256(amount1Delta));
        }
    }
}

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 15 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 15 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

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

File 5 of 15 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 6 of 15 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @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.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 8 of 15 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 9 of 15 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 10 of 15 : UniswapV3AdapterBase.sol
//       ╟╗                                                                      ╔╬
//       ╞╬╬                                                                    ╬╠╬
//      ╔╣╬╬╬                                                                  ╠╠╠╠╦
//     ╬╬╬╬╬╩                                                                  ╘╠╠╠╠╬
//    ║╬╬╬╬╬                                                                    ╘╠╠╠╠╬
//    ╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬      ╒╬╬╬╬╬╬╬╜   ╠╠╬╬╬╬╬╬╬         ╠╬╬╬╬╬╬╬    ╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╠
//    ╙╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╕    ╬╬╬╬╬╬╬╜   ╣╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬   ╬╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╩
//     ╙╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬  ╔╬╬╬╬╬╬╬    ╔╠╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬╬╬╬╬╠╠╠╠╝╙
//               ╘╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬    ╒╠╠╠╬╠╬╩╬╬╬╬╬╬       ╠╬╬╬╬╬╬╬╣╬╬╬╬╬╬╬╙
//                 ╣╬╬╬╬╬╬╬╬╬╬╠╣     ╣╬╠╠╠╬╩ ╚╬╬╬╬╬╬      ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                  ╣╬╬╬╬╬╬╬╬╬╣     ╣╬╠╠╠╬╬   ╣╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                   ╟╬╬╬╬╬╬╬╩      ╬╬╠╠╠╠╬╬╬╬╬╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╒╬╬╠╠╬╠╠╬╬╬╬╬╬╬╬╬╬╬╬    ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╬╬╬╠╠╠╠╝╝╝╝╝╝╝╠╬╬╬╬╬╬   ╠╬╬╬╬╬╬╬  ╚╬╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬    ╣╬╬╬╬╠╠╩       ╘╬╬╬╬╬╬╬  ╠╬╬╬╬╬╬╬   ╙╬╬╬╬╬╬╬╬
//

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "./UniswapV3likeAdapter.sol";

interface IUniV3Factory {
    function feeAmountTickSpacing(uint24) external view returns (int24);

    function getPool(
        address,
        address,
        uint24
    ) external view returns (address);
}

contract UniswapV3AdapterBase is UniswapV3likeAdapter {
    using SafeERC20 for IERC20;

    address immutable FACTORY;
    mapping(uint24 => bool) public isFeeAmountEnabled;
    uint24[] public feeAmounts;

    constructor(
        string memory _name,
        uint256 _swapGasEstimate,
        uint256 _quoterGasLimit,
        address _quoter,
        address _factory,
        uint24[] memory _defaultFees
    ) UniswapV3likeAdapter(_name, _swapGasEstimate, _quoter, _quoterGasLimit) {
        FACTORY = _factory;
        for (uint i = 0; i < _defaultFees.length; i++) {
            addFeeAmount(_defaultFees[i]);
        }
    }

    function enableFeeAmounts(uint24[] calldata _amounts) external onlyMaintainer {
        for (uint256 i; i < _amounts.length; ++i) enableFeeAmount(_amounts[i]);
    }

    function enableFeeAmount(uint24 _fee) internal {
        require(!isFeeAmountEnabled[_fee], "Fee already enabled");
        if (IUniV3Factory(FACTORY).feeAmountTickSpacing(_fee) == 0)
            revert("Factory doesn't support fee");
        addFeeAmount(_fee);
    }

    function addFeeAmount(uint24 _fee) internal {
        isFeeAmountEnabled[_fee] = true;
        feeAmounts.push(_fee);
    }

    function getBestPool(
        address token0, 
        address token1
    ) internal view override returns (address mostLiquid) {
        uint128 deepestLiquidity;
        for (uint256 i; i < feeAmounts.length; ++i) {
            address pool = IUniV3Factory(FACTORY).getPool(token0, token1, feeAmounts[i]);
            if (pool == address(0))
                continue;
            uint128 liquidity = IUniV3Pool(pool).liquidity();
            if (liquidity > deepestLiquidity) {
                deepestLiquidity = liquidity;
                mostLiquid = pool;
            }
        }
    }
}

File 11 of 15 : UniswapV3likeAdapter.sol
//       ╟╗                                                                      ╔╬
//       ╞╬╬                                                                    ╬╠╬
//      ╔╣╬╬╬                                                                  ╠╠╠╠╦
//     ╬╬╬╬╬╩                                                                  ╘╠╠╠╠╬
//    ║╬╬╬╬╬                                                                    ╘╠╠╠╠╬
//    ╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬      ╒╬╬╬╬╬╬╬╜   ╠╠╬╬╬╬╬╬╬         ╠╬╬╬╬╬╬╬    ╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╠
//    ╙╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╕    ╬╬╬╬╬╬╬╜   ╣╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬   ╬╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╩
//     ╙╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬  ╔╬╬╬╬╬╬╬    ╔╠╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬╬╬╬╬╠╠╠╠╝╙
//               ╘╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬    ╒╠╠╠╬╠╬╩╬╬╬╬╬╬       ╠╬╬╬╬╬╬╬╣╬╬╬╬╬╬╬╙
//                 ╣╬╬╬╬╬╬╬╬╬╬╠╣     ╣╬╠╠╠╬╩ ╚╬╬╬╬╬╬      ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                  ╣╬╬╬╬╬╬╬╬╬╣     ╣╬╠╠╠╬╬   ╣╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                   ╟╬╬╬╬╬╬╬╩      ╬╬╠╠╠╠╬╬╬╬╬╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╒╬╬╠╠╬╠╠╬╬╬╬╬╬╬╬╬╬╬╬    ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╬╬╬╠╠╠╠╝╝╝╝╝╝╝╠╬╬╬╬╬╬   ╠╬╬╬╬╬╬╬  ╚╬╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬    ╣╬╬╬╬╠╠╩       ╘╬╬╬╬╬╬╬  ╠╬╬╬╬╬╬╬   ╙╬╬╬╬╬╬╬╬
//

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "../interface/IERC20.sol";
import "../lib/SafeERC20.sol";
import "../YakAdapter.sol";

struct QParams {
    address tokenIn;
    address tokenOut;
    int256 amountIn;
    uint24 fee;
}

interface IUniV3Pool {
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function liquidity() external view returns (uint128);
}

interface IUniV3Quoter {
    function quoteExactInputSingle(
        QParams memory params
    ) external view returns (uint256);

    function quote(
        address,
        bool,
        int256,
        uint160
    ) external view returns (int256, int256);
}

abstract contract UniswapV3likeAdapter is YakAdapter {
    using SafeERC20 for IERC20;

    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    uint256 public quoterGasLimit;
    address public quoter;

    constructor(
        string memory _name,
        uint256 _swapGasEstimate,
        address _quoter,
        uint256 _quoterGasLimit
    ) YakAdapter(_name, _swapGasEstimate) {
        setQuoterGasLimit(_quoterGasLimit);
        setQuoter(_quoter);
    }

    function setQuoter(address newQuoter) public onlyMaintainer {
        quoter = newQuoter;
    }

    function setQuoterGasLimit(uint256 newLimit) public onlyMaintainer {
        require(newLimit != 0, "queryGasLimit can't be zero");
        quoterGasLimit = newLimit;
    }

    function getQuoteForPool(
        address pool,
        int256 amountIn,
        address tokenIn,
        address tokenOut
    ) external view returns (uint256) {
        QParams memory params;
        params.amountIn = amountIn;
        params.tokenIn = tokenIn;
        params.tokenOut = tokenOut;
        return getQuoteForPool(pool, params);
    }

    function _query(
        uint256 _amountIn,
        address _tokenIn,
        address _tokenOut
    ) internal view override returns (uint256 quote) {
        QParams memory params = getQParams(_amountIn, _tokenIn, _tokenOut);
        quote = getQuoteForBestPool(params);
    }

    function _swap(
        uint256 _amountIn,
        uint256 _amountOut,
        address _tokenIn,
        address _tokenOut,
        address _to
    ) internal override {
        QParams memory params = getQParams(_amountIn, _tokenIn, _tokenOut);
        uint256 amountOut = _underlyingSwap(params, new bytes(0));
        require(amountOut >= _amountOut, "Insufficient amountOut");
        _returnTo(_tokenOut, amountOut, _to);
    }

    function getQParams(
        uint256 amountIn,
        address tokenIn,
        address tokenOut
    ) internal pure returns (QParams memory params) {
        params = QParams({ 
            amountIn: int256(amountIn), 
            tokenIn: tokenIn, 
            tokenOut: tokenOut, 
            fee: 0 
        });
    }

    function _underlyingSwap(
        QParams memory params, 
        bytes memory callbackData
    ) internal virtual returns (uint256) {
        address pool = getBestPool(params.tokenIn, params.tokenOut);
        (bool zeroForOne, uint160 priceLimit) = getZeroOneAndSqrtPriceLimitX96(
            params.tokenIn, 
            params.tokenOut
        );
        (int256 amount0, int256 amount1) = IUniV3Pool(pool).swap(
            address(this),
            zeroForOne,
            int256(params.amountIn),
            priceLimit,
            callbackData
        );
        return zeroForOne ? uint256(-amount1) : uint256(-amount0);
    }

    function getQuoteForBestPool(
        QParams memory params
    ) internal view returns (uint256 quote) {
        address bestPool = getBestPool(params.tokenIn, params.tokenOut);
        if (bestPool != address(0)) quote = getQuoteForPool(bestPool, params);
    }

    function getBestPool(
        address token0, 
        address token1
    ) internal view virtual returns (address mostLiquid);
    
    function getQuoteForPool(
        address pool, 
        QParams memory params
    ) internal view returns (uint256) {
        (bool zeroForOne, uint160 priceLimit) = getZeroOneAndSqrtPriceLimitX96(
            params.tokenIn, 
            params.tokenOut
        );
        (int256 amount0, int256 amount1) = getQuoteSafe(
            pool,
            zeroForOne,
            params.amountIn,
            priceLimit
        );
        return zeroForOne ? uint256(-amount1) : uint256(-amount0);
    }

    function getQuoteSafe(
        address pool, 
        bool zeroForOne,
        int256 amountIn,
        uint160 priceLimit
    ) internal view returns (int256 amount0, int256 amount1) {
        bytes memory calldata_ = abi.encodeWithSignature(
            "quote(address,bool,int256,uint160)",
            pool,
            zeroForOne,
            amountIn,
            priceLimit
        );
        (bool success, bytes memory data) = staticCallQuoterRaw(calldata_);
        if (success)
            (amount0, amount1) = abi.decode(data, (int256, int256));
    }

    function staticCallQuoterRaw(
        bytes memory calldata_
    ) internal view returns (bool success, bytes memory data) {
        (success, data) = quoter.staticcall{gas: quoterGasLimit}(calldata_);
    }

    function getZeroOneAndSqrtPriceLimitX96(address tokenIn, address tokenOut)
        internal
        pure
        returns (bool zeroForOne, uint160 sqrtPriceLimitX96)
    {
        zeroForOne = tokenIn < tokenOut;
        sqrtPriceLimitX96 = zeroForOne ? MIN_SQRT_RATIO+1 : MAX_SQRT_RATIO-1;
    }
}

File 12 of 15 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC20 {
    event Approval(address, address, uint256);
    event Transfer(address, address, uint256);

    function name() external view returns (string memory);

    function decimals() external view returns (uint8);

    function transferFrom(
        address,
        address,
        uint256
    ) external returns (bool);

    function allowance(address, address) external view returns (uint256);

    function approve(address, uint256) external returns (bool);

    function transfer(address, uint256) external returns (bool);

    function balanceOf(address) external view returns (uint256);

    function nonces(address) external view returns (uint256); // Only tokens that support permit

    function permit(
        address,
        address,
        uint256,
        uint256,
        uint8,
        bytes32,
        bytes32
    ) external; // Only tokens that support permit

    function swap(address, uint256) external; // Only Avalanche bridge tokens

    function swapSupply(address) external view returns (uint256); // Only Avalanche bridge tokens

    function totalSupply() external view returns (uint256);
}

File 13 of 15 : Maintainable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/AccessControl.sol";

/**
 * @dev Contract module which extends the basic access control mechanism of Ownable
 * to include many maintainers, whom only the owner (DEFAULT_ADMIN_ROLE) may add and
 * remove.
 *
 * 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 this modifier:
 * `onlyMaintainer`, which can be applied to your functions to restrict their use to
 * the accounts with the role of maintainer.
 */

abstract contract Maintainable is Context, AccessControl {
    bytes32 public constant MAINTAINER_ROLE = keccak256("MAINTAINER_ROLE");

    constructor() {
        address msgSender = _msgSender();
        // members of the DEFAULT_ADMIN_ROLE alone may revoke and grant role membership
        _setupRole(DEFAULT_ADMIN_ROLE, msgSender);
        _setupRole(MAINTAINER_ROLE, msgSender);
    }

    function addMaintainer(address addedMaintainer) public virtual {
        grantRole(MAINTAINER_ROLE, addedMaintainer);
    }

    function removeMaintainer(address removedMaintainer) public virtual {
        revokeRole(MAINTAINER_ROLE, removedMaintainer);
    }

    function renounceRole(bytes32 role) public virtual {
        address msgSender = _msgSender();
        renounceRole(role, msgSender);
    }

    function transferOwnership(address newOwner) public virtual {
        address msgSender = _msgSender();
        grantRole(DEFAULT_ADMIN_ROLE, newOwner);
        renounceRole(DEFAULT_ADMIN_ROLE, msgSender);
    }

    modifier onlyMaintainer() {
        address msgSender = _msgSender();
        require(hasRole(MAINTAINER_ROLE, msgSender), "Maintainable: Caller is not a maintainer");
        _;
    }
}

File 14 of 15 : SafeERC20.sol
// This is a simplified version of OpenZepplin's SafeERC20 library
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

import "../interface/IERC20.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 ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    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));
    }

    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @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.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 15 of 15 : YakAdapter.sol
//       ╟╗                                                                      ╔╬
//       ╞╬╬                                                                    ╬╠╬
//      ╔╣╬╬╬                                                                  ╠╠╠╠╦
//     ╬╬╬╬╬╩                                                                  ╘╠╠╠╠╬
//    ║╬╬╬╬╬                                                                    ╘╠╠╠╠╬
//    ╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬      ╒╬╬╬╬╬╬╬╜   ╠╠╬╬╬╬╬╬╬         ╠╬╬╬╬╬╬╬    ╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╠
//    ╙╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╕    ╬╬╬╬╬╬╬╜   ╣╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬   ╬╬╬╬╬╬╬╬╬╠╠╠╠╠╠╠╩
//     ╙╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬  ╔╬╬╬╬╬╬╬    ╔╠╠╠╬╬╬╬╬╬╬╬        ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬╬╬╬╬╠╠╠╠╝╙
//               ╘╣╬╬╬╬╬╬╬╬╬╬╬╬╬╬    ╒╠╠╠╬╠╬╩╬╬╬╬╬╬       ╠╬╬╬╬╬╬╬╣╬╬╬╬╬╬╬╙
//                 ╣╬╬╬╬╬╬╬╬╬╬╠╣     ╣╬╠╠╠╬╩ ╚╬╬╬╬╬╬      ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                  ╣╬╬╬╬╬╬╬╬╬╣     ╣╬╠╠╠╬╬   ╣╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬
//                   ╟╬╬╬╬╬╬╬╩      ╬╬╠╠╠╠╬╬╬╬╬╬╬╬╬╬╬     ╠╬╬╬╬╬╬╬╠╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╒╬╬╠╠╬╠╠╬╬╬╬╬╬╬╬╬╬╬╬    ╠╬╬╬╬╬╬╬ ╣╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬     ╬╬╬╠╠╠╠╝╝╝╝╝╝╝╠╬╬╬╬╬╬   ╠╬╬╬╬╬╬╬  ╚╬╬╬╬╬╬╬╬
//                    ╬╬╬╬╬╬╬    ╣╬╬╬╬╠╠╩       ╘╬╬╬╬╬╬╬  ╠╬╬╬╬╬╬╬   ╙╬╬╬╬╬╬╬╬
//

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "./interface/IERC20.sol";
import "./lib/SafeERC20.sol";
import "./lib/Maintainable.sol";

abstract contract YakAdapter is Maintainable {
    using SafeERC20 for IERC20;

    event YakAdapterSwap(address indexed _tokenFrom, address indexed _tokenTo, uint256 _amountIn, uint256 _amountOut);
    event UpdatedGasEstimate(address indexed _adapter, uint256 _newEstimate);
    event Recovered(address indexed _asset, uint256 amount);

    uint256 internal constant UINT_MAX = type(uint256).max;
    uint256 public swapGasEstimate;
    string public name;

    constructor(string memory _name, uint256 _gasEstimate) {
        setName(_name);
        setSwapGasEstimate(_gasEstimate);
    }

    function setName(string memory _name) internal {
        require(bytes(_name).length != 0, "Invalid adapter name");
        name = _name;
    }

    function setSwapGasEstimate(uint256 _estimate) public onlyMaintainer {
        require(_estimate != 0, "Invalid gas-estimate");
        swapGasEstimate = _estimate;
        emit UpdatedGasEstimate(address(this), _estimate);
    }

    function revokeAllowance(address _token, address _spender) external onlyMaintainer {
        IERC20(_token).safeApprove(_spender, 0);
    }

    function recoverERC20(address _tokenAddress, uint256 _tokenAmount) external onlyMaintainer {
        require(_tokenAmount > 0, "YakAdapter: Nothing to recover");
        IERC20(_tokenAddress).safeTransfer(msg.sender, _tokenAmount);
        emit Recovered(_tokenAddress, _tokenAmount);
    }

    function recoverAVAX(uint256 _amount) external onlyMaintainer {
        require(_amount > 0, "YakAdapter: Nothing to recover");
        payable(msg.sender).transfer(_amount);
        emit Recovered(address(0), _amount);
    }

    function query(
        uint256 _amountIn,
        address _tokenIn,
        address _tokenOut
    ) external view returns (uint256) {
        return _query(_amountIn, _tokenIn, _tokenOut);
    }

    function swap(
        uint256 _amountIn,
        uint256 _amountOut,
        address _fromToken,
        address _toToken,
        address _to
    ) external virtual {
        uint256 toBal0 = IERC20(_toToken).balanceOf(_to);
        _swap(_amountIn, _amountOut, _fromToken, _toToken, _to);
        uint256 diff = IERC20(_toToken).balanceOf(_to) - toBal0;
        require(diff >= _amountOut, "Insufficient amount-out");
        emit YakAdapterSwap(_fromToken, _toToken, _amountIn, _amountOut);
    }

    function _returnTo(
        address _token,
        uint256 _amount,
        address _to
    ) internal {
        if (address(this) != _to) IERC20(_token).safeTransfer(_to, _amount);
    }

    function _swap(
        uint256 _amountIn,
        uint256 _amountOut,
        address _fromToken,
        address _toToken,
        address _to
    ) internal virtual;

    function _query(
        uint256 _amountIn,
        address _tokenIn,
        address _tokenOut
    ) internal view virtual returns (uint256);

    receive() external payable {}
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_swapGasEstimate","type":"uint256"},{"internalType":"uint256","name":"_quoterGasLimit","type":"uint256"},{"internalType":"address","name":"_quoter","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"uint24[]","name":"_defaultFees","type":"uint24[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_adapter","type":"address"},{"indexed":false,"internalType":"uint256","name":"_newEstimate","type":"uint256"}],"name":"UpdatedGasEstimate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenFrom","type":"address"},{"indexed":true,"internalType":"address","name":"_tokenTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amountOut","type":"uint256"}],"name":"YakAdapterSwap","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAINTAINER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addedMaintainer","type":"address"}],"name":"addMaintainer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24[]","name":"_amounts","type":"uint24[]"}],"name":"enableFeeAmounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feeAmounts","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"int256","name":"amountIn","type":"int256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"}],"name":"getQuoteForPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint24","name":"","type":"uint24"}],"name":"isFeeAmountEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"name":"query","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoterGasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverAVAX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"removedMaintainer","type":"address"}],"name":"removeMaintainer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"revokeAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newQuoter","type":"address"}],"name":"setQuoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLimit","type":"uint256"}],"name":"setQuoterGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_estimate","type":"uint256"}],"name":"setSwapGasEstimate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_amountOut","type":"uint256"},{"internalType":"address","name":"_fromToken","type":"address"},{"internalType":"address","name":"_toToken","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapGasEstimate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a060405234801561001057600080fd5b5060405161308338038061308383398101604081905261002f916105b7565b858585858585858584868383336100476000826100f8565b6100717f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab95826100f8565b5061007b82610106565b61008481610168565b50610090905081610261565b61009982610322565b5050506001600160a01b0383166080525060005b81518110156100e6576100de8282815181106100cb576100cb6106c3565b60200260200101516103b060201b60201c565b6001016100ad565b50505050505050505050505050610820565b6101028282610424565b5050565b805160000361015c5760405162461bcd60e51b815260206004820152601460248201527f496e76616c69642061646170746572206e616d6500000000000000000000000060448201526064015b60405180910390fd5b60026101028282610762565b336000818152600080516020613043833981519152602052604090205460ff166101d35760405162461bcd60e51b8152602060048201526028602482015260008051602061306383398151915260448201526734b73a30b4b732b960c11b6064820152608401610153565b816000036102235760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206761732d657374696d6174650000000000000000000000006044820152606401610153565b600182905560405182815230907ff43f23b7a28e6f8ce6843a21bd7b48bce778aa913b8c8cf459edf7d770e8d38a9060200160405180910390a25050565b336000818152600080516020613043833981519152602052604090205460ff166102cc5760405162461bcd60e51b8152602060048201526028602482015260008051602061306383398151915260448201526734b73a30b4b732b960c11b6064820152608401610153565b8160000361031c5760405162461bcd60e51b815260206004820152601b60248201527f71756572794761734c696d69742063616e2774206265207a65726f00000000006044820152606401610153565b50600355565b336000818152600080516020613043833981519152602052604090205460ff1661038d5760405162461bcd60e51b8152602060048201526028602482015260008051602061306383398151915260448201526734b73a30b4b732b960c11b6064820152608401610153565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b62ffffff9081166000818152600560205260408120805460ff19166001908117909155600680549182018155909152600a8082047ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018054600392909306919091026101000a928302929093021916179055565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610102576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561047e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610500576105006104c2565b604052919050565b80516001600160a01b038116811461051f57600080fd5b919050565b600082601f83011261053557600080fd5b81516001600160401b0381111561054e5761054e6104c2565b8060051b61055e602082016104d8565b9182526020818501810192908101908684111561057a57600080fd5b6020860192505b838310156105ad57825162ffffff8116811461059c57600080fd5b825260209283019290910190610581565b9695505050505050565b60008060008060008060c087890312156105d057600080fd5b86516001600160401b038111156105e657600080fd5b8701601f810189136105f757600080fd5b80516001600160401b03811115610610576106106104c2565b610623601f8201601f19166020016104d8565b8181528a602083850101111561063857600080fd5b60005b828110156106575760208185018101518383018201520161063b565b50600060209282018301529089015160408a015191985096509450610680905060608801610508565b925061068e60808801610508565b60a08801519092506001600160401b038111156106aa57600080fd5b6106b689828a01610524565b9150509295509295509295565b634e487b7160e01b600052603260045260246000fd5b600181811c908216806106ed57607f821691505b60208210810361070d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561075d57806000526020600020601f840160051c8101602085101561073a5750805b601f840160051c820191505b8181101561075a5760008155600101610746565b50505b505050565b81516001600160401b0381111561077b5761077b6104c2565b61078f8161078984546106d9565b84610713565b6020601f8211600181146107c357600083156107ab5750848201515b600019600385901b1c1916600184901b17845561075a565b600084815260208120601f198516915b828110156107f357878501518255602094850194600190920191016107d3565b50848210156108115786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b6080516128016108426000396000818161151f0152611fcb01526128016000f3fe6080604052600436106101c65760003560e01c80638bb9c5bf116100f7578063d8baf7cf11610095578063f35c4d4511610064578063f35c4d451461056a578063f87422541461058a578063f912c64b146105be578063fa461e33146105de57600080fd5b8063d8baf7cf146104ea578063eab90da61461050a578063ef99893a1461052a578063f2fde38b1461054a57600080fd5b8063a2e64137116100d1578063a2e641371461042e578063c6bbd5a714610462578063ce62f6c41461049a578063d547741f146104ca57600080fd5b80638bb9c5bf146103b557806391d14854146103d5578063a217fddf1461041957600080fd5b80634ebb79161161016457806373ec15661161013e57806373ec1566146103355780637ae267731461035557806384a33e63146103755780638980f11f1461039557600080fd5b80634ebb7916146102df57806369cff80d146102ff5780636b453c1f1461031557600080fd5b8063248a9ca3116101a0578063248a9ca3146102575780632bc857a0146102875780632f2ff15d1461029d57806336568abe146102bf57600080fd5b806301ffc9a7146101d257806305e3f4dc1461020757806306fdde031461023557600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004612169565b6105fe565b60405190151581526020015b60405180910390f35b34801561021357600080fd5b506102276102223660046121a8565b610667565b6040519081526020016101fe565b34801561024157600080fd5b5061024a6106a8565b6040516101fe919061224b565b34801561026357600080fd5b5061022761027236600461225e565b60009081526020819052604090206001015490565b34801561029357600080fd5b5061022760035481565b3480156102a957600080fd5b506102bd6102b8366004612277565b610736565b005b3480156102cb57600080fd5b506102bd6102da366004612277565b610760565b3480156102eb57600080fd5b506102bd6102fa36600461225e565b6107f1565b34801561030b57600080fd5b5061022760015481565b34801561032157600080fd5b506102bd6103303660046122a7565b610939565b34801561034157600080fd5b506102bd6103503660046122c4565b610966565b34801561036157600080fd5b506102bd61037036600461233b565b610a3d565b34801561038157600080fd5b506102bd61039036600461225e565b610ae1565b3480156103a157600080fd5b506102bd6103b0366004612369565b610bf7565b3480156103c157600080fd5b506102bd6103d036600461225e565b610d32565b3480156103e157600080fd5b506101f26103f0366004612277565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561042557600080fd5b50610227600081565b34801561043a57600080fd5b5061044e61044936600461225e565b610d3d565b60405162ffffff90911681526020016101fe565b34801561046e57600080fd5b50600454610482906001600160a01b031681565b6040516001600160a01b0390911681526020016101fe565b3480156104a657600080fd5b506101f26104b5366004612395565b60056020526000908152604090205460ff1681565b3480156104d657600080fd5b506102bd6104e5366004612277565b610d76565b3480156104f657600080fd5b506102bd6105053660046122a7565b610d9b565b34801561051657600080fd5b506102bd6105253660046123ba565b610dc5565b34801561053657600080fd5b50610227610545366004612419565b610f6c565b34801561055657600080fd5b506102bd6105653660046122a7565b610f81565b34801561057657600080fd5b506102bd61058536600461225e565b610f98565b34801561059657600080fd5b506102277f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab9581565b3480156105ca57600080fd5b506102bd6105d93660046122a7565b61107d565b3480156105ea57600080fd5b506102bd6105f936600461245b565b611147565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061066157507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b604080516080810182526000606082018190529181018590526001600160a01b0384811682528316602082015261069e8682611307565b9695505050505050565b600280546106b5906124de565b80601f01602080910402602001604051908101604052809291908181526020018280546106e1906124de565b801561072e5780601f106107035761010080835404028352916020019161072e565b820191906000526020600020905b81548152906001019060200180831161071157829003601f168201915b505050505081565b60008281526020819052604090206001015461075181611360565b61075b838361136a565b505050565b6001600160a01b03811633146107e35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6107ed8282611408565b5050565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff166108805760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b600082116108d05760405162461bcd60e51b815260206004820152601e60248201527f59616b416461707465723a204e6f7468696e6720746f207265636f766572000060448201526064016107da565b604051339083156108fc029084906000818181858888f193505050501580156108fd573d6000803e3d6000fd5b506040518281526000907f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28906020015b60405180910390a25050565b6109637f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab9582610736565b50565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff166109f55760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b60005b82811015610a3757610a2f848483818110610a1557610a15612512565b9050602002016020810190610a2a9190612395565b611487565b6001016109f8565b50505050565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff16610acc5760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b61075b6001600160a01b03841683600061165c565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff16610b705760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b81600003610bc05760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206761732d657374696d61746500000000000000000000000060448201526064016107da565b600182905560405182815230907ff43f23b7a28e6f8ce6843a21bd7b48bce778aa913b8c8cf459edf7d770e8d38a9060200161092d565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff16610c865760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b60008211610cd65760405162461bcd60e51b815260206004820152601e60248201527f59616b416461707465723a204e6f7468696e6720746f207265636f766572000060448201526064016107da565b610cea6001600160a01b03841633846117f2565b826001600160a01b03167f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa2883604051610d2591815260200190565b60405180910390a2505050565b336107ed8282610760565b60068181548110610d4d57600080fd5b90600052602060002090600a9182820401919006600302915054906101000a900462ffffff1681565b600082815260208190526040902060010154610d9181611360565b61075b8383611408565b6109637f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab9582610d76565b6040516370a0823160e01b81526001600160a01b038281166004830152600091908416906370a0823190602401602060405180830381865afa158015610e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e339190612528565b9050610e428686868686611822565b6040516370a0823160e01b81526001600160a01b03838116600483015260009183918616906370a0823190602401602060405180830381865afa158015610e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb19190612528565b610ebb9190612557565b905085811015610f0d5760405162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e7420616d6f756e742d6f757400000000000000000060448201526064016107da565b836001600160a01b0316856001600160a01b03167fe2bdbc6b7225eb0a972ac943c485a6cc05f7c6811838bce8903f23200fb744fa8989604051610f5b929190918252602082015260400190565b60405180910390a350505050505050565b6000610f798484846118ec565b949350505050565b33610f8d600083610736565b6107ed600082610760565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff166110275760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b816000036110775760405162461bcd60e51b815260206004820152601b60248201527f71756572794761734c696d69742063616e2774206265207a65726f000000000060448201526064016107da565b50600355565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff1661110c5760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b50600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600084131561122b57336001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b2919061256a565b60405163a9059cbb60e01b8152336004820152602481018690526001600160a01b03919091169063a9059cbb906044016020604051808303816000875af1158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112259190612587565b50610a37565b336001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128d919061256a565b60405163a9059cbb60e01b8152336004820152602481018590526001600160a01b03919091169063a9059cbb906044016020604051808303816000875af11580156112dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113009190612587565b5050505050565b600080600061131e8460000151856020015161194a565b91509150600080611335878588604001518661199d565b915091508361134c57611347826125a9565b611355565b611355816125a9565b979650505050505050565b6109638133611a66565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166107ed576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556113c43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156107ed576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b62ffffff811660009081526005602052604090205460ff16156114ec5760405162461bcd60e51b815260206004820152601360248201527f46656520616c726561647920656e61626c65640000000000000000000000000060448201526064016107da565b6040517f22afcccb00000000000000000000000000000000000000000000000000000000815262ffffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906322afcccb90602401602060405180830381865afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159291906125e1565b60020b6000036115e45760405162461bcd60e51b815260206004820152601b60248201527f466163746f727920646f65736e277420737570706f727420666565000000000060448201526064016107da565b6109638162ffffff9081166000818152600560205260408120805460ff19166001908117909155600680549182018155909152600a8082047ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018054600392909306919091026101000a928302929093021916179055565b8015806116ef57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156116c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ed9190612528565b155b6117615760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016107da565b6040516001600160a01b03831660248201526044810182905261075b9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611ad9565b6040516001600160a01b03831660248201526044810182905261075b90849063a9059cbb60e01b906064016117a6565b6040805160808082018352600080835260208084018290528385018290526060938401829052845192830185526001600160a01b0388811684528716838201528285018a905292820181905283518181529283019093529190611886908390611c15565b9050858110156118d85760405162461bcd60e51b815260206004820152601660248201527f496e73756666696369656e7420616d6f756e744f75740000000000000000000060448201526064016107da565b6118e3848285611cee565b50505050505050565b6040805160808082018352600080835260208084018290528385018290526060938401829052845192830185526001600160a01b03808816845286169083015292810186905290810182905261194181611d12565b95945050505050565b6001600160a01b03808216908316106000816119845761197f600173fffd8963efd1fc6a506488495d951d5263988d2661261a565b611994565b6119946401000276a36001612639565b90509250929050565b6040516001600160a01b038086166024830152841515604483015260648201849052821660848201526000908190819060a40160408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f90405d36000000000000000000000000000000000000000000000000000000001790529050600080611a3683611d4b565b915091508115611a5a5780806020019051810190611a549190612658565b90955093505b50505094509492505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166107ed57611a9781611dbd565b611aa2836020611dcf565b604051602001611ab392919061267c565b60408051601f198184030181529082905262461bcd60e51b82526107da9160040161224b565b600080836001600160a01b031683604051611af491906126fd565b6000604051808303816000865af19150503d8060008114611b31576040519150601f19603f3d011682016040523d82523d6000602084013e611b36565b606091505b509150915081611b885760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016107da565b805115610a375780806020019051810190611ba39190612587565b610a375760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107da565b600080611c2a84600001518560200151611fb7565b9050600080611c418660000151876020015161194a565b91509150600080846001600160a01b031663128acb0830868b60400151878c6040518663ffffffff1660e01b8152600401611c80959493929190612719565b60408051808303816000875af1158015611c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc29190612658565b9150915083611cd957611cd4826125a9565b611ce2565b611ce2816125a9565b98975050505050505050565b306001600160a01b0382161461075b5761075b6001600160a01b03841682846117f2565b600080611d2783600001518460200151611fb7565b90506001600160a01b03811615611d4557611d428184611307565b91505b50919050565b6004546003546040516000926060926001600160a01b0390911691611d719086906126fd565b6000604051808303818686fa925050503d8060008114611dad576040519150601f19603f3d011682016040523d82523d6000602084013e611db2565b606091505b509094909350915050565b60606106616001600160a01b03831660145b60606000611dde836002612758565b611de990600261276f565b67ffffffffffffffff811115611e0157611e01612604565b6040519080825280601f01601f191660200182016040528015611e2b576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611e6257611e62612512565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611ead57611ead612512565b60200101906001600160f81b031916908160001a9053506000611ed1846002612758565b611edc90600161276f565b90505b6001811115611f61577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611f1d57611f1d612512565b1a60f81b828281518110611f3357611f33612512565b60200101906001600160f81b031916908160001a90535060049490941c93611f5a81612782565b9050611edf565b508315611fb05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107da565b9392505050565b60008060005b6006548110156121615760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631698ee8287876006868154811061200d5761200d612512565b60009182526020909120600a8083049091015460405160e087901b6001600160e01b03191681526001600160a01b03958616600482015293909416602484015290066003026101000a90910462ffffff166044820152606401602060405180830381865afa158015612083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a7919061256a565b90506001600160a01b0381166120bd5750612159565b6000816001600160a01b0316631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121219190612799565b9050836fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff161115612156578093508194505b50505b600101611fbd565b505092915050565b60006020828403121561217b57600080fd5b81356001600160e01b031981168114611fb057600080fd5b6001600160a01b038116811461096357600080fd5b600080600080608085870312156121be57600080fd5b84356121c981612193565b93506020850135925060408501356121e081612193565b915060608501356121f081612193565b939692955090935050565b60005b838110156122165781810151838201526020016121fe565b50506000910152565b600081518084526122378160208601602086016121fb565b601f01601f19169290920160200192915050565b602081526000611fb0602083018461221f565b60006020828403121561227057600080fd5b5035919050565b6000806040838503121561228a57600080fd5b82359150602083013561229c81612193565b809150509250929050565b6000602082840312156122b957600080fd5b8135611fb081612193565b600080602083850312156122d757600080fd5b823567ffffffffffffffff8111156122ee57600080fd5b8301601f810185136122ff57600080fd5b803567ffffffffffffffff81111561231657600080fd5b8560208260051b840101111561232b57600080fd5b6020919091019590945092505050565b6000806040838503121561234e57600080fd5b823561235981612193565b9150602083013561229c81612193565b6000806040838503121561237c57600080fd5b823561238781612193565b946020939093013593505050565b6000602082840312156123a757600080fd5b813562ffffff81168114611fb057600080fd5b600080600080600060a086880312156123d257600080fd5b853594506020860135935060408601356123eb81612193565b925060608601356123fb81612193565b9150608086013561240b81612193565b809150509295509295909350565b60008060006060848603121561242e57600080fd5b83359250602084013561244081612193565b9150604084013561245081612193565b809150509250925092565b6000806000806060858703121561247157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561249657600080fd5b8501601f810187136124a757600080fd5b803567ffffffffffffffff8111156124be57600080fd5b8760208284010111156124d057600080fd5b949793965060200194505050565b600181811c908216806124f257607f821691505b602082108103611d4557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006020828403121561253a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561066157610661612541565b60006020828403121561257c57600080fd5b8151611fb081612193565b60006020828403121561259957600080fd5b81518015158114611fb057600080fd5b60007f800000000000000000000000000000000000000000000000000000000000000082036125da576125da612541565b5060000390565b6000602082840312156125f357600080fd5b81518060020b8114611fb057600080fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03828116828216039081111561066157610661612541565b6001600160a01b03818116838216019081111561066157610661612541565b6000806040838503121561266b57600080fd5b505080516020909101519092909150565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516126b48160178501602088016121fb565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516126f18160288401602088016121fb565b01602801949350505050565b6000825161270f8184602087016121fb565b9190910192915050565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a06080820152600061135560a083018461221f565b808202811582820484141761066157610661612541565b8082018082111561066157610661612541565b60008161279157612791612541565b506000190190565b6000602082840312156127ab57600080fd5b81516fffffffffffffffffffffffffffffffff81168114611fb057600080fdfea2646970667358221220071e03d8ed35ca8e4106cc555c058df50fd209b5a0b17e26ef707be51df42df864736f6c634300081b0033a54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d394d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000004baf0000000000000000000000000000000000000000000000000000000000004baf0000000000000000000000000ed6b4c0ac6756372130c024cd235ecfe850d20d000000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000c5761676d694164617074657200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000005dc0000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000000000000002710

Deployed Bytecode

0x6080604052600436106101c65760003560e01c80638bb9c5bf116100f7578063d8baf7cf11610095578063f35c4d4511610064578063f35c4d451461056a578063f87422541461058a578063f912c64b146105be578063fa461e33146105de57600080fd5b8063d8baf7cf146104ea578063eab90da61461050a578063ef99893a1461052a578063f2fde38b1461054a57600080fd5b8063a2e64137116100d1578063a2e641371461042e578063c6bbd5a714610462578063ce62f6c41461049a578063d547741f146104ca57600080fd5b80638bb9c5bf146103b557806391d14854146103d5578063a217fddf1461041957600080fd5b80634ebb79161161016457806373ec15661161013e57806373ec1566146103355780637ae267731461035557806384a33e63146103755780638980f11f1461039557600080fd5b80634ebb7916146102df57806369cff80d146102ff5780636b453c1f1461031557600080fd5b8063248a9ca3116101a0578063248a9ca3146102575780632bc857a0146102875780632f2ff15d1461029d57806336568abe146102bf57600080fd5b806301ffc9a7146101d257806305e3f4dc1461020757806306fdde031461023557600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004612169565b6105fe565b60405190151581526020015b60405180910390f35b34801561021357600080fd5b506102276102223660046121a8565b610667565b6040519081526020016101fe565b34801561024157600080fd5b5061024a6106a8565b6040516101fe919061224b565b34801561026357600080fd5b5061022761027236600461225e565b60009081526020819052604090206001015490565b34801561029357600080fd5b5061022760035481565b3480156102a957600080fd5b506102bd6102b8366004612277565b610736565b005b3480156102cb57600080fd5b506102bd6102da366004612277565b610760565b3480156102eb57600080fd5b506102bd6102fa36600461225e565b6107f1565b34801561030b57600080fd5b5061022760015481565b34801561032157600080fd5b506102bd6103303660046122a7565b610939565b34801561034157600080fd5b506102bd6103503660046122c4565b610966565b34801561036157600080fd5b506102bd61037036600461233b565b610a3d565b34801561038157600080fd5b506102bd61039036600461225e565b610ae1565b3480156103a157600080fd5b506102bd6103b0366004612369565b610bf7565b3480156103c157600080fd5b506102bd6103d036600461225e565b610d32565b3480156103e157600080fd5b506101f26103f0366004612277565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561042557600080fd5b50610227600081565b34801561043a57600080fd5b5061044e61044936600461225e565b610d3d565b60405162ffffff90911681526020016101fe565b34801561046e57600080fd5b50600454610482906001600160a01b031681565b6040516001600160a01b0390911681526020016101fe565b3480156104a657600080fd5b506101f26104b5366004612395565b60056020526000908152604090205460ff1681565b3480156104d657600080fd5b506102bd6104e5366004612277565b610d76565b3480156104f657600080fd5b506102bd6105053660046122a7565b610d9b565b34801561051657600080fd5b506102bd6105253660046123ba565b610dc5565b34801561053657600080fd5b50610227610545366004612419565b610f6c565b34801561055657600080fd5b506102bd6105653660046122a7565b610f81565b34801561057657600080fd5b506102bd61058536600461225e565b610f98565b34801561059657600080fd5b506102277f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab9581565b3480156105ca57600080fd5b506102bd6105d93660046122a7565b61107d565b3480156105ea57600080fd5b506102bd6105f936600461245b565b611147565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061066157507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b604080516080810182526000606082018190529181018590526001600160a01b0384811682528316602082015261069e8682611307565b9695505050505050565b600280546106b5906124de565b80601f01602080910402602001604051908101604052809291908181526020018280546106e1906124de565b801561072e5780601f106107035761010080835404028352916020019161072e565b820191906000526020600020905b81548152906001019060200180831161071157829003601f168201915b505050505081565b60008281526020819052604090206001015461075181611360565b61075b838361136a565b505050565b6001600160a01b03811633146107e35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6107ed8282611408565b5050565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff166108805760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b600082116108d05760405162461bcd60e51b815260206004820152601e60248201527f59616b416461707465723a204e6f7468696e6720746f207265636f766572000060448201526064016107da565b604051339083156108fc029084906000818181858888f193505050501580156108fd573d6000803e3d6000fd5b506040518281526000907f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28906020015b60405180910390a25050565b6109637f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab9582610736565b50565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff166109f55760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b60005b82811015610a3757610a2f848483818110610a1557610a15612512565b9050602002016020810190610a2a9190612395565b611487565b6001016109f8565b50505050565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff16610acc5760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b61075b6001600160a01b03841683600061165c565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff16610b705760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b81600003610bc05760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206761732d657374696d61746500000000000000000000000060448201526064016107da565b600182905560405182815230907ff43f23b7a28e6f8ce6843a21bd7b48bce778aa913b8c8cf459edf7d770e8d38a9060200161092d565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff16610c865760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b60008211610cd65760405162461bcd60e51b815260206004820152601e60248201527f59616b416461707465723a204e6f7468696e6720746f207265636f766572000060448201526064016107da565b610cea6001600160a01b03841633846117f2565b826001600160a01b03167f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa2883604051610d2591815260200190565b60405180910390a2505050565b336107ed8282610760565b60068181548110610d4d57600080fd5b90600052602060002090600a9182820401919006600302915054906101000a900462ffffff1681565b600082815260208190526040902060010154610d9181611360565b61075b8383611408565b6109637f339759585899103d2ace64958e37e18ccb0504652c81d4a1b8aa80fe2126ab9582610d76565b6040516370a0823160e01b81526001600160a01b038281166004830152600091908416906370a0823190602401602060405180830381865afa158015610e0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e339190612528565b9050610e428686868686611822565b6040516370a0823160e01b81526001600160a01b03838116600483015260009183918616906370a0823190602401602060405180830381865afa158015610e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb19190612528565b610ebb9190612557565b905085811015610f0d5760405162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e7420616d6f756e742d6f757400000000000000000060448201526064016107da565b836001600160a01b0316856001600160a01b03167fe2bdbc6b7225eb0a972ac943c485a6cc05f7c6811838bce8903f23200fb744fa8989604051610f5b929190918252602082015260400190565b60405180910390a350505050505050565b6000610f798484846118ec565b949350505050565b33610f8d600083610736565b6107ed600082610760565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff166110275760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b816000036110775760405162461bcd60e51b815260206004820152601b60248201527f71756572794761734c696d69742063616e2774206265207a65726f000000000060448201526064016107da565b50600355565b3360008181527fa54247010af6b3693b80aceddfad12e077c5de3571e6243fada502635f0d7d39602052604090205460ff1661110c5760405162461bcd60e51b815260206004820152602860248201527f4d61696e7461696e61626c653a2043616c6c6572206973206e6f742061206d6160448201526734b73a30b4b732b960c11b60648201526084016107da565b50600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600084131561122b57336001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b2919061256a565b60405163a9059cbb60e01b8152336004820152602481018690526001600160a01b03919091169063a9059cbb906044016020604051808303816000875af1158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112259190612587565b50610a37565b336001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128d919061256a565b60405163a9059cbb60e01b8152336004820152602481018590526001600160a01b03919091169063a9059cbb906044016020604051808303816000875af11580156112dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113009190612587565b5050505050565b600080600061131e8460000151856020015161194a565b91509150600080611335878588604001518661199d565b915091508361134c57611347826125a9565b611355565b611355816125a9565b979650505050505050565b6109638133611a66565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166107ed576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556113c43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156107ed576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b62ffffff811660009081526005602052604090205460ff16156114ec5760405162461bcd60e51b815260206004820152601360248201527f46656520616c726561647920656e61626c65640000000000000000000000000060448201526064016107da565b6040517f22afcccb00000000000000000000000000000000000000000000000000000000815262ffffff821660048201527f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef6001600160a01b0316906322afcccb90602401602060405180830381865afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159291906125e1565b60020b6000036115e45760405162461bcd60e51b815260206004820152601b60248201527f466163746f727920646f65736e277420737570706f727420666565000000000060448201526064016107da565b6109638162ffffff9081166000818152600560205260408120805460ff19166001908117909155600680549182018155909152600a8082047ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018054600392909306919091026101000a928302929093021916179055565b8015806116ef57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156116c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ed9190612528565b155b6117615760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016107da565b6040516001600160a01b03831660248201526044810182905261075b9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611ad9565b6040516001600160a01b03831660248201526044810182905261075b90849063a9059cbb60e01b906064016117a6565b6040805160808082018352600080835260208084018290528385018290526060938401829052845192830185526001600160a01b0388811684528716838201528285018a905292820181905283518181529283019093529190611886908390611c15565b9050858110156118d85760405162461bcd60e51b815260206004820152601660248201527f496e73756666696369656e7420616d6f756e744f75740000000000000000000060448201526064016107da565b6118e3848285611cee565b50505050505050565b6040805160808082018352600080835260208084018290528385018290526060938401829052845192830185526001600160a01b03808816845286169083015292810186905290810182905261194181611d12565b95945050505050565b6001600160a01b03808216908316106000816119845761197f600173fffd8963efd1fc6a506488495d951d5263988d2661261a565b611994565b6119946401000276a36001612639565b90509250929050565b6040516001600160a01b038086166024830152841515604483015260648201849052821660848201526000908190819060a40160408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f90405d36000000000000000000000000000000000000000000000000000000001790529050600080611a3683611d4b565b915091508115611a5a5780806020019051810190611a549190612658565b90955093505b50505094509492505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166107ed57611a9781611dbd565b611aa2836020611dcf565b604051602001611ab392919061267c565b60408051601f198184030181529082905262461bcd60e51b82526107da9160040161224b565b600080836001600160a01b031683604051611af491906126fd565b6000604051808303816000865af19150503d8060008114611b31576040519150601f19603f3d011682016040523d82523d6000602084013e611b36565b606091505b509150915081611b885760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016107da565b805115610a375780806020019051810190611ba39190612587565b610a375760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107da565b600080611c2a84600001518560200151611fb7565b9050600080611c418660000151876020015161194a565b91509150600080846001600160a01b031663128acb0830868b60400151878c6040518663ffffffff1660e01b8152600401611c80959493929190612719565b60408051808303816000875af1158015611c9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc29190612658565b9150915083611cd957611cd4826125a9565b611ce2565b611ce2816125a9565b98975050505050505050565b306001600160a01b0382161461075b5761075b6001600160a01b03841682846117f2565b600080611d2783600001518460200151611fb7565b90506001600160a01b03811615611d4557611d428184611307565b91505b50919050565b6004546003546040516000926060926001600160a01b0390911691611d719086906126fd565b6000604051808303818686fa925050503d8060008114611dad576040519150601f19603f3d011682016040523d82523d6000602084013e611db2565b606091505b509094909350915050565b60606106616001600160a01b03831660145b60606000611dde836002612758565b611de990600261276f565b67ffffffffffffffff811115611e0157611e01612604565b6040519080825280601f01601f191660200182016040528015611e2b576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611e6257611e62612512565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611ead57611ead612512565b60200101906001600160f81b031916908160001a9053506000611ed1846002612758565b611edc90600161276f565b90505b6001811115611f61577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611f1d57611f1d612512565b1a60f81b828281518110611f3357611f33612512565b60200101906001600160f81b031916908160001a90535060049490941c93611f5a81612782565b9050611edf565b508315611fb05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016107da565b9392505050565b60008060005b6006548110156121615760007f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef6001600160a01b0316631698ee8287876006868154811061200d5761200d612512565b60009182526020909120600a8083049091015460405160e087901b6001600160e01b03191681526001600160a01b03958616600482015293909416602484015290066003026101000a90910462ffffff166044820152606401602060405180830381865afa158015612083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a7919061256a565b90506001600160a01b0381166120bd5750612159565b6000816001600160a01b0316631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121219190612799565b9050836fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff161115612156578093508194505b50505b600101611fbd565b505092915050565b60006020828403121561217b57600080fd5b81356001600160e01b031981168114611fb057600080fd5b6001600160a01b038116811461096357600080fd5b600080600080608085870312156121be57600080fd5b84356121c981612193565b93506020850135925060408501356121e081612193565b915060608501356121f081612193565b939692955090935050565b60005b838110156122165781810151838201526020016121fe565b50506000910152565b600081518084526122378160208601602086016121fb565b601f01601f19169290920160200192915050565b602081526000611fb0602083018461221f565b60006020828403121561227057600080fd5b5035919050565b6000806040838503121561228a57600080fd5b82359150602083013561229c81612193565b809150509250929050565b6000602082840312156122b957600080fd5b8135611fb081612193565b600080602083850312156122d757600080fd5b823567ffffffffffffffff8111156122ee57600080fd5b8301601f810185136122ff57600080fd5b803567ffffffffffffffff81111561231657600080fd5b8560208260051b840101111561232b57600080fd5b6020919091019590945092505050565b6000806040838503121561234e57600080fd5b823561235981612193565b9150602083013561229c81612193565b6000806040838503121561237c57600080fd5b823561238781612193565b946020939093013593505050565b6000602082840312156123a757600080fd5b813562ffffff81168114611fb057600080fd5b600080600080600060a086880312156123d257600080fd5b853594506020860135935060408601356123eb81612193565b925060608601356123fb81612193565b9150608086013561240b81612193565b809150509295509295909350565b60008060006060848603121561242e57600080fd5b83359250602084013561244081612193565b9150604084013561245081612193565b809150509250925092565b6000806000806060858703121561247157600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561249657600080fd5b8501601f810187136124a757600080fd5b803567ffffffffffffffff8111156124be57600080fd5b8760208284010111156124d057600080fd5b949793965060200194505050565b600181811c908216806124f257607f821691505b602082108103611d4557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60006020828403121561253a57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561066157610661612541565b60006020828403121561257c57600080fd5b8151611fb081612193565b60006020828403121561259957600080fd5b81518015158114611fb057600080fd5b60007f800000000000000000000000000000000000000000000000000000000000000082036125da576125da612541565b5060000390565b6000602082840312156125f357600080fd5b81518060020b8114611fb057600080fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03828116828216039081111561066157610661612541565b6001600160a01b03818116838216019081111561066157610661612541565b6000806040838503121561266b57600080fd5b505080516020909101519092909150565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516126b48160178501602088016121fb565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516126f18160288401602088016121fb565b01602801949350505050565b6000825161270f8184602087016121fb565b9190910192915050565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a06080820152600061135560a083018461221f565b808202811582820484141761066157610661612541565b8082018082111561066157610661612541565b60008161279157612791612541565b506000190190565b6000602082840312156127ab57600080fd5b81516fffffffffffffffffffffffffffffffff81168114611fb057600080fdfea2646970667358221220071e03d8ed35ca8e4106cc555c058df50fd209b5a0b17e26ef707be51df42df864736f6c634300081b0033

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

00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000004baf0000000000000000000000000000000000000000000000000000000000004baf0000000000000000000000000ed6b4c0ac6756372130c024cd235ecfe850d20d000000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000c5761676d694164617074657200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000005dc0000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000000000000002710

-----Decoded View---------------
Arg [0] : _name (string): WagmiAdapter
Arg [1] : _swapGasEstimate (uint256): 310000
Arg [2] : _quoterGasLimit (uint256): 310000
Arg [3] : _quoter (address): 0xeD6b4C0Ac6756372130c024CD235ecfe850D20d0
Arg [4] : _factory (address): 0x56CFC796bC88C9c7e1b38C2b0aF9B7120B079aef
Arg [5] : _defaultFees (uint24[]): 0,500,1500,3000,10000

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 000000000000000000000000000000000000000000000000000000000004baf0
Arg [2] : 000000000000000000000000000000000000000000000000000000000004baf0
Arg [3] : 000000000000000000000000ed6b4c0ac6756372130c024cd235ecfe850d20d0
Arg [4] : 00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [7] : 5761676d69416461707465720000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [11] : 00000000000000000000000000000000000000000000000000000000000005dc
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000bb8
Arg [13] : 0000000000000000000000000000000000000000000000000000000000002710


Block Transaction 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

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.