Contract 0xBd0c7AaF0bF082712EbE919a9dD94b2d978f79A9 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xee39aff51cf542e235b4f9487117f327672d64fbf14daaf975770c5a3040e693Transfer Ownersh...134059362022-04-14 11:09:0284 days 2 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a90 AVAX0.00187206083965.760181253
0x8d27953d6d8400b8c831e6b21d9162e3e621977136e1e8f8e2d185f2a9e45ab0Add Connector98223392022-01-20 14:05:23167 days 23 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a90 AVAX0.00186427525
0xffa792e6f45f6b6289ce3e34578d43ffb2692c7000d5388e5236aeac39494d19Add Connector98223372022-01-20 14:05:15167 days 23 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a90 AVAX0.00186427525
0xfeb763928b54cde5a906040ec33150474a2f957dd76d0dee928620a9193d52aeAdd Connector98223332022-01-20 14:05:10167 days 23 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a90 AVAX0.00186427525
0xe69644d176eb3118113fa191b2b3bcc44f30745ce78b93eccb17b18726c26f76Add Connector98223292022-01-20 14:05:03167 days 23 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a90 AVAX0.00186427525
0xe705b8383cd2e8f9624983f97f96f6f5674722f503250921ca72a8d284a07408Add Oracle98221822022-01-20 14:00:08167 days 23 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  0xbd0c7aaf0bf082712ebe919a9dd94b2d978f79a90 AVAX0.00187687525
0xc58ee3658eca09a6f9992c859f20b11b0b8197ff3c2e696be2e8de726e3c111d0x60a0604086086852021-12-23 10:54:08196 days 2 hrs ago0x08f2112b3ba6c20c76988bab9ad94f7676652608 IN  Create: OffchainOracle0 AVAX0.058455425
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OffchainOracle

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 9 : OffchainOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;
pragma abicoder v1;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./interfaces/IOracle.sol";
import "./interfaces/IWrapper.sol";
import "./MultiWrapper.sol";

