ETH Price: $1,915.23 (-5.26%)

Contract

0xE50621a0527A43534D565B67D64be7C79807F269

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Enable CL Pairs39721222025-02-27 7:22:2711 days ago1740640947IN
0xE50621a0...79807F269
0 ETH0.000000270.00100025

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VeloOracle

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion, MIT license
File 1 of 11 : VeloOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.13;
pragma abicoder v2;

import "IVeloPair.sol";
import {IERC20Metadata} from "IERC20Metadata.sol";
import "Sqrt.sol";
import "Address.sol";
import {Clones} from "Clones.sol";
import {IPoolFactory} from "IPoolFactory.sol";
import {IVeloOracle} from "IVeloOracle.sol";
import {ICLFactory} from "ICLFactory.sol";
import {ICLPool} from "ICLPool.sol";

/// @title VeloOracle
/// @author @AkemiHomura-maow, @ethzoomer
/// @notice An oracle contract to fetch and calculate rates for a given set of connectors
/// @dev The routing is done by greedily choose the pool with the most amount of input tokens.
/// The DFS search is performed iteratively, and stops until we have reached the target token,
/// or when the max budget for search has been consumed.
contract VeloOracle is IVeloOracle {
    using Sqrt for uint256;

    /// @notice The address of the poolFactory contract
    address public immutable factoryV2;
    ICLFactory public immutable CLFactory;

    address owner;
    mapping(address => mapping(address => ICLPool)) public enabledCLPools;

    /// @notice Maximum number of hops allowed for rate calculations
    uint8 maxHop = 10;

    /// @param _factoryV2 Address of the factory contract for Velo pairs
    constructor(address _factoryV2, address _CLFactory) {
        factoryV2 = _factoryV2;
        CLFactory = ICLFactory(_CLFactory);
        owner = msg.sender;
    }

    /// @notice Struct to hold balance information for a pair
    struct BalanceInfo {
        uint256 bal0;
        uint256 bal1;
        bool isStable;
    }

    /// @notice Struct to hold path information including intermediate token index and rate
    struct Path {
        uint8 to_i;
        uint256 rate;
    }

    /// @notice Struct to hold return value for balance fetching function
    struct ReturnVal {
        bool mod;
        bool isStable;
        uint256 bal0;
        uint256 bal1;
    }

    /// @notice Struct to hold array variables used in rate calculation, to avoid stack too deep error
    struct Arrays {
        uint256[] rates;
        Path[] paths;
        int256[] decimals;
        uint8[] visited;
    }

    /// @notice Struct to hold iteration variables used in rate calculation, to avoid stack too deep error
    struct IterVars {
        uint256 cur_rate;
        uint256 rate;
        uint8 from_i;
        uint8 to_i;
        bool seen;
    }

    /// @notice Struct to hold variables needed to identify CL pools
    struct CLPairParams {
        address tokenA;
        address tokenB;
        int24 tickSpacing;
    }

    function change_owner(address _owner) public {
        require(msg.sender == owner);
        owner = _owner;
    }

    /// @notice Permissioned function to enable routing through certain CL pools
    function enableCLPairs(CLPairParams[] calldata params) public {
        require(msg.sender == owner);
        for (uint256 i; i < params.length; i++) {
            CLPairParams memory param = params[i];
            address pair = CLFactory.getPool(param.tokenA, param.tokenB, param.tickSpacing);
            require(pair != address(0x0));
            enabledCLPools[param.tokenA][param.tokenB] = ICLPool(pair);
            enabledCLPools[param.tokenB][param.tokenA] = ICLPool(pair);
        }
    }

    /// @notice Permissioned function to disable routing through certain CL pools
    function disableCLPairs(CLPairParams[] calldata params) public {
        require(msg.sender == owner);
        for (uint256 i; i < params.length; i++) {       
            CLPairParams memory param = params[i];     
            delete enabledCLPools[param.tokenA][param.tokenA];
            delete enabledCLPools[param.tokenA][param.tokenB];

        }
    }


    /// @notice Internal function to get balance of two tokens
    /// @param from First token of the pair
    /// @param to Second token of the pair
    /// @param in_bal0 Initial balance of the first token
    /// @return out ReturnVal structure with balance information
    function _getBal(IERC20Metadata from, IERC20Metadata to, uint256 in_bal0)
        internal
        view
        returns (ReturnVal memory out)
    {
        (uint256 b0, uint256 b1) = _getBalances(from, to, false);
        (uint256 b2, uint256 b3) = _getBalances(from, to, true);
        (uint256 b4, uint256 b5) = _getVirtualBalances(from, to);

        uint256 maxBalance = in_bal0;
        uint256 maxPair1;
        uint256 maxPair2;
        bool isMaxStable;

        if (b0 > maxBalance) {
            maxBalance = b0;
            maxPair1 = b0;
            maxPair2 = b1;
            isMaxStable = false;
        }
        if (b2 > maxBalance) {
            maxBalance = b2;
            maxPair1 = b2;
            maxPair2 = b3;
            isMaxStable = true;
        }
        if (b4 > maxBalance) {
            maxBalance = b4;
            maxPair1 = b4;
            maxPair2 = b5;
            isMaxStable = false;
        }

        if (maxBalance > in_bal0) {
            out.mod = true;
            (out.bal0, out.bal1, out.isStable) = (maxPair1, maxPair2, isMaxStable);
        }
    }

    /**
     * @inheritdoc IVeloOracle
     */
    function getManyRatesWithConnectors(uint8 src_len, IERC20Metadata[] memory connectors)
        external
        view
        returns (uint256[] memory rates)
    {
        uint8 j_max = min(maxHop, uint8(connectors.length - src_len));
        Arrays memory arr;
        arr.rates = new uint256[]( src_len );
        arr.paths = new Path[]( (connectors.length - src_len ));
        arr.decimals = new int[](connectors.length);

        // Caching decimals of all connector tokens
        {
            for (uint8 i = 0; i < connectors.length; i++) {
                arr.decimals[i] = int256(uint256(connectors[i].decimals()));
            }
        }

        // Iterating through srcTokens
        for (uint8 src = 0; src < src_len; src++) {
            IterVars memory vars;
            vars.cur_rate = 1;
            vars.from_i = src;
            arr.visited = new uint8[](connectors.length - src_len);
            // Counting hops
            for (uint8 j = 0; j < j_max; j++) {
                BalanceInfo memory balInfo = BalanceInfo(0, 0, false);
                vars.to_i = 0;
                // Going through all connectors
                for (uint8 i = src_len; i < connectors.length; i++) {
                    // Check if the current connector has been used to prevent cycles
                    vars.seen = false;
                    {
                        for (uint8 c = 0; c < j; c++) {
                            if (arr.visited[c] == i) {
                                vars.seen = true;
                                break;
                            }
                        }
                    }
                    if (vars.seen) continue;
                    ReturnVal memory out = _getBal(connectors[vars.from_i], connectors[i], balInfo.bal0);
                    if (out.mod) {
                        balInfo.isStable = out.isStable;
                        balInfo.bal0 = out.bal0;
                        balInfo.bal1 = out.bal1;
                        vars.to_i = i;
                    }
                }

                if (vars.to_i == 0) {
                    arr.rates[src] = 0;
                    break;
                }

                if (balInfo.isStable) {
                    vars.rate = _stableRate(
                        connectors[vars.from_i],
                        connectors[vars.to_i],
                        arr.decimals[vars.from_i] - arr.decimals[vars.to_i]
                    );
                } else {
                    vars.rate =
                        _volatileRate(balInfo.bal0, balInfo.bal1, arr.decimals[vars.from_i] - arr.decimals[vars.to_i]);
                }

                vars.cur_rate *= vars.rate;
                if (j > 0) vars.cur_rate /= 1e18;

                // If from_i points to a connector, cache swap rate for connectors[from_i] : connectors[to_i]
                if (vars.from_i >= src_len) {
                    arr.paths[vars.from_i - src_len] = Path(vars.to_i, vars.rate);
                }
                // If from_i points to a srcToken, check if to_i is a connector which has already been expanded.
                // If so, directly follow the cached path to dstToken to get the final rate.
                else {
                    if (arr.paths[vars.to_i - src_len].rate > 0) {
                        while (true) {
                            vars.cur_rate = vars.cur_rate * arr.paths[vars.to_i - src_len].rate / 1e18;
                            vars.to_i = arr.paths[vars.to_i - src_len].to_i;
                            if (vars.to_i == connectors.length - 1) {
                                arr.rates[src] = vars.cur_rate;
                                break;
                            }
                        }
                    }
                }
                arr.visited[j] = vars.to_i;

                // Next token is dstToken, stop
                if (vars.to_i == connectors.length - 1) {
                    arr.rates[src] = vars.cur_rate;
                    break;
                }
                vars.from_i = vars.to_i;
            }
        }
        return arr.rates;
    }

    /// @notice Internal function to calculate the volatile rate for a pair
    /// @dev For volatile pools, the price (negative derivative) is trivial and can be calculated by b1/b0
    /// @param b0 Balance of the first token
    /// @param b1 Balance of the second token
    /// @param dec_diff Decimal difference between the two tokens
    /// @return rate Calculated exchange rate, scaled by 1e18
    function _volatileRate(uint256 b0, uint256 b1, int256 dec_diff) internal pure returns (uint256 rate) {
        // b0 has less 0s
        if (dec_diff < 0) {
            rate = (1e18 * b1) / (b0 * 10 ** (uint256(-dec_diff)));
        }
        // b0 has more 0s
        else {
            rate = (1e18 * 10 ** (uint256(dec_diff)) * b1) / b0;
        }
    }

    /// @notice Internal function to calculate the stable rate for a pair
    /// @dev For stable pools, the price (negative derivative) is non-trivial to solve. The rate is thus obtained
    /// by simulating a trade of an amount equal to 1 unit of the first token (t0)
    /// in the pair and seeing how much of the second token (t1) that would buy, taking into consideration
    /// the difference in decimal places between the two tokens.
    /// @param t0 First token of the pair
    /// @param t1 Second token of the pair
    /// @param dec_diff Decimal difference between the two tokens
    /// @return rate Calculated exchange rate, scaled by 1e18
    function _stableRate(IERC20Metadata t0, IERC20Metadata t1, int256 dec_diff) internal view returns (uint256 rate) {
        uint256 t0_dec = t0.decimals();
        address currentPair = _orderedPairFor(t0, t1, true);
        uint256 newOut = 0;

        // newOut in t1
        try IVeloPair(currentPair).getAmountOut((10 ** t0_dec), address(t0)) returns (uint256 result) {
            newOut = result;
        } catch {
            return 0;
        }

        // t0 has less 0s
        if (dec_diff < 0) {
            rate = (1e18 * newOut) / (10 ** t0_dec * 10 ** (uint256(-dec_diff)));
        }
        // t0 has more 0s
        else {
            rate = (1e18 * (newOut * 10 ** (uint256(dec_diff)))) / (10 ** t0_dec);
        }
    }

    /// @notice Internal function to calculate the CREATE2 address for a pair without making any external calls
    /// @dev Codes from https://github.com/velodrome-finance/contracts/blob/main/contracts/Router.sol#L102C7-L102C110
    /// @param tokenA First token of the pair
    /// @param tokenB Second token of the pair
    /// @param stable Whether the pair is stable or not
    /// @return pair Address of the pair
    function _pairFor(IERC20Metadata tokenA, IERC20Metadata tokenB, bool stable) private view returns (address pair) {
        bytes32 salt = keccak256(abi.encodePacked(tokenA, tokenB, stable));
        pair = Clones.predictDeterministicAddress(IPoolFactory(factoryV2).implementation(), salt, factoryV2);
    }

    /// @notice Internal function to get the reserves of a pair, preserving the order of srcToken and dstToken
    /// @param srcToken Source token of the pair
    /// @param dstToken Destination token of the pair
    /// @param stable Whether the pair is stable or not
    /// @return srcBalance Reserve of the source token
    /// @return dstBalance Reserve of the destination token
    function _getBalances(IERC20Metadata srcToken, IERC20Metadata dstToken, bool stable)
        internal
        view
        returns (uint256 srcBalance, uint256 dstBalance)
    {
        (IERC20Metadata token0, IERC20Metadata token1) =
            srcToken < dstToken ? (srcToken, dstToken) : (dstToken, srcToken);
        address pairAddress = _pairFor(token0, token1, stable);

        // if the pair doesn't exist, return 0
        if (!Address.isContract(pairAddress)) {
            srcBalance = 0;
            dstBalance = 0;
        } else {
            (uint256 reserve0, uint256 reserve1,) = IVeloPair(pairAddress).getReserves();
            (srcBalance, dstBalance) = srcToken == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
        }
    }

    /// @notice Internal function to get the CL pool for srcToken and dstToken with the largest virtual reserve, and returns the virtual reserves
    /// @param srcToken Source token of the pair
    /// @param dstToken Destination token of the pair
    /// @return srcVirtualBalance Virtual reserve of the source token
    /// @return dstVirtualBalance Virtual reserve of the destination token
    function _getVirtualBalances(IERC20Metadata srcToken, IERC20Metadata dstToken)
        internal
        view
        returns (uint256 srcVirtualBalance, uint256 dstVirtualBalance)
    {
        uint256 maxLiquidity;
        bool isSrcToken0 = srcToken < dstToken;

        ICLPool pool = enabledCLPools[address(srcToken)][address(dstToken)];
        if (address(pool) != address(0x0)){
            uint256 liquidity = uint256(pool.liquidity());

            if (liquidity > maxLiquidity) {
                (uint160 sqrtPriceX96,,,,,) = pool.slot0();

                (srcVirtualBalance, dstVirtualBalance) = isSrcToken0
                    ? ((liquidity << 96) / sqrtPriceX96, (liquidity * (sqrtPriceX96 >> 32)) >> 64)
                    : ((liquidity * (sqrtPriceX96 >> 32)) >> 64, (liquidity << 96) / sqrtPriceX96);

                maxLiquidity = liquidity;
            }
        }
    }

    /// @notice Internal function to fetch the pair from tokens using correct order
    /// @param tokenA First input token
    /// @param tokenB Second input token
    /// @param stable Whether the pair is stable or not
    /// @return pairAddress Address of the ordered pair
    function _orderedPairFor(IERC20Metadata tokenA, IERC20Metadata tokenB, bool stable)
        internal
        view
        returns (address pairAddress)
    {
        (IERC20Metadata token0, IERC20Metadata token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        pairAddress = _pairFor(token0, token1, stable);
    }

    /// @notice Internal function to get the minimum of two uint8 values
    /// @param a First value
    /// @param b Second value
    /// @return Minimum of the two values
    function min(uint8 a, uint8 b) internal pure returns (uint8) {
        return a < b ? a : b;
    }
}

File 2 of 11 : IVeloPair.sol
pragma solidity ^0.8.13;

interface IVeloPair {
    function metadata() external view returns (uint dec0, uint dec1, uint r0, uint r1, bool st, address t0, address t1);
    function claimFees() external returns (uint, uint);
    function tokens() external returns (address, address);
    function transferFrom(address src, address dst, uint amount) external returns (bool);
    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function burn(address to) external returns (uint amount0, uint amount1);
    function mint(address to) external returns (uint liquidity);
    function getReserves() external view returns (uint _reserve0, uint _reserve1, uint _blockTimestampLast);
    function getAmountOut(uint, address) external view returns (uint);
}

File 3 of 11 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 11 : Sqrt.sol
pragma solidity ^0.8.13;
pragma abicoder v1;

library Sqrt {
    function sqrt(uint y) internal pure returns (uint z) {
        unchecked {
            if (y > 3) {
                z = y;
                uint x = y / 2 + 1;
                while (x < z) {
                    z = x;
                    x = (y / x + x) / 2;
                }
            } else if (y != 0) {
                z = 1;
            }
        }
    }
}

File 6 of 11 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 11 : Clones.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create(0, 0x09, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create2(0, 0x09, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(add(ptr, 0x38), deployer)
            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
            mstore(add(ptr, 0x14), implementation)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
            mstore(add(ptr, 0x58), salt)
            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
            predicted := keccak256(add(ptr, 0x43), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt
    ) internal view returns (address predicted) {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 8 of 11 : IPoolFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IPoolFactory {
    event SetFeeManager(address feeManager);
    event SetPauser(address pauser);
    event SetPauseState(bool state);
    event SetVoter(address voter);
    event PoolCreated(address indexed token0, address indexed token1, bool indexed stable, address pool, uint256);
    event SetCustomFee(address indexed pool, uint256 fee);

    error FeeInvalid();
    error FeeTooHigh();
    error InvalidPool();
    error NotFeeManager();
    error NotPauser();
    error NotSinkConverter();
    error NotVoter();
    error PoolAlreadyExists();
    error SameAddress();
    error ZeroFee();
    error ZeroAddress();

    /// @notice returns the number of pools created from this factory
    function allPoolsLength() external view returns (uint256);

    /// @notice Is a valid pool created by this factory.
    /// @param .
    function isPool(address pool) external view returns (bool);

    /// @notice Support for Velodrome v1 which wraps around isPool(pool);
    /// @param .
    function isPair(address pool) external view returns (bool);

    /// @notice Return address of pool created by this factory
    /// @param tokenA .
    /// @param tokenB .
    /// @param stable True if stable, false if volatile
    function getPool(address tokenA, address tokenB, bool stable) external view returns (address);

    /// @notice Support for v3-style pools which wraps around getPool(tokenA,tokenB,stable)
    /// @dev fee is converted to stable boolean.
    /// @param tokenA .
    /// @param tokenB .
    /// @param fee  1 if stable, 0 if volatile, else returns address(0)
    function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address);

    /// @notice Support for Velodrome v1 pools as a "pool" was previously referenced as "pair"
    /// @notice Wraps around getPool(tokenA,tokenB,stable)
    function getPair(address tokenA, address tokenB, bool stable) external view returns (address);

    /// @dev Only called once to set to Voter.sol - Voter does not have a function
    ///      to call this contract method, so once set it's immutable.
    ///      This also follows convention of setVoterAndDistributor() in VotingEscrow.sol
    /// @param _voter .
    function setVoter(address _voter) external;

    function setSinkConverter(address _sinkConvert, address _velo, address _veloV2) external;

    function setPauser(address _pauser) external;

    function setPauseState(bool _state) external;

    function setFeeManager(address _feeManager) external;

    /// @notice Set default fee for stable and volatile pools.
    /// @dev Throws if higher than maximum fee.
    ///      Throws if fee is zero.
    /// @param _stable Stable or volatile pool.
    /// @param _fee .
    function setFee(bool _stable, uint256 _fee) external;

    /// @notice Set overriding fee for a pool from the default
    /// @dev A custom fee of zero means the default fee will be used.
    function setCustomFee(address _pool, uint256 _fee) external;

    /// @notice Returns fee for a pool, as custom fees are possible.
    function getFee(address _pool, bool _stable) external view returns (uint256);

    /// @notice Create a pool given two tokens and if they're stable/volatile
    /// @dev token order does not matter
    /// @param tokenA .
    /// @param tokenB .
    /// @param stable .
    function createPool(address tokenA, address tokenB, bool stable) external returns (address pool);

    /// @notice Support for v3-style pools which wraps around createPool(tokena,tokenB,stable)
    /// @dev fee is converted to stable boolean
    /// @dev token order does not matter
    /// @param tokenA .
    /// @param tokenB .
    /// @param fee 1 if stable, 0 if volatile, else revert
    function createPool(address tokenA, address tokenB, uint24 fee) external returns (address pool);

    /// @notice Support for Velodrome v1 which wraps around createPool(tokenA,tokenB,stable)
    function createPair(address tokenA, address tokenB, bool stable) external returns (address pool);

    function isPaused() external view returns (bool);

    function velo() external view returns (address);

    function veloV2() external view returns (address);

    function voter() external view returns (address);

    function sinkConverter() external view returns (address);

    function implementation() external view returns (address);
}

File 9 of 11 : IVeloOracle.sol
pragma solidity ^0.8.13;
import {IERC20Metadata} from "IERC20Metadata.sol";

interface IVeloOracle {
    /**
    * @notice Gets exchange rates between a series of source tokens and a destination token.
    * @param src_len The length of the source tokens.
    * @param connectors Array of ERC20 tokens where the first src_len elements are source tokens, 
    *        the elements from src_len to len(connectors)-2 are connector tokens, 
    *        and the last element is the destination token.
    * @return rates Array of exchange rates.
    */
    function getManyRatesWithConnectors(uint8 src_len, IERC20Metadata[] memory connectors) external view returns (uint256[] memory rates);
}

File 10 of 11 : ICLFactory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

interface ICLFactory {
    event PoolCreated(address indexed token0, address indexed token1, int24 indexed tickSpacing, address pool);
    function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool);
}

File 11 of 11 : ICLPool.sol
pragma solidity >=0.5.0;

interface ICLPool {
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            bool unlocked
        );
    
    function liquidity() external view returns (uint128);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_factoryV2","type":"address"},{"internalType":"address","name":"_CLFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CLFactory","outputs":[{"internalType":"contract ICLFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"change_owner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"internalType":"struct VeloOracle.CLPairParams[]","name":"params","type":"tuple[]"}],"name":"disableCLPairs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"internalType":"struct VeloOracle.CLPairParams[]","name":"params","type":"tuple[]"}],"name":"enableCLPairs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"enabledCLPools","outputs":[{"internalType":"contract ICLPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factoryV2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"src_len","type":"uint8"},{"internalType":"contract IERC20Metadata[]","name":"connectors","type":"address[]"}],"name":"getManyRatesWithConnectors","outputs":[{"internalType":"uint256[]","name":"rates","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

60c06040526002805460ff1916600a1790553480156200001e57600080fd5b5060405162001a4238038062001a42833981016040819052620000419162000088565b6001600160a01b039182166080521660a052600080546001600160a01b03191633179055620000c0565b80516001600160a01b03811681146200008357600080fd5b919050565b600080604083850312156200009c57600080fd5b620000a7836200006b565b9150620000b7602084016200006b565b90509250929050565b60805160a051611949620000f96000396000818160f3015261024201526000818160af0152818161120a015261128f01526119496000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638dc2c1f61161005b5780638dc2c1f6146100ee578063a168a7e914610115578063f741416614610149578063fe6b9b4c1461015c57600080fd5b8063253c8bd41461008257806325d511571461009757806368e0d4e1146100aa575b600080fd5b610095610090366004611327565b61017c565b005b6100956100a5366004611344565b6101b5565b6100d17f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d17f000000000000000000000000000000000000000000000000000000000000000081565b6100d16101233660046113b9565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b610095610157366004611344565b61033f565b61016f61016a366004611448565b6103f9565b6040516100e5919061150f565b6000546001600160a01b0316331461019357600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146101cc57600080fd5b60005b8181101561033a5760008383838181106101eb576101eb611553565b9050606002018036038101906102019190611578565b8051602082015160408084015190516328af8d0b60e01b81526001600160a01b039384166004820152918316602483015260020b60448201529192506000917f0000000000000000000000000000000000000000000000000000000000000000909116906328af8d0b90606401602060405180830381865afa15801561028b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102af91906115ea565b90506001600160a01b0381166102c457600080fd5b81516001600160a01b03908116600090815260016020818152604080842082880180518716865290835281852080546001600160a01b03199081169888169889179091559051861685529282528084209651909416835294909452208054909216179055806103328161161d565b9150506101cf565b505050565b6000546001600160a01b0316331461035657600080fd5b60005b8181101561033a57600083838381811061037557610375611553565b90506060020180360381019061038b9190611578565b80516001600160a01b039081166000908152600160208181526040808420865186168552825280842080546001600160a01b031990811690915586518616855292825280842095820151909416835293909352208054909116905550806103f18161161d565b915050610359565b600254815160609160009161041f9160ff9081169161041a91881690611636565b610bb9565b905061044c6040518060800160405280606081526020016060815260200160608152602001606081525090565b8460ff1667ffffffffffffffff81111561046857610468611401565b604051908082528060200260200182016040528015610491578160200160208202803683370190505b50815283516104a49060ff871690611636565b67ffffffffffffffff8111156104bc576104bc611401565b60405190808252806020026020018201604052801561050157816020015b60408051808201909152600080825260208201528152602001906001900390816104da5790505b506020820152835167ffffffffffffffff81111561052157610521611401565b60405190808252806020026020018201604052801561054a578160200160208202803683370190505b50604082015260005b84518160ff16101561061657848160ff168151811061057457610574611553565b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dd9190611649565b60ff1682604001518260ff16815181106105f9576105f9611553565b60209081029190910101528061060e81611666565b915050610553565b5060005b8560ff168160ff161015610bad576040805160a0810182526000602082018190526060820181905260808201526001815260ff83811692820192909252865190916106689190891690611636565b67ffffffffffffffff81111561068057610680611401565b6040519080825280602002602001820160405280156106a9578160200160208202803683370190505b50606084015260005b8460ff168160ff161015610b98576040805160608082018352600080835260208301819052928201839052840191909152885b88518160ff1610156107f5576000608085018190525b8360ff168160ff161015610754578160ff1687606001518260ff168151811061072657610726611553565b602002602001015160ff16036107425760016080860152610754565b8061074c81611666565b9150506106fb565b5083608001516107e35760006107ab8a866040015160ff168151811061077c5761077c611553565b60200260200101518b8460ff168151811061079957610799611553565b60200260200101518560000151610bd7565b8051909150156107e157602080820151151560408086019190915282015184526060808301519185019190915260ff8316908601525b505b806107ed81611666565b9150506106e5565b50826060015160ff1660000361083257600085600001518560ff168151811061082057610820611553565b60200260200101818152505050610b98565b8060400151156108e4576108da88846040015160ff168151811061085857610858611553565b602002602001015189856060015160ff168151811061087957610879611553565b60200260200101518760400151866060015160ff168151811061089e5761089e611553565b60200260200101518860400151876040015160ff16815181106108c3576108c3611553565b60200260200101516108d59190611685565b610ca8565b6020840152610950565b61094a816000015182602001518760400151866060015160ff168151811061090e5761090e611553565b60200260200101518860400151876040015160ff168151811061093357610933611553565b60200260200101516109459190611685565b610e55565b60208401525b6020830151835184906109649083906116ac565b90525060ff82161561098e57670de0b6b3a76400008360000181815161098a91906116c3565b9052505b8860ff16836040015160ff16106109f7576040518060400160405280846060015160ff168152602001846020015181525085602001518a85604001516109d491906116e5565b60ff16815181106109e7576109e7611553565b6020026020010181905250610b12565b600085602001518a8560600151610a0e91906116e5565b60ff1681518110610a2157610a21611553565b6020026020010151602001511115610b12575b670de0b6b3a764000085602001518a8560600151610a5291906116e5565b60ff1681518110610a6557610a65611553565b6020026020010151602001518460000151610a8091906116ac565b610a8a91906116c3565b835260208501516060840151610aa1908b906116e5565b60ff1681518110610ab457610ab4611553565b60209081029190910101515160ff1660608401528751610ad690600190611636565b836060015160ff1603610b0d5782518551805160ff8716908110610afc57610afc611553565b602002602001018181525050610b12565b610a34565b826060015185606001518360ff1681518110610b3057610b30611553565b602002602001019060ff16908160ff168152505060018851610b529190611636565b836060015160ff1603610b785782518551805160ff871690811061082057610820611553565b50606082015160ff16604083015280610b9081611666565b9150506106b2565b50508080610ba590611666565b91505061061a565b50519150505b92915050565b60008160ff168360ff1610610bce5781610bd0565b825b9392505050565b60408051608081018252600080825260208201819052918101829052606081018290529080610c07868683610edb565b91509150600080610c1a88886001610edb565b91509150600080610c2b8a8a610fd3565b90925090508760008080838a1115610c4a575088925082915087905060005b83881115610c5f575086925082915085905060015b83861115610c74575084925082915083905060005b8b841115610c975760018b5280151560208c015260608b0182905260408b018390525b505050505050505050509392505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ce9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0d9190611649565b60ff1690506000610d2086866001611173565b905060006001600160a01b03821663f140a35a610d3e85600a6117e2565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b038a166024820152604401602060405180830381865afa925050508015610da5575060408051601f3d908101601f19168201909252610da2918101906117ee565b60015b610db55760009350505050610bd0565b90506000851215610e0c57610dc985611807565b610dd490600a6117e2565b610ddf84600a6117e2565b610de991906116ac565b610dfb82670de0b6b3a76400006116ac565b610e0591906116c3565b9350610e4b565b610e1783600a6117e2565b610e2286600a6117e2565b610e2c90836116ac565b610e3e90670de0b6b3a76400006116ac565b610e4891906116c3565b93505b5050509392505050565b600080821215610ea057610e6882611807565b610e7390600a6117e2565b610e7d90856116ac565b610e8f84670de0b6b3a76400006116ac565b610e9991906116c3565b9050610bd0565b8383610ead84600a6117e2565b610ebf90670de0b6b3a76400006116ac565b610ec991906116ac565b610ed391906116c3565b949350505050565b600080600080856001600160a01b0316876001600160a01b031610610f01578587610f04565b86865b915091506000610f158383886111b4565b90506001600160a01b0381163b610f33576000945060009350610fc8565b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f989190611823565b5091509150846001600160a01b03168a6001600160a01b031614610fbd578082610fc0565b81815b909750955050505b505050935093915050565b6001600160a01b0382811660008181526001602090815260408083208587168085529252822054919384938493921191168015611169576000816001600160a01b0316631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa15801561104a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106e9190611851565b6001600160801b0316905083811115611167576000826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160c060405180830381865afa1580156110c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e59190611891565b505050505090508361112857604061110a6001600160801b03602084901c16846116ac565b901c6111236001600160a01b038316606085901b6116c3565b61115b565b61113f6001600160a01b038216606084901b6116c3565b60406111586001600160801b03602085901c16856116ac565b901c5b90975095509093508390505b505b5050509250929050565b6000806000846001600160a01b0316866001600160a01b03161061119857848661119b565b85855b915091506111aa8282866111b4565b9695505050505050565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b16603482015281151560f81b604882015260009081906049016040516020818303038152906040528051906020012090506113067f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128a91906115ea565b6040517f000000000000000000000000000000000000000000000000000000000000000060388201526f5af43d82803e903d91602b57fd5bf3ff60248201526014810191909152733d602d80600a3d3981f3363d3d373d3d3d363d738152605881018390526037600c8201206078820152605560439091012090565b95945050505050565b6001600160a01b038116811461132457600080fd5b50565b60006020828403121561133957600080fd5b8135610bd08161130f565b6000806020838503121561135757600080fd5b823567ffffffffffffffff8082111561136f57600080fd5b818501915085601f83011261138357600080fd5b81358181111561139257600080fd5b8660206060830285010111156113a757600080fd5b60209290920196919550909350505050565b600080604083850312156113cc57600080fd5b82356113d78161130f565b915060208301356113e78161130f565b809150509250929050565b60ff8116811461132457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561144057611440611401565b604052919050565b6000806040838503121561145b57600080fd5b8235611466816113f2565b915060208381013567ffffffffffffffff8082111561148457600080fd5b818601915086601f83011261149857600080fd5b8135818111156114aa576114aa611401565b8060051b91506114bb848301611417565b81815291830184019184810190898411156114d557600080fd5b938501935b838510156114ff57843592506114ef8361130f565b82825293850193908501906114da565b8096505050505050509250929050565b6020808252825182820181905260009190848201906040850190845b818110156115475783518352928401929184019160010161152b565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b8060020b811461132457600080fd5b60006060828403121561158a57600080fd5b6040516060810181811067ffffffffffffffff821117156115ad576115ad611401565b60405282356115bb8161130f565b815260208301356115cb8161130f565b602082015260408301356115de81611569565b60408201529392505050565b6000602082840312156115fc57600080fd5b8151610bd08161130f565b634e487b7160e01b600052601160045260246000fd5b60006001820161162f5761162f611607565b5060010190565b81810381811115610bb357610bb3611607565b60006020828403121561165b57600080fd5b8151610bd0816113f2565b600060ff821660ff810361167c5761167c611607565b60010192915050565b81810360008312801583831316838312821617156116a5576116a5611607565b5092915050565b8082028115828204841417610bb357610bb3611607565b6000826116e057634e487b7160e01b600052601260045260246000fd5b500490565b60ff8281168282160390811115610bb357610bb3611607565b600181815b8085111561173957816000190482111561171f5761171f611607565b8085161561172c57918102915b93841c9390800290611703565b509250929050565b60008261175057506001610bb3565b8161175d57506000610bb3565b8160018114611773576002811461177d57611799565b6001915050610bb3565b60ff84111561178e5761178e611607565b50506001821b610bb3565b5060208310610133831016604e8410600b84101617156117bc575081810a610bb3565b6117c683836116fe565b80600019048211156117da576117da611607565b029392505050565b6000610bd08383611741565b60006020828403121561180057600080fd5b5051919050565b6000600160ff1b820161181c5761181c611607565b5060000390565b60008060006060848603121561183857600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561186357600080fd5b81516001600160801b0381168114610bd057600080fd5b805161ffff8116811461188c57600080fd5b919050565b60008060008060008060c087890312156118aa57600080fd5b86516118b58161130f565b60208801519096506118c681611569565b94506118d46040880161187a565b93506118e26060880161187a565b92506118f06080880161187a565b915060a0870151801515811461190557600080fd5b80915050929550929550929556fea2646970667358221220598b4a70631d6a76a218fb043f562156d4ee392a5569e6fc68773d460d07bbea64736f6c6343000813003300000000000000000000000031832f2a97fd20664d76cc421207669b55ce4bc000000000000000000000000004625b046c69577efc40e6c0bb83cdbafab5a55f

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638dc2c1f61161005b5780638dc2c1f6146100ee578063a168a7e914610115578063f741416614610149578063fe6b9b4c1461015c57600080fd5b8063253c8bd41461008257806325d511571461009757806368e0d4e1146100aa575b600080fd5b610095610090366004611327565b61017c565b005b6100956100a5366004611344565b6101b5565b6100d17f00000000000000000000000031832f2a97fd20664d76cc421207669b55ce4bc081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d17f00000000000000000000000004625b046c69577efc40e6c0bb83cdbafab5a55f81565b6100d16101233660046113b9565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b610095610157366004611344565b61033f565b61016f61016a366004611448565b6103f9565b6040516100e5919061150f565b6000546001600160a01b0316331461019357600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146101cc57600080fd5b60005b8181101561033a5760008383838181106101eb576101eb611553565b9050606002018036038101906102019190611578565b8051602082015160408084015190516328af8d0b60e01b81526001600160a01b039384166004820152918316602483015260020b60448201529192506000917f00000000000000000000000004625b046c69577efc40e6c0bb83cdbafab5a55f909116906328af8d0b90606401602060405180830381865afa15801561028b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102af91906115ea565b90506001600160a01b0381166102c457600080fd5b81516001600160a01b03908116600090815260016020818152604080842082880180518716865290835281852080546001600160a01b03199081169888169889179091559051861685529282528084209651909416835294909452208054909216179055806103328161161d565b9150506101cf565b505050565b6000546001600160a01b0316331461035657600080fd5b60005b8181101561033a57600083838381811061037557610375611553565b90506060020180360381019061038b9190611578565b80516001600160a01b039081166000908152600160208181526040808420865186168552825280842080546001600160a01b031990811690915586518616855292825280842095820151909416835293909352208054909116905550806103f18161161d565b915050610359565b600254815160609160009161041f9160ff9081169161041a91881690611636565b610bb9565b905061044c6040518060800160405280606081526020016060815260200160608152602001606081525090565b8460ff1667ffffffffffffffff81111561046857610468611401565b604051908082528060200260200182016040528015610491578160200160208202803683370190505b50815283516104a49060ff871690611636565b67ffffffffffffffff8111156104bc576104bc611401565b60405190808252806020026020018201604052801561050157816020015b60408051808201909152600080825260208201528152602001906001900390816104da5790505b506020820152835167ffffffffffffffff81111561052157610521611401565b60405190808252806020026020018201604052801561054a578160200160208202803683370190505b50604082015260005b84518160ff16101561061657848160ff168151811061057457610574611553565b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105dd9190611649565b60ff1682604001518260ff16815181106105f9576105f9611553565b60209081029190910101528061060e81611666565b915050610553565b5060005b8560ff168160ff161015610bad576040805160a0810182526000602082018190526060820181905260808201526001815260ff83811692820192909252865190916106689190891690611636565b67ffffffffffffffff81111561068057610680611401565b6040519080825280602002602001820160405280156106a9578160200160208202803683370190505b50606084015260005b8460ff168160ff161015610b98576040805160608082018352600080835260208301819052928201839052840191909152885b88518160ff1610156107f5576000608085018190525b8360ff168160ff161015610754578160ff1687606001518260ff168151811061072657610726611553565b602002602001015160ff16036107425760016080860152610754565b8061074c81611666565b9150506106fb565b5083608001516107e35760006107ab8a866040015160ff168151811061077c5761077c611553565b60200260200101518b8460ff168151811061079957610799611553565b60200260200101518560000151610bd7565b8051909150156107e157602080820151151560408086019190915282015184526060808301519185019190915260ff8316908601525b505b806107ed81611666565b9150506106e5565b50826060015160ff1660000361083257600085600001518560ff168151811061082057610820611553565b60200260200101818152505050610b98565b8060400151156108e4576108da88846040015160ff168151811061085857610858611553565b602002602001015189856060015160ff168151811061087957610879611553565b60200260200101518760400151866060015160ff168151811061089e5761089e611553565b60200260200101518860400151876040015160ff16815181106108c3576108c3611553565b60200260200101516108d59190611685565b610ca8565b6020840152610950565b61094a816000015182602001518760400151866060015160ff168151811061090e5761090e611553565b60200260200101518860400151876040015160ff168151811061093357610933611553565b60200260200101516109459190611685565b610e55565b60208401525b6020830151835184906109649083906116ac565b90525060ff82161561098e57670de0b6b3a76400008360000181815161098a91906116c3565b9052505b8860ff16836040015160ff16106109f7576040518060400160405280846060015160ff168152602001846020015181525085602001518a85604001516109d491906116e5565b60ff16815181106109e7576109e7611553565b6020026020010181905250610b12565b600085602001518a8560600151610a0e91906116e5565b60ff1681518110610a2157610a21611553565b6020026020010151602001511115610b12575b670de0b6b3a764000085602001518a8560600151610a5291906116e5565b60ff1681518110610a6557610a65611553565b6020026020010151602001518460000151610a8091906116ac565b610a8a91906116c3565b835260208501516060840151610aa1908b906116e5565b60ff1681518110610ab457610ab4611553565b60209081029190910101515160ff1660608401528751610ad690600190611636565b836060015160ff1603610b0d5782518551805160ff8716908110610afc57610afc611553565b602002602001018181525050610b12565b610a34565b826060015185606001518360ff1681518110610b3057610b30611553565b602002602001019060ff16908160ff168152505060018851610b529190611636565b836060015160ff1603610b785782518551805160ff871690811061082057610820611553565b50606082015160ff16604083015280610b9081611666565b9150506106b2565b50508080610ba590611666565b91505061061a565b50519150505b92915050565b60008160ff168360ff1610610bce5781610bd0565b825b9392505050565b60408051608081018252600080825260208201819052918101829052606081018290529080610c07868683610edb565b91509150600080610c1a88886001610edb565b91509150600080610c2b8a8a610fd3565b90925090508760008080838a1115610c4a575088925082915087905060005b83881115610c5f575086925082915085905060015b83861115610c74575084925082915083905060005b8b841115610c975760018b5280151560208c015260608b0182905260408b018390525b505050505050505050509392505050565b600080846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ce9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0d9190611649565b60ff1690506000610d2086866001611173565b905060006001600160a01b03821663f140a35a610d3e85600a6117e2565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b038a166024820152604401602060405180830381865afa925050508015610da5575060408051601f3d908101601f19168201909252610da2918101906117ee565b60015b610db55760009350505050610bd0565b90506000851215610e0c57610dc985611807565b610dd490600a6117e2565b610ddf84600a6117e2565b610de991906116ac565b610dfb82670de0b6b3a76400006116ac565b610e0591906116c3565b9350610e4b565b610e1783600a6117e2565b610e2286600a6117e2565b610e2c90836116ac565b610e3e90670de0b6b3a76400006116ac565b610e4891906116c3565b93505b5050509392505050565b600080821215610ea057610e6882611807565b610e7390600a6117e2565b610e7d90856116ac565b610e8f84670de0b6b3a76400006116ac565b610e9991906116c3565b9050610bd0565b8383610ead84600a6117e2565b610ebf90670de0b6b3a76400006116ac565b610ec991906116ac565b610ed391906116c3565b949350505050565b600080600080856001600160a01b0316876001600160a01b031610610f01578587610f04565b86865b915091506000610f158383886111b4565b90506001600160a01b0381163b610f33576000945060009350610fc8565b600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f989190611823565b5091509150846001600160a01b03168a6001600160a01b031614610fbd578082610fc0565b81815b909750955050505b505050935093915050565b6001600160a01b0382811660008181526001602090815260408083208587168085529252822054919384938493921191168015611169576000816001600160a01b0316631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa15801561104a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106e9190611851565b6001600160801b0316905083811115611167576000826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160c060405180830381865afa1580156110c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e59190611891565b505050505090508361112857604061110a6001600160801b03602084901c16846116ac565b901c6111236001600160a01b038316606085901b6116c3565b61115b565b61113f6001600160a01b038216606084901b6116c3565b60406111586001600160801b03602085901c16856116ac565b901c5b90975095509093508390505b505b5050509250929050565b6000806000846001600160a01b0316866001600160a01b03161061119857848661119b565b85855b915091506111aa8282866111b4565b9695505050505050565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b16603482015281151560f81b604882015260009081906049016040516020818303038152906040528051906020012090506113067f00000000000000000000000031832f2a97fd20664d76cc421207669b55ce4bc06001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128a91906115ea565b6040517f00000000000000000000000031832f2a97fd20664d76cc421207669b55ce4bc060388201526f5af43d82803e903d91602b57fd5bf3ff60248201526014810191909152733d602d80600a3d3981f3363d3d373d3d3d363d738152605881018390526037600c8201206078820152605560439091012090565b95945050505050565b6001600160a01b038116811461132457600080fd5b50565b60006020828403121561133957600080fd5b8135610bd08161130f565b6000806020838503121561135757600080fd5b823567ffffffffffffffff8082111561136f57600080fd5b818501915085601f83011261138357600080fd5b81358181111561139257600080fd5b8660206060830285010111156113a757600080fd5b60209290920196919550909350505050565b600080604083850312156113cc57600080fd5b82356113d78161130f565b915060208301356113e78161130f565b809150509250929050565b60ff8116811461132457600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561144057611440611401565b604052919050565b6000806040838503121561145b57600080fd5b8235611466816113f2565b915060208381013567ffffffffffffffff8082111561148457600080fd5b818601915086601f83011261149857600080fd5b8135818111156114aa576114aa611401565b8060051b91506114bb848301611417565b81815291830184019184810190898411156114d557600080fd5b938501935b838510156114ff57843592506114ef8361130f565b82825293850193908501906114da565b8096505050505050509250929050565b6020808252825182820181905260009190848201906040850190845b818110156115475783518352928401929184019160010161152b565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b8060020b811461132457600080fd5b60006060828403121561158a57600080fd5b6040516060810181811067ffffffffffffffff821117156115ad576115ad611401565b60405282356115bb8161130f565b815260208301356115cb8161130f565b602082015260408301356115de81611569565b60408201529392505050565b6000602082840312156115fc57600080fd5b8151610bd08161130f565b634e487b7160e01b600052601160045260246000fd5b60006001820161162f5761162f611607565b5060010190565b81810381811115610bb357610bb3611607565b60006020828403121561165b57600080fd5b8151610bd0816113f2565b600060ff821660ff810361167c5761167c611607565b60010192915050565b81810360008312801583831316838312821617156116a5576116a5611607565b5092915050565b8082028115828204841417610bb357610bb3611607565b6000826116e057634e487b7160e01b600052601260045260246000fd5b500490565b60ff8281168282160390811115610bb357610bb3611607565b600181815b8085111561173957816000190482111561171f5761171f611607565b8085161561172c57918102915b93841c9390800290611703565b509250929050565b60008261175057506001610bb3565b8161175d57506000610bb3565b8160018114611773576002811461177d57611799565b6001915050610bb3565b60ff84111561178e5761178e611607565b50506001821b610bb3565b5060208310610133831016604e8410600b84101617156117bc575081810a610bb3565b6117c683836116fe565b80600019048211156117da576117da611607565b029392505050565b6000610bd08383611741565b60006020828403121561180057600080fd5b5051919050565b6000600160ff1b820161181c5761181c611607565b5060000390565b60008060006060848603121561183857600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561186357600080fd5b81516001600160801b0381168114610bd057600080fd5b805161ffff8116811461188c57600080fd5b919050565b60008060008060008060c087890312156118aa57600080fd5b86516118b58161130f565b60208801519096506118c681611569565b94506118d46040880161187a565b93506118e26060880161187a565b92506118f06080880161187a565b915060a0870151801515811461190557600080fd5b80915050929550929550929556fea2646970667358221220598b4a70631d6a76a218fb043f562156d4ee392a5569e6fc68773d460d07bbea64736f6c63430008130033

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

00000000000000000000000031832f2a97fd20664d76cc421207669b55ce4bc000000000000000000000000004625b046c69577efc40e6c0bb83cdbafab5a55f

-----Decoded View---------------
Arg [0] : _factoryV2 (address): 0x31832f2a97Fd20664D76Cc421207669b55CE4BC0
Arg [1] : _CLFactory (address): 0x04625B046C69577EfC40e6c0Bb83CDBAfab5a55F

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000031832f2a97fd20664d76cc421207669b55ce4bc0
Arg [1] : 00000000000000000000000004625b046c69577efc40e6c0bb83cdbafab5a55f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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