contract OffchainOracle is Ownable {
    using SafeMath for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;

    enum OracleType { WETH, ETH, WETH_ETH }

    event OracleAdded(IOracle oracle, OracleType oracleType);
    event OracleRemoved(IOracle oracle, OracleType oracleType);
    event ConnectorAdded(IERC20 connector);
    event ConnectorRemoved(IERC20 connector);
    event MultiWrapperUpdated(MultiWrapper multiWrapper);

    EnumerableSet.AddressSet private _wethOracles;
    EnumerableSet.AddressSet private _ethOracles;
    EnumerableSet.AddressSet private _connectors;
    MultiWrapper public multiWrapper;

    IERC20 private constant _BASE = IERC20(0x0000000000000000000000000000000000000000);
    IERC20 private immutable _wBase;

    constructor(MultiWrapper _multiWrapper, IOracle[] memory existingOracles, OracleType[] memory oracleTypes, IERC20[] memory existingConnectors, IERC20 wBase) {
        unchecked {
            require(existingOracles.length == oracleTypes.length, "Arrays length mismatch");
            multiWrapper = _multiWrapper;
            emit MultiWrapperUpdated(_multiWrapper);
            for (uint256 i = 0; i < existingOracles.length; i++) {
                if (oracleTypes[i] == OracleType.WETH) {
                    require(_wethOracles.add(address(existingOracles[i])), "Oracle already added");
                } else if (oracleTypes[i] == OracleType.ETH) {
                    require(_ethOracles.add(address(existingOracles[i])), "Oracle already added");
                } else if (oracleTypes[i] == OracleType.WETH_ETH) {
                    require(_wethOracles.add(address(existingOracles[i])), "Oracle already added");
                    require(_ethOracles.add(address(existingOracles[i])), "Oracle already added");
                } else {
                    revert("Invalid OracleTokenKind");
                }
                emit OracleAdded(existingOracles[i], oracleTypes[i]);
            }
            for (uint256 i = 0; i < existingConnectors.length; i++) {
                require(_connectors.add(address(existingConnectors[i])), "Connector already added");
                emit ConnectorAdded(existingConnectors[i]);
            }
            _wBase = wBase;
        }
    }

    function oracles() public view returns (IOracle[] memory allOracles, OracleType[] memory oracleTypes) {
        unchecked {
            IOracle[] memory oraclesBuffer = new IOracle[](_wethOracles._inner._values.length + _ethOracles._inner._values.length);
            OracleType[] memory oracleTypesBuffer = new OracleType[](oraclesBuffer.length);
            for (uint256 i = 0; i < _wethOracles._inner._values.length; i++) {
                oraclesBuffer[i] = IOracle(address(uint160(uint256(_wethOracles._inner._values[i]))));
                oracleTypesBuffer[i] = OracleType.WETH;
            }

            uint256 actualItemsCount = _wethOracles._inner._values.length;

            for (uint256 i = 0; i < _ethOracles._inner._values.length; i++) {
                OracleType kind = OracleType.ETH;
                uint256 oracleIndex = actualItemsCount;
                IOracle oracle = IOracle(address(uint160(uint256(_ethOracles._inner._values[i]))));
                for (uint j = 0; j < oraclesBuffer.length; j++) {
                    if (oraclesBuffer[j] == oracle) {
                        oracleIndex = j;
                        kind = OracleType.WETH_ETH;
                        break;
                    }
                }
                if (kind == OracleType.ETH) {
                    actualItemsCount++;
                }
                oraclesBuffer[oracleIndex] = oracle;
                oracleTypesBuffer[oracleIndex] = kind;
            }

            allOracles = new IOracle[](actualItemsCount);
            oracleTypes = new OracleType[](actualItemsCount);
            for (uint256 i = 0; i < actualItemsCount; i++) {
                allOracles[i] = oraclesBuffer[i];
                oracleTypes[i] = oracleTypesBuffer[i];
            }
        }
    }

    function connectors() external view returns (IERC20[] memory allConnectors) {
        unchecked {
            allConnectors = new IERC20[](_connectors.length());
            for (uint256 i = 0; i < allConnectors.length; i++) {
                allConnectors[i] = IERC20(address(uint160(uint256(_connectors._inner._values[i]))));
            }
        }
    }

    function setMultiWrapper(MultiWrapper _multiWrapper) external onlyOwner {
        multiWrapper = _multiWrapper;
        emit MultiWrapperUpdated(_multiWrapper);
    }

    function addOracle(IOracle oracle, OracleType oracleKind) external onlyOwner {
        if (oracleKind == OracleType.WETH) {
            require(_wethOracles.add(address(oracle)), "Oracle already added");
        } else if (oracleKind == OracleType.ETH) {
            require(_ethOracles.add(address(oracle)), "Oracle already added");
        } else if (oracleKind == OracleType.WETH_ETH) {
            require(_wethOracles.add(address(oracle)), "Oracle already added");
            require(_ethOracles.add(address(oracle)), "Oracle already added");
        } else {
            revert("Invalid OracleTokenKind");
        }
        emit OracleAdded(oracle, oracleKind);
    }

    function removeOracle(IOracle oracle, OracleType oracleKind) external onlyOwner {
        if (oracleKind == OracleType.WETH) {
            require(_wethOracles.remove(address(oracle)), "Unknown oracle");
        } else if (oracleKind == OracleType.ETH) {
            require(_ethOracles.remove(address(oracle)), "Unknown oracle");
        } else if (oracleKind == OracleType.WETH_ETH) {
            require(_wethOracles.remove(address(oracle)), "Unknown oracle");
            require(_ethOracles.remove(address(oracle)), "Unknown oracle");
        } else {
            revert("Invalid OracleTokenKind");
        }
        emit OracleRemoved(oracle, oracleKind);
    }

    function addConnector(IERC20 connector) external onlyOwner {
        require(_connectors.add(address(connector)), "Connector already added");
        emit ConnectorAdded(connector);
    }

    function removeConnector(IERC20 connector) external onlyOwner {
        require(_connectors.remove(address(connector)), "Unknown connector");
        emit ConnectorRemoved(connector);
    }

    /*
        WARNING!
        Usage of the dex oracle on chain is highly discouraged!
        getRate function can be easily manipulated inside transaction!
    */
    function getRate(IERC20 srcToken, IERC20 dstToken, bool useWrappers) external view returns (uint256 weightedRate) {
        require(srcToken != dstToken, "Tokens should not be the same");
        uint256 totalWeight;
        (IOracle[] memory allOracles, ) = oracles();
        (IERC20[] memory wrappedSrcTokens, uint256[] memory srcRates) = _getWrappedTokens(srcToken, useWrappers);
        (IERC20[] memory wrappedDstTokens, uint256[] memory dstRates) = _getWrappedTokens(dstToken, useWrappers);
        bytes32[] memory connectors_ = _connectors._inner._values;

        unchecked {
            for (uint256 k1 = 0; k1 < wrappedSrcTokens.length; k1++) {
                for (uint256 k2 = 0; k2 < wrappedDstTokens.length; k2++) {
                    if (wrappedSrcTokens[k1] == wrappedDstTokens[k2]) {
                        return srcRates[k1].mul(dstRates[k2]).div(1e18);
                    }
                    for (uint256 j = 0; j < connectors_.length; j++) {
                        if (IERC20(address(uint160(uint256(connectors_[j])))) == wrappedSrcTokens[k1] || IERC20(address(uint160(uint256(connectors_[j])))) == wrappedDstTokens[k2]) {
                            continue;
                        }
                        for (uint256 i = 0; i < allOracles.length; i++) {
                            try allOracles[i].getRate(wrappedSrcTokens[k1], wrappedDstTokens[k2], IERC20(address(uint160(uint256(connectors_[j]))))) returns (uint256 rate, uint256 weight) {
                                rate = rate.mul(srcRates[k1]).mul(dstRates[k2]).div(1e36);
                                weight = weight.mul(weight);
                                weightedRate = weightedRate.add(rate.mul(weight));
                                totalWeight = totalWeight.add(weight);
                            } catch {}  // solhint-disable-line no-empty-blocks
                        }
                    }
                }
            }
        }
        if (totalWeight > 0) {
            weightedRate = weightedRate / totalWeight;
        }
    }

    /// @dev Same as `getRate` but checks against `ETH` and `WETH` only
    function getRateToEth(IERC20 srcToken, bool useSrcWrappers) external view returns (uint256 weightedRate) {
        uint256 totalWeight;
        (IERC20[] memory wrappedSrcTokens, uint256[] memory srcRates) = _getWrappedTokens(srcToken, useSrcWrappers);
        IERC20[2] memory wrappedDstTokens = [_BASE, _wBase];
        bytes32[][2] memory wrappedOracles = [_ethOracles._inner._values, _wethOracles._inner._values];
        bytes32[] memory connectors_ = _connectors._inner._values;

        unchecked {
            for (uint256 k1 = 0; k1 < wrappedSrcTokens.length; k1++) {
                for (uint256 k2 = 0; k2 < wrappedDstTokens.length; k2++) {
                    if (wrappedSrcTokens[k1] == wrappedDstTokens[k2]) {
                        return srcRates[k1];
                    }
                    for (uint256 j = 0; j < connectors_.length; j++) {
                        IERC20 connector = IERC20(address(uint160(uint256(connectors_[j]))));
                        if (connector == wrappedSrcTokens[k1] || connector == wrappedDstTokens[k2]) {
                            continue;
                        }
                        for (uint256 i = 0; i < wrappedOracles[k2].length; i++) {
                            try IOracle(address(uint160(uint256(wrappedOracles[k2][i])))).getRate(wrappedSrcTokens[k1], wrappedDstTokens[k2], connector) returns (uint256 rate, uint256 weight) {
                                rate = rate.mul(srcRates[k1]).div(1e18);
                                weight = weight.mul(weight);
                                weightedRate = weightedRate.add(rate.mul(weight));
                                totalWeight = totalWeight.add(weight);
                            } catch {}  // solhint-disable-line no-empty-blocks
                        }
                    }
                }
            }
        }
        if (totalWeight > 0) {
            weightedRate = weightedRate / totalWeight;
        }
    }

    function _getWrappedTokens(IERC20 token, bool useWrappers) internal view returns (IERC20[] memory wrappedTokens, uint256[] memory rates) {
        if (useWrappers) {
            return multiWrapper.getWrappedTokens(token);
        }

        wrappedTokens = new IERC20[](1);
        wrappedTokens[0] = token;
        rates = new uint256[](1);
        rates[0] = uint256(1e18);
    }
}

File 2 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

File 3 of 9 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 4 of 9 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 5 of 9 : IOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;
pragma abicoder v1;

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


interface IOracle {
    function getRate(IERC20 srcToken, IERC20 dstToken, IERC20 connector) external view returns (uint256 rate, uint256 weight);
}

File 6 of 9 : IWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;
pragma abicoder v1;

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


interface IWrapper {
    function wrap(IERC20 token) external view returns (IERC20 wrappedToken, uint256 rate);
}

File 7 of 9 : MultiWrapper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;
pragma abicoder v1;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./interfaces/IWrapper.sol";


contract MultiWrapper is Ownable {
    using SafeMath for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;

    event WrapperAdded(IWrapper connector);
    event WrapperRemoved(IWrapper connector);

    EnumerableSet.AddressSet private _wrappers;

    constructor(IWrapper[] memory existingWrappers) {
        unchecked {
            for (uint256 i = 0; i < existingWrappers.length; i++) {
                require(_wrappers.add(address(existingWrappers[i])), "Wrapper already added");
                emit WrapperAdded(existingWrappers[i]);
            }
        }
    }

    function wrappers() external view returns (IWrapper[] memory allWrappers) {
        allWrappers = new IWrapper[](_wrappers.length());
        unchecked {
            for (uint256 i = 0; i < allWrappers.length; i++) {
                allWrappers[i] = IWrapper(address(uint160(uint256(_wrappers._inner._values[i]))));
            }
        }
    }

    function addWrapper(IWrapper wrapper) external onlyOwner {
        require(_wrappers.add(address(wrapper)), "Wrapper already added");
        emit WrapperAdded(wrapper);
    }

    function removeWrapper(IWrapper wrapper) external onlyOwner {
        require(_wrappers.remove(address(wrapper)), "Unknown wrapper");
        emit WrapperRemoved(wrapper);
    }

    function getWrappedTokens(IERC20 token) external view returns (IERC20[] memory wrappedTokens, uint256[] memory rates) {
        unchecked {
            IERC20[] memory memWrappedTokens = new IERC20[](20);
            uint256[] memory memRates = new uint256[](20);
            uint256 len = 0;
            for (uint256 i = 0; i < _wrappers._inner._values.length; i++) {
                try IWrapper(address(uint160(uint256(_wrappers._inner._values[i])))).wrap(token) returns (IERC20 wrappedToken, uint256 rate) {
                    memWrappedTokens[len] = wrappedToken;
                    memRates[len] = rate;
                    len += 1;
                    for (uint256 j = 0; j < _wrappers._inner._values.length; j++) {
                        if (i != j) {
                            try IWrapper(address(uint160(uint256(_wrappers._inner._values[j])))).wrap(wrappedToken) returns (IERC20 wrappedToken2, uint256 rate2) {
                                bool used = false;
                                for (uint256 k = 0; k < len; k++) {
                                    if (wrappedToken2 == memWrappedTokens[k]) {
                                        used = true;
                                        break;
                                    }
                                }
                                if (!used) {
                                    memWrappedTokens[len] = wrappedToken2;
                                    memRates[len] = rate.mul(rate2).div(1e18);
                                    len += 1;
                                }
                            } catch { continue; }
                        }
                    }
                } catch { continue; }
            }
            wrappedTokens = new IERC20[](len + 1);
            rates = new uint256[](len + 1);
            for (uint256 i = 0; i < len; i++) {
                wrappedTokens[i] = memWrappedTokens[i];
                rates[i] = memRates[i];
            }
            wrappedTokens[len] = token;
            rates[len] = 1e18;
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 9 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

Contract ABI

[{"inputs":[{"internalType":"contract MultiWrapper","name":"_multiWrapper","type":"address"},{"internalType":"contract IOracle[]","name":"existingOracles","type":"address[]"},{"internalType":"enum OffchainOracle.OracleType[]","name":"oracleTypes","type":"uint8[]"},{"internalType":"contract IERC20[]","name":"existingConnectors","type":"address[]"},{"internalType":"contract IERC20","name":"wBase","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"connector","type":"address"}],"name":"ConnectorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"connector","type":"address"}],"name":"ConnectorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract MultiWrapper","name":"multiWrapper","type":"address"}],"name":"MultiWrapperUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOracle","name":"oracle","type":"address"},{"indexed":false,"internalType":"enum OffchainOracle.OracleType","name":"oracleType","type":"uint8"}],"name":"OracleAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOracle","name":"oracle","type":"address"},{"indexed":false,"internalType":"enum OffchainOracle.OracleType","name":"oracleType","type":"uint8"}],"name":"OracleRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract IERC20","name":"connector","type":"address"}],"name":"addConnector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOracle","name":"oracle","type":"address"},{"internalType":"enum OffchainOracle.OracleType","name":"oracleKind","type":"uint8"}],"name":"addOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"connectors","outputs":[{"internalType":"contract IERC20[]","name":"allConnectors","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"contract IERC20","name":"dstToken","type":"address"},{"internalType":"bool","name":"useWrappers","type":"bool"}],"name":"getRate","outputs":[{"internalType":"uint256","name":"weightedRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"bool","name":"useSrcWrappers","type":"bool"}],"name":"getRateToEth","outputs":[{"internalType":"uint256","name":"weightedRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiWrapper","outputs":[{"internalType":"contract MultiWrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracles","outputs":[{"internalType":"contract IOracle[]","name":"allOracles","type":"address[]"},{"internalType":"enum OffchainOracle.OracleType[]","name":"oracleTypes","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"connector","type":"address"}],"name":"removeConnector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOracle","name":"oracle","type":"address"},{"internalType":"enum OffchainOracle.OracleType","name":"oracleKind","type":"uint8"}],"name":"removeOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract MultiWrapper","name":"_multiWrapper","type":"address"}],"name":"setMultiWrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b5060405162002b1d38038062002b1d833981810160405260a08110156200003757600080fd5b8151602083018051604051929492938301929190846401000000008211156200005f57600080fd5b9083019060208201858111156200007557600080fd5b82518660208202830111640100000000821117156200009357600080fd5b82525081516020918201928201910280838360005b83811015620000c2578181015183820152602001620000a8565b5050505090500160405260200180516040519392919084640100000000821115620000ec57600080fd5b9083019060208201858111156200010257600080fd5b82518660208202830111640100000000821117156200012057600080fd5b82525081516020918201928201910280838360005b838110156200014f57818101518382015260200162000135565b50505050905001604052602001805160405193929190846401000000008211156200017957600080fd5b9083019060208201858111156200018f57600080fd5b8251866020820283011164010000000082111715620001ad57600080fd5b82525081516020918201928201910280838360005b83811015620001dc578181015183820152602001620001c2565b505050509190910160405250602001519150620001fb905033620006a6565b825184511462000252576040805162461bcd60e51b815260206004820152601660248201527f417272617973206c656e677468206d69736d6174636800000000000000000000604482015290519081900360640190fd5b600780546001600160a01b0387166001600160a01b0319909116811790915560408051918252517f1030152fe2062b574a830e6b9f13c65995990df31e4dc708d142533bb3ad0f529181900360200190a160005b845181101562000592576000848281518110620002c757620002c76200077e565b60200260200101516002811115620002e357620002e362000768565b14156200037957620003218582815181106200030357620003036200077e565b60200260200101516001620006f660201b62001cf01790919060201c565b62000373576040805162461bcd60e51b815260206004820152601460248201527f4f7261636c6520616c7265616479206164646564000000000000000000000000604482015290519081900360640190fd5b620004f5565b60018482815181106200039057620003906200077e565b60200260200101516002811115620003ac57620003ac62000768565b1415620003ea5762000321858281518110620003cc57620003cc6200077e565b60200260200101516003620006f660201b62001cf01790919060201c565b60028482815181106200040157620004016200077e565b602002602001015160028111156200041d576200041d62000768565b1415620004a8576200043d8582815181106200030357620003036200077e565b6200048f576040805162461bcd60e51b815260206004820152601460248201527f4f7261636c6520616c7265616479206164646564000000000000000000000000604482015290519081900360640190fd5b62000321858281518110620003cc57620003cc6200077e565b6040805162461bcd60e51b815260206004820152601760248201527f496e76616c6964204f7261636c65546f6b656e4b696e64000000000000000000604482015290519081900360640190fd5b7f5874b2072ff37562df54063dd700c59d45f311bdf6f9cabb5a15f0ffb2e9f6228582815181106200052b576200052b6200077e565b60200260200101518583815181106200054857620005486200077e565b602002602001015160405180836001600160a01b0316815260200182600281111562000578576200057862000768565b81526020019250505060405180910390a1600101620002a6565b5060005b82518110156200068e57620005d7838281518110620005b957620005b96200077e565b60200260200101516005620006f660201b62001cf01790919060201c565b62000629576040805162461bcd60e51b815260206004820152601760248201527f436f6e6e6563746f7220616c7265616479206164646564000000000000000000604482015290519081900360640190fd5b7fff88af5d962d47fd25d87755e8267a029fad5a91740c67d0dade2bdbe5268a1d8382815181106200065f576200065f6200077e565b602002602001015160405180826001600160a01b0316815260200191505060405180910390a160010162000596565b506001600160a01b0316608052506200079492505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006200070d836001600160a01b03841662000716565b90505b92915050565b60008181526001830160205260408120546200075f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000710565b50600062000710565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60805161236d620007b06000396000610b04015261236d6000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c80638da5cb5b1161008c578063b77910dc11610066578063b77910dc1461035e578063d06265181461037e578063f0b92e40146103b1578063f2fde38b146103ed57600080fd5b80638da5cb5b146102ac5780639d4d7b1c146102ef578063aa16d4c01461032b57600080fd5b8063715018a6116100bd578063715018a6146102125780637de4fd101461021a578063802431fb1461026757600080fd5b80631a6c6a98146100e45780632857373a1461011957806365050a68146101ba575b600080fd5b610117600480360360208110156100fa57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610420565b005b610121610568565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561016557818101518382015260200161014d565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156101a457818101518382015260200161018c565b5050505090500194505050505060405180910390f35b6101c2610996565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156101fe5781810151838201526020016101e6565b505050509050019250505060405180910390f35b610117610a57565b6102556004803603604081101561023057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515610ae4565b60408051918252519081900360200190f35b6102556004803603606081101561027d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001351515610fbd565b60005473ffffffffffffffffffffffffffffffffffffffff165b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101176004803603604081101561030557600080fd5b50803573ffffffffffffffffffffffffffffffffffffffff16906020013560ff166114b1565b6101176004803603602081101561034157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611758565b6007546102c69073ffffffffffffffffffffffffffffffffffffffff1681565b6101176004803603602081101561039457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661189b565b610117600480360360408110156103c757600080fd5b50803573ffffffffffffffffffffffffffffffffffffffff16906020013560ff16611995565b6101176004803603602081101561040357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611bc0565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6104b1600582611d12565b61051c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e6b6e6f776e20636f6e6e6563746f72000000000000000000000000000000604482015290519081900360640190fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517f6825b26a0827e9c2ceca01d6289ce4a40e629dc074ec48ea4727d1afbff359f59181900360200190a150565b60035460015460609182916000910167ffffffffffffffff81111561058f5761058f6121a5565b6040519080825280602002602001820160405280156105b8578160200160208202803683370190505b5090506000815167ffffffffffffffff8111156105d7576105d76121a5565b604051908082528060200260200182016040528015610600578160200160208202803683370190505b50905060005b6001548110156106c9576001805482908110610624576106246121d4565b906000526020600020015460001c838281518110610644576106446121d4565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000828281518110610692576106926121d4565b602002602001019060028111156106ab576106ab612203565b908160028111156106be576106be612203565b905250600101610606565b5060015460005b60035481101561082f5760038054600191849160009190859081106106f7576106f76121d4565b600091825260208220015491505b875181101561076f578173ffffffffffffffffffffffffffffffffffffffff16888281518110610737576107376121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415610767578092506002935061076f565b600101610705565b50600183600281111561078457610784612203565b1415610791576001909401935b808783815181106107a4576107a46121d4565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828683815181106107f1576107f16121d4565b6020026020010190600281111561080a5761080a612203565b9081600281111561081d5761081d612203565b90525050600190920191506106d09050565b508067ffffffffffffffff811115610849576108496121a5565b604051908082528060200260200182016040528015610872578160200160208202803683370190505b5094508067ffffffffffffffff81111561088e5761088e6121a5565b6040519080825280602002602001820160405280156108b7578160200160208202803683370190505b50935060005b8181101561098e578381815181106108d7576108d76121d4565b60200260200101518682815181106108f1576108f16121d4565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082818151811061093d5761093d6121d4565b6020026020010151858281518110610957576109576121d4565b6020026020010190600281111561097057610970612203565b9081600281111561098357610983612203565b9052506001016108bd565b505050509091565b60606109a26005611d34565b67ffffffffffffffff8111156109ba576109ba6121a5565b6040519080825280602002602001820160405280156109e3578160200160208202803683370190505b50905060005b8151811015610a53576005805482908110610a0657610a066121d4565b906000526020600020015460001c828281518110610a2657610a266121d4565b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101526001016109e9565b5090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ad8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049d565b610ae26000611d3e565b565b600080600080610af48686611db3565b60408051808201825260008082527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166020808401919091528351600380546060938102830184018752958201868152979950959750929591949293849391840182828015610b9757602002820191906000526020600020905b815481526020019060010190808311610b83575b5050509183525050600180546040805160208381028201810190925282815293810193929190830182828015610bec57602002820191906000526020600020905b815481526020019060010190808311610bd8575b5050509190925250506005805460408051602080840282018101909252828152939450600093929190830182828015610c4457602002820191906000526020600020905b815481526020019060010190808311610c30575b5050505050905060005b8551811015610f9c5760005b6002811015610f9357848160028110610c7557610c756121d4565b602002015173ffffffffffffffffffffffffffffffffffffffff16878381518110610ca257610ca26121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415610cef57858281518110610cd857610cd86121d4565b602002602001015198505050505050505050610fb7565b60005b8351811015610f8a576000848281518110610d0f57610d0f6121d4565b602002602001015160001c9050888481518110610d2e57610d2e6121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610db05750868360028110610d7c57610d7c6121d4565b602002015173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15610dbb5750610f82565b60005b868460028110610dd057610dd06121d4565b602002015151811015610f7f57868460028110610def57610def6121d4565b60200201518181518110610e0557610e056121d4565b602002602001015160001c73ffffffffffffffffffffffffffffffffffffffff166314999e798b8781518110610e3d57610e3d6121d4565b60200260200101518a8760028110610e5757610e576121d4565b6020020151856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200193505050506040805180830381865afa925050508015610efd57506040513d6040811015610ef157600080fd5b50805160209091015160015b610f0657610f77565b610f44670de0b6b3a7640000610f3e8d8a81518110610f2757610f276121d4565b60200260200101518561203f90919063ffffffff16565b9061204b565b9150610f50818061203f565b9050610f66610f5f838361203f565b8f90612057565b9d50610f728d82612057565b9c5050505b600101610dbe565b50505b600101610cf2565b50600101610c5a565b50600101610c4e565b508515610fb057610fad8688612261565b96505b5050505050505b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561105a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f546f6b656e732073686f756c64206e6f74206265207468652073616d65000000604482015290519081900360640190fd5b600080611065610568565b5090506000806110758887611db3565b915091506000806110868989611db3565b6005805460408051602080840282018101909252828152949650929450600093928301828280156110d657602002820191906000526020600020905b8154815260200190600101908083116110c2575b5050505050905060005b855181101561148e5760005b845181101561148557848181518110611107576111076121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16878381518110611137576111376121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614156111bc576111ac670de0b6b3a7640000610f3e86848151811061117c5761117c6121d4565b6020026020010151898681518110611196576111966121d4565b602002602001015161203f90919063ffffffff16565b99505050505050505050506114aa565b60005b835181101561147c578783815181106111da576111da6121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1684828151811061120a5761120a6121d4565b602002602001015160001c73ffffffffffffffffffffffffffffffffffffffff1614806112975750858281518110611244576112446121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16848281518110611274576112746121d4565b602002602001015160001c73ffffffffffffffffffffffffffffffffffffffff16145b156112a157611474565b60005b8951811015611472578981815181106112bf576112bf6121d4565b602002602001015173ffffffffffffffffffffffffffffffffffffffff166314999e798a86815181106112f4576112f46121d4565b602002602001015189868151811061130e5761130e6121d4565b6020026020010151888681518110611328576113286121d4565b602002602001015160001c6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200193505050506040805180830381865afa9250505080156113d357506040513d60408110156113c757600080fd5b50805160209091015160015b6113dc5761146a565b61143e6ec097ce7bc90715b34b9f1000000000610f3e8a8881518110611404576114046121d4565b60200260200101516114388e8b81518110611421576114216121d4565b60200260200101518761203f90919063ffffffff16565b9061203f565b915061144a818061203f565b9050611459610f5f838361203f565b9d506114658d82612057565b9c5050505b6001016112a4565b505b6001016111bf565b506001016110ec565b506001016110e0565b5086156114a25761149f8789612261565b97505b505050505050505b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049d565b600081600281111561154657611546612203565b14156115c757611557600183611cf0565b6115c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7261636c6520616c7265616479206164646564000000000000000000000000604482015290519081900360640190fd5b6116ee565b60018160028111156115db576115db612203565b14156115ec57611557600383611cf0565b600281600281111561160057611600612203565b141561168757611611600183611cf0565b61167c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7261636c6520616c7265616479206164646564000000000000000000000000604482015290519081900360640190fd5b611557600383611cf0565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c6964204f7261636c65546f6b656e4b696e64000000000000000000604482015290519081900360640190fd5b7f5874b2072ff37562df54063dd700c59d45f311bdf6f9cabb5a15f0ffb2e9f6228282604051808373ffffffffffffffffffffffffffffffffffffffff16815260200182600281111561174357611743612203565b81526020019250505060405180910390a15050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146117d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049d565b6117e4600582611cf0565b61184f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f436f6e6e6563746f7220616c7265616479206164646564000000000000000000604482015290519081900360640190fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517fff88af5d962d47fd25d87755e8267a029fad5a91740c67d0dade2bdbe5268a1d9181900360200190a150565b60005473ffffffffffffffffffffffffffffffffffffffff16331461191c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049d565b6007805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f1030152fe2062b574a830e6b9f13c65995990df31e4dc708d142533bb3ad0f529181900360200190a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049d565b6000816002811115611a2a57611a2a612203565b1415611aab57611a3b600183611d12565b611aa657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f556e6b6e6f776e206f7261636c65000000000000000000000000000000000000604482015290519081900360640190fd5b611b6b565b6001816002811115611abf57611abf612203565b1415611ad057611a3b600383611d12565b6002816002811115611ae457611ae4612203565b141561168757611af5600183611d12565b611b6057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f556e6b6e6f776e206f7261636c65000000000000000000000000000000000000604482015290519081900360640190fd5b611a3b600383611d12565b7f7a7f56716fe703fb190529c336e57df71ab88188ba47e8d786bac684b61ab9a68282604051808373ffffffffffffffffffffffffffffffffffffffff16815260200182600281111561174357611743612203565b60005473ffffffffffffffffffffffffffffffffffffffff163314611c41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161049d565b73ffffffffffffffffffffffffffffffffffffffff8116611ce4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161049d565b611ced81611d3e565b50565b60006114aa8373ffffffffffffffffffffffffffffffffffffffff8416612063565b60006114aa8373ffffffffffffffffffffffffffffffffffffffff84166120b2565b6000610fb7825490565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060808215611f9857600754604080517fcb991d9400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301529151919092169163cb991d949160248083019260009291908290030181865afa158015611e34573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040908152811015611e7b57600080fd5b8101908080516040519392919084640100000000821115611e9b57600080fd5b908301906020820185811115611eb057600080fd5b8251866020820283011164010000000082111715611ecd57600080fd5b82525081516020918201928201910280838360005b83811015611efa578181015183820152602001611ee2565b5050505090500160405260200180516040519392919084640100000000821115611f2357600080fd5b908301906020820185811115611f3857600080fd5b8251866020820283011164010000000082111715611f5557600080fd5b82525081516020918201928201910280838360005b83811015611f82578181015183820152602001611f6a565b5050505090500160405250505091509150612038565b60408051600180825281830190925290602080830190803683370190505091508382600081518110611fcc57611fcc6121d4565b73ffffffffffffffffffffffffffffffffffffffff92909216602092830291909101820152604080516001808252818301909252918281019080368337019050509050670de0b6b3a76400008160008151811061202b5761202b6121d4565b6020026020010181815250505b9250929050565b60006114aa828461229c565b60006114aa8284612261565b60006114aa82846122d9565b60008181526001830160205260408120546120aa57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610fb7565b506000610fb7565b6000818152600183016020526040812054801561219b5760006120d66001836122f1565b85549091506000906120ea906001906122f1565b905081811461214f57600086600001828154811061210a5761210a6121d4565b906000526020600020015490508087600001848154811061212d5761212d6121d4565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061216057612160612308565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610fb7565b6000915050610fb7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082612297577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122d4576122d4612232565b500290565b600082198211156122ec576122ec612232565b500190565b60008282101561230357612303612232565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220f91747afadc37bfc632bcdb733906a56d667d590f6fc0d5807b0f44325fa0ed864736f6c634300080a0033000000000000000000000000a0c978c28ab8aefc95bf58e68a05ce6b9deac5a900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000015f78275ef05c40a98c4c6ea75b5d6b1f7388dc000000000000000000000000a8bfb77136451d408732298392e9c37b2c54a5aa00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000ffffffffffffffffffffffffffffffffffffffff

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

000000000000000000000000a0c978c28ab8aefc95bf58e68a05ce6b9deac5a900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000015f78275ef05c40a98c4c6ea75b5d6b1f7388dc000000000000000000000000a8bfb77136451d408732298392e9c37b2c54a5aa00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000ffffffffffffffffffffffffffffffffffffffff

-----Decoded View---------------
Arg [0] : _multiWrapper (address): 0xa0c978c28ab8aefc95bf58e68a05ce6b9deac5a9
Arg [1] : existingOracles (address[]): 0x015f78275ef05c40a98c4c6ea75b5d6b1f7388dc,0xa8bfb77136451d408732298392e9c37b2c54a5aa
Arg [2] : oracleTypes (uint8[]): 0,0
Arg [3] : existingConnectors (address[]): 0x0000000000000000000000000000000000000000,0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7,0xffffffffffffffffffffffffffffffffffffffff
Arg [4] : wBase (address): 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7

-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 000000000000000000000000a0c978c28ab8aefc95bf58e68a05ce6b9deac5a9
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [4] : 000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [6] : 000000000000000000000000015f78275ef05c40a98c4c6ea75b5d6b1f7388dc
Arg [7] : 000000000000000000000000a8bfb77136451d408732298392e9c37b2c54a5aa
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [13] : 000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7
Arg [14] : 000000000000000000000000ffffffffffffffffffffffffffffffffffffffff


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.